diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index 22b0860139..99e7213373 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -107,6 +107,7 @@ const StepTwo = ({ const fileIndexingEstimate = (() => { return segmentationType === SegmentType.AUTO ? automaticFileIndexingEstimate : customFileIndexingEstimate })() + const [isCreating, setIsCreating] = useState(false) const scrollHandle = (e: Event) => { if ((e.target as HTMLDivElement).scrollTop > 0) @@ -277,7 +278,7 @@ const StepTwo = ({ } as CreateDocumentReq if (dataSourceType === DataSourceType.FILE) { params.data_source.info_list.file_info_list = { - file_ids: files.map(file => file.id), + file_ids: files.map(file => file.id || '').filter(Boolean), } } if (dataSourceType === DataSourceType.NOTION) @@ -321,6 +322,7 @@ const StepTwo = ({ try { let res const params = getCreationParams() + setIsCreating(true) if (!datasetId) { res = await createFirstDocument({ body: params, @@ -347,6 +349,9 @@ const StepTwo = ({ message: `${err}`, }) } + finally { + setIsCreating(false) + } } const handleSwitch = (state: boolean) => { @@ -622,7 +627,7 @@ const StepTwo = ({ <>