|
@@ -484,6 +484,17 @@ func CovertOpenAI2Gemini(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 如果需要附加签名但还没有附加(没有 tool_calls 或 tool_calls 为空),
|
|
|
|
|
+ // 则在第一个文本 part 上附加 thoughtSignature
|
|
|
|
|
+ if shouldAttachThoughtSignature && !signatureAttached && len(parts) > 0 {
|
|
|
|
|
+ for i := range parts {
|
|
|
|
|
+ if parts[i].Text != "" {
|
|
|
|
|
+ parts[i].ThoughtSignature = json.RawMessage(strconv.Quote(thoughtSignatureBypassValue))
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
content.Parts = parts
|
|
content.Parts = parts
|
|
|
|
|
|
|
|
// there's no assistant role in gemini and API shall vomit if Role is not user or model
|
|
// there's no assistant role in gemini and API shall vomit if Role is not user or model
|