diff --git a/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx b/src/renderer/src/pages/agents/components/AgentSessionInputbar.tsx index d5de6457338..f0fda6c6ec0 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..a2b2754a3be 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,10 @@ 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: modelOverride, session }: InputbarToolsNewProps) => { const { t } = useTranslation() const dispatch = useAppDispatch() - const { assistant, model } = useAssistant(assistantId) + const model = modelOverride ?? assistant.model const toolsContext = useInputbarTools() const quickPanelContext = useQuickPanel() const quickPanelApiCacheRef = useRef(new Map())