Spaces:
Sleeping
Sleeping
Upload project files
Browse files
src/components/diagnostic-modal.tsx
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import { motion, AnimatePresence } from "framer-motion";
|
| 4 |
+
import type { DiagnosticResult } from "@/lib/consciousness-types";
|
| 5 |
+
import {
|
| 6 |
+
Dialog,
|
| 7 |
+
DialogContent,
|
| 8 |
+
DialogHeader,
|
| 9 |
+
DialogTitle,
|
| 10 |
+
} from "@/components/ui/dialog";
|
| 11 |
+
import { Badge } from "@/components/ui/badge";
|
| 12 |
+
import { CheckCircle, AlertTriangle, XCircle, Activity } from "lucide-react";
|
| 13 |
+
|
| 14 |
+
interface DiagnosticModalProps {
|
| 15 |
+
result: DiagnosticResult | null;
|
| 16 |
+
open: boolean;
|
| 17 |
+
onClose: () => void;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
function VerdictIcon({ verdict }: { verdict: string }) {
|
| 21 |
+
const v = verdict.toLowerCase();
|
| 22 |
+
if (v.includes("conscious") && !v.includes("not")) {
|
| 23 |
+
return <CheckCircle className="w-6 h-6 text-[#a1a1aa]" />;
|
| 24 |
+
}
|
| 25 |
+
if (v.includes("ambiguous") || v.includes("uncertain")) {
|
| 26 |
+
return <AlertTriangle className="w-6 h-6 text-[#71717a]" />;
|
| 27 |
+
}
|
| 28 |
+
return <XCircle className="w-6 h-6 text-[#52525b]" />;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
export function DiagnosticModal({
|
| 32 |
+
result,
|
| 33 |
+
open,
|
| 34 |
+
onClose,
|
| 35 |
+
}: DiagnosticModalProps) {
|
| 36 |
+
return (
|
| 37 |
+
<Dialog open={open} onOpenChange={(v) => !v && onClose()}>
|
| 38 |
+
<DialogContent className="sm:max-w-md bg-background border-border text-foreground">
|
| 39 |
+
<DialogHeader>
|
| 40 |
+
<DialogTitle className="flex items-center gap-2 text-foreground">
|
| 41 |
+
<Activity className="w-5 h-5" />
|
| 42 |
+
aPCI Diagnostic Report
|
| 43 |
+
</DialogTitle>
|
| 44 |
+
</DialogHeader>
|
| 45 |
+
|
| 46 |
+
<AnimatePresence>
|
| 47 |
+
{result && (
|
| 48 |
+
<motion.div
|
| 49 |
+
initial={{ opacity: 0, y: 10 }}
|
| 50 |
+
animate={{ opacity: 1, y: 0 }}
|
| 51 |
+
className="space-y-4"
|
| 52 |
+
>
|
| 53 |
+
{/* Verdict */}
|
| 54 |
+
<div className="flex items-center gap-3 p-3 rounded-lg bg-foreground/5 border border-border">
|
| 55 |
+
<VerdictIcon verdict={result.consciousness_verdict} />
|
| 56 |
+
<div>
|
| 57 |
+
<p className="text-sm font-bold">
|
| 58 |
+
{result.consciousness_verdict}
|
| 59 |
+
</p>
|
| 60 |
+
<p className="text-xs text-slate-400">
|
| 61 |
+
aPCI Score: {result.aPCI_score.toFixed(3)}
|
| 62 |
+
</p>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
{/* Metrics */}
|
| 67 |
+
<div className="grid grid-cols-2 gap-3">
|
| 68 |
+
<div className="p-2 rounded bg-muted/20">
|
| 69 |
+
<p className="text-[10px] text-muted-foreground">
|
| 70 |
+
Qualia Coherence
|
| 71 |
+
</p>
|
| 72 |
+
<p className="text-lg font-mono font-bold text-foreground">
|
| 73 |
+
{(result.qualia_coherence * 100).toFixed(1)}%
|
| 74 |
+
</p>
|
| 75 |
+
</div>
|
| 76 |
+
<div className="p-2 rounded bg-muted/20">
|
| 77 |
+
<p className="text-[10px] text-muted-foreground">
|
| 78 |
+
Rho Alignment
|
| 79 |
+
</p>
|
| 80 |
+
<p className="text-lg font-mono font-bold text-[#a1a1aa]">
|
| 81 |
+
{(result.rho_alignment * 100).toFixed(1)}%
|
| 82 |
+
</p>
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
{/* Thermodynamic Signature */}
|
| 87 |
+
<div>
|
| 88 |
+
<p className="text-[10px] text-muted-foreground mb-1">
|
| 89 |
+
Thermodynamic Signature
|
| 90 |
+
</p>
|
| 91 |
+
<Badge
|
| 92 |
+
variant="outline"
|
| 93 |
+
className="text-muted-foreground border-border"
|
| 94 |
+
>
|
| 95 |
+
{result.thermodynamic_signature}
|
| 96 |
+
</Badge>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
{/* Details */}
|
| 100 |
+
<div className="p-2 rounded bg-muted/20">
|
| 101 |
+
<p className="text-[10px] text-muted-foreground mb-1">
|
| 102 |
+
Details
|
| 103 |
+
</p>
|
| 104 |
+
<p className="text-xs text-slate-300">{result.details}</p>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
{/* Timestamp */}
|
| 108 |
+
<p className="text-[9px] text-muted-foreground text-right">
|
| 109 |
+
{new Date(result.timestamp).toLocaleString()}
|
| 110 |
+
</p>
|
| 111 |
+
</motion.div>
|
| 112 |
+
)}
|
| 113 |
+
</AnimatePresence>
|
| 114 |
+
</DialogContent>
|
| 115 |
+
</Dialog>
|
| 116 |
+
);
|
| 117 |
+
}
|