feat: enhance workflow editor with new plugins, improved node handling, and UI updates

This commit is contained in:
mlogclub
2026-06-27 21:44:29 +08:00
parent 689acc997c
commit 1472c487ac
7 changed files with 202 additions and 60 deletions
@@ -34,11 +34,9 @@ const iconByType: Record<string, ComponentType<{ className?: string }>> = {
}
export function FlowgramNodeRenderer(props: WorkflowNodeProps) {
const { selected, node } = useNodeRender()
const { selected, node, form } = useNodeRender()
const nodeType = String(node.flowNodeType ?? "")
const Icon = iconByType[nodeType] ?? BotIcon
const nodeJSON = node.toJSON?.() as { data?: { title?: string }; title?: string } | undefined
const title = nodeJSON?.data?.title || nodeJSON?.title || nodeType || "节点"
return (
<WorkflowNodeRenderer
@@ -53,10 +51,7 @@ export function FlowgramNodeRenderer(props: WorkflowNodeProps) {
<div className="mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border bg-muted">
<Icon className="size-4 text-muted-foreground" />
</div>
<div className="min-w-0 flex-1">
<div className="truncate text-sm font-medium leading-5">{title}</div>
<div className="mt-1 truncate text-xs text-muted-foreground">{nodeType}</div>
</div>
{form?.render()}
</div>
</WorkflowNodeRenderer>
)