正在渲染流程图...
flowchart TB
%% ===== 样式定义 =====
classDef startEnd fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
classDef user fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
classDef agent1 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef agent2 fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px
classDef agent3 fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef flow fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef manual fill:#ffebee,stroke:#c62828,stroke-width:3px,color:#c62828
classDef decision fill:#fff3e0,stroke:#e65100,stroke-width:2px,shape:stadium
classDef fallback fill:#eceff1,stroke:#455a64,stroke-width:2px,stroke-dasharray: 5 5
classDef selection fill:#e1f5fe,stroke:#0277bd,stroke-width:2px
%% ===== 主流程起点 =====
Start([用户输入需求]):::startEnd --> A1[Agent 1
需求解析+生成
技术方案
输出:6模块+JSON]:::agent1
%% ===== Agent 1 异常分支点 =====
A1 --> Check{检查
nextAgent字段}:::decision
%% 分支1:技术不可能/高风险冲突(用户坚持)
Check -->|nextAgent=
'manual'
reason='high_
risk_conflict'| Manual1[人工客服介入
评估/驳回/特批]:::manual
Manual1 -->|特批通过| A1_Resume[重新生成方案
标记高风险]:::agent1
Manual1 -->|驳回| End1([结束会话
reason='rejected']):::startEnd
%% 分支2:正常流转 → 等待用户确认技术方案
Check -->|nextAgent=
'agent2'| Pending[状态:pending
等待确认技术方案
confirmationDeadline=
24h]:::decision
%% 统一入口
A1_Resume --> Pending
%% ===== Agent 1阶段超时处理 =====
Pending -->|24h超时
confirmationStatus=
'expired'| Flow_A1_Timeout[Flow发送提醒
标记sessionClosed]:::flow
Flow_A1_Timeout --> End3([会话关闭]):::startEnd
%% ===== 用户操作分支(Agent 1后) =====
Pending --> UserAction{用户操作?}:::user
%% 2.1 放弃
UserAction -->|放弃
confirmationStatus=
'abandoned'| End1
%% 2.2 修改 → Agent 1局部澄清
UserAction -->|修改
confirmationStatus=
'modifying'| A1_Modify[Agent 1
局部澄清
保留未改字段
modificationCount+1]:::agent1
A1_Modify --> ModCheck{Agent 1
修改次数?}:::decision
ModCheck -->|<3次| Pending
ModCheck -->|≥3次| Manual_A1[转人工
防止无限循环
reason='excessive_
modification']:::manual
Manual_A1 -->|人工整理需求| A2
%% 2.3 确认 → 进入Agent 2(视觉生成)
UserAction -->|确认
confirmationStatus=
'confirmed'| A2[Agent 2
视觉方案生成
输入:systemData
modificationCount=0]:::agent2
%% ===== Agent 2 内部逻辑(含修改循环) =====
A2 --> GenCheck{AI生成
结果?}:::decision
%% 2.3.1 主路径:AI生成成功
GenCheck -->|成功
fallbackInfo.level=0| VisualSelect[状态:visual_pending
等待用户选择
24h倒计时]:::selection
%% 用户选择阶段超时(从VisualSelect引出)
VisualSelect -->|24h无选择
confirmationStatus=
'expired'| Flow_A2_Timeout[Flow发送提醒
标记sessionClosed]:::flow
Flow_A2_Timeout --> End3
%% Agent 2修改循环(关键新增)
VisualSelect -->|选择schemeId
更新selectedScheme| A3_Prep[标记
isReference=false
matchConfidence=1.0
fallbackInfo.level=0]:::agent2
VisualSelect -->|要求修改
且modificationCount<2| A2_Modify[Agent 2
重新生成
modificationCount+1]:::agent2
VisualSelect -->|修改次数≥2
防无限生成| Manual_A2[转人工设计师
reason='excessive_
visual_modification']:::manual
A2_Modify --> GenCheck
Manual_A2 -->|人工出图
更新Agent2Output| A3_Prep_Manual[标记
isReference=true
fallbackInfo.level=2]:::agent2
%% 2.3.2 一级降级:AI生成失败 → 参考图库
GenCheck -->|失败/超时
fallbackInfo.level=1| Fallback1[知识库检索
匹配参考图
计算相似度]:::fallback
Fallback1 --> RefCheck{相似度
≥0.75?}:::decision
RefCheck -->|是| RefSelect[展示3张参考图
+差异说明
+匹配度分数]:::selection
%% 参考图修改循环(关键新增)
RefSelect -->|接受
确认参考图
fallbackInfo.
userAccepted=true| A3_Prep_Ref[标记
isReference=true
fallbackInfo.level=1]:::agent2
RefSelect -->|要求修改
且modificationCount<2| A2_Modify
RefSelect -->|拒绝/不匹配| Fallback2[二级降级
fallbackInfo.
userAccepted=false]:::fallback
RefCheck -->|否
相似度<0.75| Fallback2
%% 2.3.3 二级降级:强制人工
Fallback2 --> Manual2[转人工设计师
1v1沟通
nextAgent='manual'
reason='mismatch_
rejected']:::manual
Manual2 --> ManualDecision{人工判断?}:::decision
ManualDecision -->|人工出图
或确认方案| A3_Prep_Manual
ManualDecision -->|需求不明确| End1
%% ===== Agent 3 及后续 =====
A3_Prep --> A3[Agent 3
匠人匹配
输入:selectedScheme]:::agent3
A3_Prep_Ref --> A3
A3_Prep_Manual --> A3
A3 --> A3_CHECK{匹配结果?}:::decision
A3_CHECK -->|匹配为空| A3_FAIL[输出空列表
nextAgent=manual]:::agent3
A3_FAIL --> MANUAL_MATCH[人工介入派单]:::manual
MANUAL_MATCH --> MANUAL_ORDER[人工创建订单]:::order
A3_CHECK -->|匹配成功| A3_OUT[输出Top 3匠人
craftsman_pending]:::agent3
%% ===== 用户选择阶段 =====
A3_OUT --> USER_OP{用户操作?}:::user
USER_OP -->|放弃| END_ABANDON([会话结束]):::endNode
USER_OP -->|超时24h| FLOW_TIMEOUT[Flow发送提醒]:::flow
FLOW_TIMEOUT --> END_EXPIRED([会话关闭]):::endNode
USER_OP -->|换一批小于2次| A3_RETRY[重新匹配
modificationCount+1]:::agent3
A3_RETRY --> A3_CHECK
USER_OP -->|换一批大于等于2次| MANUAL_RETRY[转人工
防止无限循环]:::manual
MANUAL_RETRY --> MANUAL_MATCH
%% ===== 关键修正:用户确认路径 =====
USER_OP -->|确认选择匠人| ORDER_CREATE[订单创建
状态confirmed
合并三端数据]:::order
ORDER_CREATE --> ORDER_DB[(订单库
存储完整数据)]:::flow
MANUAL_ORDER --> ORDER_DB
ORDER_DB --> FLOW_START[Flow进度监控
规则引擎启动
定时器激活]:::flow
%% ===== 3.4 Flow进度监控(新增补充)=====
%% Flow主循环:每日定时触发
FLOW_START -->|每日8:00定时触发| Flow_Daily{R1每日播报
计算进度百分比}:::flow
Flow_Daily -->|生成进度卡片| Notify_User[推送用户
进度+今日任务]:::flow
Flow_Daily -->|生成任务提醒| Notify_Craftsman[推送匠人
待完成工序]:::flow
%% 进度计算与状态判断
ORDER_DB -.->|读取实际进度| Check_Progress{检查进度偏差}:::decision
Check_Progress -->|actual < planned
且差值≥0.5天| R2_Delay[触发R2延期预警
标记riskFlag:delay_risk]:::flow
R2_Delay --> Notify_Both[双边推送预警
用户端+匠人端]:::flow
Check_Progress -->|剩余天数≤2| R4_Urgent[触发R4临近提醒
提升频次]:::flow
Check_Progress -->|正常推进| Flow_Daily
%% R5长期停滞检测(48小时)
ORDER_DB -.->|检查lastUpdateAt| Check_Stale{48小时无更新?}:::decision
Check_Stale -->|是| R5_Stale[触发R5长期停滞
Flow_Stale_Progress]:::flow
R5_Stale -->|发送催单| Notify_Stale[双边提醒
匠人端+用户端]:::flow
R5_Stale -->|标记stale状态| Update_Stale[progress.status=stale]:::flow
%% 72小时无响应升级
Check_Stale -->|72小时仍无更新| Require_Intervention[标记requiresIntervention
触发人工介入]:::manual
%% 工序完成事件触发
Craftsman_Update[匠人标记工序完成
上传照片]:::user -->|事件触发| R3_Complete[触发R3工序确认
更新completedSteps]:::flow
R3_Complete -->|重新计算| Check_Progress
%% 定时失效兜底
Flow_Daily -.->|定时器失效| Fallback_Schedule[标记scheduledMissed
邮件兜底]:::fallback
Fallback_Schedule -->|次日9:00补发| Email_Fallback[合并版进度
含昨日+今日]:::flow
%% 交付完成
Check_Progress -->|匠人标记已完成| R6_Delivery[触发R6交付完成
推送评价邀请]:::flow
R6_Delivery --> END_SUCCESS([订单完成
状态:completed]):::startEnd
%% 用户投诉贯穿全程(虚线表示)
AnyPoint -.->|用户点击投诉| Complaint_Flow[标记complaintFlag
立即触发R5催单]:::flow
Complaint_Flow --> Require_Intervention
%% 样式补充
style AnyPoint fill:none,stroke:none
style A3_Prep fill:#f3e5f5,stroke:#6a1b9a,stroke-width:1px
style A3_Prep_Ref fill:#f3e5f5,stroke:#6a1b9a,stroke-width:1px
style A3_Prep_Manual fill:#f3e5f5,stroke:#6a1b9a,stroke-width:1px
style A2_Modify fill:#f3e5f5,stroke:#6a1b9a,stroke-width:1px
style Manual_A1 fill:#ffebee,stroke:#c62828,stroke-width:2px
style Manual_A2 fill:#ffebee,stroke:#c62828,stroke-width:2px
%% Flow状态流转
style Flow_Daily fill:#fce4ec,stroke:#c2185b,stroke-width:2px
style Check_Progress fill:#fce4ec,stroke:#c2185b,stroke-width:2px
style Check_Stale fill:#fce4ec,stroke:#c2185b,stroke-width:2px
style R2_Delay fill:#fce4ec,stroke:#c2185b,stroke-width:1px
style R3_Complete fill:#fce4ec,stroke:#c2185b,stroke-width:1px
style R4_Urgent fill:#fce4ec,stroke:#c2185b,stroke-width:1px
style R5_Stale fill:#fce4ec,stroke:#c2185b,stroke-width:1px
style R6_Delivery fill:#fce4ec,stroke:#c2185b,stroke-width:1px