[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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user