mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-09-20 12:13:38 +08:00
Fix empty tool-use response handling
This commit is contained in:
@@ -1220,11 +1220,12 @@ class TeammateRuntime:
|
||||
|
||||
self.messages.append({"role": "assistant",
|
||||
"content": response.content})
|
||||
if response.stop_reason == "tool_use":
|
||||
tool_calls = [
|
||||
block for block in response.content if block.type == "tool_use"
|
||||
]
|
||||
if tool_calls:
|
||||
results = []
|
||||
for block in response.content:
|
||||
if block.type != "tool_use":
|
||||
continue
|
||||
for block in tool_calls:
|
||||
output = _run_teammate_tool(
|
||||
self.name, block, self.handlers
|
||||
)
|
||||
@@ -1710,15 +1711,16 @@ def agent_loop(messages: list):
|
||||
return
|
||||
|
||||
messages.append({"role": "assistant", "content": response.content})
|
||||
if response.stop_reason != "tool_use":
|
||||
tool_calls = [
|
||||
block for block in response.content if block.type == "tool_use"
|
||||
]
|
||||
if not tool_calls:
|
||||
release_completed_assignment("agent")
|
||||
trigger_hooks("Stop", messages)
|
||||
return
|
||||
|
||||
results = []
|
||||
for block in response.content:
|
||||
if block.type != "tool_use":
|
||||
continue
|
||||
for block in tool_calls:
|
||||
print(f"> {block.name}")
|
||||
output = execute_tool(block)
|
||||
print(output[:300])
|
||||
|
||||
Reference in New Issue
Block a user