实现完整doctool和guitool的矫正及list_action,死循环检测与干预,优化提示词工程

This commit is contained in:
minorQAQ committed 2026-07-03 19:19:41 +08:00
1 parent 2d801911b5
commit 8befbacd65
49 files changed
+3408 -410

No files matched your search

+23
View File
@@ -63,3 +63,26 @@ git add .
git commit -m "修改内容的说明"
# 显式指定推送到个人仓库 (minor)
git push minor master
###循环检测
用户输入 → runtime.py 重置循环状态
→ graph.invoke 开始执行
│
├─ agent 节点 (nodes.py / call_model)
│ ├─ _build_reflection_prompt()
│ │ ├─ check_and_record_todolist_progress() ← todolist 停滞检测
│ │ │ └─ 10轮无进展 → 注入反思提示:"请反思当前卡点..."
│ │ │
│ │ └─ build_loop_reflection_prompt()
│ │ └─ detect_repeated_tool_calls() ← 连续相同工具检测
│ │ └─ 连续3次 → 注入反思提示:"你已连续多次调用同一工具..."
│ │
│ └─ LLM 调用(带反思提示引导)
│
├─ routing 节点 (routing.py / should_continue)
│ └─ should_force_end()
│ └─ 连续5次相同工具+相同参数 → 返回 END,强制终止
│
└─ 图结束后 (runtime.py / execute_agent)
└─ 检测到强制终止 → 向前端输出:
"检测到异常循环,工具 `xxx` 已连续调用 5 次..."