feat(web): Use number_limits for file uploading limit

Align with the current form definition in start node.

Co-Authored-By: GPT 5.4 <codex@openai.com>
This commit is contained in:
QuantumGhost 2026-04-27 07:12:21 +08:00
parent 74f17d0ec8
commit 9ad5d89b07
15 changed files with 18 additions and 18 deletions

View File

@ -147,7 +147,7 @@ describe('Human input share form', () => {
allowed_file_extensions: ['.pdf'],
allowed_file_types: [SupportUploadFileTypes.document],
allowed_file_upload_methods: [TransferMethod.local_file],
max_upload_count: 3,
number_limits: 3,
},
],
resolved_default_values: {},

View File

@ -168,7 +168,7 @@ describe('ContentItem', () => {
allowed_file_extensions: ['.pdf'],
allowed_file_types: ['document'],
allowed_file_upload_methods: ['local_file'],
max_upload_count: 4,
number_limits: 4,
} as FormInputItem,
]}
inputs={{ attachments: existingFiles }}

View File

@ -122,7 +122,7 @@ describe('HumanInputFieldRenderer', () => {
allowed_file_extensions: ['.pdf'],
allowed_file_types: [SupportUploadFileTypes.document],
allowed_file_upload_methods: [TransferMethod.local_file],
max_upload_count: 3,
number_limits: 3,
}}
value={[]}
onChange={onChange}

View File

@ -155,7 +155,7 @@ describe('HumanInputForm', () => {
allowed_file_extensions: ['.png'],
allowed_file_types: [SupportUploadFileTypes.image],
allowed_file_upload_methods: [TransferMethod.local_file],
max_upload_count: 5,
number_limits: 5,
},
] as FormInputItem[],
}
@ -202,7 +202,7 @@ describe('HumanInputForm', () => {
allowed_file_extensions: ['.png'],
allowed_file_types: [SupportUploadFileTypes.image],
allowed_file_upload_methods: [TransferMethod.local_file],
max_upload_count: 5,
number_limits: 5,
},
{
type: InputVarType.singleFile,

View File

@ -30,7 +30,7 @@ const fields: FormInputItem[] = [
allowed_file_extensions: [],
allowed_file_types: [],
allowed_file_upload_methods: [],
max_upload_count: 5,
number_limits: 5,
},
]

View File

@ -48,7 +48,7 @@ const fileListInput = (overrides: Partial<Extract<FormInputItem, { type: InputVa
allowed_file_extensions: [],
allowed_file_types: [SupportUploadFileTypes.image],
allowed_file_upload_methods: [TransferMethod.local_file],
max_upload_count: 5,
number_limits: 5,
...overrides,
})

View File

@ -100,7 +100,7 @@ const HumanInputFieldRenderer = ({
allowed_file_types: field.allowed_file_types,
allowed_file_extensions: field.allowed_file_extensions,
allowed_file_upload_methods: field.allowed_file_upload_methods,
number_limits: field.max_upload_count || 5,
number_limits: field.number_limits || 5,
}}
/>
)

View File

@ -156,7 +156,7 @@ describe('HITLInputComponentUI', () => {
allowed_file_extensions: ['.pdf'],
allowed_file_types: [SupportUploadFileTypes.document],
allowed_file_upload_methods: [TransferMethod.local_file],
max_upload_count: 4,
number_limits: 4,
} satisfies FormInputItem,
})

View File

@ -575,7 +575,7 @@ describe('InputField', () => {
allowed_file_extensions: ['.pdf'],
allowed_file_types: ['document'],
allowed_file_upload_methods: ['local_file'],
max_upload_count: 4,
number_limits: 4,
})
})

View File

@ -174,7 +174,7 @@ const InputField: React.FC<InputFieldProps> = ({
allowed_file_extensions: payload.allowed_file_extensions || [],
allowed_file_types: payload.allowed_file_types,
allowed_file_upload_methods: payload.allowed_file_upload_methods,
max_upload_count: payload.max_length,
number_limits: payload.number_limits ?? payload.max_length,
}
})
}, [])
@ -302,7 +302,7 @@ const InputField: React.FC<InputFieldProps> = ({
<FileUploadSetting
payload={{
...tempPayload,
max_length: tempPayload.max_upload_count || 5,
max_length: tempPayload.number_limits || 5,
}}
isMultiple
onChange={handleFileListPayloadChange}

View File

@ -505,7 +505,7 @@ describe('DSL Import with Human Input Node', () => {
inputs: [
{ type: 'paragraph', output_variable_name: 'review_result', default: { selector: [], type: 'constant' as const, value: '' } },
{ type: 'file', output_variable_name: 'attachment', allowed_file_extensions: [], allowed_file_types: [], allowed_file_upload_methods: [] },
{ type: 'file-list', output_variable_name: 'attachments', allowed_file_extensions: [], allowed_file_types: [], allowed_file_upload_methods: [], max_upload_count: 3 },
{ type: 'file-list', output_variable_name: 'attachments', allowed_file_extensions: [], allowed_file_types: [], allowed_file_upload_methods: [], number_limits: 3 },
{ type: 'select', output_variable_name: 'comment', option_source: { type: 'constant', selector: [], value: ['A', 'B'] } },
],
} as HumanInputNodeType

View File

@ -401,7 +401,7 @@ describe('human-input/panel', () => {
allowed_file_extensions: [],
allowed_file_types: [],
allowed_file_upload_methods: [],
max_upload_count: 3,
number_limits: 3,
},
],
}),

View File

@ -118,7 +118,7 @@ describe('SingleRunForm', () => {
allowed_file_extensions: ['.pdf'],
allowed_file_types: [SupportUploadFileTypes.document],
allowed_file_upload_methods: [TransferMethod.local_file],
max_upload_count: 3,
number_limits: 3,
},
],
actions: [

View File

@ -196,7 +196,7 @@ describe('human-input/hooks/use-single-run-form-params', () => {
allowed_file_extensions: ['.pdf'],
allowed_file_types: [SupportUploadFileTypes.document],
allowed_file_upload_methods: [TransferMethod.local_file, TransferMethod.remote_url],
max_upload_count: 3,
number_limits: 3,
},
],
} satisfies HumanInputFormData

View File

@ -104,7 +104,7 @@ export type FileFormInput = BaseFormInputItem & SharedFileFormInput & {
export type FileListFormInput = BaseFormInputItem & SharedFileFormInput & {
type: InputVarType.multiFiles
max_upload_count?: number
number_limits?: UploadFileSetting['number_limits']
}
export type FormInputItem
@ -191,7 +191,7 @@ export const createDefaultFileListFormInput = (
allowed_file_extensions: [],
allowed_file_types: [SupportUploadFileTypes.image],
allowed_file_upload_methods: [TransferMethod.local_file, TransferMethod.remote_url],
max_upload_count: 5,
number_limits: 5,
})
export const createDefaultFormInputByType = (