fix: support models with fixed reasoning levels in Gemini thinkingConfig guard

This commit is contained in:
Roo Code 2025-12-24 21:05:10 +00:00
parent e13dfb030c
commit 3b759c7806

View file

@ -133,8 +133,12 @@ export const getGeminiReasoning = ({
}: GetModelReasoningOptions): GeminiReasoningParams | undefined => {
// Only send thinkingConfig to models that advertise support for it; Gemini 3 rejects
// the field and returns 400 otherwise.
// This checks for: budget support, effort UI support, or fixed reasoning level defaults.
const supportsThinkingConfig =
typeof model.maxThinkingTokens === "number" || model.supportsReasoningBudget || model.supportsReasoningEffort
typeof model.maxThinkingTokens === "number" ||
model.supportsReasoningBudget ||
model.supportsReasoningEffort ||
!!model.reasoningEffort
// Budget-based (2.5) models: use thinkingBudget, not thinkingLevel.
if (shouldUseReasoningBudget({ model, settings })) {