From 5faa4f95209fe4579026a49257e10a059ccefdc4 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Wed, 22 Apr 2026 07:35:04 +0800 Subject: [PATCH] Define detailed human input field types --- .../workflow/nodes/human-input/types.ts | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/web/app/components/workflow/nodes/human-input/types.ts b/web/app/components/workflow/nodes/human-input/types.ts index 87c4b69ff6..87e6d718ba 100644 --- a/web/app/components/workflow/nodes/human-input/types.ts +++ b/web/app/components/workflow/nodes/human-input/types.ts @@ -1,5 +1,6 @@ import type { CommonNodeType, + UploadFileSetting, ValueSelector, } from '@/app/components/workflow/types' import { InputVarType } from '@/app/components/workflow/types' @@ -59,31 +60,47 @@ export type UserAction = { button_style: UserActionButtonType } -export type FormInputItemDefault = { +export type StringDefault = { selector: ValueSelector type: 'variable' | 'constant' value: string } +export type StringListSource = { + selector: ValueSelector + type: 'variable' | 'constant' + value: string[] +} + +// Preserve the old export during the transition to the new schema names. +export type FormInputItemDefault = StringDefault + type BaseFormInputItem = { output_variable_name: string } export type ParagraphFormInput = BaseFormInputItem & { type: InputVarType.paragraph - default: FormInputItemDefault + default: StringDefault } export type SelectFormInput = BaseFormInputItem & { type: InputVarType.select + option_source: StringListSource } -export type FileFormInput = BaseFormInputItem & { +type SharedFileFormInput = Pick< + UploadFileSetting, + 'allowed_file_extensions' | 'allowed_file_types' | 'allowed_file_upload_methods' +> + +export type FileFormInput = BaseFormInputItem & SharedFileFormInput & { type: InputVarType.singleFile } -export type FileListFormInput = BaseFormInputItem & { +export type FileListFormInput = BaseFormInputItem & SharedFileFormInput & { type: InputVarType.multiFiles + max_upload_count?: number } export type FormInputItem