feat(models): add support for new Qwen model and update effort ratio (#8537)

* feat(models): add support for new Qwen model and update effort ratio

- Introduced support for the 'qwen3-235b-a22b-thinking' model with a max token limit of 81,920.
- Updated the model options in ThinkingButton to include 'qwen_3235ba22b_thinking'.
- Adjusted the effort ratio for 'low' from 0.2 to 0.05 for improved performance.

* chore: remove
This commit is contained in:
SuYao 2025-07-26 16:15:31 +08:00 committed by GitHub
parent e7ad3e6935
commit 6d1e58b130
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 3 deletions

View File

@ -2975,6 +2975,7 @@ export const THINKING_TOKEN_MAP: Record<string, { min: number; max: number }> =
'gemini-.*-pro.*$': { min: 128, max: 32768 },
// Qwen models
'qwen3-235b-a22b-thinking(?:-[\\w-]+)$': { min: 0, max: 81_920 },
'qwen-plus-.*$': { min: 0, max: 38912 },
'qwen-turbo-.*$': { min: 0, max: 38912 },
'qwen3-0\\.6b$': { min: 0, max: 30720 },

View File

@ -42,6 +42,7 @@ const MODEL_SUPPORTED_OPTIONS: Record<string, ThinkingOption[]> = {
gemini: ['off', 'low', 'medium', 'high', 'auto'],
gemini_pro: ['low', 'medium', 'high', 'auto'],
qwen: ['off', 'low', 'medium', 'high'],
qwen_3235ba22b_thinking: ['low', 'medium', 'high'],
doubao: ['off', 'auto', 'high'],
hunyuan: ['off', 'auto']
}
@ -64,6 +65,7 @@ const ThinkingButton: FC<Props> = ({ ref, model, assistant, ToolbarButton }): Re
const isGeminiModel = isSupportedThinkingTokenGeminiModel(model)
const isGeminiFlashModel = GEMINI_FLASH_MODEL_REGEX.test(model.id)
const isQwenModel = isSupportedThinkingTokenQwenModel(model)
const isQwen3235BA22BThinkingModel = model.id.includes('qwen3-235b-a22b-thinking')
const isDoubaoModel = isSupportedThinkingTokenDoubaoModel(model)
const isHunyuanModel = isSupportedThinkingTokenHunyuanModel(model)
@ -81,11 +83,24 @@ const ThinkingButton: FC<Props> = ({ ref, model, assistant, ToolbarButton }): Re
}
}
if (isGrokModel) return 'grok'
if (isQwenModel) return 'qwen'
if (isQwenModel) {
if (isQwen3235BA22BThinkingModel) {
return 'qwen_3235ba22b_thinking'
}
return 'qwen'
}
if (isDoubaoModel) return 'doubao'
if (isHunyuanModel) return 'hunyuan'
return 'default'
}, [isGeminiModel, isGrokModel, isQwenModel, isDoubaoModel, isGeminiFlashModel, isHunyuanModel])
}, [
isGeminiModel,
isGrokModel,
isQwenModel,
isDoubaoModel,
isHunyuanModel,
isGeminiFlashModel,
isQwen3235BA22BThinkingModel
])
// 获取当前模型支持的选项
const supportedOptions = useMemo(() => {

View File

@ -51,7 +51,7 @@ export type ReasoningEffortOptions = 'low' | 'medium' | 'high' | 'auto'
export type EffortRatio = Record<ReasoningEffortOptions, number>
export const EFFORT_RATIO: EffortRatio = {
low: 0.2,
low: 0.05,
medium: 0.5,
high: 0.8,
auto: 2