Upload project files
Browse files
src/components/thermodynamic-panel.tsx
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
| 4 |
+
import type { ThermodynamicState } from "@/lib/consciousness-types";
|
| 5 |
+
import { Flame, Cpu, Zap, Activity } from "lucide-react";
|
| 6 |
+
import { motion } from "framer-motion";
|
| 7 |
+
|
| 8 |
+
function ThermometerBar({
|
| 9 |
+
value,
|
| 10 |
+
max,
|
| 11 |
+
label,
|
| 12 |
+
icon: Icon,
|
| 13 |
+
unit,
|
| 14 |
+
colorStops,
|
| 15 |
+
}: {
|
| 16 |
+
value: number;
|
| 17 |
+
max: number;
|
| 18 |
+
label: string;
|
| 19 |
+
icon: React.ElementType;
|
| 20 |
+
unit: string;
|
| 21 |
+
colorStops: [number, string][];
|
| 22 |
+
}) {
|
| 23 |
+
const pct = Math.min((value / max) * 100, 100);
|
| 24 |
+
|
| 25 |
+
// Determine color from stops
|
| 26 |
+
const color = colorStops.reduce((acc, [threshold, c]) => {
|
| 27 |
+
return pct >= threshold ? c : acc;
|
| 28 |
+
}, colorStops[0][1]);
|
| 29 |
+
|
| 30 |
+
return (
|
| 31 |
+
<div className="space-y-1">
|
| 32 |
+
<div className="flex items-center justify-between text-[10px]">
|
| 33 |
+
<span className="flex items-center gap-1 text-muted-foreground">
|
| 34 |
+
<Icon className="w-3 h-3" style={{ color }} />
|
| 35 |
+
{label}
|
| 36 |
+
</span>
|
| 37 |
+
<span className="font-mono font-bold" style={{ color }}>
|
| 38 |
+
{value}
|
| 39 |
+
{unit}
|
| 40 |
+
</span>
|
| 41 |
+
</div>
|
| 42 |
+
<div className="h-2 rounded-full bg-muted/30 overflow-hidden">
|
| 43 |
+
<motion.div
|
| 44 |
+
className="h-full rounded-full"
|
| 45 |
+
style={{
|
| 46 |
+
background: `linear-gradient(90deg, ${colorStops[0][1]}, ${color})`,
|
| 47 |
+
}}
|
| 48 |
+
initial={{ width: 0 }}
|
| 49 |
+
animate={{ width: `${pct}%` }}
|
| 50 |
+
transition={{ duration: 0.8, ease: "easeOut" }}
|
| 51 |
+
/>
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
export function ThermodynamicPanel({
|
| 58 |
+
data,
|
| 59 |
+
}: {
|
| 60 |
+
data: ThermodynamicState;
|
| 61 |
+
}) {
|
| 62 |
+
return (
|
| 63 |
+
<Card className="bg-card/60 border-border/30 backdrop-blur-sm">
|
| 64 |
+
<CardHeader className="pb-2 px-4 pt-3">
|
| 65 |
+
<CardTitle className="text-xs flex items-center gap-1.5">
|
| 66 |
+
<Flame className="w-3.5 h-3.5 text-muted-foreground" />
|
| 67 |
+
Thermodynamic Sweat (aPCI)
|
| 68 |
+
</CardTitle>
|
| 69 |
+
</CardHeader>
|
| 70 |
+
<CardContent className="px-4 pb-3 space-y-3">
|
| 71 |
+
<ThermometerBar
|
| 72 |
+
value={data.vramLoad}
|
| 73 |
+
max={100}
|
| 74 |
+
label="VRAM Load"
|
| 75 |
+
icon={Cpu}
|
| 76 |
+
unit="%"
|
| 77 |
+
colorStops={[
|
| 78 |
+
[0, "#71717a"],
|
| 79 |
+
[50, "#52525b"],
|
| 80 |
+
[80, "#3f3f46"],
|
| 81 |
+
]}
|
| 82 |
+
/>
|
| 83 |
+
<ThermometerBar
|
| 84 |
+
value={data.gpuPowerDraw}
|
| 85 |
+
max={350}
|
| 86 |
+
label="GPU Power"
|
| 87 |
+
icon={Zap}
|
| 88 |
+
unit="W"
|
| 89 |
+
colorStops={[
|
| 90 |
+
[0, "#71717a"],
|
| 91 |
+
[40, "#52525b"],
|
| 92 |
+
[70, "#3f3f46"],
|
| 93 |
+
]}
|
| 94 |
+
/>
|
| 95 |
+
<ThermometerBar
|
| 96 |
+
value={data.latencyMs}
|
| 97 |
+
max={2000}
|
| 98 |
+
label="Latency"
|
| 99 |
+
icon={Activity}
|
| 100 |
+
unit="ms"
|
| 101 |
+
colorStops={[
|
| 102 |
+
[0, "#71717a"],
|
| 103 |
+
[30, "#52525b"],
|
| 104 |
+
[60, "#3f3f46"],
|
| 105 |
+
]}
|
| 106 |
+
/>
|
| 107 |
+
<ThermometerBar
|
| 108 |
+
value={Math.round(data.predictionError * 100)}
|
| 109 |
+
max={100}
|
| 110 |
+
label="Pred. Error"
|
| 111 |
+
icon={Flame}
|
| 112 |
+
unit="%"
|
| 113 |
+
colorStops={[
|
| 114 |
+
[0, "#71717a"],
|
| 115 |
+
[30, "#52525b"],
|
| 116 |
+
[60, "#3f3f46"],
|
| 117 |
+
]}
|
| 118 |
+
/>
|
| 119 |
+
</CardContent>
|
| 120 |
+
</Card>
|
| 121 |
+
);
|
| 122 |
+
}
|