feat: enhance condition node functionality with branches and validation
- Introduced WorkflowConditionBranch and WorkflowNodeConfig types to manage condition branches in nodes. - Updated NodeConfigPanel and ConditionNodePanel components to support adding, editing, and deleting branches. - Implemented validation for condition nodes to ensure at least one branch exists and that default branches are correctly configured. - Modified workflow-utils to handle condition branches and updated toApiDefinition and fromApiDefinition functions to maintain branch integrity during serialization. - Removed edge condition handling from WorkflowEditor and related components, simplifying edge management. - Added tests to ensure condition branches are preserved in API definitions.
This commit is contained in:
+6
-12
@@ -318,18 +318,12 @@ export type AIWorkflowDefinition = {
|
||||
config: Record<string, unknown>
|
||||
inputs?: Record<string, AIWorkflowVariableSelector>
|
||||
}[]
|
||||
edges: {
|
||||
id: string
|
||||
source: string
|
||||
target: string
|
||||
condition?: {
|
||||
expression?: string
|
||||
left?: AIWorkflowVariableSelector
|
||||
operator?: string
|
||||
right?: unknown
|
||||
}
|
||||
}[]
|
||||
}
|
||||
edges: {
|
||||
id: string
|
||||
source: string
|
||||
target: string
|
||||
}[]
|
||||
}
|
||||
|
||||
export type AIWorkflow = {
|
||||
id: number
|
||||
|
||||
Reference in New Issue
Block a user