History

Fixed: #639

fix(antigravity): validate function arguments before serialization Ensure `function.arguments` is a valid JSON before setting raw bytes, fallback to setting as parameterized content if invalid.

Luis Pater committed 10 months agov6.6.46

Commit 24bc9cb1 parent 1084b531 file · +5 −1Browse files

Unified · Split

internal/translator/antigravity/openai/chat-completions/antigravity_openai_request.go+5−1
@@ -266,7 +266,11 @@ func ConvertOpenAIRequestToAntigravity(modelName string, inputRawJSON []byte, _ · 265 unmodified lines
266266 fargs := tc.Get("function.arguments").String()
267267 node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.id", fid)
268268 node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.name", fname)
269− node, _ = sjson.SetRawBytes(node, "parts."+itoa(p)+".functionCall.args", []byte(fargs))
269+ if gjson.Valid(fargs) {
270+ node, _ = sjson.SetRawBytes(node, "parts."+itoa(p)+".functionCall.args", []byte(fargs))
271+ } else {
272+ node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.args.params", []byte(fargs))
273+ }
270274 node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".thoughtSignature", geminiCLIFunctionThoughtSignature)
271275 p++
272276 if fid != "" {