- 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 | 105 | partTextResult := partResult.Get("text") |
| 106 | 106 | functionCallResult := partResult.Get("functionCall") |
| 107 | 107 | thoughtSignatureResult := partResult.Get("thoughtSignature") |
| 108 | + if !thoughtSignatureResult.Exists() { | |
| 109 | + thoughtSignatureResult = partResult.Get("thought_signature") | |
| 110 | + } | |
| 108 | 111 | inlineDataResult := partResult.Get("inlineData") |
| 109 | 112 | if !inlineDataResult.Exists() { |
| 110 | 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 | |
| 114 | − if thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" { | |
| 115 | − // Skip thoughtSignature processing - it's internal encrypted data | |
| 116 | + hasThoughtSignature := thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" | |
| 117 | + hasContentPayload := partTextResult.Exists() || functionCallResult.Exists() || inlineDataResult.Exists() | |
| 118 | + | |
| 119 | + // Ignore encrypted thoughtSignature but keep any actual content in the same part. | |
| 120 | + if hasThoughtSignature && !hasContentPayload { | |
| 116 | 121 | continue |
| 117 | 122 | } |
| 118 | 123 | |
| @@ -105,14 +105,19 @@ func ConvertCliResponseToOpenAI(_ context.Context, _ string, originalRequestRawJ · 104 unmodified lines | ||
| 105 | 105 | partTextResult := partResult.Get("text") |
| 106 | 106 | functionCallResult := partResult.Get("functionCall") |
| 107 | 107 | thoughtSignatureResult := partResult.Get("thoughtSignature") |
| 108 | + if !thoughtSignatureResult.Exists() { | |
| 109 | + thoughtSignatureResult = partResult.Get("thought_signature") | |
| 110 | + } | |
| 108 | 111 | inlineDataResult := partResult.Get("inlineData") |
| 109 | 112 | if !inlineDataResult.Exists() { |
| 110 | 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 | |
| 114 | − if thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" { | |
| 115 | − // Skip thoughtSignature processing - it's internal encrypted data | |
| 116 | + hasThoughtSignature := thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" | |
| 117 | + hasContentPayload := partTextResult.Exists() || functionCallResult.Exists() || inlineDataResult.Exists() | |
| 118 | + | |
| 119 | + // Ignore encrypted thoughtSignature but keep any actual content in the same part. | |
| 120 | + if hasThoughtSignature && !hasContentPayload { | |
| 116 | 121 | continue |
| 117 | 122 | } |
| 118 | 123 | |
| @@ -116,8 +116,11 @@ func ConvertGeminiResponseToOpenAI(_ context.Context, _ string, originalRequestR · 115 unmodified lines | ||
| 116 | 116 | thoughtSignatureResult = partResult.Get("thought_signature") |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | − // Skip thoughtSignature parts (encrypted reasoning not exposed downstream). | |
| 120 | − if thoughtSignatureResult.Exists() && thoughtSignatureResult.String() != "" { | |
| 119 | + hasThoughtSignature := 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 | 124 | continue |
| 122 | 125 | } |
| 123 | 126 | |