tool setting schema

This commit is contained in:
JzoNg 2025-01-02 08:43:09 +08:00
parent 91ac660f81
commit 4663af8a60
2 changed files with 3 additions and 3 deletions

View File

@ -107,7 +107,7 @@ const ToolSelector: FC<Props> = ({
const [isShowChooseTool, setIsShowChooseTool] = useState(false)
const handleSelectTool = (tool: ToolDefaultValue) => {
const paramValues = addDefaultValue(tool.params, toolParametersToFormSchemas(tool.paramSchemas as any))
const paramValues = addDefaultValue(tool.params, toolParametersToFormSchemas(tool.paramSchemas.filter(param => param.form !== 'llm') as any))
const toolValue = {
provider_name: tool.provider_id,
tool_name: tool.tool_name,
@ -133,7 +133,7 @@ const ToolSelector: FC<Props> = ({
const currentToolParams = useMemo(() => {
if (!currentProvider) return []
return currentProvider.tools.find(tool => tool.name === value?.tool_name)?.parameters || []
return currentProvider.tools.find(tool => tool.name === value?.tool_name)?.parameters.filter(param => param.form !== 'llm') || []
}, [currentProvider, value])
const formSchemas = useMemo(() => toolParametersToFormSchemas(currentToolParams), [currentToolParams])

View File

@ -27,6 +27,6 @@ export type ToolDefaultValue = {
title: string
is_team_authorization: boolean
params: Record<string, any>
paramSchemas: Record<string, any>
paramSchemas: Record<string, any>[]
output_schema: Record<string, any>
}