Upload components/PropertiesPanel.jsx with huggingface_hub
Browse files
components/PropertiesPanel.jsx
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function PropertiesPanel({ selectedNode, onUpdateNode, onDeleteNode }) {
|
| 2 |
+
if (!selectedNode) {
|
| 3 |
+
return (
|
| 4 |
+
<div className="flex flex-col h-full">
|
| 5 |
+
<h2 className="font-semibold mb-4 pb-2 border-b border-border">Properties</h2>
|
| 6 |
+
<div className="flex-1 flex items-center justify-center text-muted text-sm text-center px-4">
|
| 7 |
+
Select a node to configure its parameters.
|
| 8 |
+
</div>
|
| 9 |
+
</div>
|
| 10 |
+
);
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
const handleChange = (field, value) => {
|
| 14 |
+
onUpdateNode(selectedNode.id, { [field]: value });
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
return (
|
| 18 |
+
<div className="flex flex-col h-full">
|
| 19 |
+
<h2 className="font-semibold mb-4 pb-2 border-b border-border">Properties</h2>
|
| 20 |
+
|
| 21 |
+
<div className="space-y-4 flex-1 overflow-y-auto pr-2">
|
| 22 |
+
<div className="space-y-1">
|
| 23 |
+
<label className="text-xs text-muted uppercase tracking-wider">Node ID</label>
|
| 24 |
+
<input
|
| 25 |
+
type="text"
|
| 26 |
+
value={selectedNode.id}
|
| 27 |
+
disabled
|
| 28 |
+
className="w-full bg-surface border border-border rounded px-2 py-1.5 text-sm text-muted cursor-not-allowed"
|
| 29 |
+
/>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
<div className="space-y-1">
|
| 33 |
+
<label className="text-xs text-muted uppercase tracking-wider">Label</label>
|
| 34 |
+
<input
|
| 35 |
+
type="text"
|
| 36 |
+
value={selectedNode.label}
|
| 37 |
+
onChange={(e) => handleChange('label', e.target.value)}
|
| 38 |
+
className="w-full bg-surface border border-border rounded px-2 py-1.5 text-sm focus:border-primary focus:outline-none transition-colors"
|
| 39 |
+
/>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
{selectedNode.type === 'llm' && (
|
| 43 |
+
<>
|
| 44 |
+
<div className="space-y-1">
|
| 45 |
+
<label className="text-xs text-muted uppercase tracking-wider">Model</label>
|
| 46 |
+
<select
|
| 47 |
+
value={selectedNode.model}
|
| 48 |
+
onChange={(e) => handleChange('model', e.target.value)}
|
| 49 |
+
className="w-full bg-surface border border-border rounded px-2 py-1.5 text-sm focus:border-primary focus:outline-none transition-colors"
|
| 50 |
+
>
|
| 51 |
+
<option value="gpt-4-turbo">GPT-4 Turbo</option>
|
| 52 |
+
<option value="gpt-3.5-turbo">GPT-3.5 Turbo</option>
|
| 53 |
+
<option value="claude-3-opus">Claude 3 Opus</option>
|
| 54 |
+
<option value="llama-3-70b">Llama 3 70B</option>
|
| 55 |
+
</select>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
<div className="space-y-1">
|
| 59 |
+
<label className="text-xs text-muted uppercase tracking-wider">Temperature: {selectedNode.temp}</label>
|
| 60 |
+
<input
|
| 61 |
+
type="range"
|
| 62 |
+
min="0"
|
| 63 |
+
max="1"
|
| 64 |
+
step="0.1"
|
| 65 |
+
value={selectedNode.temp}
|
| 66 |
+
onChange={(e) => handleChange('temp', parseFloat(e.target.value))}
|
| 67 |
+
className="w-full accent-primary"
|
| 68 |
+
/>
|
| 69 |
+
<div className="flex justify-between text-[10px] text-muted">
|
| 70 |
+
<span>Precise</span>
|
| 71 |
+
<span>Creative</span>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
</>
|
| 75 |
+
)}
|
| 76 |
+
|
| 77 |
+
<div className="space-y-1">
|
| 78 |
+
<label className="text-xs text-muted uppercase tracking-wider">System Prompt</label>
|
| 79 |
+
<textarea
|
| 80 |
+
value={selectedNode.prompt}
|
| 81 |
+
onChange={(e) => handleChange('prompt', e.target.value)}
|
| 82 |
+
placeholder="Enter system instructions..."
|
| 83 |
+
className="w-full bg-surface border border-border rounded px-2 py-1.5 text-sm font-mono h-24 focus:border-primary focus:outline-none resize-none transition-colors"
|
| 84 |
+
/>
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
|
| 88 |
+
<div className="pt-4 border-t border-border mt-4 space-y-2">
|
| 89 |
+
<button
|
| 90 |
+
onClick={() => onDeleteNode(selectedNode.id)}
|
| 91 |
+
className="w-full py-2 rounded border border-red-900/50 text-red-400 hover:bg-red-900/20 text-sm transition-colors"
|
| 92 |
+
>
|
| 93 |
+
Delete Node
|
| 94 |
+
</button>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
);
|
| 98 |
+
}
|