From ec0633bdfbc6b0999fbf2f63d0b12058a1e29fbf Mon Sep 17 00:00:00 2001 From: CaIon Date: Sun, 12 Oct 2025 22:21:45 +0800 Subject: [PATCH] fix: update error messages for unsupported parameter names in Google extra body --- relay/channel/gemini/relay-gemini.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/relay/channel/gemini/relay-gemini.go b/relay/channel/gemini/relay-gemini.go index f26c7ce7f..3e4c82889 100644 --- a/relay/channel/gemini/relay-gemini.go +++ b/relay/channel/gemini/relay-gemini.go @@ -211,7 +211,16 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i // eg. {"google":{"thinking_config":{"thinking_budget":5324,"include_thoughts":true}}} if googleBody, ok := extraBody["google"].(map[string]interface{}); ok { adaptorWithExtraBody = true + // check error param name like thinkingConfig, should be thinking_config + if _, hasErrorParam := googleBody["thinkingConfig"]; hasErrorParam { + return nil, errors.New("extra_body.google.thinkingConfig is not supported, use extra_body.google.thinking_config instead") + } + if thinkingConfig, ok := googleBody["thinking_config"].(map[string]interface{}); ok { + // check error param name like thinkingBudget, should be thinking_budget + if _, hasErrorParam := thinkingConfig["thinkingBudget"]; hasErrorParam { + return nil, errors.New("extra_body.google.thinking_config.thinkingBudget is not supported, use extra_body.google.thinking_config.thinking_budget instead") + } if budget, ok := thinkingConfig["thinking_budget"].(float64); ok { budgetInt := int(budget) geminiRequest.GenerationConfig.ThinkingConfig = &dto.GeminiThinkingConfig{