refactor: Use helper to extract wrapped "thinking" text

Improve robustness when handling "thinking" content by using a dedicated helper to extract the thinking text. This ensures wrapped or nested thinking objects are handled correctly instead of relying on a direct string extraction, reducing parsing errors for complex payloads.
This commit is contained in:
이대희
2025-12-19 13:09:36 +09:00
parent c1f8211acb
commit 3275494fde
5 changed files with 92 additions and 1 deletions

View File

@@ -118,7 +118,8 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
contentResult := contentResults[j]
contentTypeResult := contentResult.Get("type")
if contentTypeResult.Type == gjson.String && contentTypeResult.String() == "thinking" {
thinkingText := contentResult.Get("thinking").String()
// Use GetThinkingText to handle wrapped thinking objects
thinkingText := util.GetThinkingText(contentResult)
signatureResult := contentResult.Get("signature")
signature := ""
if signatureResult.Exists() && signatureResult.String() != "" {