mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-07-31 16:32: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
|
<Form.Item
|
||||||
name={['parser_config', 'delimiter']}
|
name={['parser_config', 'delimiter']}
|
||||||
label={t('knowledgeDetails.delimiter')}
|
label={t('knowledgeDetails.delimiter')}
|
||||||
initialValue={`\\n!?;。;!?`}
|
initialValue={`\n`}
|
||||||
rules={[{ required: true }]}
|
rules={[{ required: true }]}
|
||||||
tooltip={t('knowledgeDetails.delimiterTip')}
|
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[];
|
uploadFileList?: UploadFile[];
|
||||||
setUploadFileList?: Dispatch<SetStateAction<UploadFile[]>>;
|
setUploadFileList?: Dispatch<SetStateAction<UploadFile[]>>;
|
||||||
uploadProgress?: number;
|
uploadProgress?: number;
|
||||||
@ -108,7 +111,9 @@ const FileUploadModal = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ret = await onFileUploadOk?.(
|
const ret = await onFileUploadOk?.(
|
||||||
fileList ? parseOnCreation : [...currentFileList, ...directoryFileList],
|
fileList
|
||||||
|
? { parseOnCreation, directoryFileList }
|
||||||
|
: [...currentFileList, ...directoryFileList],
|
||||||
);
|
);
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
@ -148,7 +148,13 @@ export const useHandleUploadDocument = () => {
|
|||||||
const { runDocumentByIds, loading: _ } = useRunNextDocument();
|
const { runDocumentByIds, loading: _ } = useRunNextDocument();
|
||||||
|
|
||||||
const onDocumentUploadOk = useCallback(
|
const onDocumentUploadOk = useCallback(
|
||||||
async (parseOnCreation: boolean): Promise<number | undefined> => {
|
async ({
|
||||||
|
parseOnCreation,
|
||||||
|
directoryFileList,
|
||||||
|
}: {
|
||||||
|
directoryFileList: UploadFile[];
|
||||||
|
parseOnCreation: boolean;
|
||||||
|
}): Promise<number | undefined> => {
|
||||||
const processFileGroup = async (filesPart: UploadFile[]) => {
|
const processFileGroup = async (filesPart: UploadFile[]) => {
|
||||||
// set status to uploading on files
|
// set status to uploading on files
|
||||||
setFileList(
|
setFileList(
|
||||||
@ -192,9 +198,18 @@ export const useHandleUploadDocument = () => {
|
|||||||
totalSuccess: succesfulFilenames.length,
|
totalSuccess: succesfulFilenames.length,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const totalFiles = fileList.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) {
|
if (totalFiles === 0) {
|
||||||
console.log('No files to upload');
|
console.log('No files to upload');
|
||||||
hideDocumentUploadModal();
|
hideDocumentUploadModal();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user