mirror of
https://github.com/langgenius/dify.git
synced 2026-05-09 21:28:25 +08:00
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:
parent
74f17d0ec8
commit
9ad5d89b07
@ -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: {},
|
||||
|
||||
@ -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 }}
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -30,7 +30,7 @@ const fields: FormInputItem[] = [
|
||||
allowed_file_extensions: [],
|
||||
allowed_file_types: [],
|
||||
allowed_file_upload_methods: [],
|
||||
max_upload_count: 5,
|
||||
number_limits: 5,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
|
||||
@ -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,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
|
||||
@ -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,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
@ -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: [
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 = (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user