From 64f6e1686dd72cf49bcbdc8e9c1ed5abb5d34748 Mon Sep 17 00:00:00 2001 From: mlogclub Date: Sun, 28 Jun 2026 17:47:48 +0800 Subject: [PATCH] feat: remove showConfigJSON prop from NodeConfigPanel and WorkflowConfigPanel for cleaner UI --- .../_components/node-config-panel.tsx | 58 ------------------- .../_components/workflow-config-sidebar.tsx | 1 - 2 files changed, 59 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 30e6bba..c18b013 100644 --- a/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx +++ b/web/app/dashboard/ai-workflows/_components/node-config-panel.tsx @@ -1,12 +1,10 @@ "use client" -import { useMemo, useState } from "react" import { Trash2Icon } from "lucide-react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" -import { Textarea } from "@/components/ui/textarea" import { OptionCombobox } from "@/components/option-combobox" import type { AIWorkflowDefinition, AIWorkflowNodeSpec } from "@/lib/api/admin" import { cn } from "@/lib/utils" @@ -46,7 +44,6 @@ export function NodeConfigPanel({ availableVariables, showHeader = true, showConditionBranches = true, - showConfigJSON = true, onChange, onDelete, }: { @@ -57,7 +54,6 @@ export function NodeConfigPanel({ branchSummaries?: WorkflowBranchSummary[] showHeader?: boolean showConditionBranches?: boolean - showConfigJSON?: boolean onChange: (nodeId: string, data: AIWorkflowDefinition["nodes"][number]["data"]) => void onDelete?: (nodeId: string) => void }) { @@ -184,65 +180,11 @@ export function NodeConfigPanel({ onDelete={deleteBranch} /> ) : null} - - {showConfigJSON ? ( - updateData({ config: nextConfig })} - /> - ) : null} ) } -function NodeConfigJSONField({ - nodeId, - config, - onChange, -}: { - nodeId: string - config: Record - onChange: (config: Record) => void -}) { - const [configText, setConfigText] = useState(() => JSON.stringify(config, null, 2)) - const configError = useMemo(() => { - try { - const parsed = JSON.parse(configText || "{}") - return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? "" : "配置必须是 JSON 对象" - } catch { - return "JSON 格式错误" - } - }, [configText]) - - return ( -
- -