From 6d1e58b13086d3b41741a83bd3bc5580d2436fa5 Mon Sep 17 00:00:00 2001 From: SuYao Date: Sat, 26 Jul 2025 16:15:31 +0800 Subject: [PATCH] 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 --- src/renderer/src/config/models.ts | 1 + .../pages/home/Inputbar/ThinkingButton.tsx | 19 +++++++++++++++++-- src/renderer/src/types/index.ts | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/config/models.ts b/src/renderer/src/config/models.ts index 76c002ce29..2dc074b860 100644 --- a/src/renderer/src/config/models.ts +++ b/src/renderer/src/config/models.ts @@ -2975,6 +2975,7 @@ export const THINKING_TOKEN_MAP: Record = '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 }, diff --git a/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx b/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx index d029d198e2..a23a34d27a 100644 --- a/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx +++ b/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx @@ -42,6 +42,7 @@ const MODEL_SUPPORTED_OPTIONS: Record = { 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 = ({ 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 = ({ 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(() => { diff --git a/src/renderer/src/types/index.ts b/src/renderer/src/types/index.ts index c2340e5b65..a9a5beb063 100644 --- a/src/renderer/src/types/index.ts +++ b/src/renderer/src/types/index.ts @@ -51,7 +51,7 @@ export type ReasoningEffortOptions = 'low' | 'medium' | 'high' | 'auto' export type EffortRatio = Record export const EFFORT_RATIO: EffortRatio = { - low: 0.2, + low: 0.05, medium: 0.5, high: 0.8, auto: 2