| return true | return true | ||||
| if (datasetRes.provider === 'external') | if (datasetRes.provider === 'external') | ||||
| return false | return false | ||||
| if (!datasetRes.pipeline_id) | |||||
| if (datasetRes.runtime_mode === 'general') | |||||
| return false | return false | ||||
| return !datasetRes.is_published | return !datasetRes.is_published | ||||
| }, [datasetRes]) | }, [datasetRes]) | ||||
| ] | ] | ||||
| if (datasetRes?.provider !== 'external') { | if (datasetRes?.provider !== 'external') { | ||||
| if (datasetRes?.pipeline_id) { | |||||
| if (datasetRes?.runtime_mode === 'rag_pipeline') { | |||||
| baseNavigation.unshift({ | baseNavigation.unshift({ | ||||
| name: t('common.datasetMenus.pipeline'), | name: t('common.datasetMenus.pipeline'), | ||||
| href: `/datasets/${datasetId}/pipeline`, | href: `/datasets/${datasetId}/pipeline`, | ||||
| } | } | ||||
| return baseNavigation | 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')) | useDocumentTitle(datasetRes?.name || t('common.menus.datasets')) | ||||
| datasetId, | datasetId, | ||||
| documentId, | documentId, | ||||
| }: SettingsProps) => { | }: 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 ( | return ( | ||||
| <DocumentSettings | <DocumentSettings | ||||
| datasetId={datasetId} | datasetId={datasetId} |
| const routeToDocCreate = () => { | const routeToDocCreate = () => { | ||||
| // if dataset is create from pipeline, redirect to create from pipeline page | // 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`) | router.push(`/datasets/${datasetId}/documents/create-from-pipeline`) | ||||
| return | return | ||||
| } | } |
| return dataset.provider === EXTERNAL_PROVIDER | return dataset.provider === EXTERNAL_PROVIDER | ||||
| }, [dataset.provider]) | }, [dataset.provider]) | ||||
| const isPipelineUnpublished = useMemo(() => { | 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 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 Icon = isExternalProvider ? DOC_FORM_ICON_WITH_BG.external : chunkingModeIcon | ||||
| const iconInfo = dataset.icon_info || { | const iconInfo = dataset.icon_info || { |
| datasource_type: DatasourceType.onlineDocument, | datasource_type: DatasourceType.onlineDocument, | ||||
| }, { | }, { | ||||
| onSuccess(documentsData) { | onSuccess(documentsData) { | ||||
| setDocumentsData(documentsData as DataSourceNotionWorkspace[]) | |||||
| setDocumentsData(documentsData.result as DataSourceNotionWorkspace[]) | |||||
| }, | }, | ||||
| }) | }) | ||||
| } | } |
| keyword_number?: number | keyword_number?: number | ||||
| pipeline_id?: string | pipeline_id?: string | ||||
| is_published?: boolean // Indicates if the pipeline is published | is_published?: boolean // Indicates if the pipeline is published | ||||
| runtime_mode: 'rag_pipeline' | 'general' | |||||
| } | } | ||||
| export type ExternalAPIItem = { | export type ExternalAPIItem = { |
| export type PipelineDatasourceNodeRunResponse = { | export type PipelineDatasourceNodeRunResponse = { | ||||
| job_id?: string | job_id?: string | ||||
| status: 'processing' | 'completed' | status: 'processing' | 'completed' | ||||
| result: Record<string, any> | |||||
| result: any | |||||
| provider_type: DatasourceType | provider_type: DatasourceType | ||||
| } | } | ||||