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:
mlogclub
2026-06-25 21:08:59 +08:00
parent 072c2f0105
commit b806a2208b
12 changed files with 745 additions and 511 deletions
+6 -12
View File
@@ -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