From faed304196a6140ec6d5d50ea59847b05545a0da Mon Sep 17 00:00:00 2001 From: suyao Date: Wed, 18 Mar 2026 02:09:20 +0800 Subject: [PATCH 1/2] fix(agents): show reasoning effort button for agent session reasoning models InputbarTools used useAssistant(assistantId) to resolve the model, but agent session IDs don't exist in the Redux assistants store. This caused the model to fall back to the global defaultModel, which is typically not a reasoning model, so the thinking tool's condition check (isReasoningModel) failed and the button was filtered out. Fix by passing assistant and model as props from the caller, which already has the correct data, instead of having InputbarTools fetch internally via useAssistant. Co-Authored-By: Claude Opus 4.6 Signed-off-by: suyao --- .../src/pages/agents/components/AgentSessionInputbar.tsx | 6 ++++-- src/renderer/src/pages/home/Inputbar/Inputbar.tsx | 2 +- src/renderer/src/pages/home/Inputbar/InputbarTools.tsx | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx b/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx index d5de6457338..de119af0a32 100644 --- a/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx +++ b/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx @@ -480,10 +480,12 @@ const AgentSessionInputbarInner: FC = ({ assistant, agentId, session const leftToolbar = useMemo( () => ( - {config.showTools && } + {config.showTools && ( + + )} ), - [config.showTools, scope, assistant.id, toolsSession] + [config.showTools, scope, assistant, toolsSession] ) const placeholderText = useMemo( () => diff --git a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx index cc88b4b32cc..f962c2f49ad 100644 --- a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx @@ -478,7 +478,7 @@ const InputbarInner: FC = ({ assistant: initialAssistant, se ) // leftToolbar: 左侧工具栏 - const leftToolbar = config.showTools ? : null + const leftToolbar = config.showTools ? : null // rightToolbar: 右侧工具栏 const rightToolbar = ( diff --git a/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx b/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx index 734289f65e0..0c3be732be2 100644 --- a/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx +++ b/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx @@ -5,7 +5,6 @@ import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd' import { ActionIconButton } from '@renderer/components/Buttons' import type { QuickPanelListItem, QuickPanelReservedSymbol } from '@renderer/components/QuickPanel' import { useQuickPanel } from '@renderer/components/QuickPanel' -import { useAssistant } from '@renderer/hooks/useAssistant' import { useInputbarTools } from '@renderer/pages/home/Inputbar/context/InputbarToolsProvider' import type { InputbarScope, @@ -22,6 +21,7 @@ import type { import { getToolsForScope } from '@renderer/pages/home/Inputbar/types' import { useAppDispatch, useAppSelector } from '@renderer/store' import { selectToolOrderForScope, setIsCollapsed, setToolOrder } from '@renderer/store/inputTools' +import type { Assistant, Model } from '@renderer/types' import type { InputBarToolType } from '@renderer/types/chat' import { classNames } from '@renderer/utils' import { Divider, Dropdown } from 'antd' @@ -34,7 +34,8 @@ import styled from 'styled-components' export interface InputbarToolsNewProps { scope: InputbarScope - assistantId: string + assistant: Assistant + model: Model session?: ToolContext['session'] } @@ -49,10 +50,9 @@ const DraggablePortal = ({ children, isDragging }: { children: React.ReactNode; return isDragging ? createPortal(children, document.body) : children } -const InputbarTools = ({ scope, assistantId, session }: InputbarToolsNewProps) => { +const InputbarTools = ({ scope, assistant, model, session }: InputbarToolsNewProps) => { const { t } = useTranslation() const dispatch = useAppDispatch() - const { assistant, model } = useAssistant(assistantId) const toolsContext = useInputbarTools() const quickPanelContext = useQuickPanel() const quickPanelApiCacheRef = useRef(new Map()) From afa62e14122b3e0e65b8ba0be5acb75d603732f6 Mon Sep 17 00:00:00 2001 From: cherryai002 Date: Wed, 18 Mar 2026 12:39:58 +0800 Subject: [PATCH 2/2] fix(agents): avoid non-null assertion for inputbar model --- .../src/pages/agents/components/AgentSessionInputbar.tsx | 2 +- src/renderer/src/pages/home/Inputbar/InputbarTools.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx b/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx index de119af0a32..f0fda6c6ec0 100644 --- a/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx +++ b/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx @@ -481,7 +481,7 @@ const AgentSessionInputbarInner: FC = ({ assistant, agentId, session () => ( {config.showTools && ( - + )} ), diff --git a/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx b/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx index 0c3be732be2..a2b2754a3be 100644 --- a/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx +++ b/src/renderer/src/pages/home/Inputbar/InputbarTools.tsx @@ -35,7 +35,7 @@ import styled from 'styled-components' export interface InputbarToolsNewProps { scope: InputbarScope assistant: Assistant - model: Model + model?: Model session?: ToolContext['session'] } @@ -50,9 +50,10 @@ const DraggablePortal = ({ children, isDragging }: { children: React.ReactNode; return isDragging ? createPortal(children, document.body) : children } -const InputbarTools = ({ scope, assistant, model, session }: InputbarToolsNewProps) => { +const InputbarTools = ({ scope, assistant, model: modelOverride, session }: InputbarToolsNewProps) => { const { t } = useTranslation() const dispatch = useAppDispatch() + const model = modelOverride ?? assistant.model const toolsContext = useInputbarTools() const quickPanelContext = useQuickPanel() const quickPanelApiCacheRef = useRef(new Map())