[Frontend] Allow parsed tool arguments (#28820)

Signed-off-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Quentin Gallouédec 2025-11-19 23:20:12 -07:00 committed by GitHub
parent a9705a290a
commit 1c7bcc55b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1437,6 +1437,7 @@ def _postprocess_messages(messages: list[ConversationMessage]) -> None:
for item in message["tool_calls"]: for item in message["tool_calls"]:
# if arguments is None or empty string, set to {} # if arguments is None or empty string, set to {}
if content := item["function"].get("arguments"): if content := item["function"].get("arguments"):
if not isinstance(content, (dict, list)):
item["function"]["arguments"] = json.loads(content) item["function"]["arguments"] = json.loads(content)
else: else:
item["function"]["arguments"] = {} item["function"]["arguments"] = {}