overview.html
26.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>技术方案总览 — llm-call-platform</title>
<style>
/* === Magic-Vision 设计系统 === */
:root {
--color-primary: #2563eb; --color-primary-light: #dbeafe; --color-primary-dark: #1e40af;
--color-success: #16a34a; --color-success-light: #dcfce7;
--color-warning: #d97706; --color-warning-light: #fef3c7;
--color-danger: #dc2626; --color-danger-light: #fee2e2;
--color-pending: #6b7280; --color-pending-light: #f3f4f6;
--color-bg: #ffffff; --color-bg-secondary: #f8fafc;
--color-border: #e2e8f0; --color-text: #1e293b;
--color-text-secondary: #64748b; --color-text-muted: #94a3b8;
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-mono: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
--radius: 8px; --radius-sm: 4px;
--shadow: 0 1px 3px rgba(0,0,0,0.1); --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family); background: var(--color-bg-secondary); color: var(--color-text); line-height: 1.6; min-height: 100vh; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
/* 通用组件 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-confirmed { background: var(--color-success-light); color: var(--color-success); }
.badge-pending { background: var(--color-pending-light); color: var(--color-pending); }
.badge-doubt { background: var(--color-warning-light); color: var(--color-warning); }
.priority { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.priority-p0 { background: var(--color-danger-light); color: var(--color-danger); }
.priority-p1 { background: var(--color-warning-light); color: var(--color-warning); }
.priority-p2 { background: var(--color-primary-light); color: var(--color-primary); }
.card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--color-bg-secondary); border-bottom: 1px solid var(--color-border); }
.card-title { margin: 0; font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }
.accordion { border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 12px; }
.accordion-summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; cursor: pointer; font-weight: 600; background: var(--color-bg-secondary); list-style: none; }
.accordion-summary::-webkit-details-marker { display: none; }
.accordion[open] .accordion-summary { border-bottom: 1px solid var(--color-border); }
.accordion-content { padding: 20px; }
.tabs { margin-bottom: 24px; }
.tab-nav { display: flex; gap: 0; border-bottom: 2px solid var(--color-border); margin-bottom: 20px; }
.tab-btn { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--color-text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th { padding: 12px 14px; text-align: left; font-weight: 600; background: var(--color-bg-secondary); border-bottom: 2px solid var(--color-border); font-size: 0.78rem; text-transform: uppercase; color: var(--color-text-secondary); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--color-bg-secondary); }
.stack-tag { display: inline-block; padding: 2px 8px; margin: 2px; background: var(--color-primary-light); color: var(--color-primary-dark); border-radius: 4px; font-size: 0.75rem; font-weight: 500; }
.tree { font-family: var(--font-mono); font-size: 0.875rem; line-height: 2; }
.tree-node { padding: 2px 0; }
.tree-children { padding-left: 24px; border-left: 1px dashed var(--color-border); margin-left: 8px; }
.tree-icon { margin-right: 6px; }
.tree-comment { color: var(--color-text-muted); font-size: 0.8rem; font-family: var(--font-family); margin-left: 8px; }
/* 顶部导航栏 */
.top-nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; background: var(--color-bg); border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.nav-left { display: flex; align-items: center; gap: 8px; }
.nav-title { margin: 0; font-size: 1.25rem; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-version { font-size: 0.85rem; color: var(--color-text-secondary); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-label { font-size: 0.8rem; color: var(--color-text-muted); }
.nav-link { padding: 4px 12px; border-radius: var(--radius-sm); text-decoration: none; font-size: 0.85rem; font-weight: 500; color: var(--color-primary); border: 1px solid var(--color-primary-light); transition: all 0.2s; }
.nav-link:hover { background: var(--color-primary-light); }
.back-link { color: var(--color-text-secondary); text-decoration: none; font-size: 0.85rem; padding: 4px 10px; border-radius: var(--radius-sm); transition: all 0.2s; }
.back-link:hover { color: var(--color-primary); background: var(--color-primary-light); }
/* Hero 标题卡片 */
.hero-card { display: flex; align-items: center; justify-content: space-between; padding: 24px; background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-bg) 100%); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-md); margin-bottom: 24px; }
.hero-title { margin: 0 0 8px; font-size: 1.5rem; }
.hero-goal { margin: 0; color: var(--color-text-secondary); font-size: 1rem; }
/* 页脚 */
.footer { text-align: center; padding: 32px; color: var(--color-text-muted); font-size: 0.8rem; }
/* 信息网格 */
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.info-item { display: flex; flex-direction: column; padding: 12px 16px; border-bottom: 1px solid var(--color-border); border-right: 1px solid var(--color-border); }
.info-item:nth-child(3n) { border-right: none; }
.info-full { grid-column: 1 / -1; border-right: none; }
.info-label { font-size: 0.72rem; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 4px; font-weight: 600; letter-spacing: 0.05em; }
.info-value { font-size: 0.9rem; }
.info-value code { font-family: var(--font-mono); background: var(--color-bg-secondary); padding: 1px 6px; border-radius: 3px; font-size: 0.85rem; }
/* 导航中心 */
.nav-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; transition: box-shadow 0.2s; }
.nav-card:hover { box-shadow: var(--shadow-md); }
.nav-card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--color-bg-secondary); border-bottom: 1px solid var(--color-border); }
.nav-card-title { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 600; }
.nav-card-icon { font-size: 1.2rem; }
.nav-card-date { font-size: 0.75rem; color: var(--color-text-muted); }
.nav-card-body { padding: 8px 0; }
.nav-card-body.empty { padding: 20px 24px; color: var(--color-text-muted); font-style: italic; text-align: center; }
.nav-file-link { display: flex; align-items: center; padding: 8px 24px; text-decoration: none; color: var(--color-text); font-size: 0.9rem; transition: background 0.15s; }
.nav-file-link:hover { background: var(--color-primary-light); color: var(--color-primary); }
.nav-file-link .file-icon { margin-right: 10px; font-size: 0.85rem; flex-shrink: 0; }
.nav-file-link .file-desc { margin-left: auto; font-size: 0.78rem; color: var(--color-text-muted); }
/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 13px; opacity: 0; transition: opacity .2s; z-index: 200; }
.toast.show { opacity: 1; }
/* 交互图 */
.diagram-container { background: var(--color-bg-secondary); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; overflow-x: auto; }
.interaction-svg, .flow-svg, .dep-svg { width: 100%; height: auto; }
.node-box { fill: var(--color-bg); stroke-width: 2; }
.node-t01 { stroke: var(--color-primary); }
.node-t02 { stroke: var(--color-success); }
.node-db { stroke: var(--color-warning); }
.node-title { font-size: 0.85rem; font-weight: 700; fill: var(--color-text); }
.node-subtitle { font-size: 0.7rem; fill: var(--color-text-secondary); }
.edge { stroke: var(--color-text-muted); stroke-width: 2; }
.edge-label { font-size: 0.7rem; fill: var(--color-text-secondary); }
/* 技术栈卡片网格 */
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }
.tech-card { position: relative; padding: 20px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); box-shadow: var(--shadow); border-top: 3px solid var(--color-pending); }
.tech-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tech-card.dimension-frontend { border-top-color: var(--color-primary); }
.tech-card.dimension-backend { border-top-color: var(--color-success); }
.tech-card.dimension-database { border-top-color: var(--color-warning); }
.tech-card.dimension-cache { border-top-color: #e11d48; }
.tech-card.dimension-deploy { border-top-color: #7c3aed; }
.tech-card.dimension-disabled { opacity: 0.55; border-top-color: var(--color-border); }
.tech-card-icon { font-size: 1.5rem; margin-bottom: 8px; }
.tech-dimension { margin: 0 0 12px; font-size: 0.95rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-secondary); }
.tech-choice, .tech-reason, .tech-alt { font-size: 0.85rem; margin-bottom: 8px; color: var(--color-text); }
.tech-na { font-size: 0.85rem; color: var(--color-text-muted); font-style: italic; }
.tech-card .badge { position: absolute; top: 16px; right: 16px; }
.overview-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.overview-table .row-confirmed { border-left: 3px solid var(--color-success); }
.overview-table .row-pending { border-left: 3px solid var(--color-pending); }
.overview-table .row-doubt { border-left: 3px solid var(--color-warning); }
.tech-id { font-family: var(--font-mono); font-weight: 700; color: var(--color-primary); }
.detail-link { color: var(--color-primary); text-decoration: none; font-weight: 500; font-size: 0.85rem; }
.detail-link:hover { text-decoration: underline; }
.interaction-id { font-family: var(--font-mono); font-weight: 600; }
.interaction-type { display: inline-block; padding: 2px 10px; background: var(--color-primary-light); color: var(--color-primary-dark); border-radius: 4px; font-size: 0.78rem; font-weight: 500; }
</style>
</head>
<body>
<nav class="top-nav">
<div class="nav-left">
<a href="../index.html" class="back-link" title="返回文档导航中心">🏠 导航</a>
<h1 class="nav-title">📋 llm-call-platform — 技术方案设计</h1>
</div>
<div class="nav-right">
<span class="nav-version">v1.0</span>
<span class="badge badge-confirmed">已确认</span>
<div class="nav-links">
<span class="nav-label">详细方案:</span>
$scheme_nav_links
</div>
</div>
</nav>
<main class="container">
<div class="tabs">
<div class="tab-nav">
<button class="tab-btn active" onclick="switchTab(event, 'tab-overview')">方案总览</button>
<button class="tab-btn" onclick="switchTab(event, 'tab-interaction')">交互关系</button>
<button class="tab-btn" onclick="switchTab(event, 'tab-structure')">文件夹结构</button>
</div>
<div class="tab-content active" id="tab-overview">
<div class="card">
<div class="card-header"><h3 class="card-title">文档信息</h3></div>
<div class="card-body">
<table class="data-table">
<tr><td style="width:120px;font-weight:600">项目名称</td><td>llm-call-platform</td></tr>
<tr><td style="width:120px;font-weight:600">文档版本</td><td>v1.0</td></tr>
<tr><td style="width:120px;font-weight:600">创建日期</td><td>2026-06-11</td></tr>
<tr><td style="width:120px;font-weight:600">评审状态</td><td><span class="badge badge-confirmed">已确认</span></td></tr>
</table>
</div>
</div>
<h3 style="margin:20px 0 12px">技术方案总览</h3>
<table class="data-table overview-table">
<thead>
<tr><th>编号</th><th>方案名称</th><th>实现目标</th><th>技术栈摘要</th><th>确认状态</th><th>详情</th></tr>
</thead>
<tbody>
<tr class="row-confirmed">
<td><span class="tech-id">T-01</span></td>
<td>Web 管理控制台</td>
<td>基于 React 的管理界面,提供模型调用配置、调用监控、日志查看、统计面板等</td>
<td>React · Vite · Ant Design · Zustand</td>
<td><span class="badge badge-confirmed">已确认</span></td>
<td><a href="T-01-web-console.html" class="detail-link">详情 →</a></td>
</tr>
<tr class="row-confirmed">
<td><span class="tech-id">T-02</span></td>
<td>核心 API 服务</td>
<td>FastAPI REST API 服务,LLM 调用入口,同步/异步任务编排,调用策略调度</td>
<td>Python · FastAPI · SQLAlchemy · JWT</td>
<td><span class="badge badge-confirmed">已确认</span></td>
<td><a href="T-02-core-api.html" class="detail-link">详情 →</a></td>
</tr>
<tr class="row-confirmed">
<td><span class="tech-id">T-03</span></td>
<td>LLM 适配引擎</td>
<td>策略模式适配多 LLM 供应商,支持重试/降级/限流/超时可配置调用策略</td>
<td>Python · 策略模式 · HTTP SDK</td>
<td><span class="badge badge-confirmed">已确认</span></td>
<td><a href="T-03-llm-adapter.html" class="detail-link">详情 →</a></td>
</tr>
<tr class="row-confirmed">
<td><span class="tech-id">T-04</span></td>
<td>异步任务调度器</td>
<td>Celery 分布式任务队列,处理异步 LLM 调用任务</td>
<td>Celery · Redis · Python</td>
<td><span class="badge badge-confirmed">已确认</span></td>
<td><a href="T-04-async-scheduler.html" class="detail-link">详情 →</a></td>
</tr>
<tr class="row-confirmed">
<td><span class="tech-id">T-05</span></td>
<td>数据存储层</td>
<td>MySQL + Redis 数据持久化,结构化调用日志与原始文件日志混合存储</td>
<td>MySQL · Redis · SQLAlchemy</td>
<td><span class="badge badge-confirmed">已确认</span></td>
<td><a href="T-05-data-storage.html" class="detail-link">详情 →</a></td>
</tr>
</tbody>
</table>
</div>
<div class="tab-content" id="tab-interaction">
<div class="diagram-container">
<svg viewBox="0 0 950 480" xmlns="http://www.w3.org/2000/svg" class="interaction-svg">
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#94a3b8"/>
</marker>
<marker id="arrow-purple" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#c084fc"/>
</marker>
</defs>
<rect x="380" y="10" width="190" height="70" rx="8" class="node-box node-t01"/>
<text x="475" y="40" text-anchor="middle" class="node-title">T-01 Web 管理控制台</text>
<text x="475" y="60" text-anchor="middle" class="node-subtitle">React + Ant Design</text>
<rect x="380" y="130" width="190" height="70" rx="8" class="node-box node-t02"/>
<text x="475" y="160" text-anchor="middle" class="node-title">T-02 核心 API 服务</text>
<text x="475" y="180" text-anchor="middle" class="node-subtitle">FastAPI + SQLAlchemy</text>
<rect x="140" y="240" width="190" height="70" rx="8" class="node-box node-t03"/>
<text x="235" y="270" text-anchor="middle" class="node-title">T-03 LLM 适配引擎</text>
<text x="235" y="290" text-anchor="middle" class="node-subtitle">策略模式</text>
<rect x="620" y="240" width="190" height="70" rx="8" class="node-box node-t04"/>
<text x="715" y="270" text-anchor="middle" class="node-title">T-04 异步任务调度器</text>
<text x="715" y="290" text-anchor="middle" class="node-subtitle">Celery + Redis</text>
<rect x="380" y="370" width="190" height="70" rx="8" class="node-box node-t05"/>
<text x="475" y="400" text-anchor="middle" class="node-title">T-05 数据存储层</text>
<text x="475" y="420" text-anchor="middle" class="node-subtitle">MySQL + Redis</text>
<rect x="0" y="130" width="90" height="70" rx="8" class="node-box node-external"/>
<text x="45" y="160" text-anchor="middle" class="node-title">外部系统</text>
<text x="45" y="180" text-anchor="middle" class="node-subtitle">第三方</text>
<rect x="780" y="130" width="90" height="70" rx="8" class="node-box node-external"/>
<text x="825" y="155" text-anchor="middle" class="node-title">模型 API</text>
<text x="825" y="175" text-anchor="middle" class="node-subtitle">GLM/Qwen/... </text>
<line x1="475" y1="80" x2="475" y2="125" class="edge" marker-end="url(#arrow)"/>
<text x="490" y="108" text-anchor="start" class="edge-label">I-02 HTTP REST</text>
<line x1="475" y1="200" x2="330" y2="240" class="edge" marker-end="url(#arrow)"/>
<text x="380" y="225" text-anchor="start" class="edge-label">I-03 SDK</text>
<line x1="475" y1="200" x2="715" y2="235" class="edge" marker-end="url(#arrow)"/>
<text x="530" y="225" text-anchor="start" class="edge-label">I-05 Celery</text>
<line x1="715" y1="310" x2="425" y2="240" class="edge" marker-end="url(#arrow)"/>
<text x="560" y="295" text-anchor="start" class="edge-label">I-06 SDK</text>
<line x1="235" y1="310" x2="235" y2="370" class="edge" marker-end="url(#arrow)"/>
<text x="250" y="345" text-anchor="start" class="edge-label">I-07 DB</text>
<line x1="715" y1="310" x2="715" y2="370" class="edge" marker-end="url(#arrow)"/>
<text x="700" y="345" text-anchor="end" class="edge-label">I-07 DB</text>
<line x1="475" y1="200" x2="475" y2="365" class="edge" marker-end="url(#arrow)"/>
<text x="490" y="290" text-anchor="start" class="edge-label">I-07 SQLAlchemy</text>
<line x1="90" y1="165" x2="375" y2="165" class="edge" marker-end="url(#arrow)"/>
<text x="230" y="158" text-anchor="middle" class="edge-label">I-08 HTTP REST</text>
<line x1="235" y1="310" x2="780" y2="175" class="edge arrow-purple" marker-end="url(#arrow-purple)"/>
<text x="530" y="320" text-anchor="start" class="edge-label edge-label-purple">I-04 HTTP</text>
</svg>
</div>
<h3 style="margin:20px 0 12px">交互关系明细</h3>
<table class="data-table">
<thead><tr><th>编号</th><th>方案 A</th><th>方案 B</th><th>交互方式</th><th>说明</th></tr></thead>
<tbody>
<tr>
<td><span class="interaction-id">I-01</span></td>
<td>用户浏览器</td>
<td>T-01</td>
<td><span class="interaction-type">HTTP</span></td>
<td>用户通过浏览器访问 Web 管理控制台</td>
</tr>
<tr>
<td><span class="interaction-id">I-02</span></td>
<td>T-01</td>
<td>T-02</td>
<td><span class="interaction-type">HTTP REST</span></td>
<td>前端通过 REST API 调用后端进行模型调用、查询统计数据</td>
</tr>
<tr>
<td><span class="interaction-id">I-03</span></td>
<td>T-02</td>
<td>T-03</td>
<td><span class="interaction-type">SDK 调用</span></td>
<td>API 服务通过 LLM 适配引擎工厂创建模型适配器,发起同步/异步调用</td>
</tr>
<tr>
<td><span class="interaction-id">I-04</span></td>
<td>T-03</td>
<td>模型 API</td>
<td><span class="interaction-type">HTTP</span></td>
<td>适配引擎通过 HTTP 请求调用各模型厂商的 API(GLM-4/Qwen/Baidu 等)</td>
</tr>
<tr>
<td><span class="interaction-id">I-05</span></td>
<td>T-02</td>
<td>T-04</td>
<td><span class="interaction-type">消息队列</span></td>
<td>提交异步 LLM 调用任务到 Celery 任务队列</td>
</tr>
<tr>
<td><span class="interaction-id">I-06</span></td>
<td>T-04</td>
<td>T-03</td>
<td><span class="interaction-type">SDK 调用</span></td>
<td>Celery Worker 在处理异步任务时调用 LLM 适配引擎执行模型请求</td>
</tr>
<tr>
<td><span class="interaction-id">I-07</span></td>
<td>T-02 / T-04</td>
<td>T-05</td>
<td><span class="interaction-type">SQLAlchemy / Redis</span></td>
<td>API 服务和 Celery Worker 通过 SQLAlchemy 读写 MySQL,通过 Redis 操作缓存/计数器</td>
</tr>
<tr>
<td><span class="interaction-id">I-08</span></td>
<td>外部系统</td>
<td>T-02</td>
<td><span class="interaction-type">HTTP REST</span></td>
<td>第三方系统通过 REST API 调用平台的模型能力</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-content" id="tab-structure">
<div class="tree">
<div class="tree">
<div class="tree-item">📁 llm-call-platform/ <span class="tree-comment">项目根目录</span></div>
<div class="tree-children">
<div class="tree-item">📁 frontend/ <span class="tree-comment">T-01 React 前端应用</span></div>
<div class="tree-children">
<div class="tree-item">📁 public/ <span class="tree-comment">静态资源</span></div>
<div class="tree-item">📁 src/</div>
<div class="tree-children">
<div class="tree-item">📁 pages/ <span class="tree-comment">页面组件(监控面板/模型配置/调用日志/统计报表)</span></div>
<div class="tree-item">📁 components/ <span class="tree-comment">公共组件</span></div>
<div class="tree-item">📁 hooks/ <span class="tree-comment">自定义 Hooks</span></div>
<div class="tree-item">📁 services/ <span class="tree-comment">API 请求层</span></div>
<div class="tree-item">📁 stores/ <span class="tree-comment">Zustand 状态管理</span></div>
<div class="tree-item">📁 types/ <span class="tree-comment">TypeScript 类型定义</span></div>
<div class="tree-item">📁 utils/ <span class="tree-comment">工具函数</span></div>
<div class="tree-item">📄 App.tsx <span class="tree-comment">根组件</span></div>
<div class="tree-item">📄 main.tsx <span class="tree-comment">应用入口</span></div>
</div>
<div class="tree-item">📄 package.json</div>
<div class="tree-item">📄 vite.config.ts</div>
<div class="tree-item">📄 Dockerfile <span class="tree-comment">Nginx 容器化构建</span></div>
</div>
<div class="tree-item">📁 backend/ <span class="tree-comment">T-02 FastAPI 后端 + T-03 LLM 适配 + T-04 Celery 任务</span></div>
<div class="tree-children">
<div class="tree-item">📁 app/</div>
<div class="tree-children">
<div class="tree-item">📁 api/ <span class="tree-comment">REST 路由(按业务模块分文件)</span></div>
<div class="tree-item">📁 models/ <span class="tree-comment">SQLAlchemy ORM 数据模型</span></div>
<div class="tree-item">📁 schemas/ <span class="tree-comment">Pydantic 请求/响应模型</span></div>
<div class="tree-item">📁 services/ <span class="tree-comment">业务逻辑层</span></div>
<div class="tree-children">
<div class="tree-item">📁 llm/ <span class="tree-comment">T-03 LLM 适配引擎</span></div>
<div class="tree-children">
<div class="tree-item">📁 adapters/ <span class="tree-comment">各模型适配器(GLM/Qwen/Baidu/Custom)</span></div>
<div class="tree-item">📁 strategies/ <span class="tree-comment">调用策略(重试/降级/限流/超时)</span></div>
<div class="tree-item">📄 factory.py <span class="tree-comment">适配器工厂</span></div>
<div class="tree-item">📄 base.py <span class="tree-comment">基础适配器接口</span></div>
</div>
<div class="tree-item">📄 call_service.py <span class="tree-comment">模型调用编排服务</span></div>
<div class="tree-item">📄 statistics_service.py <span class="tree-comment">调用统计服务</span></div>
</div>
<div class="tree-item">📁 core/ <span class="tree-comment">核心配置(配置读取/JWT 认证/依赖注入)</span></div>
<div class="tree-item">📁 db/ <span class="tree-comment">数据库会话与迁移(Alembic)</span></div>
<div class="tree-item">📄 main.py <span class="tree-comment">FastAPI 应用入口</span></div>
</div>
<div class="tree-item">📁 tasks/ <span class="tree-comment">T-04 Celery 异步任务定义</span></div>
<div class="tree-item">📁 tests/ <span class="tree-comment">测试用例</span></div>
<div class="tree-children">
<div class="tree-item">📁 api/</div>
<div class="tree-item">📁 services/</div>
<div class="tree-item">📄 conftest.py</div>
</div>
<div class="tree-item">📁 logs/ <span class="tree-comment">日志文件(本地开发用,不提交)</span></div>
<div class="tree-item">📄 .env <span class="tree-comment">敏感环境变量(不提交)</span></div>
<div class="tree-item">📄 config.yaml <span class="tree-comment">业务/应用配置</span></div>
<div class="tree-item">📄 requirements.txt</div>
<div class="tree-item">📄 Dockerfile <span class="tree-comment">Python 容器化构建</span></div>
<div class="tree-item">📄 celery_app.py <span class="tree-comment">Celery 应用实例</span></div>
</div>
<div class="tree-item">📄 docker-compose.yml <span class="tree-comment">容器编排(前端/后端/Celery/Redis/MySQL)</span></div>
<div class="tree-item">📄 .gitignore</div>
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="footer">Magic-Vision-Spec · 技术方案设计 · v1.0</footer>
<script>
function switchTab(event, tabId) {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
event.target.classList.add('active');
document.getElementById(tabId).classList.add('active');
}
</script>
</body>
</html>