mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-25 23:58:15 +08:00
22 lines
531 B
TypeScript
22 lines
531 B
TypeScript
import type {
|
|
ValueSelector,
|
|
} from '../types'
|
|
import type {
|
|
BlockEnum,
|
|
} 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 isExceptionVariable = (variable: string, nodeType?: BlockEnum) => {
|
|
if ((variable === 'error_message' || variable === 'error_type') && hasErrorHandleNode(nodeType))
|
|
return true
|
|
|
|
return false
|
|
}
|