Files
dify/web/app/components/workflow/utils/variable.ts
T

12 lines
464 B
TypeScript
Raw Normal View History

2026-07-12 23:57:46 +08:00
import type { BlockEnum, ValueSelector } from '../types'
2025-04-10 10:03:19 +08:00
import { hasErrorHandleNode } from '.'
export const variableTransformer = (v: ValueSelector | string) => {
2026-07-12 23:57:46 +08:00
if (typeof v === 'string') return v.replace(/^\{\{#|#\}\}$/g, '').split('.')
2025-04-10 10:03:19 +08:00
return `{{#${v.join('.')}#}}`
}
export const isExceptionVariable = (variable: string, nodeType?: BlockEnum) => {
2025-04-14 15:28:20 +08:00
return (variable === 'error_message' || variable === 'error_type') && hasErrorHandleNode(nodeType)
2025-04-10 10:03:19 +08:00
}