mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-07 02:55:08 +08:00
Fix: ingestion pipeline (#13012)
### What problem does this PR solve? Fix ingestion pipeline Only 1 file is acceptable for ingestion pipeline. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -42,7 +42,7 @@ class File(ProcessBase):
|
|||||||
#self.set_output("blob", STORAGE_IMPL.get(b, n))
|
#self.set_output("blob", STORAGE_IMPL.get(b, n))
|
||||||
self.set_output("name", doc.name)
|
self.set_output("name", doc.name)
|
||||||
else:
|
else:
|
||||||
file = kwargs.get("file")
|
file = kwargs.get("file")[0]
|
||||||
self.set_output("name", file["name"])
|
self.set_output("name", file["name"])
|
||||||
self.set_output("file", file)
|
self.set_output("file", file)
|
||||||
#self.set_output("blob", FileService.get_blob(file["created_by"], file["id"]))
|
#self.set_output("blob", FileService.get_blob(file["created_by"], file["id"]))
|
||||||
|
|||||||
@ -21,11 +21,13 @@ import { toast } from 'sonner';
|
|||||||
type FileUploadDirectUploadProps = {
|
type FileUploadDirectUploadProps = {
|
||||||
value: Record<string, any> | Record<string, any>[];
|
value: Record<string, any> | Record<string, any>[];
|
||||||
onChange(value: Record<string, any>[]): void;
|
onChange(value: Record<string, any>[]): void;
|
||||||
|
maxFiles?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function FileUploadDirectUpload({
|
export function FileUploadDirectUpload({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
|
maxFiles,
|
||||||
}: FileUploadDirectUploadProps) {
|
}: FileUploadDirectUploadProps) {
|
||||||
const [files, setFiles] = React.useState<File[]>([]);
|
const [files, setFiles] = React.useState<File[]>([]);
|
||||||
const uploadedFilesRef = React.useRef<Record<string, any>[]>(
|
const uploadedFilesRef = React.useRef<Record<string, any>[]>(
|
||||||
@ -99,9 +101,10 @@ export function FileUploadDirectUpload({
|
|||||||
onValueChange={handleFilesChange}
|
onValueChange={handleFilesChange}
|
||||||
onUpload={onUpload}
|
onUpload={onUpload}
|
||||||
onFileReject={onFileReject}
|
onFileReject={onFileReject}
|
||||||
maxFiles={5}
|
// TODO: DEFALUT to 5 / 1 for params
|
||||||
|
maxFiles={(maxFiles ?? 5) as number}
|
||||||
className="w-full"
|
className="w-full"
|
||||||
multiple={true}
|
multiple={!maxFiles || !!(maxFiles && maxFiles > 1)}
|
||||||
>
|
>
|
||||||
<FileUploadDropzone>
|
<FileUploadDropzone>
|
||||||
<div className="flex flex-col items-center gap-1 text-center">
|
<div className="flex flex-col items-center gap-1 text-center">
|
||||||
@ -110,7 +113,7 @@ export function FileUploadDirectUpload({
|
|||||||
</div>
|
</div>
|
||||||
<p className="font-medium text-sm">Drag & drop files here</p>
|
<p className="font-medium text-sm">Drag & drop files here</p>
|
||||||
<p className="text-muted-foreground text-xs">
|
<p className="text-muted-foreground text-xs">
|
||||||
Or click to browse (max 5 files)
|
Or click to browse (max {(maxFiles ?? 5) as number} files)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<FileUploadTrigger asChild>
|
<FileUploadTrigger asChild>
|
||||||
|
|||||||
@ -37,6 +37,7 @@ export function UploaderForm({ ok, loading }: UploaderFormProps) {
|
|||||||
<FileUploadDirectUpload
|
<FileUploadDirectUpload
|
||||||
value={field.value}
|
value={field.value}
|
||||||
onChange={field.onChange}
|
onChange={field.onChange}
|
||||||
|
maxFiles={1}
|
||||||
></FileUploadDirectUpload>
|
></FileUploadDirectUpload>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user