抽象json提取风格

This commit is contained in:
zk
2026-04-23 17:49:06 +08:00
parent fa7d87e435
commit 8fbb1f6fca
6 changed files with 34 additions and 37 deletions
@@ -140,6 +140,12 @@ inclusion: manual
- AI 调用应做好异常捕获和容错,单次失败不应影响整体流程
- 长耗时 AI 调用考虑异步执行
### AI 输出 JSON 解析
- LLM 返回的 JSON 经常被 markdown 代码块(` ```json ... ``` `)包裹,**禁止**直接使用 LangChain 的 `JsonOutputParser`
- 统一使用 `app.tool.json_helper.parse_llm_json` 解析 AI 输出的 JSON 文本
- `parse_llm_json` 会自动剥离 markdown 代码块标记,并通过 `json_repair` 做容错修复
- **不要**在各模块中自行编写 JSON 清洗/解析逻辑,统一复用 `parse_llm_json`
## 代码格式规范
### 紧凑风格