Merge pull request #1761 from margbug01/fix/thinking-chain-display

fix: support thinking.type=auto from Amp client and decouple thinking translation from unsigned history
This commit is contained in:
Luis Pater
2026-03-01 02:30:42 +08:00
committed by GitHub
2 changed files with 10 additions and 3 deletions
@@ -400,7 +400,7 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
hasTools := toolDeclCount > 0
thinkingResult := gjson.GetBytes(rawJSON, "thinking")
thinkingType := thinkingResult.Get("type").String()
hasThinking := thinkingResult.Exists() && thinkingResult.IsObject() && (thinkingType == "enabled" || thinkingType == "adaptive")
hasThinking := thinkingResult.Exists() && thinkingResult.IsObject() && (thinkingType == "enabled" || thinkingType == "adaptive" || thinkingType == "auto")
isClaudeThinking := util.IsClaudeThinkingModel(modelName)
if hasTools && hasThinking && isClaudeThinking {
@@ -440,6 +440,12 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingBudget", budget)
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
}
case "auto":
// Amp sends thinking.type="auto" — use max budget from model config
// Antigravity API for Claude models requires a concrete positive budget,
// not -1. Use a high default that ApplyThinking will cap to model max.
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingBudget", 128000)
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
case "adaptive":
// Keep adaptive as a high level sentinel; ApplyThinking resolves it
// to model-specific max capability.