Fix: Add folder upload #9743 (#13448)

### What problem does this PR solve?

Fix: Add folder upload  #9743

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2026-03-06 20:17:29 +08:00
committed by GitHub
parent 82a616589b
commit ae4645e01b
4 changed files with 155 additions and 67 deletions

View File

@@ -20,8 +20,16 @@ import { Switch } from '../ui/switch';
function buildUploadFormSchema(t: TFunction) {
const FormSchema = z.object({
parseOnCreation: z.boolean().optional(),
// Update schema to allow files with path property to handle folder uploads
fileList: z
.array(z.instanceof(File))
.array(
z.instanceof(File).or(
z.object({
file: z.instanceof(File),
path: z.string(), // Store the relative path for files in folders
}),
),
)
.min(1, { message: t('fileManager.pleaseUploadAtLeastOneFile') }),
});
@@ -72,7 +80,7 @@ function UploadForm({ submit, showParseOnCreation }: UploadFormProps) {
)}
</RAGFlowFormItem>
)}
<RAGFlowFormItem name="fileList" label={t('fileManager.file')}>
<RAGFlowFormItem name="fileList" label={''}>
{(field) => (
<FileUploader
value={field.value}