- Updated handling of `thoughtSignature` across all translator modules to retain other content payloads if present. - Adjusted logic for `thought_signature` and `inline_data` keys for consistent processing.
Unified · Split
| @@ -105,14 +105,19 @@ func ConvertAntigravityResponseToOpenAI(_ context.Context, _ string, originalReq · 104 unmodified lines | |||
| 105 | partTextResult := partResult.Get("text") | 105 | partTextResult := partResult.Get("text") |
| 106 | functionCallResult := partResult.Get("functionCall") | 106 | functionCallResult := partResult.Get("functionCall") |
| 107 | thoughtSignatureResult := partResult.Get("thoughtSignature") | 107 | thoughtSignatureResult := partResult.Get("thoughtSignature") |
| 108 | if !thoughtSignatureResult.Exists() { | ||
| 109 | thoughtSignatureResult = partResult.Get("thought_signature") | ||
| 110 | } | ||
| 108 | inlineDataResult := partResult.Get("inlineData") | 111 | inlineDataResult := partResult.Get("inlineData") |
| 109 | if !inlineDataResult.Exists() { | 112 | if !inlineDataResult.Exists() { |
| 110 | inlineDataResult = partResult.Get("inline_data") | 113 | inlineDataResult = partResult.Get("inline_data") |
| 111 | } | 114 | } |
| 112 | 115 | ||
| 113 | // Handle thoughtSignature - this is encrypted reasoning content that should not be exposed to the client | 116 | hasThoughtSignature := thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" |
| 114 | if thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" { | 117 | hasContentPayload := partTextResult.Exists() || functionCallResult.Exists() || inlineDataResult.Exists() |
| 115 | // Skip thoughtSignature processing - it's internal encrypted data | 118 | |
| 119 | // Ignore encrypted thoughtSignature but keep any actual content in the same part. | ||
| 120 | if hasThoughtSignature && !hasContentPayload { | ||
| 116 | continue | 121 | continue |
| 117 | } | 122 | } |
| 118 | 123 | ||
| @@ -105,14 +105,19 @@ func ConvertCliResponseToOpenAI(_ context.Context, _ string, originalRequestRawJ · 104 unmodified lines | |||
| 105 | partTextResult := partResult.Get("text") | 105 | partTextResult := partResult.Get("text") |
| 106 | functionCallResult := partResult.Get("functionCall") | 106 | functionCallResult := partResult.Get("functionCall") |
| 107 | thoughtSignatureResult := partResult.Get("thoughtSignature") | 107 | thoughtSignatureResult := partResult.Get("thoughtSignature") |
| 108 | if !thoughtSignatureResult.Exists() { | ||
| 109 | thoughtSignatureResult = partResult.Get("thought_signature") | ||
| 110 | } | ||
| 108 | inlineDataResult := partResult.Get("inlineData") | 111 | inlineDataResult := partResult.Get("inlineData") |
| 109 | if !inlineDataResult.Exists() { | 112 | if !inlineDataResult.Exists() { |
| 110 | inlineDataResult = partResult.Get("inline_data") | 113 | inlineDataResult = partResult.Get("inline_data") |
| 111 | } | 114 | } |
| 112 | 115 | ||
| 113 | // Handle thoughtSignature - this is encrypted reasoning content that should not be exposed to the client | 116 | hasThoughtSignature := thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" |
| 114 | if thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" { | 117 | hasContentPayload := partTextResult.Exists() || functionCallResult.Exists() || inlineDataResult.Exists() |
| 115 | // Skip thoughtSignature processing - it's internal encrypted data | 118 | |
| 119 | // Ignore encrypted thoughtSignature but keep any actual content in the same part. | ||
| 120 | if hasThoughtSignature && !hasContentPayload { | ||
| 116 | continue | 121 | continue |
| 117 | } | 122 | } |
| 118 | 123 | ||
| @@ -116,8 +116,11 @@ func ConvertGeminiResponseToOpenAI(_ context.Context, _ string, originalRequestR · 115 unmodified lines | |||
| 116 | thoughtSignatureResult = partResult.Get("thought_signature") | 116 | thoughtSignatureResult = partResult.Get("thought_signature") |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | // Skip thoughtSignature parts (encrypted reasoning not exposed downstream). | 119 | hasThoughtSignature := thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" |
| 120 | if thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" { | 120 | hasContentPayload := partTextResult.Exists() || functionCallResult.Exists() || inlineDataResult.Exists() |
| 121 | |||
| 122 | // Skip pure thoughtSignature parts but keep any actual payload in the same part. | ||
| 123 | if hasThoughtSignature && !hasContentPayload { | ||
| 121 | continue | 124 | continue |
| 122 | } | 125 | } |
| 123 | 126 | ||