"use client"; import { useEffect, useState } from "react"; import { X, Bot } from "lucide-react"; import { AgentNodeData, LLMModel } from "@/app/types/council"; import { useCouncilStore } from "@/app/store/council-store"; const MODELS: { value: LLMModel; label: string }[] = [ { value: "claude-3-5-sonnet", label: "Claude 3.5 Sonnet" }, { value: "gpt-4o", label: "GPT-4o" }, { value: "local", label: "Lokal" }, ]; // Right-side panel shown when an AgentNode is selected export function NodeSettingsPanel() { const selectedNodeId = useCouncilStore((s) => s.selectedNodeId); const nodes = useCouncilStore((s) => s.nodes); const updateNodeData = useCouncilStore((s) => s.updateNodeData); const selectNode = useCouncilStore((s) => s.selectNode); const node = nodes.find((n) => n.id === selectedNodeId); const data = node?.data as AgentNodeData | undefined; // Local draft to avoid re-renders on every keystroke const [draft, setDraft] = useState(null); useEffect(() => { setDraft(data ?? null); }, [selectedNodeId, data]); if (!selectedNodeId || !draft) return null; const commit = (partial: Partial) => { const updated = { ...draft, ...partial }; setDraft(updated); updateNodeData(selectedNodeId, partial); }; return (