feat: Enhance AI Workflow with Variable Contracts and Input Mapping
- Added ConfigSchema, InputSchema, OutputSchema, and DefaultInputs to AIWorkflowNodeSpecResponse. - Implemented BuildAIWorkflowNodeSpecs to include variable contracts for start and send_reply nodes. - Introduced applyAutoInputMappings to automatically map inputs based on node connections. - Enhanced validation to check for required input mappings in workflows. - Updated workflow editor to support variable selection for node inputs. - Translated node names and labels to Chinese for better localization. - Added tests for variable mapping and validation logic.
This commit is contained in:
@@ -286,6 +286,28 @@ export type AIWorkflowPosition = {
|
||||
y: number
|
||||
}
|
||||
|
||||
export type AIWorkflowVariableType =
|
||||
| "string"
|
||||
| "integer"
|
||||
| "boolean"
|
||||
| "object"
|
||||
| "array<string>"
|
||||
| "array<int>"
|
||||
| "array<object>"
|
||||
| "any"
|
||||
|
||||
export type AIWorkflowVariableSelector = {
|
||||
nodeId: string
|
||||
field: string
|
||||
}
|
||||
|
||||
export type AIWorkflowVariableSpec = {
|
||||
name: string
|
||||
type: AIWorkflowVariableType
|
||||
required?: boolean
|
||||
description: string
|
||||
}
|
||||
|
||||
export type AIWorkflowDefinition = {
|
||||
schemaVersion: number
|
||||
entryNodeId: string
|
||||
@@ -295,6 +317,7 @@ export type AIWorkflowDefinition = {
|
||||
name: string
|
||||
position: AIWorkflowPosition
|
||||
config: Record<string, unknown>
|
||||
inputs?: Record<string, AIWorkflowVariableSelector>
|
||||
}[]
|
||||
edges: {
|
||||
id: string
|
||||
@@ -342,6 +365,10 @@ export type AIWorkflowNodeSpec = {
|
||||
riskLevel: "low" | "medium" | "high"
|
||||
interruptible: boolean
|
||||
requiresConfirmationPredecessor: boolean
|
||||
configSchema?: unknown
|
||||
inputSchema?: AIWorkflowVariableSpec[]
|
||||
outputSchema?: AIWorkflowVariableSpec[]
|
||||
defaultInputs?: Record<string, AIWorkflowVariableSelector>
|
||||
}
|
||||
|
||||
export type AIWorkflowValidationResult = {
|
||||
|
||||
Reference in New Issue
Block a user