Limit HTML unescape to markup tool-call parsing
This commit is contained in:
1 parent
77a401fb19
commit
da7c46b278
4 files changed
+41
-52
No files matched your search
@@ -703,3 +703,15 @@ func TestParseToolCallsUnescapesHTMLEntityArguments(t *testing.T) {
|
||||
t.Fatalf("expected html entities to be unescaped in command, got %q", cmd)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseToolCallsJSONPayloadKeepsLiteralEntities(t *testing.T) {
|
||||
text := `{"tool_calls":[{"name":"bash","input":{"command":"echo > literally"}}]}`
|
||||
calls := ParseToolCalls(text, []string{"bash"})
|
||||
if len(calls) != 1 {
|
||||
t.Fatalf("expected one call, got %#v", calls)
|
||||
}
|
||||
cmd, _ := calls[0].Input["command"].(string)
|
||||
if cmd != "echo > literally" {
|
||||
t.Fatalf("expected json payload to keep literal entities, got %q", cmd)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user