feat(tool-form): add extraParams prop to ToolForm and ToolFormItem components

- Introduced extraParams prop to both ToolForm and ToolFormItem components for enhanced flexibility in passing additional parameters.
- Updated component usage to accommodate the new prop, improving the overall functionality of the tool forms.
This commit is contained in:
Harry 2025-09-02 20:33:40 +08:00
parent 4b253e1f73
commit 5e5ffaa416
2 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,7 @@ type Props = {
inPanel?: boolean inPanel?: boolean
currentTool?: Tool currentTool?: Tool
currentProvider?: ToolWithProvider currentProvider?: ToolWithProvider
extraParams?: Record<string, any>
} }
const ToolForm: FC<Props> = ({ const ToolForm: FC<Props> = ({
@ -27,6 +28,7 @@ const ToolForm: FC<Props> = ({
inPanel, inPanel,
currentTool, currentTool,
currentProvider, currentProvider,
extraParams,
}) => { }) => {
return ( return (
<div className='space-y-1'> <div className='space-y-1'>
@ -42,6 +44,7 @@ const ToolForm: FC<Props> = ({
inPanel={inPanel} inPanel={inPanel}
currentTool={currentTool} currentTool={currentTool}
currentProvider={currentProvider} currentProvider={currentProvider}
extraParams={extraParams}
/> />
)) ))
} }

View File

@ -24,6 +24,7 @@ type Props = {
inPanel?: boolean inPanel?: boolean
currentTool?: Tool currentTool?: Tool
currentProvider?: ToolWithProvider currentProvider?: ToolWithProvider
extraParams?: Record<string, any>
} }
const ToolFormItem: FC<Props> = ({ const ToolFormItem: FC<Props> = ({
@ -35,6 +36,7 @@ const ToolFormItem: FC<Props> = ({
inPanel, inPanel,
currentTool, currentTool,
currentProvider, currentProvider,
extraParams,
}) => { }) => {
const language = useLanguage() const language = useLanguage()
const { name, label, type, required, tooltip, input_schema } = schema const { name, label, type, required, tooltip, input_schema } = schema
@ -89,6 +91,7 @@ const ToolFormItem: FC<Props> = ({
inPanel={inPanel} inPanel={inPanel}
currentTool={currentTool} currentTool={currentTool}
currentProvider={currentProvider} currentProvider={currentProvider}
extraParams={extraParams}
/> />
{isShowSchema && ( {isShowSchema && (