"use client"; import { ImagePlus, MonitorSmartphone, Sparkles, Video } from "lucide-react"; import type { AgentSlotNodeData, CanvasNode } from "@/types/canvas"; import { cn } from "@/lib/utils"; interface AgentSlotNodeProps { node: CanvasNode; isSelected: boolean; } function getSlotIcon(slotType: AgentSlotNodeData["slotType"]) { if (slotType === "video") return Video; if (slotType === "ui-screen") return MonitorSmartphone; return ImagePlus; } function getSlotTypeLabel(slotType: AgentSlotNodeData["slotType"]) { if (slotType === "video") return "视频槽位"; if (slotType === "ui-screen") return "UI 槽位"; return "图片槽位"; } function getStatusLabel(status: AgentSlotNodeData["status"]) { if (status === "generating") return "生成中"; if (status === "completed") return "已填充"; if (status === "failed") return "失败"; return "等待生成"; } export function AgentSlotNode({ node, isSelected }: AgentSlotNodeProps) { const data = node.data as AgentSlotNodeData; const slotType = data.slotType || "image"; const SlotIcon = getSlotIcon(slotType); const filledCount = Array.isArray(data.filledNodeIds) ? data.filledNodeIds.length : 0; return (
{data.status === "generating" ? ( ) : ( )}
{data.label || getSlotTypeLabel(slotType)}
{getStatusLabel(data.status)} {filledCount > 0 ? ` · ${filledCount} 个结果` : ""}
{data.aspectRatio || "1:1"} {data.fillPolicy === "append-version" ? "追加版本" : data.fillPolicy === "replace-existing" ? "允许替换" : "填充空槽"}
); }