gemini-2.0-flash-thinking-exp-1219 不能用 OFF 改成 NONE 正常了
image1045×475 53.3 KB
改了relay/channel/gemini/relay-gemini.go的函数,得把 thinking-exp 摘出去,也不知道其他think是不是也不能用 OFF
threshold := common.GeminiSafetySetting
if strings.Contains(textRequest.Model, "exp") && textRequest.Model != "gemini-2.0-flash-thinking-exp-1219" {
threshold = "OFF"
}
geminiRequest := GeminiChatRequest{
Contents: make([]GeminiChatContent, 0, len(textRequest.Messages)),
SafetySettings: []GeminiChatSafetySettings{
{
Category: "HARM_CATEGORY_HARASSMENT",
Threshold: threshold,
},
{
Category: "HARM_CATEGORY_HATE_SPEECH",
Threshold: threshold,
},
{
Category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
Threshold: threshold,
},
{
Category: "HARM_CATEGORY_DANGEROUS_CONTENT",
Threshold: threshold,
},
{
Category: "HARM_CATEGORY_CIVIC_INTEGRITY",
Threshold: common.GeminiSafetySetting,
},
},
GenerationConfig: GeminiChatGenerationConfig{
Temperature: textRequest.Temperature,
TopP: textRequest.TopP,
MaxOutputTokens: textRequest.MaxTokens,
Seed: int64(textRequest.Seed),
},
} }