From 4d18dc21e9c7192d0511ff10403c664a01438a91 Mon Sep 17 00:00:00 2001 From: mlogclub Date: Mon, 22 Jun 2026 19:38:59 +0800 Subject: [PATCH] feat: enhance WorkflowEditor with improved node selection and validation display --- .../_components/config-workbench.tsx | 80 +++++++++---------- .../_components/workflow-editor.tsx | 69 ++++++++-------- 2 files changed, 74 insertions(+), 75 deletions(-) diff --git a/web/app/dashboard/ai-agents/_components/config-workbench.tsx b/web/app/dashboard/ai-agents/_components/config-workbench.tsx index 07a9652..98d93d4 100644 --- a/web/app/dashboard/ai-agents/_components/config-workbench.tsx +++ b/web/app/dashboard/ai-agents/_components/config-workbench.tsx @@ -530,14 +530,38 @@ export function AIAgentConfigWorkbench({
- - + {activeSection === "workflow" ? ( + <> + {validation ? ( + + {validation.valid ? "校验通过" : `${validation.errors.length} 个问题`} + + ) : null} + + + + + ) : ( + <> + + + + )}
@@ -753,40 +777,12 @@ export function AIAgentConfigWorkbench({ ) : null} {activeSection === "workflow" ? ( -
-
-
-
主会话流程
-
-
- {validation ? ( - - {validation.valid ? "校验通过" : `${validation.errors.length} 个问题`} - - ) : null} - - - -
-
-
- -
-
+ ) : null} {activeSection === "handoff" ? ( diff --git a/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx b/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx index 0fd5715..76f419b 100644 --- a/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx +++ b/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx @@ -24,7 +24,6 @@ import { AlertCircleIcon, CheckCircle2Icon } from "lucide-react" import { useCallback, useEffect, useMemo, useRef, useState } from "react" import { Badge } from "@/components/ui/badge" -import { Button } from "@/components/ui/button" import { Popover, PopoverContent, @@ -188,6 +187,10 @@ export function WorkflowEditor({ onDefinitionChange(toApiDefinition(draft) as AIWorkflowDefinition) }, [draft, onDefinitionChange]) + useEffect(() => { + onDefinitionChange(toApiDefinition(draft) as AIWorkflowDefinition) + }, [draft, onDefinitionChange]) + const onConnect = useCallback( (connection: Connection) => { if (!connection.source || !connection.target) { @@ -361,7 +364,7 @@ export function WorkflowEditor({ - +
setSelectedNodeId(node.id)} + onNodeClick={(event, node) => { + event.stopPropagation() + setSelectedNodeId(node.id) + }} + onEdgeClick={() => setSelectedNodeId(null)} + onPaneClick={() => setSelectedNodeId(null)} fitView fitViewOptions={fitViewOptions} minZoom={0.45} @@ -406,36 +414,31 @@ export function WorkflowEditor({ ) : null}
- - - - + {selectedNode ? ( + <> + + + + + + ) : null} ) }