fix: 彻底修复 RAG 无限循环问题
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m33s

关键修复:
1. rag_nodes.py: history 里记录的 action 改成大写 RETRIEVE_RAG
2. react_nodes.py: route_by_reasoning 优先检查 DIRECT_RESPONSE
3. 优化路由判断顺序,避免不必要的循环
This commit is contained in:
2026-05-04 19:03:41 +08:00
parent c9bf21be0e
commit 0543a4da8b
2 changed files with 14 additions and 8 deletions

View File

@@ -234,7 +234,7 @@ async def rag_retrieve_node(state: MainGraphState, config: Optional[Dict[str, An
# 关键修复:把 rag_retrieve 加到 reasoning_history 里,让下次推理知道
state.reasoning_history.append({
"step": state.reasoning_step,
"action": "rag_retrieve",
"action": "RETRIEVE_RAG", # 大写,和推理结果保持一致
"confidence": 1.0,
"reasoning": "RAG 检索完成",
"timestamp": datetime.now().isoformat()