mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-02 20:40:52 +08:00
Fix antigravity Claude thinking signature handling
This commit is contained in:
@@ -84,13 +84,18 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
|
||||
contentResult := contentResults[j]
|
||||
contentTypeResult := contentResult.Get("type")
|
||||
if contentTypeResult.Type == gjson.String && contentTypeResult.String() == "thinking" {
|
||||
prompt := contentResult.Get("thinking").String()
|
||||
// Claude "thinking" blocks are internal-only. They also require a valid provider signature
|
||||
// when replayed as conversation history. Since we cannot mint signatures, only forward
|
||||
// thinking blocks when the client provides a non-empty signature; otherwise, drop them.
|
||||
signatureResult := contentResult.Get("signature")
|
||||
signature := geminiCLIClaudeThoughtSignature
|
||||
if signatureResult.Exists() {
|
||||
signature = signatureResult.String()
|
||||
if signatureResult.Type == gjson.String && signatureResult.String() != "" {
|
||||
prompt := contentResult.Get("thinking").String()
|
||||
clientContent.Parts = append(clientContent.Parts, client.Part{
|
||||
Text: prompt,
|
||||
Thought: true,
|
||||
ThoughtSignature: signatureResult.String(),
|
||||
})
|
||||
}
|
||||
clientContent.Parts = append(clientContent.Parts, client.Part{Text: prompt, Thought: true, ThoughtSignature: signature})
|
||||
} else if contentTypeResult.Type == gjson.String && contentTypeResult.String() == "text" {
|
||||
prompt := contentResult.Get("text").String()
|
||||
clientContent.Parts = append(clientContent.Parts, client.Part{Text: prompt})
|
||||
@@ -134,7 +139,9 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
|
||||
}
|
||||
}
|
||||
}
|
||||
contents = append(contents, clientContent)
|
||||
if len(clientContent.Parts) > 0 {
|
||||
contents = append(contents, clientContent)
|
||||
}
|
||||
} else if contentsResult.Type == gjson.String {
|
||||
prompt := contentsResult.String()
|
||||
contents = append(contents, client.Content{Role: role, Parts: []client.Part{{Text: prompt}}})
|
||||
|
||||
Reference in New Issue
Block a user