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:
@@ -714,7 +714,10 @@ def agent_loop(messages: list):
|
||||
"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:
|
||||
force = trigger_hooks("Stop", messages)
|
||||
if force:
|
||||
messages.append({"role": "user", "content": force})
|
||||
@@ -724,9 +727,7 @@ def agent_loop(messages: list):
|
||||
return
|
||||
|
||||
results = []
|
||||
for block in response.content:
|
||||
if block.type != "tool_use":
|
||||
continue
|
||||
for block in tool_calls:
|
||||
output = execute_tool(block)
|
||||
results.append({
|
||||
"type": "tool_result",
|
||||
|
||||
Reference in New Issue
Block a user