fix(web): optimize the pop logic of the tool selector (#21558)

- Adjust the display logic of the tool selector to ensure that the popover is not affected by collapse
- Improve the definition of tool value types to make the tool description field optional
pull/21559/head
zhujiruo 11 months ago
parent cefb8e4218
commit 5dd062160f

@ -117,6 +117,7 @@ const MultipleToolSelector = ({
)} )}
{!disabled && ( {!disabled && (
<ActionButton className='mx-1' onClick={() => { <ActionButton className='mx-1' onClick={() => {
setCollapse(false)
setOpen(!open) setOpen(!open)
setPanelShowState(true) setPanelShowState(true)
}}> }}>
@ -126,23 +127,6 @@ const MultipleToolSelector = ({
</div> </div>
{!collapse && ( {!collapse && (
<> <>
<ToolSelector
nodeId={nodeId}
nodeOutputVars={nodeOutputVars}
availableNodes={availableNodes}
scope={scope}
value={undefined}
selectedTools={value}
onSelect={handleAdd}
controlledState={open}
onControlledStateChange={setOpen}
trigger={
<div className=''></div>
}
panelShowState={panelShowState}
onPanelShowStateChange={setPanelShowState}
isEdit={false}
/>
{value.length === 0 && ( {value.length === 0 && (
<div className='system-xs-regular flex justify-center rounded-[10px] bg-background-section p-3 text-text-tertiary'>{t('plugin.detailPanel.toolSelector.empty')}</div> <div className='system-xs-regular flex justify-center rounded-[10px] bg-background-section p-3 text-text-tertiary'>{t('plugin.detailPanel.toolSelector.empty')}</div>
)} )}
@ -164,6 +148,23 @@ const MultipleToolSelector = ({
))} ))}
</> </>
)} )}
<ToolSelector
nodeId={nodeId}
nodeOutputVars={nodeOutputVars}
availableNodes={availableNodes}
scope={scope}
value={undefined}
selectedTools={value}
onSelect={handleAdd}
controlledState={open}
onControlledStateChange={setOpen}
trigger={
<div className=''></div>
}
panelShowState={panelShowState}
onPanelShowStateChange={setPanelShowState}
isEdit={false}
/>
</> </>
) )
} }

@ -36,7 +36,7 @@ export type ToolValue = {
provider_name: string provider_name: string
tool_name: string tool_name: string
tool_label: string tool_label: string
tool_description: string tool_description?: string
settings?: Record<string, any> settings?: Record<string, any>
parameters?: Record<string, any> parameters?: Record<string, any>
enabled?: boolean enabled?: boolean

Loading…
Cancel
Save