mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 11:56:53 +08:00
feat: workflow continue on error (#11474)
This commit is contained in:
@@ -19,7 +19,11 @@ import type {
|
||||
ToolWithProvider,
|
||||
ValueSelector,
|
||||
} from './types'
|
||||
import { BlockEnum, ErrorHandleMode } from './types'
|
||||
import {
|
||||
BlockEnum,
|
||||
ErrorHandleMode,
|
||||
NodeRunningStatus,
|
||||
} from './types'
|
||||
import {
|
||||
CUSTOM_NODE,
|
||||
ITERATION_CHILDREN_Z_INDEX,
|
||||
@@ -761,3 +765,34 @@ export const getParallelInfo = (nodes: Node[], edges: Edge[], parentNodeId?: str
|
||||
hasAbnormalEdges,
|
||||
}
|
||||
}
|
||||
|
||||
export const hasErrorHandleNode = (nodeType?: BlockEnum) => {
|
||||
return nodeType === BlockEnum.LLM || nodeType === BlockEnum.Tool || nodeType === BlockEnum.HttpRequest || nodeType === BlockEnum.Code
|
||||
}
|
||||
|
||||
export const getEdgeColor = (nodeRunningStatus?: NodeRunningStatus, isFailBranch?: boolean) => {
|
||||
if (nodeRunningStatus === NodeRunningStatus.Succeeded)
|
||||
return 'var(--color-workflow-link-line-success-handle)'
|
||||
|
||||
if (nodeRunningStatus === NodeRunningStatus.Failed)
|
||||
return 'var(--color-workflow-link-line-error-handle)'
|
||||
|
||||
if (nodeRunningStatus === NodeRunningStatus.Exception)
|
||||
return 'var(--color-workflow-link-line-failure-handle)'
|
||||
|
||||
if (nodeRunningStatus === NodeRunningStatus.Running) {
|
||||
if (isFailBranch)
|
||||
return 'var(--color-workflow-link-line-failure-handle)'
|
||||
|
||||
return 'var(--color-workflow-link-line-handle)'
|
||||
}
|
||||
|
||||
return 'var(--color-workflow-link-line-normal)'
|
||||
}
|
||||
|
||||
export const isExceptionVariable = (variable: string, nodeType?: BlockEnum) => {
|
||||
if ((variable === 'error_message' || variable === 'error_type') && hasErrorHandleNode(nodeType))
|
||||
return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user