diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx index ab2f6998d7..28c9ae456e 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx @@ -15,6 +15,7 @@ type CrawledResultProps = { checkedList: CrawlResultItem[] onSelectedChange: (selected: CrawlResultItem[]) => void onPreview?: (payload: CrawlResultItem, index: number) => void + showPreview?: boolean usedTime: number isMultipleChoice?: boolean } @@ -27,6 +28,7 @@ const CrawledResult = ({ onSelectedChange, usedTime, onPreview, + showPreview = false, isMultipleChoice = true, }: CrawledResultProps) => { const { t } = useTranslation() @@ -81,7 +83,7 @@ const CrawledResult = ({ onCheckChange={handleItemCheckChange(item)} isPreview={index === previewIndex} onPreview={handlePreview.bind(null, index)} - showPreview={!!onPreview} + showPreview={showPreview} isMultipleChoice={isMultipleChoice} /> ))} diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx index 92ea5527c9..2753f5f8c9 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx @@ -73,7 +73,7 @@ const WebsiteCrawl = ({ setCrawlResult(undefined) setCurrentWebsite(undefined) setWebsitePages([]) - setPreviewIndex(0) + setPreviewIndex(-1) setCrawledNum(0) setTotalNum(0) setCrawlErrorMessage('') @@ -195,6 +195,7 @@ const WebsiteCrawl = ({ usedTime={Number.parseFloat(crawlResult?.time_consuming as string) || 0} previewIndex={previewIndex} onPreview={handlePreview} + showPreview={!isInPipeline} isMultipleChoice={!isInPipeline} // only support single choice in test run /> )} diff --git a/web/app/components/datasets/documents/create-from-pipeline/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/index.tsx index c80c6a510d..34027ccc84 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/index.tsx @@ -315,7 +315,14 @@ const CreateFormPipeline = () => { }, [dataSourceStore, onClickPreview]) const handleSelectAll = useCallback(() => { - const { setOnlineDocuments, setSelectedFileKeys, setSelectedPagesId } = dataSourceStore.getState() + const { + onlineDocuments, + fileList: onlineDriveFileList, + selectedFileKeys, + setOnlineDocuments, + setSelectedFileKeys, + setSelectedPagesId, + } = dataSourceStore.getState() if (datasourceType === DatasourceType.onlineDocument) { const allIds = currentWorkspace?.pages.map(page => page.page_id) || [] if (onlineDocuments.length < allIds.length) { @@ -337,7 +344,7 @@ const CreateFormPipeline = () => { else setSelectedFileKeys([]) } - }, [PagesMapAndSelectedPagesId, currentWorkspace?.pages, dataSourceStore, datasourceType, onlineDocuments.length, onlineDriveFileList, selectedFileKeys.length]) + }, [PagesMapAndSelectedPagesId, currentWorkspace?.pages, dataSourceStore, datasourceType]) if (isFetchingPipelineInfo) { return (