fix(upstream): 跳过 Claude 模型无 signature 的 thinking block
- buildParts 函数检测 thinking block 的 signature - Claude 模型 (allowDummyThought=false) 时跳过无 signature 的 block - 记录警告日志以便调试 - Gemini 模型继续使用 dummy signature 兼容方案 修复 Issue 0.1: Claude thinking block signature 缺失错误
This commit is contained in:
@@ -3,6 +3,7 @@ package antigravity
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@@ -205,6 +206,10 @@ func buildParts(content json.RawMessage, toolIDToName map[string]string, allowDu
|
|||||||
// 保留原有 signature(Claude 模型需要有效的 signature)
|
// 保留原有 signature(Claude 模型需要有效的 signature)
|
||||||
if block.Signature != "" {
|
if block.Signature != "" {
|
||||||
part.ThoughtSignature = block.Signature
|
part.ThoughtSignature = block.Signature
|
||||||
|
} else if !allowDummyThought {
|
||||||
|
// Claude 模型需要有效 signature,跳过无 signature 的 thinking block
|
||||||
|
log.Printf("Warning: skipping thinking block without signature for Claude model")
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
parts = append(parts, part)
|
parts = append(parts, part)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user