import type { NodeProps } from 'reactflow' import type { CommonNodeType } from '@/app/components/workflow/types' import { memo } from 'react' import { useTranslation } from 'react-i18next' import { AssembleVariablesAlt } from '@/app/components/base/icons/src/vender/line/general' import { Agent } from '@/app/components/base/icons/src/vender/workflow' import Tooltip from '@/app/components/base/tooltip' import { NodeSourceHandle } from '@/app/components/workflow/nodes/_base/components/node-handle' import { cn } from '@/utils/classnames' type SubGraphStartNodeData = CommonNodeType<{ tooltip?: string iconType?: string }> type IconComponent = typeof Agent const iconMap: Record = { agent: Agent, assemble: AssembleVariablesAlt, } const SubGraphStartNode = ({ id, data }: NodeProps) => { const { t } = useTranslation() const iconType = data?.iconType || 'agent' const Icon = iconMap[iconType] || Agent const rawTitle = data?.title?.trim() || '' const showTitle = iconType === 'agent' && !!rawTitle const displayTitle = showTitle && (rawTitle.startsWith('@') ? rawTitle : `@${rawTitle}`) const tooltip = data?.tooltip || (iconType === 'assemble' ? t('blocks.start', { ns: 'workflow' }) : (data?.title || t('blocks.start', { ns: 'workflow' }))) return (
{showTitle && ( {displayTitle} )}
) } export default memo(SubGraphStartNode)