From 7ca045d8b9cc9deda6a5c36b9f1e99c328eeeb25 Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Thu, 22 Jan 2026 20:28:08 +0800 Subject: [PATCH] fix(executor): adjust model-specific request payload --- .../runtime/executor/antigravity_executor.go | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/internal/runtime/executor/antigravity_executor.go b/internal/runtime/executor/antigravity_executor.go index ea73c266..0baab410 100644 --- a/internal/runtime/executor/antigravity_executor.go +++ b/internal/runtime/executor/antigravity_executor.go @@ -1240,6 +1240,12 @@ func (e *AntigravityExecutor) buildRequest(ctx context.Context, auth *cliproxyau } } + if strings.Contains(modelName, "claude") { + payload, _ = sjson.SetBytes(payload, "request.toolConfig.functionCallingConfig.mode", "VALIDATED") + } else { + payload, _ = sjson.DeleteBytes(payload, "request.generationConfig.maxOutputTokens") + } + httpReq, errReq := http.NewRequestWithContext(ctx, http.MethodPost, requestURL.String(), bytes.NewReader(payload)) if errReq != nil { return nil, errReq @@ -1419,28 +1425,6 @@ func geminiToAntigravity(modelName string, payload []byte, projectID string) []b template, _ = sjson.SetRaw(template, "request.toolConfig", toolConfig.Raw) template, _ = sjson.Delete(template, "toolConfig") } - if strings.Contains(modelName, "claude") { - template, _ = sjson.Set(template, "request.toolConfig.functionCallingConfig.mode", "VALIDATED") - } - - if strings.Contains(modelName, "claude") || strings.Contains(modelName, "gemini-3-pro-high") { - gjson.Get(template, "request.tools").ForEach(func(key, tool gjson.Result) bool { - tool.Get("functionDeclarations").ForEach(func(funKey, funcDecl gjson.Result) bool { - if funcDecl.Get("parametersJsonSchema").Exists() { - template, _ = sjson.SetRaw(template, fmt.Sprintf("request.tools.%d.functionDeclarations.%d.parameters", key.Int(), funKey.Int()), funcDecl.Get("parametersJsonSchema").Raw) - template, _ = sjson.Delete(template, fmt.Sprintf("request.tools.%d.functionDeclarations.%d.parameters.$schema", key.Int(), funKey.Int())) - template, _ = sjson.Delete(template, fmt.Sprintf("request.tools.%d.functionDeclarations.%d.parametersJsonSchema", key.Int(), funKey.Int())) - } - return true - }) - return true - }) - } - - if !strings.Contains(modelName, "claude") { - template, _ = sjson.Delete(template, "request.generationConfig.maxOutputTokens") - } - return []byte(template) }