[Bugfix][Frontend] Emit non-ASCII tool-call arguments without \uXXXX escapes (#46308)

Signed-off-by: EazyReal <8047065+EazyReal@users.noreply.github.com>
Co-authored-by: EazyReal <8047065+EazyReal@users.noreply.github.com>
This commit is contained in:
Maxwill Lin
2026-06-23 20:43:11 +00:00
committed by GitHub
co-authored by EazyReal
parent 899d72a58c
commit 6617db1bfb
6 changed files with 75 additions and 9 deletions
+4 -2
View File
@@ -165,7 +165,7 @@ class xLAMToolParser(ToolParser):
function=FunctionCall(
name=call["name"],
arguments=(
json.dumps(call["arguments"])
json.dumps(call["arguments"], ensure_ascii=False)
if isinstance(call["arguments"], dict)
else call["arguments"]
),
@@ -473,7 +473,9 @@ class xLAMToolParser(ToolParser):
):
current_tool = parsed_tools[current_idx]
if isinstance(current_tool.get("arguments"), dict):
args_text = json.dumps(current_tool["arguments"])
args_text = json.dumps(
current_tool["arguments"], ensure_ascii=False
)
else:
args_text = str(current_tool.get("arguments", "{}"))
except (json.JSONDecodeError, KeyError, IndexError):