feat(trigger): add support for trigger nodes and user input node management in workflow components

This commit is contained in:
zhsama
2025-11-11 15:21:04 +08:00
parent 50619fba0a
commit 9c37f8c1cb
12 changed files with 297 additions and 105 deletions

View File

@ -40,6 +40,12 @@ import { useIsChatMode } from '../../hooks'
import type { StartNodeType } from '@/app/components/workflow/nodes/start/types'
import type { Node } from '@/app/components/workflow/types'
const TRIGGER_NODE_TYPES: BlockEnum[] = [
BlockEnum.TriggerSchedule,
BlockEnum.TriggerWebhook,
BlockEnum.TriggerPlugin,
]
const FeaturesTrigger = () => {
const { t } = useTranslation()
const { theme } = useTheme()
@ -89,6 +95,10 @@ const FeaturesTrigger = () => {
return false
return edges.some(edge => startNodeIds.includes(edge.source))
}, [edges, startNodeIds])
// Track trigger presence so the publisher can adjust UI (e.g. hide missing start section).
const hasTriggerNode = useMemo(() => (
nodes.some(node => TRIGGER_NODE_TYPES.includes(node.data.type as BlockEnum))
), [nodes])
const resetWorkflowVersionHistory = useResetWorkflowVersionHistory()
const invalidateAppTriggers = useInvalidateAppTriggers()
@ -189,6 +199,7 @@ const FeaturesTrigger = () => {
workflowToolAvailable: lastPublishedHasUserInput,
crossAxisOffset: 4,
missingStartNode: !startNode,
hasTriggerNode,
}}
/>
</>