Merge PR #1294: fix tool hint crash when arguments is a list (Kimi K2.5)

This commit is contained in:
Re-bin
2026-02-28 08:06:20 +00:00

View File

@@ -163,7 +163,8 @@ class AgentLoop:
def _tool_hint(tool_calls: list) -> str:
"""Format tool calls as concise hint, e.g. 'web_search("query")'."""
def _fmt(tc):
val = next(iter(tc.arguments.values()), None) if tc.arguments else None
args = (tc.arguments[0] if isinstance(tc.arguments, list) else tc.arguments) or {}
val = next(iter(args.values()), None) if isinstance(args, dict) else None
if not isinstance(val, str):
return tc.name
return f'{tc.name}("{val[:40]}")' if len(val) > 40 else f'{tc.name}("{val}")'