From 9136018273fb3929a66981b733b4cc52be48b6dd Mon Sep 17 00:00:00 2001 From: mlogclub Date: Tue, 30 Jun 2026 12:53:22 +0800 Subject: [PATCH] refactor: update layout and styling in WorkflowConfigPanel; enhance panel header and description display --- .../_components/node-config-panel.tsx | 263 +++++++++++------- .../_components/workflow-config-sidebar.tsx | 68 ++--- 2 files changed, 202 insertions(+), 129 deletions(-) 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 f4a1819..f8b976f 100644 --- a/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx +++ b/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx @@ -5,7 +5,6 @@ import { Trash2Icon } from "lucide-react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" -import { Label } from "@/components/ui/label" import { OptionCombobox } from "@/components/option-combobox" import type { AIWorkflowDefinition, AIWorkflowNodeSpec } from "@/lib/api/admin" import { cn } from "@/lib/utils" @@ -41,8 +40,8 @@ const CONDITION_OPERATOR_OPTIONS = [ { value: "empty", label: "为空" }, ] -const cardInputClassName = "h-8 rounded-md border-slate-200 bg-white text-xs shadow-none" -const cardComboboxClassName = "h-8 rounded-md border-slate-200 bg-white text-xs shadow-none" +const inspectorInputClassName = "h-7 rounded-sm border-slate-200 bg-white px-2 text-xs shadow-none" +const inspectorComboboxClassName = "h-7 rounded-sm border-slate-200 bg-white text-xs shadow-none" export function NodeConfigPanel({ node, @@ -108,7 +107,7 @@ export function NodeConfigPanel({ } return ( -
+
{showHeader ? (
@@ -133,23 +132,24 @@ export function NodeConfigPanel({
) : null} -
+
{inputSchema.length > 0 ? ( - -
+ {inputSchema.map((input) => { const value = inputsValues[input.name] return ( -
- + { updateData({ inputsValues: { @@ -159,11 +159,11 @@ export function NodeConfigPanel({ }) }} /> -
+ {input.description ? {input.description} : null} + ) })} -
-
+ ) : null} {showConditionBranches && (node.type === "condition" || branches.length > 0) ? ( @@ -179,22 +179,16 @@ export function NodeConfigPanel({ ) : null} {outputSchema.length > 0 ? ( - -
- {outputSchema.map((output) => { - const item = buildVariableSpecDisplay(output) - return ( -
-
{item.label}
-
{item.subtitle}
- {item.description ? ( -
{item.description}
- ) : null} -
- ) - })} -
-
+ + {outputSchema.map((output) => { + const item = buildVariableSpecDisplay(output) + return ( + + {item.description ? {item.description} : null} + + ) + })} + ) : null}
@@ -238,45 +232,48 @@ export function ConditionBranchConfigPanel({ } return ( -
- -
-
- +
+
+ + updateBranch({ ...branch, targetNodeId })} /> -
+ - -
- + + + + - {branch.default ? ( -
- 默认分支不需要条件表达式,会在其他条件不匹配时执行。 -
- ) : ( - - - - )} + {branch.default ? ( + +
+ 默认分支不需要条件表达式,会在其他条件不匹配时执行。 +
+
+ ) : ( + + + + )} +
) } @@ -301,32 +298,32 @@ function ConditionBranchesEditor({ const targetOptions = buildTargetOptions(nodes, currentNodeId) return ( - + } > {branches.length === 0 ? ( -
+
暂无分支。条件节点需要至少一个默认分支或条件分支。
) : null} -
+
{branches.map((branch) => { return ( -
-
- +
+
+ {branch.default ? "ELSE" : "IF"} onChange({ ...branch, name: event.target.value })} /> {branch.default ? null : ( @@ -342,18 +339,18 @@ function ConditionBranchesEditor({ )}
-
- +
+
目标节点
onChange({ ...branch, targetNodeId })} />
-