diff --git a/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx b/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx index a7e676f..11547fb 100644 --- a/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx +++ b/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx @@ -11,6 +11,7 @@ import { VariableSelector } from "./variable-selector" import type { WorkflowNodeSpec, WorkflowVariableRef, + WorkflowVariableSpec, WorkflowVariableSelector, } from "./workflow-utils" @@ -21,15 +22,24 @@ type WorkflowNodeData = Record & { inputs?: Record } +export type WorkflowBranchSummary = { + edgeId: string + targetName: string + conditionLabel: string + isDefault: boolean +} + export function NodeConfigPanel({ node, nodeSpec, availableVariables, + branchSummaries = [], onChange, }: { node: Node | null nodeSpec?: WorkflowNodeSpec availableVariables: WorkflowVariableRef[] + branchSummaries?: WorkflowBranchSummary[] onChange: (nodeId: string, data: WorkflowNodeData) => void }) { if (!node) { @@ -46,6 +56,7 @@ export function NodeConfigPanel({ node={node} nodeSpec={nodeSpec} availableVariables={availableVariables} + branchSummaries={branchSummaries} onChange={onChange} /> ) @@ -55,11 +66,13 @@ function NodeConfigForm({ node, nodeSpec, availableVariables, + branchSummaries, onChange, }: { node: Node nodeSpec?: WorkflowNodeSpec availableVariables: WorkflowVariableRef[] + branchSummaries: WorkflowBranchSummary[] onChange: (nodeId: string, data: WorkflowNodeData) => void }) { const [name, setName] = useState(node.data.name ?? "") @@ -70,6 +83,7 @@ function NodeConfigForm({ const [error, setError] = useState("") const inputSchema = nodeSpec?.inputSchema ?? [] const outputSchema = nodeSpec?.outputSchema ?? [] + const isConditionNode = node.data.nodeType === "condition" const commitChange = (next: Partial) => { onChange(node.id, { @@ -106,64 +120,128 @@ function NodeConfigForm({ onBlur={() => commitChange({ name: name.trim() || node.data.nodeType || node.id })} /> - {inputSchema.length > 0 ? ( -
-
输入映射
- {availableVariables.length === 0 ? ( -
- 当前节点前面还没有可用变量,请先连接上游节点。 -
- ) : null} - {inputSchema.map((input) => ( -
-
- - {input.type} -
- { - const nextInputs = { - ...inputs, - [input.name]: value, - } - setInputs(nextInputs) - commitChange({ - inputs: nextInputs, - }) - }} - /> - {inputs[input.name] ? ( -
- 已选择:{inputs[input.name].nodeId}.{inputs[input.name].field} + {isConditionNode ? ( + + ) : ( + <> + {inputSchema.length > 0 ? ( +
+
输入映射
+ {availableVariables.length === 0 ? ( +
+ 当前节点前面还没有可用变量,请先连接上游节点。
) : null} - {input.description ? ( -
{input.description}
- ) : null} + {inputSchema.map((input) => ( +
+
+ + {input.type} +
+ { + const nextInputs = { + ...inputs, + [input.name]: value, + } + setInputs(nextInputs) + commitChange({ + inputs: nextInputs, + }) + }} + /> + {inputs[input.name] ? ( +
+ 已选择:{inputs[input.name].nodeId}.{inputs[input.name].field} +
+ ) : null} + {input.description ? ( +
{input.description}
+ ) : null} +
+ ))}
- ))} -
- ) : null} -
- 高级配置 JSON -
-