From e2c8edab61239365530d6d415e517f2ed0831c9f Mon Sep 17 00:00:00 2001 From: Konjac-XZ <71483384+Konjac-XZ@users.noreply.github.com> Date: Mon, 10 Nov 2025 16:42:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20incorrect=20spelling=20caused=20Gemini?= =?UTF-8?q?=20endpoint=E2=80=99s=20thinking=20budget=20to=20fail=20(#11217?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/aiCore/utils/reasoning.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/aiCore/utils/reasoning.ts b/src/renderer/src/aiCore/utils/reasoning.ts index 3a36fb658a..1d7123a47b 100644 --- a/src/renderer/src/aiCore/utils/reasoning.ts +++ b/src/renderer/src/aiCore/utils/reasoning.ts @@ -418,6 +418,8 @@ export function getAnthropicReasoningParams(assistant: Assistant, model: Model): /** * 获取 Gemini 推理参数 * 从 GeminiAPIClient 中提取的逻辑 + * 注意:Gemini/GCP 端点所使用的 thinkingBudget 等参数应该按照驼峰命名法传递 + * 而在 Google 官方提供的 OpenAI 兼容端点中则使用蛇形命名法 thinking_budget */ export function getGeminiReasoningParams(assistant: Assistant, model: Model): Record { if (!isReasoningModel(model)) { @@ -431,8 +433,8 @@ export function getGeminiReasoningParams(assistant: Assistant, model: Model): Re if (reasoningEffort === undefined) { return { thinkingConfig: { - include_thoughts: false, - ...(GEMINI_FLASH_MODEL_REGEX.test(model.id) ? { thinking_budget: 0 } : {}) + includeThoughts: false, + ...(GEMINI_FLASH_MODEL_REGEX.test(model.id) ? { thinkingBudget: 0 } : {}) } } } @@ -442,7 +444,7 @@ export function getGeminiReasoningParams(assistant: Assistant, model: Model): Re if (effortRatio > 1) { return { thinkingConfig: { - include_thoughts: true + includeThoughts: true } } } @@ -452,8 +454,8 @@ export function getGeminiReasoningParams(assistant: Assistant, model: Model): Re return { thinkingConfig: { - ...(budget > 0 ? { thinking_budget: budget } : {}), - include_thoughts: true + ...(budget > 0 ? { thinkingBudget: budget } : {}), + includeThoughts: true } } }