From 1e6d0de48bbc08b069f721fd615b18ed277b695b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E6=B3=95=E6=93=8D=E4=BD=9C?= Date: Fri, 14 Nov 2025 09:47:37 +0800 Subject: [PATCH] fix: knowledge pipeline can not published (#28203) --- .../workflow/hooks/use-checklist.ts | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.ts index 8c4ec7299e..be7aabbc68 100644 --- a/web/app/components/workflow/hooks/use-checklist.ts +++ b/web/app/components/workflow/hooks/use-checklist.ts @@ -249,6 +249,8 @@ export const useChecklistBeforePublish = () => { const { data: buildInTools } = useAllBuiltInTools() const { data: customTools } = useAllCustomTools() const { data: workflowTools } = useAllWorkflowTools() + const appMode = useAppStore.getState().appDetail?.mode + const shouldCheckStartNode = appMode === AppModeEnum.WORKFLOW || appMode === AppModeEnum.ADVANCED_CHAT const getCheckData = useCallback((data: CommonNodeType<{}>, datasets: DataSet[]) => { let checkData = data @@ -366,17 +368,22 @@ export const useChecklistBeforePublish = () => { } } - if (!validNodes.find(n => n.id === node.id)) { + const isStartNodeMeta = nodesExtraData?.[node.data.type as BlockEnum]?.metaData.isStart ?? false + const canSkipConnectionCheck = shouldCheckStartNode ? isStartNodeMeta : true + const isUnconnected = !validNodes.find(n => n.id === node.id) + + if (isUnconnected && !canSkipConnectionCheck) { notify({ type: 'error', message: `[${node.data.title}] ${t('workflow.common.needConnectTip')}` }) return false } } - const startNodesFiltered = nodes.filter(node => START_NODE_TYPES.includes(node.data.type as BlockEnum)) - - if (startNodesFiltered.length === 0) { - notify({ type: 'error', message: t('workflow.common.needStartNode') }) - return false + if (shouldCheckStartNode) { + const startNodesFiltered = nodes.filter(node => START_NODE_TYPES.includes(node.data.type as BlockEnum)) + if (startNodesFiltered.length === 0) { + notify({ type: 'error', message: t('workflow.common.needStartNode') }) + return false + } } const isRequiredNodesType = Object.keys(nodesExtraData!).filter((key: any) => (nodesExtraData as any)[key].metaData.isRequired) @@ -391,7 +398,7 @@ export const useChecklistBeforePublish = () => { } return true - }, [store, notify, t, language, nodesExtraData, strategyProviders, updateDatasetsDetail, getCheckData, workflowStore, buildInTools, customTools, workflowTools]) + }, [store, notify, t, language, nodesExtraData, strategyProviders, updateDatasetsDetail, getCheckData, workflowStore, buildInTools, customTools, workflowTools, shouldCheckStartNode]) return { handleCheckBeforePublish,