From 7436b34a961b6a41de043957a44a4fe0823725c9 Mon Sep 17 00:00:00 2001 From: SuYao Date: Wed, 30 Jul 2025 00:18:21 +0800 Subject: [PATCH] feat: add support for Qwen 3-235B-A22B thinking model detection (#8641) - Introduced a new function to check if a model is the Qwen 3-235B-A22B thinking model. - Updated the ThinkingButton component to utilize the new detection function for improved model handling. --- src/renderer/src/config/models.ts | 8 ++++++++ src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/config/models.ts b/src/renderer/src/config/models.ts index f43049f806..7c14ee4b2c 100644 --- a/src/renderer/src/config/models.ts +++ b/src/renderer/src/config/models.ts @@ -2704,6 +2704,14 @@ export function isSupportedThinkingTokenQwenModel(model?: Model): boolean { ) } +export function isQwen3235BA22BThinkingModel(model?: Model): boolean { + if (!model) { + return false + } + const baseName = getLowerBaseModelName(model.id, '/') + return baseName.includes('qwen3-235b-a22b-thinking') +} + export function isSupportedThinkingTokenDoubaoModel(model?: Model): boolean { if (!model) { return false diff --git a/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx b/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx index 1d59b20797..a558f8e07f 100644 --- a/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx +++ b/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx @@ -9,6 +9,7 @@ import { useQuickPanel } from '@renderer/components/QuickPanel' import { GEMINI_FLASH_MODEL_REGEX, isDoubaoThinkingAutoModel, + isQwen3235BA22BThinkingModel, isSupportedReasoningEffortGrokModel, isSupportedReasoningEffortPerplexityModel, isSupportedThinkingTokenDoubaoModel, @@ -69,7 +70,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 isQwen3235BA22BThinking = isQwen3235BA22BThinkingModel(model) const isDoubaoModel = isSupportedThinkingTokenDoubaoModel(model) const isHunyuanModel = isSupportedThinkingTokenHunyuanModel(model) const isPerplexityModel = isSupportedReasoningEffortPerplexityModel(model) @@ -90,7 +91,7 @@ const ThinkingButton: FC = ({ ref, model, assistant, ToolbarButton }): Re } if (isGrokModel) return 'grok' if (isQwenModel) { - if (isQwen3235BA22BThinkingModel) { + if (isQwen3235BA22BThinking) { return 'qwen_3235ba22b_thinking' } return 'qwen' @@ -108,7 +109,7 @@ const ThinkingButton: FC = ({ ref, model, assistant, ToolbarButton }): Re isGeminiFlashModel, isHunyuanModel, isPerplexityModel, - isQwen3235BA22BThinkingModel, + isQwen3235BA22BThinking, isZhipuModel ])