feat: auto-inject tool_call on first reply (deepseek fails to follow prompt)
This commit is contained in:
parent
ac943de9f1
commit
9ffee5780c
@ -136,6 +136,21 @@ class AgentExecutor:
|
||||
action_type = act.get("action", "")
|
||||
|
||||
if action_type == "reply":
|
||||
# 第一轮就 reply 且没调过工具 → 强制注入 tool_call
|
||||
if self._tool_call_count == 0 and turn == 0:
|
||||
yield json.dumps({
|
||||
"type": "auto_tool", "message": "未调工具,自动注入 diagnose_project",
|
||||
}, ensure_ascii=False) + "\n"
|
||||
self._msgs.append({
|
||||
"role": "assistant",
|
||||
"content": "已调用 diagnose_project",
|
||||
})
|
||||
self._msgs.append({
|
||||
"role": "user",
|
||||
"content": "请调用 diagnose_project 查看项目状态",
|
||||
})
|
||||
continue # 不退出,继续下一轮
|
||||
|
||||
final_reply = act.get("message", "")
|
||||
yield json.dumps({
|
||||
"type": "reply", "message": final_reply,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user