Files
lpt-meta/docs/diagrams/recall-ai/retry.mmd
T

27 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
%%{init: {"flowchart": {"wrappingWidth": 680}}}%%
flowchart TB
%% 依据:lpt-ai task-queue.ts#runTask 的 retryOptions.isRetryable 与结构/长度纠正分支(LPT_AI_MAX_ATTEMPTS 默认 3);
%% lpt-be RecallAiClient#remoteFailure(阶段白名单)、RecallAiService#fail;lpt-fe utils/recallResult.ts#recallAiFailure。
%% 已定位缺陷见 defect.mmd。
classDef src fill:#ffe1e1,stroke:#c0392b,stroke-width:3.5px,color:#7b1414
classDef api fill:#e8f0fe,stroke:#1a56b0,stroke-width:1.2px,color:#111
classDef take fill:#e7f6ea,stroke:#2e8b57,stroke-width:1.2px,color:#14532d
classDef use fill:#f3f0fb,stroke:#6b4fa0,stroke-width:1.2px,color:#3b2a63
classDef origin fill:#fff3cd,stroke:#b8860b,stroke-dasharray:4 3,color:#664d03
classDef note fill:#f7f7f7,stroke:#999,stroke-dasharray:4 3,color:#333
classDef warn fill:#ffe1e1,stroke:#c0392b,stroke-width:2.2px,color:#7b1414
F["「源」某阶段失败<br/>INVALID_AI_RESULT(阶段)"]:::warn
F --> RT["「用」结构纠正<br/>整份重生成"]:::use
RT --> BUD["「取」预算:LPT_AI_MAX_ATTEMPTS=3<br/>结构纠正与传输重试共用"]:::take
BUD --> FAIL["「源」预算用尽<br/>errorCode=INVALID_AI_RESULT<br/>error=(未通过:阶段)"]:::origin
FAIL --> MAP["「用」lpt-be 只取阶段<br/>白名单 8 个阶段"]:::use
MAP --> MSG["「源」ai_tasks.errorMessage<br/>这次 AI 回应多次未通过核验(X)"]:::origin
MSG --> FE["「说明」前端原样展示(最多 240 字)<br/>不再提示手动重试"]:::note
RT -.-> RTMSG["「说明」追加到 system 的原文<br/>上一次输出未通过结构校验(阶段:固定子原因)。<br/>例:提示结构:根节点不是 null<br/>请按上面的字段要求重新生成完整 JSON:<br/>顶层字段一个不少(limitations 没有内容也要输出空数组),<br/>数组元素只带规定字段;不要解释重试过程。"]:::note
RTMSG -.-> SUB["「说明」子原因只描述协议形状、不含学习内容;<br/>整段不超过 40 字符,lpt-be 仍只把阶段给用户"]:::note
LEN["「说明」另一条纠正<br/>finish_reason=length 或空正文最多 1 次:<br/>reasoning_effort 设为 none 并追加精简提示"]:::note
LEN -.->|"另一条纠正"| RT