\begin{figure}[H] \centering \begin{tikzpicture}[node distance=1.5cm, auto, block/.style={rectangle, draw, fill=white, text width=12cm, text centered, rounded corners, minimum height=1.2cm, font=\small}, layer/.style={rectangle, draw, fill=white, text width=12cm, text centered, rounded corners, minimum height=4cm, font=\small}, module/.style={rectangle, draw, fill=white, text width=3cm, text centered, rounded corners, minimum height=1cm, font=\small}, arrow/.style={thick,->,>=stealth}, title/.style={font=\bfseries\small} ] % 定义三层架构 \node[layer, fill=blue!10, text height=5cm] (presentation) at (0,0) {}; \node[title, above=0.1cm of presentation.north west, anchor=west] {表现层}; \node[layer, fill=green!10, below=0.5cm of presentation] (business) {}; \node[title, above=0.1cm of business.north west, anchor=west] {业务逻辑层}; \node[layer, fill=orange!10, below=0.5cm of business] (data) {}; \node[title, above=0.1cm of data.north west, anchor=west] {数据访问层}; % 表现层模块 \node[module, fill=blue!20] (ui1) at (-3.5, 1.5) {模型管理}; \node[module, fill=blue!20] (ui2) at (0, 1.5) {模型推理}; \node[module, fill=blue!20] (ui3) at (3.5, 1.5) {模型微调}; \node[module, fill=blue!20] (ui4) at (-3.5, 0) {数据集生成}; \node[module, fill=blue!20] (ui5) at (0, 0) {数据集管理}; \node[module, fill=blue!20] (ui6) at (3.5, 0) {提示词模板管理}; \node[module, fill=blue!20] (ui7) at (0, -1.5) {系统设置}; % 业务逻辑层模块 \node[module, fill=green!20] (bl1) at (-3.5, -4.5) {模型训练模块\\(Unsloth/TRL)}; \node[module, fill=green!20] (bl2) at (0, -4.5) {模型推理模块\\(流式生成)}; \node[module, fill=green!20] (bl3) at (3.5, -4.5) {数据集生成模块\\(LangChain)}; \node[module, fill=green!20] (bl4) at (-2, -6) {数据处理模块}; \node[module, fill=green!20] (bl5) at (2, -6) {配置管理模块}; % 数据访问层模块 \node[module, fill=orange!20] (dl1) at (-3.5, -10) {SQLite\\(系统配置)}; \node[module, fill=orange!20] (dl2) at (0, -10) {TinyDB\\(数据集管理)}; \node[module, fill=orange!20] (dl3) at (3.5, -10) {JSON文件\\(导入/导出)}; % 层间连接 \draw[arrow] (presentation.south) -- (business.north) node[midway, right] {函数调用}; \draw[arrow] (business.south) -- (data.north) node[midway, right] {数据操作}; % 添加Gradio框架标注 \node[above=0.1cm of presentation.north east, anchor=east, font=\small\itshape] {基于Gradio框架}; % 添加说明 \node[below=0.2cm of data.south, text width=12cm, text centered, font=\footnotesize] {系统采用三层架构设计,实现了功能模块间的解耦与分层,提高了系统的可扩展性和可维护性}; \end{tikzpicture} \caption{系统三层架构设计图} \label{fig:system-architecture} \end{figure}