fix: prefer quoted functionCall keys over bare matches

This commit is contained in:
CJACK.
2026-04-02 20:11:29 +08:00
parent 39f6e066d6
commit 24655342a7

View File

@@ -7,16 +7,13 @@ func findQuotedFunctionCallKeyStart(s string) int {
quotedIdx := findFunctionCallKeyStart(lower, `"functioncall"`)
bareIdx := findFunctionCallKeyStart(lower, "functioncall")
if quotedIdx < 0 {
return bareIdx
}
if bareIdx < 0 {
// Prefer the quoted JSON key whenever we have a structural match.
// Bare-key detection is only for loose payloads where the quoted form
// is absent.
if quotedIdx >= 0 {
return quotedIdx
}
if bareIdx < quotedIdx {
return bareIdx
}
return quotedIdx
return bareIdx
}
func findFunctionCallKeyStart(lower, key string) int {