html.unescape JSON body before json.loads in tool-call fallback

The <parameter> path on line 113 already unescapes HTML entities;
the JSON fallback path didn't, so any MiniMax JSON body that arrived
with HTML-escaped characters (either in string values like
&lt;script&gt; or in the JSON syntax itself like &quot;path&quot;)
would either fail to parse or produce values with literal entity
text instead of the original character.
This commit is contained in:
n1majne3 2026-05-03 19:48:11 -07:00 • committed by 0xallam
parent 7327ca8324
commit 15c3910ded

View file

@ -113,7 +113,7 @@ def parse_tool_invocations(content: str) -> list[dict[str, Any]] | None:
args[param_name] = param_value
if not args:
body_stripped = fn_body.strip()
body_stripped = html.unescape(fn_body.strip())
if body_stripped.startswith("{"):
try:
parsed = json.loads(body_stripped)