%%{init: {"flowchart": {"wrappingWidth": 680}}}%% flowchart TB %% 依据:lpt-ai src/llm/recall.ts#parseRecallResult/normalizeRecallResult(阶段顺序与各段规则)。 %% 只画校验阶段本身;失败后的重试、落库与前端文案见 retry.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 IN["「入口」parseRecallResult(type, raw, model, params)"]:::api IN --> S1{"raw 超过 64 KiB?"} S1 -->|"是"| X1["INVALID_AI_RESULT
阶段:输出长度"]:::warn S1 -->|"否"| S2{"JSON.parse 成功?"} S2 -->|"否"| X2["INVALID_AI_RESULT
阶段:不是有效 JSON"]:::warn S2 -->|"是"| P["「用」normalizeRecallResult
进入固定阶段顺序"]:::use P --> P1["1 结构与字段
7 个顶层字段精确匹配;缺 limitations 补 []"]:::use P1 --> P2["2 分析判定
assessments 形状、unitId、status、引用"]:::use P2 --> P3["3 提示结构
form、anchor、引文、nodes 形状、parentId=null 根、LEAF=1 节点"]:::use P3 --> P4["4 查漏依据
findings 形状、category 引文;HINT 必须空 findings + PARTIAL"]:::use P4 --> P5["5 表达依据
expressionEvidence 的 nodeId / field / 偏移 / 原文"]:::use P5 --> P6["6 分析覆盖
补 UNANALYZED、丢弃未分析引用、算 analysisStatus"]:::use P6 --> OK["「源」result:返回给 lpt-be"]:::origin F["「源」某一阶段抛错
RecallProtocolError(INVALID_AI_RESULT, 阶段)"]:::warn P3 -.-> F X1 -.-> F X2 -.-> F F -.-> NEXT["「说明」重生成、落库与前端文案见 retry 图"]:::note