From dfbfc2869cd2cbbb450fb12da93171716a1fb1f0 Mon Sep 17 00:00:00 2001 From: defi-failure <159208748+defi-failure@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:32:04 +0800 Subject: [PATCH] fix: use session model when sending messages (#11028) --- .../src/pages/home/Inputbar/AgentSessionInputbar.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx b/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx index 57497b6044..153f921d54 100644 --- a/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx @@ -2,7 +2,6 @@ import { Tooltip } from '@heroui/react' import { loggerService } from '@logger' import { ActionIconButton } from '@renderer/components/Buttons' import { QuickPanelView } from '@renderer/components/QuickPanel' -import { useAgent } from '@renderer/hooks/agents/useAgent' import { useCreateDefaultSession } from '@renderer/hooks/agents/useCreateDefaultSession' import { useSession } from '@renderer/hooks/agents/useSession' import { selectNewTopicLoading } from '@renderer/hooks/useMessageOperations' @@ -46,7 +45,6 @@ const AgentSessionInputbar: FC = ({ agentId, sessionId }) => { const [text, setText] = useState(_text) const [inputFocus, setInputFocus] = useState(false) const { session } = useSession(agentId, sessionId) - const { agent } = useAgent(agentId) const { apiServer } = useSettings() const { createDefaultSession, creatingSession } = useCreateDefaultSession(agentId) const newTopicShortcut = useShortcutDisplay('new_topic') @@ -184,7 +182,7 @@ const AgentSessionInputbar: FC = ({ agentId, sessionId }) => { const userMessageBlocks: MessageBlock[] = [mainBlock] // Extract the actual model ID from session.model (format: "provider:modelId") - const [providerId, actualModelId] = agent?.model.split(':') ?? [undefined, undefined] + const [providerId, actualModelId] = session?.model?.split(':') ?? [undefined, undefined] // Try to find the actual model from providers const actualModel = actualModelId ? getModel(actualModelId, providerId) : undefined @@ -230,7 +228,7 @@ const AgentSessionInputbar: FC = ({ agentId, sessionId }) => { logger.warn('Failed to send message:', error as Error) } }, [ - agent?.model, + session?.model, agentId, dispatch, sendDisabled,