feat: enhance FlowgramNodeForm and WorkflowNodeCard by removing unused spec prop and adding node description display
This commit is contained in:
@@ -49,7 +49,6 @@ export function buildFlowgramNodeRegistries(nodeSpecs: AIWorkflowNodeSpec[]): Wo
|
||||
<FlowgramNodeForm
|
||||
nodeType={spec.type}
|
||||
fallbackTitle={spec.title || spec.type}
|
||||
spec={spec}
|
||||
/>
|
||||
),
|
||||
},
|
||||
@@ -59,11 +58,9 @@ export function buildFlowgramNodeRegistries(nodeSpecs: AIWorkflowNodeSpec[]): Wo
|
||||
function FlowgramNodeForm({
|
||||
nodeType,
|
||||
fallbackTitle,
|
||||
spec,
|
||||
}: {
|
||||
nodeType: string
|
||||
fallbackTitle: string
|
||||
spec?: AIWorkflowNodeSpec
|
||||
}) {
|
||||
const { node, selected } = useNodeRender()
|
||||
const nodeId = String(node.id ?? "")
|
||||
@@ -74,7 +71,6 @@ function FlowgramNodeForm({
|
||||
<WorkflowNodeCard
|
||||
nodeType={nodeType}
|
||||
title={field.value || fallbackTitle}
|
||||
spec={spec}
|
||||
selected={selected}
|
||||
width={nodeType === "condition" ? "wide" : "normal"}
|
||||
>
|
||||
|
||||
@@ -150,6 +150,15 @@ export function NodeConfigPanel({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{nodeSpec?.description ? (
|
||||
<div className="space-y-2">
|
||||
<Label>节点说明</Label>
|
||||
<div className="rounded-md border bg-muted/30 px-3 py-2 text-xs leading-5 text-muted-foreground">
|
||||
{nodeSpec.description}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{inputSchema.length > 0 ? (
|
||||
<div className="space-y-3">
|
||||
<div className="text-sm font-medium">输入</div>
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import type { AIWorkflowNodeSpec } from "@/lib/api/admin"
|
||||
import { WorkflowNodeIcon } from "./workflow-node-icon"
|
||||
|
||||
export function WorkflowNodeCard({
|
||||
nodeType,
|
||||
title,
|
||||
spec,
|
||||
selected,
|
||||
width = "normal",
|
||||
children,
|
||||
}: {
|
||||
nodeType: string
|
||||
title: string
|
||||
spec?: AIWorkflowNodeSpec
|
||||
selected: boolean
|
||||
width?: "normal" | "wide"
|
||||
children?: ReactNode
|
||||
@@ -38,11 +35,6 @@ export function WorkflowNodeCard({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{spec?.description ? (
|
||||
<div className="mx-3 mb-2 line-clamp-2 rounded-lg bg-muted/45 px-2 py-1.5 text-xs leading-4 text-muted-foreground">
|
||||
{spec.description}
|
||||
</div>
|
||||
) : null}
|
||||
{children ? <div className="border-t bg-muted/20 px-3 py-2.5">{children}</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user