From ddbf710727a36f234319b0f7666badf7232d589e Mon Sep 17 00:00:00 2001 From: Pleasure1234 <3196812536@qq.com> Date: Wed, 6 Aug 2025 20:54:35 +0800 Subject: [PATCH] feat: add toggle to disable thinking mode in ThinkingButton (#8856) Introduces logic to allow users to disable thinking mode directly from the ThinkingButton if supported. Tooltip text now reflects the action to close when thinking is enabled and 'off' is available. --- .../pages/home/Inputbar/ThinkingButton.tsx | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx b/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx index a558f8e07f..2c2f545f9b 100644 --- a/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx +++ b/src/renderer/src/pages/home/Inputbar/ThinkingButton.tsx @@ -188,6 +188,12 @@ const ThinkingButton: FC = ({ ref, model, assistant, ToolbarButton }): Re })) }, [createThinkingIcon, currentReasoningEffort, supportedOptions, onThinkingChange]) + const isThinkingEnabled = currentReasoningEffort !== undefined && currentReasoningEffort !== 'off' + + const disableThinking = useCallback(() => { + onThinkingChange('off') + }, [onThinkingChange]) + const openQuickPanel = useCallback(() => { quickPanel.open({ title: t('assistants.settings.reasoning_effort.label'), @@ -199,10 +205,15 @@ const ThinkingButton: FC = ({ ref, model, assistant, ToolbarButton }): Re const handleOpenQuickPanel = useCallback(() => { if (quickPanel.isVisible && quickPanel.symbol === 'thinking') { quickPanel.close() - } else { - openQuickPanel() + return } - }, [openQuickPanel, quickPanel]) + + if (isThinkingEnabled && supportedOptions.includes('off')) { + disableThinking() + return + } + openQuickPanel() + }, [openQuickPanel, quickPanel, isThinkingEnabled, supportedOptions, disableThinking]) // 获取当前应显示的图标 const getThinkingIcon = useCallback(() => { @@ -219,7 +230,15 @@ const ThinkingButton: FC = ({ ref, model, assistant, ToolbarButton }): Re })) return ( - + {getThinkingIcon()}