dify/web/app/components/workflow/utils/variable.ts
QuantumGhost d6e4f48526
fix(web): merge workflow tool outputs from all End nodes (#41517)
Co-authored-by: twwu <twwu@dify.ai>
2026-09-01 08:50:37 +00:00

15 lines
546 B
TypeScript

import type { BlockEnum, ValueSelector } from '../types'
import { hasErrorHandleNode } from '.'
export const variableTransformer = (v: ValueSelector | string) => {
if (typeof v === 'string') return v.replace(/^\{\{#|#\}\}$/g, '').split('.')
return `{{#${v.join('.')}#}}`
}
export const normalizeWorkflowOutputName = (name?: string) => name?.trim() ?? ''
export const isExceptionVariable = (variable: string, nodeType?: BlockEnum) => {
return (variable === 'error_message' || variable === 'error_type') && hasErrorHandleNode(nodeType)
}