Add sample diagram preview, upload hints, and block taglines
Browse filesSample circuit preview:
- Backend SampleCircuit now carries depth/size/params/diagram_text so the
sample list exposes enough metadata to preview without a second round trip.
- Each sample button has an eye-toggle that expands an ASCII circuit
diagram inline. The Loaded card has a matching toggle.
Upload affordance:
- Button label is now 'upload .qpy / .qasm' with a descriptive title.
- Empty Loaded card explains what formats are accepted and offers a
'download a sample' link so new users can try the upload flow with a
known-good file.
- New GET /api/circuits/samples/{key}/download serves the raw .qpy.
Block discoverability:
- Added NodeSpec.tagline (3-5 word human-friendly caption).
- Palette tiles show the tagline under the label (tile height grew from
52px to 68px, width 92px -> 108px).
- Canvas QNode also renders the tagline so users don't need the tooltip
or the tour to recall what each block does.
- backend/app/routes/circuits.py +18 -0
- backend/app/schemas.py +4 -0
- backend/app/services/circuit_service.py +4 -0
- frontend/src/components/CircuitPicker.tsx +122 -29
- frontend/src/components/NodePalette.tsx +4 -1
- frontend/src/components/QNode.tsx +6 -0
- frontend/src/lib/api.ts +4 -0
- frontend/src/lib/nodeCatalog.ts +15 -3
|
@@ -3,7 +3,9 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from fastapi import APIRouter, HTTPException, UploadFile, File
|
|
|
|
| 6 |
|
|
|
|
| 7 |
from app.schemas import CircuitInfo, SampleCircuit
|
| 8 |
from app.services.circuit_service import (
|
| 9 |
CircuitNotFoundError,
|
|
@@ -32,6 +34,22 @@ def load_sample_circuit(key: str) -> CircuitInfo:
|
|
| 32 |
return summarize(qc, circuit_id)
|
| 33 |
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
@router.post("/circuits/upload", response_model=CircuitInfo)
|
| 36 |
async def upload_circuit(file: UploadFile = File(...)) -> CircuitInfo:
|
| 37 |
data = await file.read()
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from fastapi import APIRouter, HTTPException, UploadFile, File
|
| 6 |
+
from fastapi.responses import FileResponse
|
| 7 |
|
| 8 |
+
from app.config import SAMPLE_CIRCUITS_DIR
|
| 9 |
from app.schemas import CircuitInfo, SampleCircuit
|
| 10 |
from app.services.circuit_service import (
|
| 11 |
CircuitNotFoundError,
|
|
|
|
| 34 |
return summarize(qc, circuit_id)
|
| 35 |
|
| 36 |
|
| 37 |
+
@router.get("/circuits/samples/{key}/download")
|
| 38 |
+
def download_sample_qpy(key: str):
|
| 39 |
+
"""Serve the raw .qpy file for a built-in sample so users can try the
|
| 40 |
+
upload flow with a known-good file without writing Qiskit code."""
|
| 41 |
+
# Only allow bare filenames to avoid path traversal.
|
| 42 |
+
safe = key.replace("/", "").replace("\\", "").replace("..", "")
|
| 43 |
+
path = SAMPLE_CIRCUITS_DIR / f"{safe}.qpy"
|
| 44 |
+
if not path.exists():
|
| 45 |
+
raise HTTPException(status_code=404, detail=f"No sample circuit named {key!r}")
|
| 46 |
+
return FileResponse(
|
| 47 |
+
path,
|
| 48 |
+
media_type="application/octet-stream",
|
| 49 |
+
filename=f"{safe}.qpy",
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
@router.post("/circuits/upload", response_model=CircuitInfo)
|
| 54 |
async def upload_circuit(file: UploadFile = File(...)) -> CircuitInfo:
|
| 55 |
data = await file.read()
|
|
@@ -30,6 +30,10 @@ class SampleCircuit(BaseModel):
|
|
| 30 |
display_name: str
|
| 31 |
description: str
|
| 32 |
num_qubits: int
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
source: Literal["qpy", "builtin"] = "qpy"
|
| 34 |
|
| 35 |
|
|
|
|
| 30 |
display_name: str
|
| 31 |
description: str
|
| 32 |
num_qubits: int
|
| 33 |
+
depth: int = 0
|
| 34 |
+
size: int = 0
|
| 35 |
+
num_parameters: int = 0
|
| 36 |
+
diagram_text: str = ""
|
| 37 |
source: Literal["qpy", "builtin"] = "qpy"
|
| 38 |
|
| 39 |
|
|
@@ -154,6 +154,10 @@ def discover_samples(sample_dir: Path = SAMPLE_CIRCUITS_DIR) -> list[SampleCircu
|
|
| 154 |
display_name=qc.name or path.stem,
|
| 155 |
description=_describe(qc, path.stem),
|
| 156 |
num_qubits=qc.num_qubits,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
source="qpy",
|
| 158 |
)
|
| 159 |
ordered: list[SampleCircuit] = []
|
|
|
|
| 154 |
display_name=qc.name or path.stem,
|
| 155 |
description=_describe(qc, path.stem),
|
| 156 |
num_qubits=qc.num_qubits,
|
| 157 |
+
depth=qc.depth(),
|
| 158 |
+
size=qc.size(),
|
| 159 |
+
num_parameters=qc.num_parameters,
|
| 160 |
+
diagram_text=str(qc.draw(output="text", fold=80)),
|
| 161 |
source="qpy",
|
| 162 |
)
|
| 163 |
ordered: list[SampleCircuit] = []
|
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { useEffect, useRef, useState } from "react";
|
| 2 |
-
import { FileUp, Loader2 } from "lucide-react";
|
| 3 |
import { api, type CircuitInfo, type SampleCircuit } from "../lib/api";
|
| 4 |
import { useApp } from "../lib/store";
|
| 5 |
|
|
@@ -7,6 +7,7 @@ export function CircuitPicker() {
|
|
| 7 |
const [samples, setSamples] = useState<SampleCircuit[]>([]);
|
| 8 |
const [busy, setBusy] = useState<string | null>(null);
|
| 9 |
const [err, setErr] = useState<string | null>(null);
|
|
|
|
| 10 |
const circuit = useApp((s) => s.circuit);
|
| 11 |
const setCircuit = useApp((s) => s.setCircuit);
|
| 12 |
const fileRef = useRef<HTMLInputElement>(null);
|
|
@@ -53,14 +54,14 @@ export function CircuitPicker() {
|
|
| 53 |
<button
|
| 54 |
className="btn-ghost"
|
| 55 |
onClick={() => fileRef.current?.click()}
|
| 56 |
-
title="Upload
|
| 57 |
>
|
| 58 |
-
<FileUp className="w-3 h-3" /> upload
|
| 59 |
</button>
|
| 60 |
<input
|
| 61 |
ref={fileRef}
|
| 62 |
type="file"
|
| 63 |
-
accept=".qpy,.qasm"
|
| 64 |
hidden
|
| 65 |
onChange={(e) => e.target.files?.[0] && onUpload(e.target.files[0])}
|
| 66 |
/>
|
|
@@ -72,43 +73,94 @@ export function CircuitPicker() {
|
|
| 72 |
<div className="text-[11px] text-mute leading-snug mb-2">
|
| 73 |
Pick a sample circuit below. It becomes the{" "}
|
| 74 |
<span className="text-ink">Input circuit</span> block in your pipeline.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
</div>
|
| 76 |
<div className="text-[11px] text-mute uppercase tracking-wider mb-1">Samples</div>
|
| 77 |
{samples.map((s) => {
|
| 78 |
const active = circuit?.name === s.display_name;
|
|
|
|
| 79 |
return (
|
| 80 |
-
<
|
| 81 |
key={s.key}
|
| 82 |
-
|
| 83 |
-
className={`w-full text-left px-2 py-1.5 rounded-md border transition-colors ${
|
| 84 |
active
|
| 85 |
? "bg-accent/10 border-accent/50"
|
| 86 |
: "border-transparent hover:bg-surfaceAlt hover:border-edge"
|
| 87 |
}`}
|
| 88 |
-
disabled={busy === s.key}
|
| 89 |
>
|
| 90 |
-
<div className="flex items-
|
| 91 |
-
<
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
}
|
| 95 |
>
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
)}
|
| 105 |
</div>
|
| 106 |
-
{s.
|
| 107 |
-
<div className="
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
</div>
|
| 110 |
)}
|
| 111 |
-
</
|
| 112 |
);
|
| 113 |
})}
|
| 114 |
</div>
|
|
@@ -118,17 +170,53 @@ export function CircuitPicker() {
|
|
| 118 |
}
|
| 119 |
|
| 120 |
function ActiveCircuitCard({ info }: { info: CircuitInfo | null }) {
|
|
|
|
| 121 |
if (!info) {
|
| 122 |
return (
|
| 123 |
-
<div className="panel-alt px-3 py-3 text-xs text-mute">
|
| 124 |
-
No circuit loaded. Pick a sample below or upload
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
</div>
|
| 126 |
);
|
| 127 |
}
|
|
|
|
| 128 |
return (
|
| 129 |
<div className="panel-alt px-3 py-3">
|
| 130 |
-
<div className="
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
</div>
|
| 133 |
<div className="font-medium text-ink text-sm truncate">{info.name}</div>
|
| 134 |
<div className="mt-1 flex flex-wrap gap-1">
|
|
@@ -141,6 +229,11 @@ function ActiveCircuitCard({ info }: { info: CircuitInfo | null }) {
|
|
| 141 |
</span>
|
| 142 |
)}
|
| 143 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
</div>
|
| 145 |
);
|
| 146 |
}
|
|
|
|
| 1 |
import { useEffect, useRef, useState } from "react";
|
| 2 |
+
import { Eye, EyeOff, FileUp, Loader2 } from "lucide-react";
|
| 3 |
import { api, type CircuitInfo, type SampleCircuit } from "../lib/api";
|
| 4 |
import { useApp } from "../lib/store";
|
| 5 |
|
|
|
|
| 7 |
const [samples, setSamples] = useState<SampleCircuit[]>([]);
|
| 8 |
const [busy, setBusy] = useState<string | null>(null);
|
| 9 |
const [err, setErr] = useState<string | null>(null);
|
| 10 |
+
const [openPreview, setOpenPreview] = useState<string | null>(null);
|
| 11 |
const circuit = useApp((s) => s.circuit);
|
| 12 |
const setCircuit = useApp((s) => s.setCircuit);
|
| 13 |
const fileRef = useRef<HTMLInputElement>(null);
|
|
|
|
| 54 |
<button
|
| 55 |
className="btn-ghost"
|
| 56 |
onClick={() => fileRef.current?.click()}
|
| 57 |
+
title="Upload your own .qpy (Qiskit) or .qasm (OpenQASM 2/3) file"
|
| 58 |
>
|
| 59 |
+
<FileUp className="w-3 h-3" /> upload .qpy / .qasm
|
| 60 |
</button>
|
| 61 |
<input
|
| 62 |
ref={fileRef}
|
| 63 |
type="file"
|
| 64 |
+
accept=".qpy,.qasm,.qasm2,.qasm3"
|
| 65 |
hidden
|
| 66 |
onChange={(e) => e.target.files?.[0] && onUpload(e.target.files[0])}
|
| 67 |
/>
|
|
|
|
| 73 |
<div className="text-[11px] text-mute leading-snug mb-2">
|
| 74 |
Pick a sample circuit below. It becomes the{" "}
|
| 75 |
<span className="text-ink">Input circuit</span> block in your pipeline.
|
| 76 |
+
Or <button
|
| 77 |
+
type="button"
|
| 78 |
+
className="underline decoration-dotted hover:text-ink"
|
| 79 |
+
onClick={() => fileRef.current?.click()}
|
| 80 |
+
>
|
| 81 |
+
upload your own
|
| 82 |
+
</button>{" "}
|
| 83 |
+
(Qiskit <span className="font-mono">.qpy</span> or OpenQASM{" "}
|
| 84 |
+
<span className="font-mono">.qasm</span>).
|
| 85 |
</div>
|
| 86 |
<div className="text-[11px] text-mute uppercase tracking-wider mb-1">Samples</div>
|
| 87 |
{samples.map((s) => {
|
| 88 |
const active = circuit?.name === s.display_name;
|
| 89 |
+
const previewOpen = openPreview === s.key;
|
| 90 |
return (
|
| 91 |
+
<div
|
| 92 |
key={s.key}
|
| 93 |
+
className={`rounded-md border transition-colors ${
|
|
|
|
| 94 |
active
|
| 95 |
? "bg-accent/10 border-accent/50"
|
| 96 |
: "border-transparent hover:bg-surfaceAlt hover:border-edge"
|
| 97 |
}`}
|
|
|
|
| 98 |
>
|
| 99 |
+
<div className="flex items-stretch">
|
| 100 |
+
<button
|
| 101 |
+
onClick={() => pick(s.key)}
|
| 102 |
+
className="flex-1 text-left px-2 py-1.5 min-w-0"
|
| 103 |
+
disabled={busy === s.key}
|
| 104 |
>
|
| 105 |
+
<div className="flex items-center justify-between gap-2">
|
| 106 |
+
<span
|
| 107 |
+
className={`truncate text-sm ${
|
| 108 |
+
active ? "text-ink" : "text-ink/90"
|
| 109 |
+
}`}
|
| 110 |
+
>
|
| 111 |
+
{s.display_name}
|
| 112 |
+
</span>
|
| 113 |
+
{busy === s.key ? (
|
| 114 |
+
<Loader2 className="w-3 h-3 animate-spin text-mute" />
|
| 115 |
+
) : (
|
| 116 |
+
<span className="text-[10px] font-mono text-mute shrink-0">
|
| 117 |
+
{s.num_qubits}q
|
| 118 |
+
</span>
|
| 119 |
+
)}
|
| 120 |
+
</div>
|
| 121 |
+
{s.description && (
|
| 122 |
+
<div className="text-[11px] text-mute leading-snug mt-0.5">
|
| 123 |
+
{s.description}
|
| 124 |
+
</div>
|
| 125 |
+
)}
|
| 126 |
+
</button>
|
| 127 |
+
{s.diagram_text && (
|
| 128 |
+
<button
|
| 129 |
+
type="button"
|
| 130 |
+
onClick={(e) => {
|
| 131 |
+
e.stopPropagation();
|
| 132 |
+
setOpenPreview(previewOpen ? null : s.key);
|
| 133 |
+
}}
|
| 134 |
+
className="shrink-0 px-2 text-mute hover:text-ink hover:bg-surfaceAlt/80 rounded-r-md border-l border-edge/40 flex items-center"
|
| 135 |
+
title={previewOpen ? "Hide circuit diagram" : "Preview circuit diagram"}
|
| 136 |
+
aria-label={previewOpen ? "Hide circuit diagram" : "Preview circuit diagram"}
|
| 137 |
+
>
|
| 138 |
+
{previewOpen ? (
|
| 139 |
+
<EyeOff className="w-3.5 h-3.5" />
|
| 140 |
+
) : (
|
| 141 |
+
<Eye className="w-3.5 h-3.5" />
|
| 142 |
+
)}
|
| 143 |
+
</button>
|
| 144 |
)}
|
| 145 |
</div>
|
| 146 |
+
{previewOpen && s.diagram_text && (
|
| 147 |
+
<div className="px-2 pb-2">
|
| 148 |
+
<div className="flex items-center gap-1 mb-1 text-[10px] text-mute">
|
| 149 |
+
<span className="chip">{s.num_qubits}q</span>
|
| 150 |
+
<span className="chip">depth {s.depth}</span>
|
| 151 |
+
<span className="chip">{s.size} gates</span>
|
| 152 |
+
{s.num_parameters > 0 && (
|
| 153 |
+
<span className="chip !border-accent2/40 !text-accent2">
|
| 154 |
+
{s.num_parameters} params
|
| 155 |
+
</span>
|
| 156 |
+
)}
|
| 157 |
+
</div>
|
| 158 |
+
<pre className="text-[10px] font-mono text-ink/90 bg-surface/60 border border-edge/60 rounded p-2 overflow-x-auto leading-tight whitespace-pre">
|
| 159 |
+
{s.diagram_text}
|
| 160 |
+
</pre>
|
| 161 |
</div>
|
| 162 |
)}
|
| 163 |
+
</div>
|
| 164 |
);
|
| 165 |
})}
|
| 166 |
</div>
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
function ActiveCircuitCard({ info }: { info: CircuitInfo | null }) {
|
| 173 |
+
const [showDiagram, setShowDiagram] = useState(false);
|
| 174 |
if (!info) {
|
| 175 |
return (
|
| 176 |
+
<div className="panel-alt px-3 py-3 text-xs text-mute leading-relaxed">
|
| 177 |
+
No circuit loaded. Pick a sample below, or upload your own Qiskit{" "}
|
| 178 |
+
<span className="font-mono">.qpy</span> / OpenQASM{" "}
|
| 179 |
+
<span className="font-mono">.qasm</span> file.
|
| 180 |
+
<div className="mt-1 text-[10px] text-mute/80">
|
| 181 |
+
Not sure what a <span className="font-mono">.qpy</span> looks like?
|
| 182 |
+
You can{" "}
|
| 183 |
+
<a
|
| 184 |
+
className="underline decoration-dotted hover:text-ink"
|
| 185 |
+
href="/api/circuits/samples/bell_state/download"
|
| 186 |
+
download="bell_state.qpy"
|
| 187 |
+
>
|
| 188 |
+
download a sample
|
| 189 |
+
</a>{" "}
|
| 190 |
+
and re-upload it as a sanity check.
|
| 191 |
+
</div>
|
| 192 |
</div>
|
| 193 |
);
|
| 194 |
}
|
| 195 |
+
const hasDiagram = !!info.diagram_text;
|
| 196 |
return (
|
| 197 |
<div className="panel-alt px-3 py-3">
|
| 198 |
+
<div className="flex items-center justify-between">
|
| 199 |
+
<div className="text-[10px] uppercase tracking-wider text-mute/80 mb-0.5">
|
| 200 |
+
Loaded
|
| 201 |
+
</div>
|
| 202 |
+
{hasDiagram && (
|
| 203 |
+
<button
|
| 204 |
+
type="button"
|
| 205 |
+
onClick={() => setShowDiagram((v) => !v)}
|
| 206 |
+
className="text-[10px] text-mute hover:text-ink flex items-center gap-1"
|
| 207 |
+
title={showDiagram ? "Hide circuit diagram" : "Show circuit diagram"}
|
| 208 |
+
>
|
| 209 |
+
{showDiagram ? (
|
| 210 |
+
<>
|
| 211 |
+
<EyeOff className="w-3 h-3" /> hide diagram
|
| 212 |
+
</>
|
| 213 |
+
) : (
|
| 214 |
+
<>
|
| 215 |
+
<Eye className="w-3 h-3" /> show diagram
|
| 216 |
+
</>
|
| 217 |
+
)}
|
| 218 |
+
</button>
|
| 219 |
+
)}
|
| 220 |
</div>
|
| 221 |
<div className="font-medium text-ink text-sm truncate">{info.name}</div>
|
| 222 |
<div className="mt-1 flex flex-wrap gap-1">
|
|
|
|
| 229 |
</span>
|
| 230 |
)}
|
| 231 |
</div>
|
| 232 |
+
{showDiagram && hasDiagram && (
|
| 233 |
+
<pre className="mt-2 text-[10px] font-mono text-ink/90 bg-surface/60 border border-edge/60 rounded p-2 overflow-x-auto leading-tight whitespace-pre">
|
| 234 |
+
{info.diagram_text}
|
| 235 |
+
</pre>
|
| 236 |
+
)}
|
| 237 |
</div>
|
| 238 |
);
|
| 239 |
}
|
|
@@ -59,7 +59,7 @@ function PaletteTile({ spec }: { spec: NodeSpec }) {
|
|
| 59 |
<div
|
| 60 |
draggable
|
| 61 |
onDragStart={onDragStart}
|
| 62 |
-
className="group shrink-0 cursor-grab active:cursor-grabbing flex flex-col items-center justify-center gap-0.5 w-[
|
| 63 |
title={spec.description}
|
| 64 |
>
|
| 65 |
<span
|
|
@@ -70,6 +70,9 @@ function PaletteTile({ spec }: { spec: NodeSpec }) {
|
|
| 70 |
<span className="text-[10px] text-ink truncate max-w-full leading-tight">
|
| 71 |
{spec.label}
|
| 72 |
</span>
|
|
|
|
|
|
|
|
|
|
| 73 |
</div>
|
| 74 |
);
|
| 75 |
}
|
|
|
|
| 59 |
<div
|
| 60 |
draggable
|
| 61 |
onDragStart={onDragStart}
|
| 62 |
+
className="group shrink-0 cursor-grab active:cursor-grabbing flex flex-col items-center justify-center gap-0.5 w-[108px] h-[68px] rounded-md border border-edge/60 hover:border-edge hover:bg-surfaceAlt transition-colors text-center px-1.5 py-1"
|
| 63 |
title={spec.description}
|
| 64 |
>
|
| 65 |
<span
|
|
|
|
| 70 |
<span className="text-[10px] text-ink truncate max-w-full leading-tight">
|
| 71 |
{spec.label}
|
| 72 |
</span>
|
| 73 |
+
<span className="text-[9px] text-mute/80 leading-tight max-w-full line-clamp-2">
|
| 74 |
+
{spec.tagline}
|
| 75 |
+
</span>
|
| 76 |
</div>
|
| 77 |
);
|
| 78 |
}
|
|
@@ -58,6 +58,12 @@ export function QNode({ id, data, selected }: NodeProps) {
|
|
| 58 |
</div>
|
| 59 |
</div>
|
| 60 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
{d.params && Object.keys(d.params).length > 0 && (
|
| 62 |
<div className="mt-2 pt-2 border-t border-edge/60 space-y-0.5">
|
| 63 |
{Object.entries(d.params).map(([k, v]) => (
|
|
|
|
| 58 |
</div>
|
| 59 |
</div>
|
| 60 |
</div>
|
| 61 |
+
<div
|
| 62 |
+
className="mt-1.5 text-[10px] text-mute leading-snug line-clamp-2"
|
| 63 |
+
title={spec.description}
|
| 64 |
+
>
|
| 65 |
+
{spec.tagline}
|
| 66 |
+
</div>
|
| 67 |
{d.params && Object.keys(d.params).length > 0 && (
|
| 68 |
<div className="mt-2 pt-2 border-t border-edge/60 space-y-0.5">
|
| 69 |
{Object.entries(d.params).map(([k, v]) => (
|
|
@@ -25,6 +25,10 @@ export interface SampleCircuit {
|
|
| 25 |
display_name: string;
|
| 26 |
description: string;
|
| 27 |
num_qubits: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
source: string;
|
| 29 |
}
|
| 30 |
|
|
|
|
| 25 |
display_name: string;
|
| 26 |
description: string;
|
| 27 |
num_qubits: number;
|
| 28 |
+
depth: number;
|
| 29 |
+
size: number;
|
| 30 |
+
num_parameters: number;
|
| 31 |
+
diagram_text: string;
|
| 32 |
source: string;
|
| 33 |
}
|
| 34 |
|
|
@@ -27,6 +27,10 @@ export interface NodeSpec {
|
|
| 27 |
kind: NodeKind;
|
| 28 |
label: string;
|
| 29 |
family: "source" | "backend" | "algorithm" | "metric" | "sink";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
description: string;
|
| 31 |
icon: LucideIcon;
|
| 32 |
accent: string; // tailwind text color
|
|
@@ -40,7 +44,8 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 40 |
kind: "input_circuit",
|
| 41 |
label: "Input circuit",
|
| 42 |
family: "source",
|
| 43 |
-
|
|
|
|
| 44 |
icon: Atom,
|
| 45 |
accent: "text-accent",
|
| 46 |
accentRing: "border-accent/50",
|
|
@@ -50,6 +55,7 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 50 |
kind: "fake_backend",
|
| 51 |
label: "Noisy simulator",
|
| 52 |
family: "backend",
|
|
|
|
| 53 |
description:
|
| 54 |
"Simulates a real IBM quantum chip with its measured noise. Runs locally, no IBM account needed.",
|
| 55 |
icon: Server,
|
|
@@ -62,6 +68,7 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 62 |
kind: "ibm_backend",
|
| 63 |
label: "IBM live backend",
|
| 64 |
family: "backend",
|
|
|
|
| 65 |
description: "Fresh calibration from the IBM Quantum Platform (requires token).",
|
| 66 |
icon: Cpu,
|
| 67 |
accent: "text-warn",
|
|
@@ -72,7 +79,8 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 72 |
kind: "qucad",
|
| 73 |
label: "QuCAD",
|
| 74 |
family: "algorithm",
|
| 75 |
-
|
|
|
|
| 76 |
icon: Waypoints,
|
| 77 |
accent: "text-accent2",
|
| 78 |
accentRing: "border-accent2/50",
|
|
@@ -82,7 +90,8 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 82 |
kind: "qubound",
|
| 83 |
label: "QuBound",
|
| 84 |
family: "algorithm",
|
| 85 |
-
|
|
|
|
| 86 |
icon: LineChart,
|
| 87 |
accent: "text-accent3",
|
| 88 |
accentRing: "border-accent3/50",
|
|
@@ -92,6 +101,7 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 92 |
kind: "compvqc",
|
| 93 |
label: "CompressVQC",
|
| 94 |
family: "algorithm",
|
|
|
|
| 95 |
description: "QAOA-optimized lookup table that folds redundant parametric gates.",
|
| 96 |
icon: Shrink,
|
| 97 |
accent: "text-accent4",
|
|
@@ -101,6 +111,7 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 101 |
kind: "fidelity",
|
| 102 |
label: "Fidelity",
|
| 103 |
family: "metric",
|
|
|
|
| 104 |
description: "Quick statevector-vs-noisy fidelity estimate (bound-parameter circuits only).",
|
| 105 |
icon: Gauge,
|
| 106 |
accent: "text-ok",
|
|
@@ -110,6 +121,7 @@ export const NODE_CATALOG: NodeSpec[] = [
|
|
| 110 |
kind: "output",
|
| 111 |
label: "Output",
|
| 112 |
family: "sink",
|
|
|
|
| 113 |
description: "Final circuit, transpiled gate counts, and aggregated metrics.",
|
| 114 |
icon: PackageCheck,
|
| 115 |
accent: "text-ink",
|
|
|
|
| 27 |
kind: NodeKind;
|
| 28 |
label: string;
|
| 29 |
family: "source" | "backend" | "algorithm" | "metric" | "sink";
|
| 30 |
+
/** Short human-friendly caption (~3-5 words) shown under the label. */
|
| 31 |
+
tagline: string;
|
| 32 |
+
/** Long-form description: hover tooltip on the palette tile and
|
| 33 |
+
* subtitle text on the canvas node. */
|
| 34 |
description: string;
|
| 35 |
icon: LucideIcon;
|
| 36 |
accent: string; // tailwind text color
|
|
|
|
| 44 |
kind: "input_circuit",
|
| 45 |
label: "Input circuit",
|
| 46 |
family: "source",
|
| 47 |
+
tagline: "your quantum program",
|
| 48 |
+
description: "Parameterized QuantumCircuit (uploaded .qpy or a demo sample).",
|
| 49 |
icon: Atom,
|
| 50 |
accent: "text-accent",
|
| 51 |
accentRing: "border-accent/50",
|
|
|
|
| 55 |
kind: "fake_backend",
|
| 56 |
label: "Noisy simulator",
|
| 57 |
family: "backend",
|
| 58 |
+
tagline: "local IBM-chip simulator",
|
| 59 |
description:
|
| 60 |
"Simulates a real IBM quantum chip with its measured noise. Runs locally, no IBM account needed.",
|
| 61 |
icon: Server,
|
|
|
|
| 68 |
kind: "ibm_backend",
|
| 69 |
label: "IBM live backend",
|
| 70 |
family: "backend",
|
| 71 |
+
tagline: "live IBM hardware",
|
| 72 |
description: "Fresh calibration from the IBM Quantum Platform (requires token).",
|
| 73 |
icon: Cpu,
|
| 74 |
accent: "text-warn",
|
|
|
|
| 79 |
kind: "qucad",
|
| 80 |
label: "QuCAD",
|
| 81 |
family: "algorithm",
|
| 82 |
+
tagline: "noise-aware pruning",
|
| 83 |
+
description: "ADMM-based noise-aware VQC sparsification (weights pushed to 0 under target noise).",
|
| 84 |
icon: Waypoints,
|
| 85 |
accent: "text-accent2",
|
| 86 |
accentRing: "border-accent2/50",
|
|
|
|
| 90 |
kind: "qubound",
|
| 91 |
label: "QuBound",
|
| 92 |
family: "algorithm",
|
| 93 |
+
tagline: "predict fidelity bound",
|
| 94 |
+
description: "LSTM over 14 days of calibration history; predicts today's error bound.",
|
| 95 |
icon: LineChart,
|
| 96 |
accent: "text-accent3",
|
| 97 |
accentRing: "border-accent3/50",
|
|
|
|
| 101 |
kind: "compvqc",
|
| 102 |
label: "CompressVQC",
|
| 103 |
family: "algorithm",
|
| 104 |
+
tagline: "fold redundant gates",
|
| 105 |
description: "QAOA-optimized lookup table that folds redundant parametric gates.",
|
| 106 |
icon: Shrink,
|
| 107 |
accent: "text-accent4",
|
|
|
|
| 111 |
kind: "fidelity",
|
| 112 |
label: "Fidelity",
|
| 113 |
family: "metric",
|
| 114 |
+
tagline: "statevector vs noisy",
|
| 115 |
description: "Quick statevector-vs-noisy fidelity estimate (bound-parameter circuits only).",
|
| 116 |
icon: Gauge,
|
| 117 |
accent: "text-ok",
|
|
|
|
| 121 |
kind: "output",
|
| 122 |
label: "Output",
|
| 123 |
family: "sink",
|
| 124 |
+
tagline: "final metrics & diagram",
|
| 125 |
description: "Final circuit, transpiled gate counts, and aggregated metrics.",
|
| 126 |
icon: PackageCheck,
|
| 127 |
accent: "text-ink",
|