fix: tool params not work as expected when develop a tool (#6550)

This commit is contained in:
非法操作
2024-07-23 17:00:39 +08:00
committed by GitHub
parent 1690788827
commit c0ada940bd
4 changed files with 88 additions and 23 deletions

View File

@@ -48,6 +48,8 @@ const InputVarList: FC<Props> = ({
return 'Number'
else if (type === FormTypeEnum.files)
return 'Files'
else if (type === FormTypeEnum.select)
return 'Options'
else
return 'String'
}
@@ -114,17 +116,19 @@ const InputVarList: FC<Props> = ({
return (
<div className='space-y-3'>
{
schema.map(({
variable,
label,
type,
required,
tooltip,
}, index) => {
schema.map((schema, index) => {
const {
variable,
label,
type,
required,
tooltip,
} = schema
const varInput = value[variable]
const isNumber = type === FormTypeEnum.textNumber
const isSelect = type === FormTypeEnum.select
const isFile = type === FormTypeEnum.files
const isString = type !== FormTypeEnum.textNumber && type !== FormTypeEnum.files
const isString = type !== FormTypeEnum.textNumber && type !== FormTypeEnum.files && type !== FormTypeEnum.select
return (
<div key={variable} className='space-y-1'>
<div className='flex items-center h-[18px] space-x-2'>
@@ -145,7 +149,7 @@ const InputVarList: FC<Props> = ({
placeholderClassName='!leading-[21px]'
/>
)}
{isNumber && (
{(isNumber || isSelect) && (
<VarReferencePicker
readonly={readOnly}
isShowNodeName
@@ -155,7 +159,9 @@ const InputVarList: FC<Props> = ({
onOpen={handleOpen(index)}
isSupportConstantValue={isSupportConstantValue}
defaultVarKindType={varInput?.type}
filterVar={filterVar}
filterVar={isNumber ? filterVar : undefined}
availableVars={isSelect ? availableVars : undefined}
schema={schema}
/>
)}
{isFile && (