support extra for tool selector

This commit is contained in:
JzoNg 2024-12-26 17:58:34 +08:00
parent 10218cfe8d
commit bfecc73de9
1 changed files with 7 additions and 4 deletions

View File

@ -41,8 +41,8 @@ type Props = {
value?: {
provider: string
tool_name: string
description?: string
parameters?: Record<string, any>
extra?: Record<string, any>
}
disabled?: boolean
placement?: Placement
@ -50,8 +50,8 @@ type Props = {
onSelect: (tool: {
provider: string
tool_name: string
description?: string
parameters?: Record<string, any>
extra?: Record<string, any>
}) => void
supportAddCustomTool?: boolean
scope?: string
@ -101,7 +101,10 @@ const ToolSelector: FC<Props> = ({
const handleDescriptionChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
onSelect({
...value,
description: e.target.value || '',
extra: {
...value?.extra,
description: e.target.value || '',
},
} as any)
}
@ -186,7 +189,7 @@ const ToolSelector: FC<Props> = ({
<Textarea
className='resize-none'
placeholder={t('plugin.detailPanel.toolSelector.descriptionPlaceholder')}
value={value?.description || ''}
value={value?.extra?.description || ''}
onChange={handleDescriptionChange}
/>
</div>