更新 README.md

This commit is contained in:
charles 2026-02-10 20:51:37 +08:00
parent 411f9768ff
commit b115b1a898

View File

@ -56,21 +56,31 @@ graph TD
SQLite -.->|"17. 检测 completed"| Gateway SQLite -.->|"17. 检测 completed"| Gateway
Gateway -->|"18. 返回最终结果"| User Gateway -->|"18. 返回最终结果"| User
%% 样式美化 %% 样式美化 - 黑色背景优化
style Gateway fill:#bbdefb,stroke:#1565c0,stroke-width:3px style Gateway fill:#1e88e5,stroke:#64b5f6,stroke-width:3px,color:#fff
style TaskQueue fill:#fff9c4,stroke:#f57f17,stroke-width:2px style TaskQueue fill:#ffa726,stroke:#ffb74d,stroke-width:2px,color:#000
style SQLite fill:#e1bee7,stroke:#7b1fa2,stroke-width:2px style SQLite fill:#ab47bc,stroke:#ce93d8,stroke-width:2px,color:#fff
style MattingAPI fill:#e1f5fe,stroke:#01579b,stroke-width:2px style MattingAPI fill:#26c6da,stroke:#4dd0e1,stroke-width:2px,color:#000
style ComparisonAPI fill:#fff3e0,stroke:#e65100,stroke-width:2px style ComparisonAPI fill:#ff7043,stroke:#ff8a65,stroke-width:2px,color:#fff
style MattingCluster fill:#e3f2fd,stroke:#0277bd style MattingCluster fill:#0277bd,stroke:#0288d1,color:#fff
style ComparisonCluster fill:#fff8e1,stroke:#f57c00 style ComparisonCluster fill:#d84315,stroke:#e64a19,color:#fff
style Folder1 fill:#f5f5f5,stroke:#616161 style M1 fill:#0288d1,stroke:#4fc3f7,color:#fff
style Folder2 fill:#f5f5f5,stroke:#616161 style M2 fill:#0288d1,stroke:#4fc3f7,color:#fff
style Folder3 fill:#f5f5f5,stroke:#616161 style M3 fill:#0288d1,stroke:#4fc3f7,color:#fff
style Storage fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px style C1 fill:#e64a19,stroke:#ff7043,color:#fff
style C2 fill:#e64a19,stroke:#ff7043,color:#fff
style C3 fill:#e64a19,stroke:#ff7043,color:#fff
style Folder1 fill:#424242,stroke:#9e9e9e,stroke-width:2px,color:#e0e0e0
style Folder2 fill:#424242,stroke:#9e9e9e,stroke-width:2px,color:#e0e0e0
style Folder3 fill:#424242,stroke:#9e9e9e,stroke-width:2px,color:#e0e0e0
style Storage fill:#1b5e20,stroke:#4caf50,stroke-width:2px,color:#fff
style User fill:#5e35b1,stroke:#9575cd,stroke-width:2px,color:#fff
``` ```
结构图(如有误请纠正)
序列图(如有误请纠正)
```mermaid ```mermaid
%%{init: {'theme':'dark'}}%%
sequenceDiagram sequenceDiagram
autonumber autonumber
participant User as 用户 participant User as 用户
@ -83,7 +93,7 @@ sequenceDiagram
participant CW as Comparison Worker participant CW as Comparison Worker
%% 上传阶段 %% 上传阶段
rect rgb(220, 240, 255) rect rgb(30, 60, 90)
Note over User,GW: 阶段1: 数据上传与任务创建 Note over User,GW: 阶段1: 数据上传与任务创建
User->>+GW: POST /upload (100GB 原始数据) User->>+GW: POST /upload (100GB 原始数据)
GW->>FS: 保存到 /input/raw_data.zip GW->>FS: 保存到 /input/raw_data.zip
@ -96,7 +106,7 @@ sequenceDiagram
end end
%% Gateway 主动调度 Matting %% Gateway 主动调度 Matting
rect rgb(225, 245, 254) rect rgb(0, 60, 80)
Note over GW,MW: 阶段2: Gateway 调度 Matting 任务 Note over GW,MW: 阶段2: Gateway 调度 Matting 任务
loop 遍历所有待处理任务 loop 遍历所有待处理任务
GW->>DB: SELECT task WHERE status='pending' LIMIT 1 GW->>DB: SELECT task WHERE status='pending' LIMIT 1
@ -121,7 +131,7 @@ sequenceDiagram
end end
%% Gateway 主动调度 Comparison %% Gateway 主动调度 Comparison
rect rgb(255, 243, 224) rect rgb(80, 40, 0)
Note over GW,CW: 阶段3: Gateway 调度 Comparison 任务 Note over GW,CW: 阶段3: Gateway 调度 Comparison 任务
GW->>DB: SELECT task WHERE status='matting_done' GW->>DB: SELECT task WHERE status='matting_done'
DB-->>GW: 返回 task_id='chunk_001' DB-->>GW: 返回 task_id='chunk_001'
@ -142,7 +152,7 @@ sequenceDiagram
end end
%% 并发处理多个任务 %% 并发处理多个任务
rect rgb(245, 245, 245) rect rgb(40, 40, 40)
Note over GW,CW: 并发处理 (Gateway 继续调度其他任务) Note over GW,CW: 并发处理 (Gateway 继续调度其他任务)
par Gateway 同时调度多个任务 par Gateway 同时调度多个任务
GW->>MAPI: POST /matting {task_id: 'chunk_002'} GW->>MAPI: POST /matting {task_id: 'chunk_002'}
@ -157,7 +167,7 @@ sequenceDiagram
end end
%% 进度查询 %% 进度查询
rect rgb(232, 245, 233) rect rgb(20, 60, 40)
Note over User,GW: 阶段4: 进度查询与结果下载 Note over User,GW: 阶段4: 进度查询与结果下载
User->>+GW: GET /status/{job_id} User->>+GW: GET /status/{job_id}
GW->>DB: SELECT COUNT(*) FROM tasks WHERE job_id=? GROUP BY status GW->>DB: SELECT COUNT(*) FROM tasks WHERE job_id=? GROUP BY status
@ -173,7 +183,7 @@ sequenceDiagram
end end
%% 错误处理 %% 错误处理
rect rgb(255, 235, 238) rect rgb(80, 20, 20)
Note over MW,GW: 异常处理与重试 Note over MW,GW: 异常处理与重试
MW->>MW: 处理失败 (OOM 或其他错误) MW->>MW: 处理失败 (OOM 或其他错误)
MW->>DB: UPDATE status='failed', error='CUDA out of memory' MW->>DB: UPDATE status='failed', error='CUDA out of memory'