Commit 03890bc9 by roy Committed by GitHub

fix: set fallback file name while import documents from other api server (#6372)

* fix: deps

* fix: set fallback file name while import documents from other api server
parent cfded3af
...@@ -11,6 +11,7 @@ import { readFileRawTextByUrl } from '../../read'; ...@@ -11,6 +11,7 @@ import { readFileRawTextByUrl } from '../../read';
import { type ParentIdType } from '@fastgpt/global/common/parentFolder/type'; import { type ParentIdType } from '@fastgpt/global/common/parentFolder/type';
import { type RequireOnlyOne } from '@fastgpt/global/common/type/utils'; import { type RequireOnlyOne } from '@fastgpt/global/common/type/utils';
import { getS3RawTextSource } from '../../../../common/s3/sources/rawText'; import { getS3RawTextSource } from '../../../../common/s3/sources/rawText';
import { getNanoid } from '@fastgpt/global/common/string/tools';
type ResponseDataType = { type ResponseDataType = {
success: boolean; success: boolean;
...@@ -176,15 +177,17 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer } ...@@ -176,15 +177,17 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
getFormatText: true getFormatText: true
}); });
const sourceName = title || getNanoid();
getS3RawTextSource().addRawTextBuffer({ getS3RawTextSource().addRawTextBuffer({
sourceId: previewUrl, sourceId: previewUrl,
sourceName: title || '', sourceName,
text: rawText, text: rawText,
customPdfParse customPdfParse
}); });
return { return {
title, title: sourceName,
rawText rawText
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment