feat: tool support file type

This commit is contained in:
Joel 2024-08-09 11:38:40 +08:00
parent bc5f109308
commit 3c4ab0632d
2 changed files with 15 additions and 1 deletions

View File

@ -14,6 +14,7 @@ export enum FormTypeEnum {
radio = 'radio', radio = 'radio',
boolean = 'boolean', boolean = 'boolean',
files = 'files', files = 'files',
file = 'file',
} }
export type FormOption = { export type FormOption = {

View File

@ -127,7 +127,8 @@ const InputVarList: FC<Props> = ({
const varInput = value[variable] const varInput = value[variable]
const isNumber = type === FormTypeEnum.textNumber const isNumber = type === FormTypeEnum.textNumber
const isSelect = type === FormTypeEnum.select const isSelect = type === FormTypeEnum.select
const isFile = type === FormTypeEnum.files const isFile = type === FormTypeEnum.file
const isFileArray = type === FormTypeEnum.files
const isString = type !== FormTypeEnum.textNumber && type !== FormTypeEnum.files && type !== FormTypeEnum.select const isString = type !== FormTypeEnum.textNumber && type !== FormTypeEnum.files && type !== FormTypeEnum.select
return ( return (
<div key={variable} className='space-y-1'> <div key={variable} className='space-y-1'>
@ -165,6 +166,18 @@ const InputVarList: FC<Props> = ({
/> />
)} )}
{isFile && ( {isFile && (
<VarReferencePicker
readonly={readOnly}
isShowNodeName
nodeId={nodeId}
value={varInput?.type === VarKindType.constant ? (varInput?.value || '') : (varInput?.value || [])}
onChange={handleNotMixedTypeChange(variable)}
onOpen={handleOpen(index)}
defaultVarKindType={VarKindType.variable}
filterVar={(varPayload: Var) => varPayload.type === VarType.file}
/>
)}
{isFileArray && (
<VarReferencePicker <VarReferencePicker
readonly={readOnly} readonly={readOnly}
isShowNodeName isShowNodeName