From 6f17200dec2312b4e59b70f5c6275f6da39ddd8f Mon Sep 17 00:00:00 2001 From: twwu Date: Thu, 12 Jun 2025 15:57:07 +0800 Subject: [PATCH 1/2] refactor: update dataset handling to use runtime_mode instead of pipeline_id --- .../(datasetDetailLayout)/[datasetId]/layout-main.tsx | 6 +++--- .../components/datasets/documents/detail/settings/index.tsx | 5 +++-- web/app/components/datasets/documents/index.tsx | 2 +- web/app/components/datasets/list/dataset-card/index.tsx | 4 ++-- .../online-documents/online-document-selector.tsx | 2 +- web/models/datasets.ts | 1 + web/models/pipeline.ts | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx index f0db548bcd..5be674441e 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx @@ -125,7 +125,7 @@ const DatasetDetailLayout: FC = (props) => { return true if (datasetRes.provider === 'external') return false - if (!datasetRes.pipeline_id) + if (datasetRes.runtime_mode === 'general') return false return !datasetRes.is_published }, [datasetRes]) @@ -149,7 +149,7 @@ const DatasetDetailLayout: FC = (props) => { ] if (datasetRes?.provider !== 'external') { - if (datasetRes?.pipeline_id) { + if (datasetRes?.runtime_mode === 'rag_pipeline') { baseNavigation.unshift({ name: t('common.datasetMenus.pipeline'), href: `/datasets/${datasetId}/pipeline`, @@ -168,7 +168,7 @@ const DatasetDetailLayout: FC = (props) => { } return baseNavigation - }, [t, datasetId, isButtonDisabledWithPipeline, datasetRes?.provider, datasetRes?.pipeline_id]) + }, [t, datasetId, isButtonDisabledWithPipeline, datasetRes?.provider, datasetRes?.runtime_mode]) useDocumentTitle(datasetRes?.name || t('common.menus.datasets')) diff --git a/web/app/components/datasets/documents/detail/settings/index.tsx b/web/app/components/datasets/documents/detail/settings/index.tsx index 88957c00d3..ba1c1eb197 100644 --- a/web/app/components/datasets/documents/detail/settings/index.tsx +++ b/web/app/components/datasets/documents/detail/settings/index.tsx @@ -13,9 +13,10 @@ const Settings = ({ datasetId, documentId, }: SettingsProps) => { - const pipelineId = useDatasetDetailContextWithSelector(s => s.dataset?.pipeline_id) + const runtimeMode = useDatasetDetailContextWithSelector(s => s.dataset?.runtime_mode) + const isGeneralDataset = runtimeMode === 'general' - if (!pipelineId) { + if (isGeneralDataset) { return ( = ({ datasetId }) => { const routeToDocCreate = () => { // if dataset is create from pipeline, redirect to create from pipeline page - if (dataset?.pipeline_id) { + if (dataset?.runtime_mode === 'rag_pipeline') { router.push(`/datasets/${datasetId}/documents/create-from-pipeline`) return } diff --git a/web/app/components/datasets/list/dataset-card/index.tsx b/web/app/components/datasets/list/dataset-card/index.tsx index d7d9a9f79a..7d02642ebc 100644 --- a/web/app/components/datasets/list/dataset-card/index.tsx +++ b/web/app/components/datasets/list/dataset-card/index.tsx @@ -50,8 +50,8 @@ const DatasetCard = ({ return dataset.provider === EXTERNAL_PROVIDER }, [dataset.provider]) const isPipelineUnpublished = useMemo(() => { - return !!dataset.pipeline_id && !dataset.is_published - }, [dataset.pipeline_id, dataset.is_published]) + return dataset.runtime_mode === 'rag_pipeline' && !dataset.is_published + }, [dataset.runtime_mode, dataset.is_published]) const chunkingModeIcon = dataset.doc_form ? DOC_FORM_ICON_WITH_BG[dataset.doc_form] : React.Fragment const Icon = isExternalProvider ? DOC_FORM_ICON_WITH_BG.external : chunkingModeIcon const iconInfo = dataset.icon_info || { diff --git a/web/app/components/rag-pipeline/components/panel/test-run/data-source/online-documents/online-document-selector.tsx b/web/app/components/rag-pipeline/components/panel/test-run/data-source/online-documents/online-document-selector.tsx index e8d8ceb700..5ad26034b1 100644 --- a/web/app/components/rag-pipeline/components/panel/test-run/data-source/online-documents/online-document-selector.tsx +++ b/web/app/components/rag-pipeline/components/panel/test-run/data-source/online-documents/online-document-selector.tsx @@ -50,7 +50,7 @@ const OnlineDocumentSelector = ({ datasource_type: DatasourceType.onlineDocument, }, { onSuccess(documentsData) { - setDocumentsData(documentsData as DataSourceNotionWorkspace[]) + setDocumentsData(documentsData.result as DataSourceNotionWorkspace[]) }, }) } diff --git a/web/models/datasets.ts b/web/models/datasets.ts index f06b4de904..37e8682eb8 100644 --- a/web/models/datasets.ts +++ b/web/models/datasets.ts @@ -83,6 +83,7 @@ export type DataSet = { keyword_number?: number pipeline_id?: string is_published?: boolean // Indicates if the pipeline is published + runtime_mode: 'rag_pipeline' | 'general' } export type ExternalAPIItem = { diff --git a/web/models/pipeline.ts b/web/models/pipeline.ts index 1525150548..df252921b8 100644 --- a/web/models/pipeline.ts +++ b/web/models/pipeline.ts @@ -167,7 +167,7 @@ export type PipelineDatasourceNodeRunRequest = { export type PipelineDatasourceNodeRunResponse = { job_id?: string status: 'processing' | 'completed' - result: Record + result: any provider_type: DatasourceType } From b367f48de60e2552f4d9149dfcb6da475057b43e Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Thu, 12 Jun 2025 16:23:50 +0800 Subject: [PATCH 2/2] add datasource category --- web/app/components/plugins/card/index.tsx | 2 +- web/app/components/plugins/marketplace/plugin-type-switch.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx index 1cc18ac24f..99328d6f88 100644 --- a/web/app/components/plugins/card/index.tsx +++ b/web/app/components/plugins/card/index.tsx @@ -48,7 +48,7 @@ const Card = ({ const { t } = useMixedTranslation(localeFromProps) const { categoriesMap } = useSingleCategories(t) const { category, type, name, org, label, brief, icon, verified, badges = [] } = payload - const isBundle = !['plugin', 'model', 'tool', 'extension', 'agent-strategy'].includes(type) + const isBundle = !['plugin', 'model', 'tool', 'datasource', 'extension', 'agent-strategy'].includes(type) const cornerMark = isBundle ? categoriesMap.bundle?.label : categoriesMap[category]?.label const getLocalizedText = (obj: Record | undefined) => obj ? renderI18nObject(obj, locale) : '' diff --git a/web/app/components/plugins/marketplace/plugin-type-switch.tsx b/web/app/components/plugins/marketplace/plugin-type-switch.tsx index ed04ff34f1..2784402466 100644 --- a/web/app/components/plugins/marketplace/plugin-type-switch.tsx +++ b/web/app/components/plugins/marketplace/plugin-type-switch.tsx @@ -2,6 +2,7 @@ import { RiArchive2Line, RiBrain2Line, + RiDatabase2Line, RiHammerLine, RiPuzzle2Line, RiSpeakAiLine, @@ -60,7 +61,7 @@ const PluginTypeSwitch = ({ { value: PLUGIN_TYPE_SEARCH_MAP.datasource, text: t('plugin.category.datasources'), - icon: , + icon: , }, { value: PLUGIN_TYPE_SEARCH_MAP.agent,