From 1525f2e919b36d17ac4dc3dc18182a1fb850e3d3 Mon Sep 17 00:00:00 2001 From: mlogclub Date: Sun, 28 Jun 2026 12:44:38 +0800 Subject: [PATCH] feat: remove WorkflowSimpleNodeContent and update WorkflowNodeCard for optional children rendering --- .../_components/flowgram-node-registries.tsx | 5 +-- .../_components/workflow-node-card.tsx | 4 +- .../workflow-simple-node-content.tsx | 42 ------------------- 3 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 web/app/dashboard/ai-workflows/_components/workflow-simple-node-content.tsx diff --git a/web/app/dashboard/ai-workflows/_components/flowgram-node-registries.tsx b/web/app/dashboard/ai-workflows/_components/flowgram-node-registries.tsx index 5b13bef..0f6bfc7 100644 --- a/web/app/dashboard/ai-workflows/_components/flowgram-node-registries.tsx +++ b/web/app/dashboard/ai-workflows/_components/flowgram-node-registries.tsx @@ -3,7 +3,6 @@ import { Field, type WorkflowNodeRegistry, useNodeRender } from "@flowgram.ai/fr import type { AIWorkflowNodeSpec } from "@/lib/api/admin" import { WorkflowConditionNodeContent } from "./workflow-condition-node-content" import { WorkflowNodeCard } from "./workflow-node-card" -import { WorkflowSimpleNodeContent } from "./workflow-simple-node-content" export function buildFlowgramNodeRegistries(nodeSpecs: AIWorkflowNodeSpec[]): WorkflowNodeRegistry[] { const seen = new Set() @@ -89,9 +88,7 @@ function FlowgramNodeForm({ /> )} - ) : ( - - )} + ) : null} )} diff --git a/web/app/dashboard/ai-workflows/_components/workflow-node-card.tsx b/web/app/dashboard/ai-workflows/_components/workflow-node-card.tsx index fc0bd2c..014f806 100644 --- a/web/app/dashboard/ai-workflows/_components/workflow-node-card.tsx +++ b/web/app/dashboard/ai-workflows/_components/workflow-node-card.tsx @@ -18,7 +18,7 @@ export function WorkflowNodeCard({ spec?: AIWorkflowNodeSpec selected: boolean width?: "normal" | "wide" - children: ReactNode + children?: ReactNode }) { const meta = getWorkflowNodeMeta(nodeType) @@ -46,7 +46,7 @@ export function WorkflowNodeCard({ {spec.description} ) : null} -
{children}
+ {children ?
{children}
: null} ) diff --git a/web/app/dashboard/ai-workflows/_components/workflow-simple-node-content.tsx b/web/app/dashboard/ai-workflows/_components/workflow-simple-node-content.tsx deleted file mode 100644 index c094506..0000000 --- a/web/app/dashboard/ai-workflows/_components/workflow-simple-node-content.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import type { AIWorkflowNodeSpec } from "@/lib/api/admin" - -export function WorkflowSimpleNodeContent({ - spec, -}: { - spec?: AIWorkflowNodeSpec -}) { - const inputCount = spec?.inputSchema?.length ?? 0 - const outputCount = spec?.outputSchema?.length ?? 0 - const hasSchema = inputCount > 0 || outputCount > 0 - - if (!hasSchema && !spec?.riskLevel && !spec?.interruptible) { - return ( -
- 通过右侧面板配置节点参数 -
- ) - } - - return ( -
- {inputCount > 0 ? : null} - {outputCount > 0 ? : null} - {spec?.riskLevel ? : null} - {spec?.interruptible ? : null} -
- ) -} - -function NodeInfoChip({ label }: { label: string }) { - return ( - - {label} - - ) -} - -function riskLevelLabel(riskLevel: AIWorkflowNodeSpec["riskLevel"]) { - if (riskLevel === "high") return "高风险" - if (riskLevel === "medium") return "中风险" - return "低风险" -}