From 2984dbc0df974b70f35988f0f3ae71a7f338ccaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E6=B3=95=E6=93=8D=E4=BD=9C?= Date: Tue, 26 Aug 2025 18:06:11 +0800 Subject: [PATCH] fix: when workflow not has start node can't open service api (#24564) --- web/app/components/app/overview/app-card.tsx | 9 +++++++-- web/app/components/tools/mcp/mcp-service-card.tsx | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/web/app/components/app/overview/app-card.tsx b/web/app/components/app/overview/app-card.tsx index 02fd779df6..0dddfed0f2 100644 --- a/web/app/components/app/overview/app-card.tsx +++ b/web/app/components/app/overview/app-card.tsx @@ -39,7 +39,9 @@ import { fetchAppDetailDirect } from '@/service/apps' import { AccessMode } from '@/models/access-control' import AccessControl from '../app-access-control' import { useAppWhiteListSubjects } from '@/service/access-control' +import { useAppWorkflow } from '@/service/use-workflow' import { useGlobalPublicStore } from '@/context/global-public-context' +import { BlockEnum } from '@/app/components/workflow/types' export type IAppCardProps = { className?: string @@ -65,6 +67,7 @@ function AppCard({ const router = useRouter() const pathname = usePathname() const { isCurrentWorkspaceManager, isCurrentWorkspaceEditor } = useAppContext() + const { data: currentWorkflow } = useAppWorkflow(appInfo.mode === 'workflow' ? appInfo.id : '') const appDetail = useAppStore(state => state.appDetail) const setAppDetail = useAppStore(state => state.setAppDetail) const [showSettingsModal, setShowSettingsModal] = useState(false) @@ -100,8 +103,10 @@ function AppCard({ const basicName = isApp ? appInfo?.site?.title : t('appOverview.overview.apiInfo.title') - const toggleDisabled = isApp ? !isCurrentWorkspaceEditor : !isCurrentWorkspaceManager - const runningStatus = isApp ? appInfo.enable_site : appInfo.enable_api + const hasStartNode = currentWorkflow?.graph?.nodes.find(node => node.data.type === BlockEnum.Start) + const isWorkflowAndMissingStart = appInfo.mode === 'workflow' && !hasStartNode + const toggleDisabled = isWorkflowAndMissingStart || (isApp ? !isCurrentWorkspaceEditor : !isCurrentWorkspaceManager) + const runningStatus = isWorkflowAndMissingStart ? false : (isApp ? appInfo.enable_site : appInfo.enable_api) const { app_base_url, access_token } = appInfo.site ?? {} const appMode = (appInfo.mode !== 'completion' && appInfo.mode !== 'workflow') ? 'chat' : appInfo.mode const appUrl = `${app_base_url}${basePath}/${appMode}/${access_token}` diff --git a/web/app/components/tools/mcp/mcp-service-card.tsx b/web/app/components/tools/mcp/mcp-service-card.tsx index 301bb66897..2230d3701c 100644 --- a/web/app/components/tools/mcp/mcp-service-card.tsx +++ b/web/app/components/tools/mcp/mcp-service-card.tsx @@ -73,7 +73,8 @@ function MCPServiceCard({ const serverPublished = !!id const serverActivated = status === 'active' const serverURL = serverPublished ? `${appInfo.api_base_url.replace('/v1', '')}/mcp/server/${server_code}/mcp` : '***********' - const toggleDisabled = !isCurrentWorkspaceEditor || appUnpublished + const hasStartNode = currentWorkflow?.graph?.nodes.find(node => node.data.type === BlockEnum.Start) + const toggleDisabled = !isCurrentWorkspaceEditor || appUnpublished || !hasStartNode const [activated, setActivated] = useState(serverActivated)