mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-04 11:49:02 +08:00
fix: set thinking budget to 0 for gemini-2.5-flash when reasoning effort is off (#6917)
This commit is contained in:
parent
9ba2dea148
commit
7f12c2f8b8
@ -2631,7 +2631,8 @@ export function groupQwenModels(models: Model[]): Record<string, Model[]> {
|
|||||||
|
|
||||||
export const THINKING_TOKEN_MAP: Record<string, { min: number; max: number }> = {
|
export const THINKING_TOKEN_MAP: Record<string, { min: number; max: number }> = {
|
||||||
// Gemini models
|
// Gemini models
|
||||||
'gemini-.*$': { min: 0, max: 24576 },
|
'gemini-.*-flash.*$': { min: 0, max: 24576 },
|
||||||
|
'gemini-.*-pro.*$': { min: 128, max: 32768 },
|
||||||
|
|
||||||
// Qwen models
|
// Qwen models
|
||||||
'qwen-plus-.*$': { min: 0, max: 38912 },
|
'qwen-plus-.*$': { min: 0, max: 38912 },
|
||||||
|
|||||||
@ -286,12 +286,14 @@ export default class GeminiProvider extends BaseProvider {
|
|||||||
private getBudgetToken(assistant: Assistant, model: Model) {
|
private getBudgetToken(assistant: Assistant, model: Model) {
|
||||||
if (isGeminiReasoningModel(model)) {
|
if (isGeminiReasoningModel(model)) {
|
||||||
const reasoningEffort = assistant?.settings?.reasoning_effort
|
const reasoningEffort = assistant?.settings?.reasoning_effort
|
||||||
|
const GEMINI_FLASH_MODEL_REGEX = new RegExp('gemini-.*-flash.*$')
|
||||||
|
|
||||||
// 如果thinking_budget是undefined,不思考
|
// 如果thinking_budget是undefined,不思考
|
||||||
if (reasoningEffort === undefined) {
|
if (reasoningEffort === undefined) {
|
||||||
return {
|
return {
|
||||||
thinkingConfig: {
|
thinkingConfig: {
|
||||||
includeThoughts: false
|
includeThoughts: false,
|
||||||
|
...(GEMINI_FLASH_MODEL_REGEX.test(model.id) ? { thinkingBudget: 0 } : {})
|
||||||
} as ThinkingConfig
|
} as ThinkingConfig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user