debug: stderr log instead of yield
This commit is contained in:
parent
c091e98df1
commit
bf4413b81c
@ -128,13 +128,8 @@ class AgentExecutor:
|
|||||||
# 5b. LLM 调用
|
# 5b. LLM 调用
|
||||||
raw = await self._call_llm()
|
raw = await self._call_llm()
|
||||||
|
|
||||||
# debug: show raw LLM output
|
import sys
|
||||||
yield json.dumps({
|
print(f"AGENT_LOOP turn={self._turn_count} raw_len={len(raw) if raw else 0}", file=sys.stderr, flush=True)
|
||||||
"type": "debug_raw",
|
|
||||||
"turn": self._turn_count,
|
|
||||||
"raw_len": len(raw) if raw else 0,
|
|
||||||
"raw_preview": (raw or "")[:200],
|
|
||||||
}, ensure_ascii=False) + "\n"
|
|
||||||
|
|
||||||
# 5c. 解析 LLM 输出
|
# 5c. 解析 LLM 输出
|
||||||
actions = self._parse_actions(raw)
|
actions = self._parse_actions(raw)
|
||||||
@ -144,14 +139,6 @@ class AgentExecutor:
|
|||||||
action_type = act.get("action", "")
|
action_type = act.get("action", "")
|
||||||
|
|
||||||
if action_type == "reply":
|
if action_type == "reply":
|
||||||
# debug: always emit count
|
|
||||||
yield json.dumps({
|
|
||||||
"type": "debug",
|
|
||||||
"tool_call_count": self._tool_call_count,
|
|
||||||
"turn": self._turn_count,
|
|
||||||
"action": action_type,
|
|
||||||
}, ensure_ascii=False) + "\n"
|
|
||||||
|
|
||||||
# 任何轮次,只要没成功调过工具就 reply → 强制注入工具调用
|
# 任何轮次,只要没成功调过工具就 reply → 强制注入工具调用
|
||||||
if self._tool_call_count == 0:
|
if self._tool_call_count == 0:
|
||||||
hint_tool = "diagnose_project"
|
hint_tool = "diagnose_project"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user