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:
@@ -432,7 +432,10 @@ def agent_loop(messages: list, active_request: str):
|
||||
raise
|
||||
|
||||
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:
|
||||
force = trigger_hooks("Stop", messages)
|
||||
if force:
|
||||
messages.append({"role": "user", "content": force})
|
||||
@@ -441,9 +444,7 @@ def agent_loop(messages: list, active_request: str):
|
||||
|
||||
results = []
|
||||
compact_requested = False
|
||||
for block in response.content:
|
||||
if block.type != "tool_use":
|
||||
continue
|
||||
for block in tool_calls:
|
||||
print(f"\033[36m> {block.name}\033[0m")
|
||||
if block.name == "compact":
|
||||
output = "Compaction requested after this tool batch."
|
||||
|
||||
Reference in New Issue
Block a user