Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,12 @@ const AgentSessionInputbarInner: FC<InnerProps> = ({ assistant, agentId, session
const leftToolbar = useMemo(
() => (
<ToolbarGroup>
{config.showTools && <InputbarTools scope={scope} assistantId={assistant.id} session={toolsSession} />}
{config.showTools && (
<InputbarTools scope={scope} assistant={assistant} model={assistant.model!} session={toolsSession} />
)}
</ToolbarGroup>
),
[config.showTools, scope, assistant.id, toolsSession]
[config.showTools, scope, assistant, toolsSession]
)
const placeholderText = useMemo(
() =>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/pages/home/Inputbar/Inputbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ const InputbarInner: FC<InputbarInnerProps> = ({ assistant: initialAssistant, se
)

// leftToolbar: 左侧工具栏
const leftToolbar = config.showTools ? <InputbarTools scope={scope} assistantId={assistant.id} /> : null
const leftToolbar = config.showTools ? <InputbarTools scope={scope} assistant={assistant} model={model} /> : null

// rightToolbar: 右侧工具栏
const rightToolbar = (
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/src/pages/home/Inputbar/InputbarTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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'
Expand All @@ -34,7 +34,8 @@ import styled from 'styled-components'

export interface InputbarToolsNewProps {
scope: InputbarScope
assistantId: string
assistant: Assistant
model: Model
session?: ToolContext['session']
}

Expand All @@ -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<string, ToolQuickPanelApi>())
Expand Down
Loading