🐛 fix: Update Gemini range of thinkingBudget (#8122)

This commit is contained in:
sxjeru
2025-06-11 10:47:06 +08:00
committed by GitHub
parent 261e2ca0bf
commit 7331e8a70e
+10 -2
View File
@@ -123,9 +123,17 @@ export class LobeGoogleAI implements LobeRuntimeAI {
: undefined,
thinkingBudget:
thinking?.type === 'enabled'
? Math.min(thinking.budget_tokens, 24_576)
? (() => {
const budget = thinking.budget_tokens;
if (model.includes('-2.5-flash')) {
return Math.min(budget, 24_576);
} else if (model.includes('-2.5-pro')) {
return Math.max(128, Math.min(budget, 32_768));
}
return Math.min(budget, 24_576);
})()
: thinking?.type === 'disabled'
? 0
? model.includes('-2.5-pro') ? 128 : 0
: undefined,
};