%%{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["「源」某阶段失败
INVALID_AI_RESULT(阶段)"]:::warn F --> RT["「用」结构纠正
整份重生成"]:::use RT --> BUD["「取」预算:LPT_AI_MAX_ATTEMPTS=3
结构纠正与传输重试共用"]:::take BUD --> FAIL["「源」预算用尽
errorCode=INVALID_AI_RESULT
error=(未通过:阶段)"]:::origin FAIL --> MAP["「用」lpt-be 只取阶段
白名单 8 个阶段"]:::use MAP --> MSG["「源」ai_tasks.errorMessage
这次 AI 回应多次未通过核验(X)"]:::origin MSG --> FE["「说明」前端原样展示(最多 240 字)
不再提示手动重试"]:::note RT -.-> RTMSG["「说明」追加到 system 的原文
上一次输出未通过结构校验(阶段:固定子原因)。
例:提示结构:根节点不是 null
请按上面的字段要求重新生成完整 JSON:
顶层字段一个不少(limitations 没有内容也要输出空数组),
数组元素只带规定字段;不要解释重试过程。"]:::note RTMSG -.-> SUB["「说明」子原因只描述协议形状、不含学习内容;
整段不超过 40 字符,lpt-be 仍只把阶段给用户"]:::note LEN["「说明」另一条纠正
finish_reason=length 或空正文最多 1 次:
reasoning_effort 设为 none 并追加精简提示"]:::note LEN -.->|"另一条纠正"| RT