mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-24 07:00:02 +08:00
### What problem does this PR solve? Fix: Knowledge base page cannot upload folders #6062 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
b77e844fc3
commit
9d94acbedb
@ -30,7 +30,7 @@ const Delimiter = () => {
|
||||
<Form.Item
|
||||
name={['parser_config', 'delimiter']}
|
||||
label={t('knowledgeDetails.delimiter')}
|
||||
initialValue={`\\n!?;。;!?`}
|
||||
initialValue={`\n`}
|
||||
rules={[{ required: true }]}
|
||||
tooltip={t('knowledgeDetails.delimiterTip')}
|
||||
>
|
||||
|
@ -68,7 +68,10 @@ const FileUpload = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface IFileUploadModalProps extends IModalProps<boolean | UploadFile[]> {
|
||||
interface IFileUploadModalProps
|
||||
extends IModalProps<
|
||||
{ parseOnCreation: boolean; directoryFileList: UploadFile[] } | UploadFile[]
|
||||
> {
|
||||
uploadFileList?: UploadFile[];
|
||||
setUploadFileList?: Dispatch<SetStateAction<UploadFile[]>>;
|
||||
uploadProgress?: number;
|
||||
@ -108,7 +111,9 @@ const FileUploadModal = ({
|
||||
}
|
||||
|
||||
const ret = await onFileUploadOk?.(
|
||||
fileList ? parseOnCreation : [...currentFileList, ...directoryFileList],
|
||||
fileList
|
||||
? { parseOnCreation, directoryFileList }
|
||||
: [...currentFileList, ...directoryFileList],
|
||||
);
|
||||
return ret;
|
||||
};
|
||||
|
@ -148,7 +148,13 @@ export const useHandleUploadDocument = () => {
|
||||
const { runDocumentByIds, loading: _ } = useRunNextDocument();
|
||||
|
||||
const onDocumentUploadOk = useCallback(
|
||||
async (parseOnCreation: boolean): Promise<number | undefined> => {
|
||||
async ({
|
||||
parseOnCreation,
|
||||
directoryFileList,
|
||||
}: {
|
||||
directoryFileList: UploadFile[];
|
||||
parseOnCreation: boolean;
|
||||
}): Promise<number | undefined> => {
|
||||
const processFileGroup = async (filesPart: UploadFile[]) => {
|
||||
// set status to uploading on files
|
||||
setFileList(
|
||||
@ -192,9 +198,18 @@ export const useHandleUploadDocument = () => {
|
||||
totalSuccess: succesfulFilenames.length,
|
||||
};
|
||||
};
|
||||
|
||||
const totalFiles = fileList.length;
|
||||
|
||||
if (directoryFileList.length > 0) {
|
||||
const ret = await uploadDocument(directoryFileList);
|
||||
if (ret?.code === 0) {
|
||||
hideDocumentUploadModal();
|
||||
}
|
||||
if (totalFiles === 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (totalFiles === 0) {
|
||||
console.log('No files to upload');
|
||||
hideDocumentUploadModal();
|
||||
|
Loading…
x
Reference in New Issue
Block a user