diff --git a/web/app/components/base/notion-page-selector/base.tsx b/web/app/components/base/notion-page-selector/base.tsx index 9315605cdf..ba89be7ef7 100644 --- a/web/app/components/base/notion-page-selector/base.tsx +++ b/web/app/components/base/notion-page-selector/base.tsx @@ -21,7 +21,6 @@ type NotionPageSelectorProps = { datasetId?: string credentialList: DataSourceCredential[] onSelectCredential?: (credentialId: string) => void - supportBatchUpload?: boolean } const NotionPageSelector = ({ @@ -33,7 +32,6 @@ const NotionPageSelector = ({ datasetId = '', credentialList, onSelectCredential, - supportBatchUpload = false, }: NotionPageSelectorProps) => { const [searchValue, setSearchValue] = useState('') const setShowAccountSettingModal = useModalContextSelector(s => s.setShowAccountSettingModal) @@ -177,7 +175,6 @@ const NotionPageSelector = ({ canPreview={canPreview} previewPageId={previewPageId} onPreview={handlePreviewPage} - isMultipleChoice={supportBatchUpload} /> )} diff --git a/web/app/components/base/notion-page-selector/page-selector/index.tsx b/web/app/components/base/notion-page-selector/page-selector/index.tsx index 9c89b601fb..3541997c67 100644 --- a/web/app/components/base/notion-page-selector/page-selector/index.tsx +++ b/web/app/components/base/notion-page-selector/page-selector/index.tsx @@ -7,7 +7,6 @@ import Checkbox from '../../checkbox' import NotionIcon from '../../notion-icon' import cn from '@/utils/classnames' import type { DataSourceNotionPage, DataSourceNotionPageMap } from '@/models/common' -import Radio from '@/app/components/base/radio/ui' type PageSelectorProps = { value: Set @@ -82,7 +81,6 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ searchValue: string previewPageId: string pagesMap: DataSourceNotionPageMap - isMultipleChoice?: boolean }>) => { const { t } = useTranslation() const { @@ -97,7 +95,6 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ searchValue, previewPageId, pagesMap, - isMultipleChoice, } = data const current = dataList[index] const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[current.page_id] @@ -138,24 +135,14 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ previewPageId === current.page_id && 'bg-state-base-hover')} style={{ ...style, top: style.top as number + 8, left: 8, right: 8, width: 'calc(100% - 16px)' }} > - {isMultipleChoice ? ( - { - handleCheck(index) - }} - />) : ( - { - handleCheck(index) - }} - /> - )} + { + handleCheck(index) + }} + /> {!searchValue && renderArrow()} { const { t } = useTranslation() const [dataList, setDataList] = useState([]) @@ -278,7 +264,7 @@ const PageSelector = ({ const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[pageId] if (copyValue.has(pageId)) { - if (!searchValue && isMultipleChoice) { + if (!searchValue) { for (const item of currentWithChildrenAndDescendants.descendants) copyValue.delete(item) } @@ -286,18 +272,12 @@ const PageSelector = ({ copyValue.delete(pageId) } else { - if (!searchValue && isMultipleChoice) { + if (!searchValue) { for (const item of currentWithChildrenAndDescendants.descendants) copyValue.add(item) } - // Single choice mode, clear previous selection - if (!isMultipleChoice && copyValue.size > 0) { - copyValue.clear() - copyValue.add(pageId) - } - else { - copyValue.add(pageId) - } + + copyValue.add(pageId) } onSelect(new Set(copyValue)) @@ -341,7 +321,6 @@ const PageSelector = ({ searchValue, previewPageId: currentPreviewPageId, pagesMap, - isMultipleChoice, }} > {Item} diff --git a/web/app/components/datasets/create/step-one/index.tsx b/web/app/components/datasets/create/step-one/index.tsx index 2e6dc4817b..e70feb204c 100644 --- a/web/app/components/datasets/create/step-one/index.tsx +++ b/web/app/components/datasets/create/step-one/index.tsx @@ -297,7 +297,6 @@ const StepOne = ({ credentialList={notionCredentialList} onSelectCredential={updateNotionCredentialId} datasetId={datasetId} - supportBatchUpload={supportBatchUpload} /> {isShowVectorSpaceFull && ( diff --git a/web/app/components/datasets/create/website/base/crawled-result-item.tsx b/web/app/components/datasets/create/website/base/crawled-result-item.tsx index 51e043c35a..8ea316f62a 100644 --- a/web/app/components/datasets/create/website/base/crawled-result-item.tsx +++ b/web/app/components/datasets/create/website/base/crawled-result-item.tsx @@ -6,7 +6,6 @@ import cn from '@/utils/classnames' import type { CrawlResultItem as CrawlResultItemType } from '@/models/datasets' import Checkbox from '@/app/components/base/checkbox' import Button from '@/app/components/base/button' -import Radio from '@/app/components/base/radio/ui' type Props = { payload: CrawlResultItemType @@ -14,7 +13,6 @@ type Props = { isPreview: boolean onCheckChange: (checked: boolean) => void onPreview: () => void - isMultipleChoice: boolean } const CrawledResultItem: FC = ({ @@ -23,7 +21,6 @@ const CrawledResultItem: FC = ({ isChecked, onCheckChange, onPreview, - isMultipleChoice, }) => { const { t } = useTranslation() @@ -34,21 +31,7 @@ const CrawledResultItem: FC = ({
- { - isMultipleChoice ? ( - - ) : ( - - ) - } +
void onPreview: (payload: CrawlResultItem) => void usedTime: number - isMultipleChoice: boolean } const CrawledResult: FC = ({ @@ -26,7 +25,6 @@ const CrawledResult: FC = ({ onSelectedChange, onPreview, usedTime, - isMultipleChoice, }) => { const { t } = useTranslation() @@ -42,17 +40,13 @@ const CrawledResult: FC = ({ const handleItemCheckChange = useCallback((item: CrawlResultItem) => { return (checked: boolean) => { - if (checked) { - if (isMultipleChoice) - onSelectedChange([...checkedList, item]) - else - onSelectedChange([item]) - } - else { + if (checked) + onSelectedChange([...checkedList, item]) + + else onSelectedChange(checkedList.filter(checkedItem => checkedItem.source_url !== item.source_url)) - } } - }, [checkedList, isMultipleChoice, onSelectedChange]) + }, [checkedList, onSelectedChange]) const [previewIndex, setPreviewIndex] = React.useState(-1) const handlePreview = useCallback((index: number) => { @@ -65,13 +59,11 @@ const CrawledResult: FC = ({ return (
- {isMultipleChoice && ( - - )} +
{t(`${I18N_PREFIX}.scrapTimeInfo`, { total: list.length, @@ -88,7 +80,6 @@ const CrawledResult: FC = ({ payload={item} isChecked={checkedList.some(checkedItem => checkedItem.source_url === item.source_url)} onCheckChange={handleItemCheckChange(item)} - isMultipleChoice={isMultipleChoice} /> ))}
diff --git a/web/app/components/datasets/create/website/firecrawl/index.tsx b/web/app/components/datasets/create/website/firecrawl/index.tsx index 1ef934308a..17d8d6416e 100644 --- a/web/app/components/datasets/create/website/firecrawl/index.tsx +++ b/web/app/components/datasets/create/website/firecrawl/index.tsx @@ -26,7 +26,6 @@ type Props = { onJobIdChange: (jobId: string) => void crawlOptions: CrawlOptions onCrawlOptionsChange: (payload: CrawlOptions) => void - supportBatchUpload: boolean } enum Step { @@ -42,7 +41,6 @@ const FireCrawl: FC = ({ onJobIdChange, crawlOptions, onCrawlOptionsChange, - supportBatchUpload, }) => { const { t } = useTranslation() const [step, setStep] = useState(Step.init) @@ -168,12 +166,8 @@ const FireCrawl: FC = ({ setCrawlErrorMessage(errorMessage || t(`${I18N_PREFIX}.unknownError`)) } else { - data.data = data.data.map((item: any) => ({ - ...item, - content: item.markdown, - })) setCrawlResult(data) - onCheckedCrawlResultChange(supportBatchUpload ? (data.data || []) : (data.data?.slice(0, 1) || [])) // default select the crawl result + onCheckedCrawlResultChange(data.data || []) // default select the crawl result setCrawlErrorMessage('') } } @@ -184,7 +178,7 @@ const FireCrawl: FC = ({ finally { setStep(Step.finished) } - }, [checkValid, crawlOptions, onJobIdChange, waitForCrawlFinished, t, onCheckedCrawlResultChange, supportBatchUpload]) + }, [checkValid, crawlOptions, onJobIdChange, t, waitForCrawlFinished, onCheckedCrawlResultChange]) return (
@@ -223,7 +217,6 @@ const FireCrawl: FC = ({ onSelectedChange={onCheckedCrawlResultChange} onPreview={onPreview} usedTime={Number.parseFloat(crawlResult?.time_consuming as string) || 0} - isMultipleChoice={supportBatchUpload} /> }
diff --git a/web/app/components/datasets/create/website/index.tsx b/web/app/components/datasets/create/website/index.tsx index 15324f642e..ee7ace6815 100644 --- a/web/app/components/datasets/create/website/index.tsx +++ b/web/app/components/datasets/create/website/index.tsx @@ -24,7 +24,6 @@ type Props = { crawlOptions: CrawlOptions onCrawlOptionsChange: (payload: CrawlOptions) => void authedDataSourceList: DataSourceAuth[] - supportBatchUpload?: boolean } const Website: FC = ({ @@ -36,7 +35,6 @@ const Website: FC = ({ crawlOptions, onCrawlOptionsChange, authedDataSourceList, - supportBatchUpload = false, }) => { const { t } = useTranslation() const { setShowAccountSettingModal } = useModalContext() @@ -118,7 +116,6 @@ const Website: FC = ({ onJobIdChange={onJobIdChange} crawlOptions={crawlOptions} onCrawlOptionsChange={onCrawlOptionsChange} - supportBatchUpload={supportBatchUpload} /> )} {source && selectedProvider === DataSourceProvider.waterCrawl && ( @@ -129,7 +126,6 @@ const Website: FC = ({ onJobIdChange={onJobIdChange} crawlOptions={crawlOptions} onCrawlOptionsChange={onCrawlOptionsChange} - supportBatchUpload={supportBatchUpload} /> )} {source && selectedProvider === DataSourceProvider.jinaReader && ( @@ -140,7 +136,6 @@ const Website: FC = ({ onJobIdChange={onJobIdChange} crawlOptions={crawlOptions} onCrawlOptionsChange={onCrawlOptionsChange} - supportBatchUpload={supportBatchUpload} /> )} {!source && ( diff --git a/web/app/components/datasets/create/website/jina-reader/index.tsx b/web/app/components/datasets/create/website/jina-reader/index.tsx index b2189b3e5c..7257e8f7e6 100644 --- a/web/app/components/datasets/create/website/jina-reader/index.tsx +++ b/web/app/components/datasets/create/website/jina-reader/index.tsx @@ -26,7 +26,6 @@ type Props = { onJobIdChange: (jobId: string) => void crawlOptions: CrawlOptions onCrawlOptionsChange: (payload: CrawlOptions) => void - supportBatchUpload: boolean } enum Step { @@ -42,7 +41,6 @@ const JinaReader: FC = ({ onJobIdChange, crawlOptions, onCrawlOptionsChange, - supportBatchUpload, }) => { const { t } = useTranslation() const [step, setStep] = useState(Step.init) @@ -178,7 +176,7 @@ const JinaReader: FC = ({ } else { setCrawlResult(data) - onCheckedCrawlResultChange(supportBatchUpload ? (data.data || []) : (data.data?.slice(0, 1) || [])) // default select the crawl result + onCheckedCrawlResultChange(data.data || []) // default select the crawl result setCrawlErrorMessage('') } } @@ -190,7 +188,7 @@ const JinaReader: FC = ({ finally { setStep(Step.finished) } - }, [checkValid, crawlOptions, onCheckedCrawlResultChange, onJobIdChange, supportBatchUpload, t, waitForCrawlFinished]) + }, [checkValid, crawlOptions, onCheckedCrawlResultChange, onJobIdChange, t, waitForCrawlFinished]) return (
@@ -229,7 +227,6 @@ const JinaReader: FC = ({ onSelectedChange={onCheckedCrawlResultChange} onPreview={onPreview} usedTime={Number.parseFloat(crawlResult?.time_consuming as string) || 0} - isMultipleChoice={supportBatchUpload} /> }
diff --git a/web/app/components/datasets/create/website/watercrawl/index.tsx b/web/app/components/datasets/create/website/watercrawl/index.tsx index bf0048b788..f1aee37e19 100644 --- a/web/app/components/datasets/create/website/watercrawl/index.tsx +++ b/web/app/components/datasets/create/website/watercrawl/index.tsx @@ -26,7 +26,6 @@ type Props = { onJobIdChange: (jobId: string) => void crawlOptions: CrawlOptions onCrawlOptionsChange: (payload: CrawlOptions) => void - supportBatchUpload: boolean } enum Step { @@ -42,7 +41,6 @@ const WaterCrawl: FC = ({ onJobIdChange, crawlOptions, onCrawlOptionsChange, - supportBatchUpload, }) => { const { t } = useTranslation() const [step, setStep] = useState(Step.init) @@ -165,7 +163,7 @@ const WaterCrawl: FC = ({ } else { setCrawlResult(data) - onCheckedCrawlResultChange(supportBatchUpload ? (data.data || []) : (data.data?.slice(0, 1) || [])) // default select the crawl result + onCheckedCrawlResultChange(data.data || []) // default select the crawl result setCrawlErrorMessage('') } } @@ -176,7 +174,7 @@ const WaterCrawl: FC = ({ finally { setStep(Step.finished) } - }, [checkValid, crawlOptions, onCheckedCrawlResultChange, onJobIdChange, supportBatchUpload, t, waitForCrawlFinished]) + }, [checkValid, crawlOptions, onCheckedCrawlResultChange, onJobIdChange, t, waitForCrawlFinished]) return (
@@ -215,7 +213,6 @@ const WaterCrawl: FC = ({ onSelectedChange={onCheckedCrawlResultChange} onPreview={onPreview} usedTime={Number.parseFloat(crawlResult?.time_consuming as string) || 0} - isMultipleChoice={supportBatchUpload} /> }