quantcheck 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quantcheck/__init__.py +3 -0
- quantcheck/auth/__init__.py +6 -0
- quantcheck/auth/base.py +74 -0
- quantcheck/auth/callback.py +73 -0
- quantcheck/auth/fake.py +40 -0
- quantcheck/auth/service.py +49 -0
- quantcheck/auth/store.py +63 -0
- quantcheck/auth/supabase.py +168 -0
- quantcheck/bench.py +38 -0
- quantcheck/candidates.py +138 -0
- quantcheck/cli.py +251 -0
- quantcheck/config.py +63 -0
- quantcheck/executors/__init__.py +0 -0
- quantcheck/hardware.py +52 -0
- quantcheck/limits.py +19 -0
- quantcheck/pipeline.py +172 -0
- quantcheck/prompt.py +67 -0
- quantcheck/recommend.py +131 -0
- quantcheck/report/__init__.py +0 -0
- quantcheck/report/html.py +38 -0
- quantcheck/report/templates/report.html.j2 +272 -0
- quantcheck/report/terminal.py +90 -0
- quantcheck/report/tokens.py +41 -0
- quantcheck/report/view.py +161 -0
- quantcheck/runners/__init__.py +3 -0
- quantcheck/runners/base.py +87 -0
- quantcheck/runners/fake.py +68 -0
- quantcheck/runners/llamacpp_runner.py +185 -0
- quantcheck/runners/mlx_runner.py +153 -0
- quantcheck/runners/toolparse.py +107 -0
- quantcheck/scoring/__init__.py +0 -0
- quantcheck/scoring/checks.py +342 -0
- quantcheck/scoring/fake_judge.py +50 -0
- quantcheck/scoring/judge.py +171 -0
- quantcheck/scoring/language.py +99 -0
- quantcheck/scoring/models.py +92 -0
- quantcheck/scoring/score.py +167 -0
- quantcheck/scoring/stats.py +60 -0
- quantcheck/settings.py +14 -0
- quantcheck/store.py +88 -0
- quantcheck/tests_io.py +169 -0
- quantcheck/ui/__init__.py +1 -0
- quantcheck/ui/app.py +534 -0
- quantcheck/ui/catalog.py +47 -0
- quantcheck/ui/chat.py +211 -0
- quantcheck/ui/compare.py +63 -0
- quantcheck/ui/downloads.py +172 -0
- quantcheck/ui/jobs.py +173 -0
- quantcheck/ui/modeldetail.py +97 -0
- quantcheck/ui/reviews.py +59 -0
- quantcheck/ui/security.py +45 -0
- quantcheck/ui/static/chat.js +312 -0
- quantcheck/ui/static/fonts/JetBrainsMono-latin-b87346.woff2 +0 -0
- quantcheck/ui/static/fonts/JetBrainsMono-latin-ext-9326b4.woff2 +0 -0
- quantcheck/ui/static/fonts/NotoSansDevanagari-devanagari-3819bb.woff2 +0 -0
- quantcheck/ui/static/fonts/NotoSansDevanagari-latin-ext-542103.woff2 +0 -0
- quantcheck/ui/static/fonts/NotoSansDevanagari-latin-f3aaed.woff2 +0 -0
- quantcheck/ui/static/fonts/NotoSansTamil-latin-17e6dc.woff2 +0 -0
- quantcheck/ui/static/fonts/NotoSansTamil-latin-ext-027c12.woff2 +0 -0
- quantcheck/ui/static/fonts/NotoSansTamil-tamil-a57d5e.woff2 +0 -0
- quantcheck/ui/static/fonts/Outfit-latin-ebadd8.woff2 +0 -0
- quantcheck/ui/static/fonts/Outfit-latin-ext-744997.woff2 +0 -0
- quantcheck/ui/static/fonts/README.md +14 -0
- quantcheck/ui/static/fonts.css +228 -0
- quantcheck/ui/static/index.html +24 -0
- quantcheck/ui/static/lab.css +768 -0
- quantcheck/ui/static/lab.js +896 -0
- quantcheck/ui/static/logo.svg +5 -0
- quantcheck/ui/static/review.js +127 -0
- quantcheck/ui/static/setup.js +132 -0
- quantcheck/ui/static/testsets.js +527 -0
- quantcheck/ui/summary.py +104 -0
- quantcheck/ui/system.py +101 -0
- quantcheck/ui/testsets.py +243 -0
- quantcheck-0.0.1.dist-info/METADATA +115 -0
- quantcheck-0.0.1.dist-info/RECORD +79 -0
- quantcheck-0.0.1.dist-info/WHEEL +4 -0
- quantcheck-0.0.1.dist-info/entry_points.txt +2 -0
- quantcheck-0.0.1.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
/* quantcheck lab front end: no build step, no external requests, no innerHTML with data. */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const app = document.getElementById("app");
|
|
5
|
+
let account = null;
|
|
6
|
+
let pollTimer = null;
|
|
7
|
+
const store = {
|
|
8
|
+
get(k) { try { return localStorage.getItem(k); } catch (e) { return null; } },
|
|
9
|
+
set(k, v) { try { localStorage.setItem(k, v); } catch (e) { /* storage unavailable */ } },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// ---- helpers ---------------------------------------------------------------------------
|
|
13
|
+
function h(tag, props, ...kids) {
|
|
14
|
+
const el = document.createElement(tag);
|
|
15
|
+
for (const [k, v] of Object.entries(props || {})) {
|
|
16
|
+
if (v === undefined || v === null || v === false) continue;
|
|
17
|
+
if (k === "class") el.className = v;
|
|
18
|
+
else if (k.startsWith("on")) el.addEventListener(k.slice(2), v);
|
|
19
|
+
else if (k === "text") el.textContent = v;
|
|
20
|
+
else el.setAttribute(k, v === true ? "" : v);
|
|
21
|
+
}
|
|
22
|
+
for (const kid of kids.flat()) {
|
|
23
|
+
if (kid === null || kid === undefined || kid === false) continue;
|
|
24
|
+
el.append(kid.nodeType ? kid : document.createTextNode(String(kid)));
|
|
25
|
+
}
|
|
26
|
+
return el;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function api(path, opts = {}) {
|
|
30
|
+
const res = await fetch(path, {
|
|
31
|
+
method: opts.method || "GET",
|
|
32
|
+
headers: { "X-QuantCheck": "1", ...(opts.body ? { "Content-Type": "application/json" } : {}) },
|
|
33
|
+
body: opts.body ? JSON.stringify(opts.body) : undefined,
|
|
34
|
+
});
|
|
35
|
+
let data = null;
|
|
36
|
+
try { data = await res.json(); } catch (e) { /* not json */ }
|
|
37
|
+
if (res.status === 401) { account = null; route(); throw new Error("Please sign in."); }
|
|
38
|
+
if (!res.ok) throw new Error((data && (data.detail || data.error)) || `Request failed (${res.status})`);
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const fmtDate = (iso) => { const d = new Date(iso); return isNaN(d) ? iso : d.toLocaleString([], { dateStyle: "medium", timeStyle: "short" }); };
|
|
43
|
+
const stopPolling = () => { if (pollTimer) { clearTimeout(pollTimer); pollTimer = null; } };
|
|
44
|
+
|
|
45
|
+
const STATUS = {
|
|
46
|
+
recommended: ["ok", "Recommended"], keep_reference: ["ok", "Keep the best version"],
|
|
47
|
+
inconclusive: ["warn", "Not proven yet"], no_data: ["warn", "No data"], not_scored: ["warn", "Not scored"],
|
|
48
|
+
};
|
|
49
|
+
function statusChip(status) {
|
|
50
|
+
const [cls, label] = STATUS[status] || ["plain", status];
|
|
51
|
+
return h("span", { class: `chip ${cls}`, text: label });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ---- theme -----------------------------------------------------------------------------
|
|
55
|
+
function applyTheme(mode) {
|
|
56
|
+
if (mode === "light" || mode === "dark") document.documentElement.dataset.theme = mode;
|
|
57
|
+
else delete document.documentElement.dataset.theme;
|
|
58
|
+
store.set("qc-theme", mode);
|
|
59
|
+
}
|
|
60
|
+
function themeSwitch() {
|
|
61
|
+
const current = store.get("qc-theme") || "system";
|
|
62
|
+
const wrap = h("div", { class: "seg", role: "group", "aria-label": "Theme" });
|
|
63
|
+
for (const [mode, label] of [["system", "System"], ["light", "Light"], ["dark", "Dark"]]) {
|
|
64
|
+
wrap.append(h("button", {
|
|
65
|
+
type: "button", text: label, "aria-pressed": String(current === mode),
|
|
66
|
+
onclick: () => { applyTheme(mode); for (const b of wrap.children) b.setAttribute("aria-pressed", String(b.textContent === label)); },
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
return wrap;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ---- layout ----------------------------------------------------------------------------
|
|
73
|
+
const SVG = "http://www.w3.org/2000/svg";
|
|
74
|
+
// Icons are the design canvas's own paths (24x24 stroke icons).
|
|
75
|
+
const ICONS = {
|
|
76
|
+
home: ["M3 11l9-7 9 7v9a1 1 0 01-1 1h-5v-6H9v6H4a1 1 0 01-1-1z"], plus: ["M12 5v14M5 12h14"],
|
|
77
|
+
sets: ["M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"], runs: ["M22 12h-4l-3 9L9 3l-3 9H2"],
|
|
78
|
+
models: ["M21 8l-9-5-9 5 9 5 9-5zM3 8v8l9 5 9-5V8M12 13v8"], compare: ["M3 3v18h18", "M7 15l4-4 3 3 6-7"],
|
|
79
|
+
settings: ["M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6"],
|
|
80
|
+
chat: ["M21 12a8 8 0 01-11.6 7.1L4 20l1-4.6A8 8 0 1121 12z"], chev: ["M7 15l5-5 5 5"], lock: ["M8 11V7a4 4 0 018 0v4"],
|
|
81
|
+
chip: ["M9 1v4M15 1v4M9 19v4M15 19v4M1 9h4M1 15h4M19 9h4M19 15h4"],
|
|
82
|
+
};
|
|
83
|
+
function svgEl(paths, cls, rects = []) {
|
|
84
|
+
const s = document.createElementNS(SVG, "svg");
|
|
85
|
+
s.setAttribute("viewBox", "0 0 24 24"); s.setAttribute("aria-hidden", "true"); if (cls) s.setAttribute("class", cls);
|
|
86
|
+
for (const r of rects) { const e = document.createElementNS(SVG, "rect"); for (const [k, v] of Object.entries(r)) e.setAttribute(k, v); s.append(e); }
|
|
87
|
+
for (const d of paths) { const p = document.createElementNS(SVG, "path"); p.setAttribute("d", d); s.append(p); }
|
|
88
|
+
return s;
|
|
89
|
+
}
|
|
90
|
+
function logoMark() {
|
|
91
|
+
const s = document.createElementNS(SVG, "svg");
|
|
92
|
+
s.setAttribute("viewBox", "0 0 30 30"); s.setAttribute("aria-hidden", "true");
|
|
93
|
+
const mk = (t, a) => { const e = document.createElementNS(SVG, t); for (const [k, v] of Object.entries(a)) e.setAttribute(k, v); s.append(e); };
|
|
94
|
+
mk("rect", { width: 30, height: 30, rx: 9, fill: "#047857" });
|
|
95
|
+
mk("circle", { cx: 13.5, cy: 13.5, r: 6.8, stroke: "#FFFFFF", "stroke-width": 2.6, fill: "none" });
|
|
96
|
+
mk("path", { d: "M14.5 15.5l3 3 7-7.5", stroke: "#6EE7B7", "stroke-width": 2.6, fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" });
|
|
97
|
+
return s;
|
|
98
|
+
}
|
|
99
|
+
const NAV = [["#/home", "Home", "home"], ["#/new", "New test", "plus"], ["#/chat", "Chat", "chat"], ["#/sets", "Test sets", "sets"], ["#/runs", "Runs", "runs"], ["#/compare", "Compare", "compare"], ["#/models", "Models", "models"], ["#/settings", "Settings", "settings"]];
|
|
100
|
+
|
|
101
|
+
function jobPct(job) {
|
|
102
|
+
const live = job.versions.filter((v) => v.state !== "skipped");
|
|
103
|
+
const genTotal = live.reduce((a, v) => a + v.total, 0), genDone = live.reduce((a, v) => a + v.done, 0);
|
|
104
|
+
const total = genTotal + (job.judge.total || genTotal), done = genDone + job.judge.done;
|
|
105
|
+
return total ? Math.min(100, Math.round((done / total) * 100)) : 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function shell(title, body, current, actions, opts = {}) {
|
|
109
|
+
const initials = ((account.name || account.email || "?")[0] || "?").toUpperCase();
|
|
110
|
+
const menu = h("div", { class: "menu", role: "menu", hidden: true },
|
|
111
|
+
h("div", { class: "menu-head" }, h("b", { text: account.name || account.email }), h("small", { text: account.email })),
|
|
112
|
+
h("a", { href: "#/settings", role: "menuitem", text: "Account and settings" }),
|
|
113
|
+
h("a", { href: "#/plans", role: "menuitem" }, "Team platform", h("span", { class: "chip plain", text: "Early access" })),
|
|
114
|
+
h("a", { href: "#/help", role: "menuitem", text: "Help and docs" }),
|
|
115
|
+
h("button", { type: "button", role: "menuitem", class: "danger", text: "Sign out", onclick: signOut }));
|
|
116
|
+
const toggle = h("button", { type: "button", "aria-haspopup": "menu", "aria-expanded": "false", "aria-label": "Account menu",
|
|
117
|
+
onclick: () => { menu.hidden = !menu.hidden; toggle.setAttribute("aria-expanded", String(!menu.hidden)); } },
|
|
118
|
+
h("span", { class: "avatar", text: initials }),
|
|
119
|
+
h("span", { class: "who" }, h("b", { text: account.name || account.email }), h("small", { text: `${account.plan[0].toUpperCase()}${account.plan.slice(1)} plan` })),
|
|
120
|
+
svgEl(ICONS.chev, "chev"));
|
|
121
|
+
document.addEventListener("click", (e) => { if (!menu.contains(e.target) && !toggle.contains(e.target)) menu.hidden = true; }, { once: true });
|
|
122
|
+
const runsBadge = h("span", { class: "chip ok live", hidden: true });
|
|
123
|
+
const hw = h("div", { class: "hwcard", "aria-label": "This Mac" });
|
|
124
|
+
const nav = h("nav", { class: "nav", "aria-label": "Main" }, NAV.map(([href, label, icon]) =>
|
|
125
|
+
h("a", { href, title: label, "aria-current": href === current ? "page" : false }, svgEl(ICONS[icon], "ico"), h("span", { class: "nv", text: label }), href === "#/runs" ? runsBadge : null)));
|
|
126
|
+
fillShell(hw, runsBadge);
|
|
127
|
+
return h("div", { class: opts.compact ? "shell compact" : "shell" },
|
|
128
|
+
h("aside", { class: "sidebar", "aria-label": "Lab navigation" },
|
|
129
|
+
h("a", { class: "brand", href: "#/home" }, logoMark(), h("span", { class: "word", text: "quantcheck" }), h("span", { class: "chip plain lab-badge", text: "Lab" })),
|
|
130
|
+
nav,
|
|
131
|
+
h("div", { class: "side-bottom" }, h("div", { class: "account" }, menu, toggle), hw,
|
|
132
|
+
h("p", { class: "local" }, svgEl(ICONS.lock, null, [{ x: 4, y: 11, width: 16, height: 10, rx: 2 }]), "Local · nothing leaves this Mac"))),
|
|
133
|
+
h("header", { class: "topbar" },
|
|
134
|
+
h("nav", { class: "crumbs", "aria-label": "Breadcrumb" }, h("span", { text: "Lab" }), ...[].concat(title).flatMap((t, i, all) => [h("span", { class: "sep", "aria-hidden": "true", text: "/" }), i === all.length - 1 ? h("h1", { text: t }) : h("span", { text: t })])),
|
|
135
|
+
h("div", { class: "row" }, actions, current === "#/new" ? null : h("a", { class: "btn primary", href: "#/new" }, svgEl(ICONS.plus, "ico"), "New test"))),
|
|
136
|
+
h("main", { class: "content", id: "main" }, h("div", { class: "page" }, body)));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Hardware card and the "running" badge fill in after the page is up; a failure leaves them empty.
|
|
140
|
+
async function fillShell(hw, badge) {
|
|
141
|
+
try {
|
|
142
|
+
const [sys, job] = await Promise.all([api("/api/system"), api("/api/jobs/active")]);
|
|
143
|
+
const m = sys.memory, pct = Math.min(100, Math.round((m.used_gb / m.total_gb) * 100));
|
|
144
|
+
hw.replaceChildren(
|
|
145
|
+
h("div", { class: "hw-title" }, svgEl(ICONS.chip, null, [{ x: 5, y: 5, width: 14, height: 14, rx: 2 }]), sys.hardware.chip),
|
|
146
|
+
h("div", {}, h("div", { class: "hw-row gap" }, h("span", { text: "Memory in use" }), h("span", { class: "mono", text: `${m.used_gb} / ${m.total_gb} GB` })),
|
|
147
|
+
h("div", { class: "track sm", role: "progressbar", "aria-label": "Memory in use", "aria-valuenow": String(pct), "aria-valuemin": "0", "aria-valuemax": "100" }, h("i", { style: `width:${pct}%` }))),
|
|
148
|
+
h("div", { class: "hw-row" }, h("span", { text: "Disk for models" }), h("span", { class: "mono", text: `${sys.hardware.free_disk_gb} GB free` })));
|
|
149
|
+
if (job) { badge.hidden = false; badge.textContent = "1 running"; }
|
|
150
|
+
} catch (e) { /* the card is optional */ }
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function mount(node) { app.replaceChildren(node); }
|
|
154
|
+
|
|
155
|
+
// Empty and error states (design: Lab-Empty-States, Lab-Errors). Say what happened, what was kept,
|
|
156
|
+
// and the one thing to do next.
|
|
157
|
+
function emptyCard(iconPaths, title, text, actions) {
|
|
158
|
+
return h("div", { class: "card es-empty" }, h("span", { class: "es-ic" }, svgEl(iconPaths, "ico")), h("h3", { text: title }), h("p", { class: "mu", text }),
|
|
159
|
+
h("div", { class: "es-act" }, ...actions));
|
|
160
|
+
}
|
|
161
|
+
function alertCard(tone, title, text, actions) {
|
|
162
|
+
return h("div", { class: `es-alert ${tone}`, role: tone === "fail" ? "alert" : "status" }, h("span", { class: "es-bang", text: "!" }),
|
|
163
|
+
h("span", { class: "es-body" }, h("b", { text: title }), h("span", { text }), actions && actions.length ? h("span", { class: "es-act left" }, ...actions) : null));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function signOut() {
|
|
167
|
+
try { await api("/api/auth/logout", { method: "POST" }); } catch (e) { /* already signed out */ }
|
|
168
|
+
account = null; location.hash = "#/signin"; route();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ---- screens ---------------------------------------------------------------------------
|
|
172
|
+
function screenSignIn() {
|
|
173
|
+
const msg = h("div", { "aria-live": "polite" });
|
|
174
|
+
let timer = null;
|
|
175
|
+
const begin = async (idp) => {
|
|
176
|
+
msg.replaceChildren(h("p", { class: "muted", text: "Opening your browser to sign in…" }));
|
|
177
|
+
try {
|
|
178
|
+
const { url } = await api("/api/auth/start", { method: "POST", body: { idp } });
|
|
179
|
+
window.open(url, "_blank", "noopener");
|
|
180
|
+
msg.replaceChildren(h("div", { class: "si-wait" }, h("span", { class: "si-dot" }), h("span", {}, "Waiting for you to finish in the new tab. If it did not open, ", h("a", { href: url, target: "_blank", rel: "noopener", text: "open it here" }), ".")));
|
|
181
|
+
const poll = async () => {
|
|
182
|
+
const s = await api("/api/auth/state");
|
|
183
|
+
if (s.state === "signed_in") { location.hash = "#/home"; route(); return; }
|
|
184
|
+
if (s.state === "error") { fail(s.error); return; }
|
|
185
|
+
timer = setTimeout(poll, 1000);
|
|
186
|
+
};
|
|
187
|
+
poll();
|
|
188
|
+
} catch (e) { fail(e.message); }
|
|
189
|
+
};
|
|
190
|
+
const fail = (text) => msg.replaceChildren(alertCard("warn", "Sign-in didn't finish", `${text} Sign-in needs internet once. After that the lab works offline.`,
|
|
191
|
+
[h("button", { class: "btn primary", type: "button", text: "Try again", onclick: () => msg.replaceChildren() }), h("span", { class: "mu", style: "align-self:center;font-size:13px", text: "or run quantcheck login in a terminal" })]));
|
|
192
|
+
const gIcon = () => h("span", { class: "si-g", "aria-hidden": "true", text: "G" });
|
|
193
|
+
const ghIcon = () => svgEl(["M9 19c-4 1.5-4-2.5-6-3m12 5v-3.5c0-1 .1-1.4-.5-2 2.8-.3 5.5-1.4 5.5-6a4.6 4.6 0 00-1.3-3.2 4.2 4.2 0 00-.1-3.2s-1.1-.3-3.5 1.3a12.3 12.3 0 00-6.2 0C6.5 2.8 5.4 3.1 5.4 3.1a4.2 4.2 0 00-.1 3.2A4.6 4.6 0 004 9.5c0 4.6 2.7 5.7 5.5 6-.6.6-.6 1.2-.5 2V21"], "ico");
|
|
194
|
+
const tick = () => svgEl(["M5 12l5 5L20 7"], "ico");
|
|
195
|
+
const bullet = (t) => h("li", {}, h("span", { class: "si-b" }, tick()), h("span", { text: t }));
|
|
196
|
+
mount(h("div", { class: "signin si" }, h("div", { class: "si-card" },
|
|
197
|
+
h("section", { class: "si-l" },
|
|
198
|
+
h("div", { class: "si-brand" }, logoMark(), h("span", { class: "word", text: "quantcheck" }), h("span", { class: "chip plain lab-badge", text: "Lab" })),
|
|
199
|
+
h("div", { class: "si-h" }, h("h1", { text: "Sign in to the lab" }), h("p", { class: "mu", text: "One quick sign-in on this Mac. After that it works offline." })),
|
|
200
|
+
h("div", { class: "si-sso" },
|
|
201
|
+
h("button", { class: "btn si-btn", type: "button", onclick: () => begin("google") }, gIcon(), "Continue with Google"),
|
|
202
|
+
h("button", { class: "btn si-btn", type: "button", onclick: () => begin("github") }, ghIcon(), "Continue with GitHub")),
|
|
203
|
+
msg,
|
|
204
|
+
h("div", { class: "si-or" }, h("span"), "or", h("span")),
|
|
205
|
+
h("label", { class: "si-em" }, "Email", h("input", { type: "email", disabled: true, placeholder: "you@email.com", "aria-describedby": "si-soon" })),
|
|
206
|
+
h("button", { class: "btn si-cta", type: "button", disabled: true, text: "Email me a sign-in link" }),
|
|
207
|
+
h("p", { class: "mu si-small", id: "si-soon", text: "The email link is coming soon. For now, use Google or GitHub. New here? Signing in creates your free account." }),
|
|
208
|
+
h("div", { class: "si-term" }, h("span", { class: "mu", text: "Using the terminal instead?" }), h("code", { class: "mono" }, h("span", { class: "g", text: "$" }), " quantcheck login"), h("span", { class: "mu si-t12", text: "Opens this sign-in in your browser, then returns to the terminal." }))),
|
|
209
|
+
h("aside", { class: "si-r" },
|
|
210
|
+
h("span", { class: "si-why", text: "Why sign in?" }),
|
|
211
|
+
h("h2", { text: "Your account, not your data." }),
|
|
212
|
+
h("ul", {}, bullet("Prompts, answers, models and reports never leave this Mac"), bullet("Your account stores only your email, plan and devices"), bullet("Free forever for local testing")),
|
|
213
|
+
h("p", { class: "mu si-t12 si-legal", text: "By continuing you agree to the Terms and Privacy policy." })))));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const dash = "—";
|
|
217
|
+
const pctText = (x) => (x === null || x === undefined ? dash : `${(x * 100).toFixed(1)}%`);
|
|
218
|
+
function runLabel(r) {
|
|
219
|
+
if (r.status === "recommended") return r.recommended;
|
|
220
|
+
const keep = r.recommended || r.reference;
|
|
221
|
+
return keep ? `Keep ${keep}` : dash;
|
|
222
|
+
}
|
|
223
|
+
function whenText(iso) {
|
|
224
|
+
const d = new Date(iso); if (isNaN(d)) return iso;
|
|
225
|
+
const days = Math.round((new Date().setHours(0, 0, 0, 0) - new Date(d).setHours(0, 0, 0, 0)) / 864e5);
|
|
226
|
+
const hm = d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: false });
|
|
227
|
+
if (days === 0) return `Today, ${hm}`;
|
|
228
|
+
if (days === 1) return "Yesterday";
|
|
229
|
+
return d.toLocaleDateString([], { day: "numeric", month: "short", ...(d.getFullYear() !== new Date().getFullYear() ? { year: "numeric" } : {}) });
|
|
230
|
+
}
|
|
231
|
+
function runStatus(status) {
|
|
232
|
+
if (status === "recommended" || status === "keep_reference") return h("span", { class: "chip ok", text: "Done" });
|
|
233
|
+
return statusChip(status);
|
|
234
|
+
}
|
|
235
|
+
function runsTable(runs, active) {
|
|
236
|
+
const head = h("thead", {}, h("tr", {}, ["Run", "Model", "Recommended", "Quality kept", "Status", "When"].map((t) => h("th", { scope: "col", text: t }))));
|
|
237
|
+
const rows = [];
|
|
238
|
+
if (active) rows.push(h("tr", {},
|
|
239
|
+
h("td", {}, h("a", { class: "strong", href: `#/run/${active.id}`, text: active.model.split("/").pop().toLowerCase() }), h("div", { class: "sub", text: `${active.n_prompts} prompts` })),
|
|
240
|
+
h("td", { text: active.model.split("/").pop() }), h("td", { class: "mono strong", text: dash }), h("td", { class: "mono", text: dash }),
|
|
241
|
+
h("td", {}, h("span", { class: "chip ok live", text: `Running · ${jobPct(active)}%` })), h("td", { class: "muted", text: "Running" })));
|
|
242
|
+
for (const r of runs) rows.push(h("tr", {},
|
|
243
|
+
h("td", {}, h("a", { class: "strong", href: `#/report/${encodeURIComponent(r.run_id)}`, text: r.name }), h("div", { class: "sub", text: `${r.n_prompts} prompts · ${r.versions.join(" · ")}` })),
|
|
244
|
+
h("td", { text: String(r.model).split("/").pop() }), h("td", { class: "mono strong", text: runLabel(r) }), h("td", { class: "mono", text: pctText(r.quality_kept) }),
|
|
245
|
+
h("td", {}, runStatus(r.status)), h("td", { class: "muted", text: whenText(r.created_at) })));
|
|
246
|
+
return h("div", { class: "table-wrap" }, h("table", { class: "runs" }, head, h("tbody", {}, rows)));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
// First time: three steps to a first result, from what is really on this Mac.
|
|
251
|
+
async function homeFirstRun(body) {
|
|
252
|
+
const [cached, sets] = await Promise.all([api("/api/models"), api("/api/testsets")]);
|
|
253
|
+
const hasModel = cached.some((m) => /-\d+bit$/.test(m.id) || /gguf/i.test(m.id));
|
|
254
|
+
if (!hasModel && !store.get("qc-setup-done")) { location.hash = "#/setup"; return; }
|
|
255
|
+
const hasSet = sets.some((x) => !x.error && x.prompts > 0);
|
|
256
|
+
const name = (account.name || "").split(" ")[0];
|
|
257
|
+
const doneN = (hasModel ? 1 : 0) + (hasSet ? 1 : 0);
|
|
258
|
+
const step = (n, done, title, sub, action) => h("div", { class: "fr-step" },
|
|
259
|
+
h("span", { class: `mono fr-n ${done ? "done" : ""}` }, done ? svgEl(["M5 12l5 5L20 7"], "ico") : String(n)),
|
|
260
|
+
h("span", { class: "fr-t" }, h("span", { class: done ? "fr-struck" : "fr-title", text: title }), h("span", { class: "mu fr-sub", text: sub })), action);
|
|
261
|
+
const makeExample = h("button", { class: "btn", type: "button", text: "Create the example test set", onclick: async (e) => {
|
|
262
|
+
e.currentTarget.disabled = true;
|
|
263
|
+
try { const help = await api("/api/testsets/help"); await api("/api/testsets/example", { method: "PUT", body: { header: { system: help.examples.system, tools: help.examples.tools }, cases: help.examples.prompts } }); location.hash = "#/sets/example"; route(); }
|
|
264
|
+
catch (err) { e.currentTarget.disabled = false; alert(err.message); }
|
|
265
|
+
} });
|
|
266
|
+
body.replaceChildren(
|
|
267
|
+
h("div", { class: "nt-title" }, h("h2", { class: "nt-h1", text: name ? `Welcome, ${name}` : "Welcome" }), h("p", { class: "mu nt-sub", text: "Three steps to your first result." })),
|
|
268
|
+
h("div", { class: "fr-grid" },
|
|
269
|
+
h("section", { class: "card fr-card" },
|
|
270
|
+
h("div", { class: "fr-head" }, h("h2", { text: "Get your first result" }), h("span", { class: "mono mu", style: "font-size:13px", text: `${doneN} of 3 done` })),
|
|
271
|
+
h("div", { class: "fr-seg" }, ...[hasModel, hasSet, false].map((d) => h("span", { class: d ? "on" : "" }))),
|
|
272
|
+
step(1, hasModel, "Pick a model", hasModel ? "A model is already on this Mac" : "Models download from Hugging Face the first time you test them", h("a", { class: hasModel ? "btn" : "btn primary", href: hasModel ? "#/models" : "#/setup", text: hasModel ? "Models" : "Set up a model" })),
|
|
273
|
+
step(2, hasSet, "Add your prompts", hasSet ? "You have a test set" : "20 real prompts is enough to start. A guided setup shows you how, with examples.", h("span", { class: "row", style: "gap:8px;flex-wrap:nowrap" }, hasSet ? null : makeExample, h("a", { class: hasSet ? "btn" : "btn primary", href: "#/sets/new", text: hasSet ? "Test sets" : "Start guided setup" }))),
|
|
274
|
+
step(3, false, "Run your first test", "Compares the versions and recommends the smallest safe one", h("a", { class: hasModel && hasSet ? "btn primary" : "btn", href: "#/new", text: "New test" }))),
|
|
275
|
+
h("section", { class: "card fr-side" }, h("h2", { text: "What you'll get" }),
|
|
276
|
+
h("ul", { class: "fr-ul" }, ...["A plain recommendation, like \"use 6-bit\"", "Every answer that changed, side by side", "Speed and memory for each version", "Everything saved on this Mac"].map((t) => h("li", {}, svgEl(["M5 12l5 5L20 7"], "ico"), h("span", { text: t })))))));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async function screenHome() {
|
|
280
|
+
const body = h("div", { class: "stack" }, h("p", { class: "muted", text: "Loading…" }));
|
|
281
|
+
mount(shell("Home", body, "#/home"));
|
|
282
|
+
try {
|
|
283
|
+
const [runs, active, week] = await Promise.all([api("/api/runs"), api("/api/jobs/active"), api("/api/summary")]);
|
|
284
|
+
if (!runs.length && !active) { await homeFirstRun(body); return; }
|
|
285
|
+
const tile = (label, value, unit, tone) => h("div", { class: "tile", title: "Counted from your saved runs in the last 7 days" }, h("div", { class: "lbl", text: label }),
|
|
286
|
+
h("div", { class: `mono big ${tone || ""}` }, value === null || value === undefined ? dash : String(value), value !== null && value !== undefined && unit ? h("small", { text: ` ${unit}` }) : null));
|
|
287
|
+
const hour = new Date().getHours();
|
|
288
|
+
const hello = hour < 12 ? "Good morning" : hour < 18 ? "Good afternoon" : "Good evening";
|
|
289
|
+
const parts = [
|
|
290
|
+
h("div", { style: "display:flex;flex-direction:column;gap:6px" }, h("h2", { class: "greet", text: hello }), h("p", { class: "muted", style: "margin:0;font-size:16px", text: "Find the smallest version of a model that still works on your prompts." })),
|
|
291
|
+
h("section", { class: "hero-grid" },
|
|
292
|
+
h("div", { class: "card hero" }, h("h2", { text: "Test a model on your own prompts" }),
|
|
293
|
+
h("p", { text: "Pick a model, choose which versions to compare and add your prompts. QuantCheck recommends the smallest one that stays above your quality bar." }),
|
|
294
|
+
h("div", { class: "row", style: "gap:10px;align-items:stretch" }, h("a", { class: "btn primary", href: "#/new" }, svgEl(ICONS.plus, "ico"), "New test"), h("a", { class: "btn", href: "#/sets", text: "Write prompts first" }))),
|
|
295
|
+
h("div", { class: "card stats" }, h("h2", { text: "This week on your Mac" }),
|
|
296
|
+
h("div", { class: "tiles" }, tile("Tests run", week.tests_run), tile("Prompts checked", week.prompts_checked === null ? null : week.prompts_checked.toLocaleString()),
|
|
297
|
+
tile("Memory saved", week.memory_saved_gb, "GB"), tile("Worse answers found", week.worse_answers, "", week.worse_answers ? "warn-text" : "")))),
|
|
298
|
+
];
|
|
299
|
+
if (!runs.length && !active) {
|
|
300
|
+
parts.push(h("div", { class: "card empty" }, h("h2", { text: "No runs yet" }), h("p", { class: "muted", text: "Start a new test to compare the versions of a model on your own prompts." }), h("a", { class: "btn primary", href: "#/new", text: "Start a new test" })));
|
|
301
|
+
} else {
|
|
302
|
+
parts.push(h("section", { class: "card flush" }, h("div", { class: "row between pad" }, h("h2", { style: "margin:0", text: "Recent runs" }), h("a", { href: "#/runs", style: "font-size:14px", text: "All runs" })), runsTable(runs.slice(0, 5), active)));
|
|
303
|
+
}
|
|
304
|
+
body.replaceChildren(...parts);
|
|
305
|
+
} catch (e) { body.replaceChildren(h("div", { class: "notice fail", text: e.message })); }
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
async function screenRuns() {
|
|
309
|
+
const body = h("div", { class: "stack" }, h("p", { class: "muted", text: "Loading…" }));
|
|
310
|
+
mount(shell("Runs", body, "#/runs"));
|
|
311
|
+
try {
|
|
312
|
+
const [runs, active] = await Promise.all([api("/api/runs"), api("/api/jobs/active")]);
|
|
313
|
+
body.replaceChildren(runs.length || active ? h("section", { class: "card flush" }, runsTable(runs, active))
|
|
314
|
+
: emptyCard(ICONS.runs, "No tests yet", "Run your first test to see which version of your model is safe to use.", [h("a", { class: "btn primary", href: "#/new", text: "New test" })]));
|
|
315
|
+
} catch (e) { body.replaceChildren(h("div", { class: "notice fail", text: e.message })); }
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async function screenNew(prefill) {
|
|
319
|
+
const VERSIONS = [["8bit", "8-bit", ""], ["6bit", "6-bit", ""], ["4bit", "4-bit", "Most popular"], ["3bit", "3-bit", ""], ["2bit", "2-bit", "Often breaks"]];
|
|
320
|
+
const preModel = (prefill || "").startsWith("model:") ? decodeURIComponent(prefill.slice(6)) : "";
|
|
321
|
+
if (preModel) prefill = "";
|
|
322
|
+
const st = { picked: new Set(["8bit", "6bit", "4bit", "3bit"]), set: prefill || "", th: 97, models: [], sets: [], ram: 0, fit: null, runtime: "mlx", custom: "" };
|
|
323
|
+
const err = h("div", { "aria-live": "polite" });
|
|
324
|
+
const model = h("input", { type: "text", id: "model", placeholder: "mlx-community/Qwen3-8B or a local folder", autocomplete: "off", "aria-label": "Model",
|
|
325
|
+
style: "border:0;outline:0;background:transparent;min-height:46px;padding:0;flex:1;font-weight:500;color:inherit;font:inherit" });
|
|
326
|
+
const judge = h("input", { type: "text", id: "judge", placeholder: "default: mlx-community/Qwen3-8B-4bit" });
|
|
327
|
+
const maxTokens = h("input", { type: "number", id: "maxtokens", min: "1", max: "2048", placeholder: "512" });
|
|
328
|
+
const runtime = h("select", { id: "runtime" }, h("option", { value: "mlx", text: "MLX" }), h("option", { value: "llamacpp", text: "llama.cpp (GGUF)" }));
|
|
329
|
+
const custom = h("input", { type: "text", id: "testpath", placeholder: "/full/path/to/tests.jsonl", "aria-label": "Path to a test file" });
|
|
330
|
+
const modelNote = h("span", { class: "mu nt-small" });
|
|
331
|
+
const found = h("div", { class: "mu nt-small" });
|
|
332
|
+
const versionsBox = h("div", { class: "nt-versions" });
|
|
333
|
+
const bigBox = h("div");
|
|
334
|
+
const refNote = h("span", { class: "mu nt-small nt-right" });
|
|
335
|
+
const setsBox = h("div", { class: "nt-sets" });
|
|
336
|
+
const sliderVal = h("span", { class: "mono nt-green" });
|
|
337
|
+
const slider = h("input", { type: "range", min: "90", max: "100", step: "0.5", value: String(st.th), "aria-label": "Quality bar, percent of reference", class: "nt-range",
|
|
338
|
+
oninput: () => { st.th = Number(slider.value); sliderVal.textContent = `${st.th}% of reference`; } });
|
|
339
|
+
const fitBox = h("div", { class: "nt-fit" });
|
|
340
|
+
const summary = h("aside", { class: "card nt-summary" });
|
|
341
|
+
const short = () => (model.value.trim().split("/").pop() || "").replace(/-(\d+bit)$/, "");
|
|
342
|
+
const sizeGB = (label) => {
|
|
343
|
+
const s = short(); if (!s) return null;
|
|
344
|
+
const m = st.models.find((x) => x.id.split("/").pop().toLowerCase() === `${s}-${label}`.toLowerCase());
|
|
345
|
+
return m ? m.size_mb / 1000 : null;
|
|
346
|
+
};
|
|
347
|
+
const picked = () => VERSIONS.map((v) => v[0]).filter((l) => st.picked.has(l));
|
|
348
|
+
const chosenSet = () => st.sets.find((s) => s.file === st.set);
|
|
349
|
+
const testsValue = () => (st.set === "__path__" ? custom.value.trim() : st.set);
|
|
350
|
+
const ready = () => picked().length >= 2 && model.value.trim() && testsValue();
|
|
351
|
+
const num = (x) => (Math.round(x * 10) / 10).toString();
|
|
352
|
+
const tk = (n) => (n >= 1000 ? `${num(n / 1000)}k` : String(n));
|
|
353
|
+
|
|
354
|
+
const stepHead = (n, title, extra) => h("div", { class: "nt-head" }, h("span", { class: "mono nt-num", text: String(n) }), h("h2", { text: title }), extra || null);
|
|
355
|
+
|
|
356
|
+
function drawVersions() {
|
|
357
|
+
const ref = picked().find((l) => sizeGB(l) !== null && sizeGB(l) < st.ram - 2) || picked()[0];
|
|
358
|
+
versionsBox.replaceChildren(...VERSIONS.map(([label, text, note]) => {
|
|
359
|
+
const on = st.picked.has(label), gb = sizeGB(label), mem = gb === null ? null : gb * 1.1;
|
|
360
|
+
const fits = mem === null ? ["Not downloaded yet", ""] : mem < st.ram - 2 ? ["Fits in memory", "ok"] : ["Too big", "bad"];
|
|
361
|
+
return h("button", { type: "button", class: "nt-ver", "aria-pressed": String(on),
|
|
362
|
+
onclick: () => { on ? st.picked.delete(label) : st.picked.add(label); update(); } },
|
|
363
|
+
h("span", { class: "nt-box" }, svgEl(["M5 12l5 5L20 7"], "ico")),
|
|
364
|
+
h("span", { class: "nt-vname" }, text, " ", h("span", { class: "mu nt-small nt-w4", text: on && label === ref ? "Reference" : note })),
|
|
365
|
+
h("span", { class: "mono mu nt-small", text: gb === null ? "—" : `${num(gb)} GB` }),
|
|
366
|
+
h("span", { class: "mono nt-small", text: mem === null ? "—" : `~${num(mem)} GB RAM` }),
|
|
367
|
+
h("span", { class: `nt-small nt-fit-${fits[1]}`, text: fits[0] }));
|
|
368
|
+
}));
|
|
369
|
+
refNote.textContent = "The largest one that fits is the reference";
|
|
370
|
+
const big = picked().filter((l) => sizeGB(l) !== null && sizeGB(l) * 1.1 >= st.ram - 2);
|
|
371
|
+
bigBox.replaceChildren(...(big.length ? [alertCard("fail", `${big.join(", ")} can't load on this Mac`, `This Mac has ${st.ram} GB, so ${big.length === 1 ? "this version" : "these versions"} will be skipped. ${ref ? `${ref} is the largest that fits and will be the reference.` : ""}`)] : []));
|
|
372
|
+
}
|
|
373
|
+
function drawSets() {
|
|
374
|
+
setsBox.replaceChildren(...st.sets.filter((s) => !s.error).map((s) => h("button", { type: "button", class: "nt-set", "aria-pressed": String(st.set === s.file),
|
|
375
|
+
onclick: () => { st.set = s.file; loadFit(); update(); } },
|
|
376
|
+
h("span", { class: "nt-setname" }, h("span", { class: "nt-dot" }), s.name),
|
|
377
|
+
h("span", { class: "mu nt-small", text: `${s.prompts} prompts · Your set` }))),
|
|
378
|
+
h("button", { type: "button", class: "nt-set", "aria-pressed": String(st.set === "__path__"), onclick: () => { st.set = "__path__"; st.fit = null; update(); } },
|
|
379
|
+
h("span", { class: "nt-setname" }, h("span", { class: "nt-dot" }), "Another file"), h("span", { class: "mu nt-small", text: "A .jsonl on this Mac" })));
|
|
380
|
+
custom.hidden = st.set !== "__path__";
|
|
381
|
+
}
|
|
382
|
+
function drawFit() {
|
|
383
|
+
const f = st.fit;
|
|
384
|
+
if (!f) { fitBox.replaceChildren(h("div", { class: "mu nt-small", text: "Pick a test set to see how much of the model's context its longest prompt uses." })); return; }
|
|
385
|
+
const pct = (n) => `${Math.min(100, (n / f.context_tokens) * 100)}%`;
|
|
386
|
+
fitBox.replaceChildren(
|
|
387
|
+
h("div", { class: "nt-fit-top" }, h("span", { class: "nt-fit-title" }, svgEl(["M5 12l5 5L20 7"], "ico"), f.warn ? "Close to the limit" : "Fits the model"),
|
|
388
|
+
h("span", { class: "mono mu nt-small", text: `longest prompt ${tk(f.total)} of ${Math.round(f.context_tokens / 1024)}k tokens (typical window)` })),
|
|
389
|
+
h("div", { class: "nt-bar" }, h("i", { style: `width:${pct(f.fixed)};background:var(--primary)` }), h("i", { style: `width:${pct(f.documents)};background:var(--bright)` }), h("i", { style: `width:${pct(f.question + f.room)};background:var(--mint)` })),
|
|
390
|
+
h("div", { class: "mu nt-legend" },
|
|
391
|
+
h("span", {}, h("b", { style: "background:var(--primary)" }), ` Instructions + tools ${tk(f.fixed)}`),
|
|
392
|
+
h("span", {}, h("b", { style: "background:var(--bright)" }), ` Documents ${tk(f.documents)}`),
|
|
393
|
+
h("span", {}, h("b", { style: "background:var(--mint)" }), ` Question + answer room ${tk(f.question + f.room)}`),
|
|
394
|
+
h("span", { text: "We warn at 80% so nothing gets cut off silently" })));
|
|
395
|
+
if (f.warn) fitBox.append(h("div", { class: "notice warn", text: "This prompt fills most of the context window: answers may be cut short." }));
|
|
396
|
+
}
|
|
397
|
+
// The judge is a model too: if it is not on this Mac, the first run downloads it. Say so up front.
|
|
398
|
+
function judgeWarning() {
|
|
399
|
+
const id = judge.value.trim() || "mlx-community/Qwen3-8B-4bit";
|
|
400
|
+
if (id.startsWith("/") || id.startsWith(".") || id.startsWith("~") || st.models.some((m) => m.id === id)) return null;
|
|
401
|
+
const have = st.models.filter((m) => /-\d+bit$/.test(m.id)).slice(0, 3);
|
|
402
|
+
return h("div", { class: "nt-jw", role: "status" }, h("b", { text: "Judge model not on this Mac" }),
|
|
403
|
+
h("span", { text: `${id.split("/").pop()} will be downloaded from Hugging Face the first time (about 5 GB for the default). Or use one you already have:` }),
|
|
404
|
+
have.length ? h("span", { class: "nt-jw-btns" }, have.map((m) => h("button", { type: "button", class: "chip nodot", onclick: () => { judge.value = m.id; update(); }, text: m.id.split("/").pop() }))) : h("span", { class: "mu", text: "No other model is downloaded yet." }));
|
|
405
|
+
}
|
|
406
|
+
function drawSummary() {
|
|
407
|
+
const set = chosenSet(), n = picked().length, calls = set ? n * set.prompts : null;
|
|
408
|
+
const row = (k, v, cls) => h("div", { class: "nt-kv" }, h("span", { class: "mu", text: k }), h("span", { class: cls || "", text: v }));
|
|
409
|
+
summary.replaceChildren(
|
|
410
|
+
h("h2", { text: "Summary" }),
|
|
411
|
+
h("div", { class: "nt-kvs" }, row("Model", short() || "—"), row("Versions", String(n), "mono"), row("Test set", set ? set.name : st.set === "__path__" ? "Another file" : "—"),
|
|
412
|
+
row("Answers to generate", calls === null ? "—" : String(calls), "mono"), row("Judge", `Local · ${judge.value.trim().split("/").pop() || "Qwen3-8B-4bit"}`)),
|
|
413
|
+
...[judgeWarning()].filter(Boolean),
|
|
414
|
+
h("div", { class: "nt-where" }, h("span", { class: "nt-small nt-w5", text: "Where to run" }),
|
|
415
|
+
h("div", { class: "nt-run on" }, h("span", { class: "nt-radio on" }), h("span", { class: "nt-grow" }, h("b", { text: "This Mac" }), " ", h("span", { class: "mu nt-tiny", text: "· free, unlimited" }))),
|
|
416
|
+
h("a", { class: "nt-run", href: "#/plans" }, h("span", { class: "nt-radio" }), h("span", { class: "nt-grow" }, h("b", { text: "Cloud GPU" }), " ", h("span", { class: "mu nt-tiny", text: "· NVIDIA, vLLM" })), h("span", { class: "chip plain team", text: "Team" }))),
|
|
417
|
+
h("div", { class: "nt-time" }, h("div", { class: "lbl", text: `Estimated time on ${st.chip || "this Mac"}` }), h("div", { class: "mono nt-bigtime", text: "—" }), h("div", { class: "nt-small", text: "Shown after your first run. Versions run one at a time so memory stays free." })),
|
|
418
|
+
h("button", { class: "btn nt-start", type: "button", disabled: !ready(), onclick: start }, svgEl(["M6 4l14 8-14 8z"], "ico"), "Start test"),
|
|
419
|
+
h("span", { class: "mu nt-tiny nt-center", text: "Pick at least 2 versions." }),
|
|
420
|
+
h("details", { class: "nt-adv" }, h("summary", { text: `Advanced: seed 42 · temperature 0 · ${maxTokens.value || 512} tokens` }),
|
|
421
|
+
h("p", { class: "mu", style: "margin:8px 0", text: "Saved with the results so anyone can rerun them exactly." }),
|
|
422
|
+
h("div", { class: "field" }, h("label", { for: "runtime", text: "Runtime" }), runtime),
|
|
423
|
+
h("div", { class: "field" }, h("label", { for: "judge", text: "Judge model" }), judge, h("span", { class: "hint", text: "Runs on this Mac. Needs about 5 GB the first time." })),
|
|
424
|
+
h("div", { class: "field" }, h("label", { for: "maxtokens", text: "Max answer length (tokens)" }), maxTokens)));
|
|
425
|
+
}
|
|
426
|
+
function update() {
|
|
427
|
+
modelNote.textContent = model.value.trim() ? "Hugging Face id or local folder" : "Type a Hugging Face id or a local folder";
|
|
428
|
+
drawVersions(); drawSets(); drawFit(); drawSummary();
|
|
429
|
+
}
|
|
430
|
+
async function loadFit() {
|
|
431
|
+
st.fit = null;
|
|
432
|
+
if (!st.set || st.set === "__path__") { drawFit(); return; }
|
|
433
|
+
try { st.fit = await api(`/api/testsets/${encodeURIComponent(st.set.replace(/\.jsonl$/, ""))}/context`); } catch (e) { st.fit = null; }
|
|
434
|
+
drawFit();
|
|
435
|
+
}
|
|
436
|
+
async function start() {
|
|
437
|
+
err.replaceChildren();
|
|
438
|
+
const body = { model: model.value.trim(), runtime: runtime.value, versions: picked(), tests: testsValue(), quality_limit: st.th / 100 };
|
|
439
|
+
if (judge.value.trim()) body.judge_model = judge.value.trim();
|
|
440
|
+
if (maxTokens.value) body.max_tokens = Number(maxTokens.value);
|
|
441
|
+
try { const job = await api("/api/runs", { method: "POST", body }); location.hash = `#/run/${job.id}`; }
|
|
442
|
+
catch (e) { err.replaceChildren(h("div", { class: "notice fail", role: "alert", text: e.message })); }
|
|
443
|
+
}
|
|
444
|
+
for (const el of [model, judge, maxTokens, runtime, custom]) el.addEventListener("input", update);
|
|
445
|
+
runtime.addEventListener("change", update);
|
|
446
|
+
sliderVal.textContent = `${st.th}% of reference`;
|
|
447
|
+
|
|
448
|
+
const body = h("div", { class: "stack nt" },
|
|
449
|
+
h("div", { class: "nt-title" }, h("h2", { class: "nt-h1", text: "New test" }), h("p", { class: "mu nt-sub", text: "Three choices, then QuantCheck does the rest." })),
|
|
450
|
+
h("div", { class: "nt-grid" },
|
|
451
|
+
h("div", { class: "nt-col" },
|
|
452
|
+
h("section", { class: "card nt-card" }, stepHead(1, "Model"),
|
|
453
|
+
h("label", { class: "nt-search" }, svgEl(["M11 4a7 7 0 100 14 7 7 0 000-14zM21 21l-4.3-4.3"], "ico"), model, modelNote), found),
|
|
454
|
+
h("section", { class: "card nt-card" }, stepHead(2, "Versions to compare", refNote), versionsBox, bigBox),
|
|
455
|
+
h("section", { class: "card nt-card" }, stepHead(3, "Prompts", h("a", { href: "#/sets", class: "nt-right", style: "font-size:14px", text: "Manage test sets" })),
|
|
456
|
+
setsBox, custom,
|
|
457
|
+
h("label", { class: "nt-bar-label" }, h("span", { class: "nt-qrow" }, "Quality bar", sliderVal), slider,
|
|
458
|
+
h("span", { class: "mu nt-small", text: "A version is recommended only if it keeps at least this much quality. 97% suits most support and chat use." })),
|
|
459
|
+
fitBox, err)),
|
|
460
|
+
summary));
|
|
461
|
+
mount(shell("New test", body, "#/new", h("a", { class: "btn", href: "#/home", text: "Cancel" })));
|
|
462
|
+
if (preModel) model.value = preModel;
|
|
463
|
+
update();
|
|
464
|
+
try {
|
|
465
|
+
const [models, sets, sys] = await Promise.all([api("/api/models"), api("/api/testsets"), api("/api/system")]);
|
|
466
|
+
st.models = models; st.sets = sets; st.ram = sys.hardware.ram_gb; st.chip = (sys.hardware.chip || "").replace(/^Apple /, "");
|
|
467
|
+
const ok = sets.filter((s) => !s.error);
|
|
468
|
+
if (!ok.some((s) => s.file === st.set)) st.set = ok.length ? ok[0].file : "__path__";
|
|
469
|
+
const base = [...new Set(models.filter((m) => /-\d+bit$/.test(m.id)).map((m) => m.id.replace(/-(\d+bit)$/, "")))];
|
|
470
|
+
model.setAttribute("list", "models-list");
|
|
471
|
+
body.append(h("datalist", { id: "models-list" }, base.map((b) => h("option", { value: b }))));
|
|
472
|
+
found.replaceChildren(models.length ? `Found on this Mac: ${base.length} model${base.length === 1 ? "" : "s"} in the Hugging Face cache` : "No models cached yet: they download the first time you run a test.");
|
|
473
|
+
if (sys.ollama_models.length) found.append(" · ", h("a", { href: "#/models", text: `Ollama (${sys.ollama_models.length} model${sys.ollama_models.length === 1 ? "" : "s"})` }));
|
|
474
|
+
update(); loadFit();
|
|
475
|
+
} catch (e) { /* lists are optional */ }
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
async function screenRun(jobId) {
|
|
479
|
+
const body = h("div", { class: "stack" }, h("p", { class: "muted", text: "Loading…" }));
|
|
480
|
+
mount(shell(["Runs", "Test running"], body, "#/runs"));
|
|
481
|
+
const mins = (sec) => (sec < 60 ? "under 1 min" : `${Math.round(sec / 60)} min`);
|
|
482
|
+
const hhmm = (t) => new Date(t * 1000).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
483
|
+
const short = (m) => (m || "").split("/").pop();
|
|
484
|
+
const ringSvg = (pct) => {
|
|
485
|
+
const s = document.createElementNS(SVG, "svg");
|
|
486
|
+
s.setAttribute("width", "128"); s.setAttribute("height", "128"); s.setAttribute("viewBox", "0 0 128 128"); s.setAttribute("role", "img"); s.setAttribute("aria-label", `${pct}% complete`);
|
|
487
|
+
s.classList.add("rn-ring");
|
|
488
|
+
const mk = (t, a, txt) => { const e = document.createElementNS(SVG, t); for (const [k, v] of Object.entries(a)) e.setAttribute(k, v); if (txt) e.textContent = txt; s.append(e); };
|
|
489
|
+
const C = 2 * Math.PI * 58.5;
|
|
490
|
+
mk("circle", { cx: 64, cy: 64, r: 58.5, fill: "none", class: "rn-ring-bg", "stroke-width": 11 });
|
|
491
|
+
mk("circle", { cx: 64, cy: 64, r: 58.5, fill: "none", class: "rn-ring-fg", "stroke-width": 11, "stroke-linecap": "round", "stroke-dasharray": C.toFixed(1), "stroke-dashoffset": (C * (1 - pct / 100)).toFixed(1), transform: "rotate(-90 64 64)" });
|
|
492
|
+
mk("text", { x: "50%", y: "48%", "text-anchor": "middle", class: "rn-ring-n" }, `${pct}%`);
|
|
493
|
+
mk("text", { x: "50%", y: "66%", "text-anchor": "middle", class: "rn-ring-l" }, "done");
|
|
494
|
+
return s;
|
|
495
|
+
};
|
|
496
|
+
const smallRing = (frac) => {
|
|
497
|
+
const s = document.createElementNS(SVG, "svg");
|
|
498
|
+
s.setAttribute("width", "26"); s.setAttribute("height", "26"); s.setAttribute("viewBox", "0 0 26 26"); s.setAttribute("aria-hidden", "true"); s.classList.add("rn-sring");
|
|
499
|
+
const mk = (a) => { const e = document.createElementNS(SVG, "circle"); for (const [k, v] of Object.entries(a)) e.setAttribute(k, v); s.append(e); };
|
|
500
|
+
mk({ cx: 13, cy: 13, r: 10, fill: "none", class: "bg", "stroke-width": 3 });
|
|
501
|
+
mk({ cx: 13, cy: 13, r: 10, fill: "none", class: "fg", "stroke-width": 3, "stroke-linecap": "round", "stroke-dasharray": "62.8", "stroke-dashoffset": (62.8 * (1 - frac)).toFixed(1), transform: "rotate(-90 13 13)" });
|
|
502
|
+
return s;
|
|
503
|
+
};
|
|
504
|
+
const tick = () => svgEl(["M5 12l5 5L20 7"], "ico");
|
|
505
|
+
|
|
506
|
+
const draw = (job) => {
|
|
507
|
+
const now = Date.now() / 1000;
|
|
508
|
+
const live = job.versions.filter((v) => v.state !== "skipped");
|
|
509
|
+
const total = live.reduce((a, v) => a + v.total, 0), done = live.reduce((a, v) => a + v.done, 0);
|
|
510
|
+
const pct = jobPct(job);
|
|
511
|
+
// seconds per answer, from versions that have started (load time is included, so it errs long)
|
|
512
|
+
let spent = 0, n = 0;
|
|
513
|
+
for (const v of live) if (v.started_at && v.done) { spent += (v.ended_at || now) - v.started_at; n += v.done; }
|
|
514
|
+
const perAnswer = n >= 2 ? spent / n : null;
|
|
515
|
+
const leftSec = perAnswer !== null && job.phase === "generating" ? (total - done) * perAnswer : null;
|
|
516
|
+
const running = job.state === "running";
|
|
517
|
+
const chip = h("span", { class: `chip ${running ? "ok live" : job.state === "done" ? "ok" : "fail"} rn-chip`, text:
|
|
518
|
+
job.state === "error" ? "Stopped" : job.state === "done" ? "Finished" : job.phase === "judging" ? `Judging answers · ${job.judge.done} of ${job.judge.total}`
|
|
519
|
+
: leftSec !== null ? `Running · about ${mins(leftSec)} left` : "Running" });
|
|
520
|
+
const bars = live.length ? job.versions.map((v) => {
|
|
521
|
+
if (v.state === "skipped") return h("div", { class: "rn-vb" }, h("div", { class: "rn-big wait" }), h("div", { class: "rn-vl" }, h("b", { text: v.label }), h("span", { class: "mu", text: "Skipped" })));
|
|
522
|
+
const vp = v.total ? Math.round((v.done / v.total) * 100) : 0;
|
|
523
|
+
const sub = v.state === "done" ? `Done · ${v.started_at && v.ended_at ? mins(v.ended_at - v.started_at) : ""}`.replace(/ · $/, "")
|
|
524
|
+
: v.state === "running" ? `${vp}%${perAnswer !== null ? ` · ${mins((v.total - v.done) * perAnswer)} left` : ""}` : "Queued";
|
|
525
|
+
return h("div", { class: "rn-vb" },
|
|
526
|
+
h("div", { class: `rn-big ${v.state === "waiting" ? "wait" : ""}` }, v.state === "waiting" ? null : h("i", { class: v.state === "running" ? "stripe" : "", style: `width:${v.state === "done" ? 100 : vp}%` })),
|
|
527
|
+
h("div", { class: "rn-vl" }, h("b", { text: v.label }), h("span", { class: v.state === "done" ? "ok" : v.state === "running" ? "go" : "mu", text: sub })));
|
|
528
|
+
}) : [];
|
|
529
|
+
const started = h("div", { class: "rn-facts" },
|
|
530
|
+
...[["Started", hhmm(job.started_at)], ["Elapsed", mins(now - job.started_at)], ["Left", leftSec !== null ? `~${mins(leftSec)}` : "—"], ["Answers so far", String(done)]].map(([k, v]) =>
|
|
531
|
+
h("div", { class: "rn-fact" }, h("span", { class: "lbl", text: k }), h("span", { class: "mono", text: v }))));
|
|
532
|
+
const top = h("section", { class: "card rn-top" }, ringSvg(pct),
|
|
533
|
+
h("div", { class: "rn-topr" },
|
|
534
|
+
h("div", { class: "rn-toph" }, h("span", { class: "rn-count", text: `${done} of ${total} answers` }), h("span", { class: "mu", text: "One version at a time, so memory stays free" })),
|
|
535
|
+
h("div", { class: "rn-vbs", style: `grid-template-columns:repeat(${Math.max(1, job.versions.length)},minmax(0,1fr))` }, bars), started));
|
|
536
|
+
const row = (v) => {
|
|
537
|
+
const vp = v.total ? Math.round((v.done / v.total) * 100) : 0;
|
|
538
|
+
const icon = v.state === "done" ? h("span", { class: "rn-ok" }, tick()) : v.state === "running" ? smallRing(vp / 100) : h("span", { class: "rn-dash" });
|
|
539
|
+
const lineTxt = v.state === "skipped" ? v.reason || "Skipped" : v.state === "waiting" ? "Waiting its turn" : v.state === "running" ? `${v.done} of ${v.total} · generating answers` : `${v.done} of ${v.total}${v.failed ? ` · ${v.failed} could not be answered` : ""}`;
|
|
540
|
+
return h("div", { class: `rn-row ${v.state === "running" ? "now" : ""}` }, icon, h("b", { text: v.label }),
|
|
541
|
+
h("div", { class: "rn-prog" }, h("div", { class: "rn-prog-top" }, h("div", { class: `rn-bar ${v.state === "waiting" || v.state === "skipped" ? "wait" : ""}` }, v.state === "waiting" || v.state === "skipped" ? null : h("i", { class: v.state === "running" ? "stripe" : "", style: `width:${v.state === "done" ? 100 : vp}%` })),
|
|
542
|
+
h("span", { class: "mono rn-pct", text: v.state === "waiting" || v.state === "skipped" ? "—" : `${v.state === "done" ? 100 : vp}%` })), h("span", { class: "mu rn-sm", text: lineTxt })),
|
|
543
|
+
h("span", { class: "mono", text: "—", title: "Quality appears after the judge has scored the answers" }),
|
|
544
|
+
h("span", { class: "mono", text: v.tok_s ? `${v.tok_s} t/s` : "—" }), h("span", { class: "mono", text: v.peak_gb ? `${v.peak_gb} GB` : "—" }));
|
|
545
|
+
};
|
|
546
|
+
const table = h("section", { class: "card rn-table" },
|
|
547
|
+
h("div", { class: "rn-row rn-hd lbl" }, h("span"), h("span", { text: "Version" }), h("span", { text: "Progress" }), h("span", { text: "Quality so far" }), h("span", { text: "Speed" }), h("span", { text: "Memory" })),
|
|
548
|
+
...job.versions.map(row));
|
|
549
|
+
const lt = job.latest;
|
|
550
|
+
const nowCard = h("section", { class: "card rn-now" },
|
|
551
|
+
h("div", { class: "rn-nowh" }, h("h3", { text: lt ? `Latest answer · ${lt.version}` : "Latest answer" }), lt ? h("span", { class: "mono mu rn-sm", text: lt.case_id }) : null),
|
|
552
|
+
lt ? [h("div", { class: "rn-q", text: lt.prompt }), h("div", { class: "rn-a", text: lt.error ? `Could not answer: ${lt.error}` : lt.answer || "(empty answer)" })]
|
|
553
|
+
: h("p", { class: "mu", text: "The first answer appears here once the model has loaded." }));
|
|
554
|
+
const signals = [];
|
|
555
|
+
for (const v of job.versions) if (v.failed) signals.push(["warn", `${v.label}: ${v.failed} answer${v.failed === 1 ? "" : "s"} could not be generated.`]);
|
|
556
|
+
for (const v of job.versions) if (v.state === "skipped") signals.push(["warn", `${v.label} was skipped: ${v.reason || "not available"}.`]);
|
|
557
|
+
for (const w of job.warnings) signals.push(["warn", w]);
|
|
558
|
+
const sig = h("section", { class: "card rn-sig" }, h("h3", { text: "Early signals" }),
|
|
559
|
+
...(signals.length ? signals.map(([k, t]) => h("div", { class: `rn-note ${k}` }, h("span", { class: "dot" }), h("span", { text: t }))) : [h("div", { class: "rn-note ok" }, h("span", { class: "dot" }), h("span", { text: "Nothing wrong so far. Checks and scores come once every version has answered." }))]),
|
|
560
|
+
h("div", { class: "mu rn-sm", text: "Scores are provisional until the judge finishes." }));
|
|
561
|
+
const parts = [
|
|
562
|
+
h("div", { class: "rn-title" }, h("div", {}, h("h2", { class: "nt-h1", text: `Testing ${short(job.model)}` }),
|
|
563
|
+
h("p", { class: "mu nt-sub", text: `${job.tests || "Test set"} · ${job.n_prompts} prompts · ${live.length} version${live.length === 1 ? "" : "s"} · quality bar ${Math.round(job.quality_limit * 1000) / 10}%` })), chip),
|
|
564
|
+
top, table, h("div", { class: "rn-two" }, nowCard, sig)];
|
|
565
|
+
if (job.state === "error") {
|
|
566
|
+
const kept = job.run_id ? "Your answers are saved with this run." : "Nothing was saved: answers are written when every version has answered.";
|
|
567
|
+
parts.push(alertCard(job.run_id ? "warn" : "fail", job.run_id ? "Scoring stopped" : "Test stopped", `${job.error} ${kept}`,
|
|
568
|
+
[h("a", { class: "btn primary", href: job.run_id ? `#/report/${job.run_id}` : "#/new", text: job.run_id ? "Open what was saved" : "Start again" }), h("a", { class: "btn", href: "#/runs", text: "Back to Runs" })]));
|
|
569
|
+
}
|
|
570
|
+
if (job.run_id && !running) parts.push(h("div", { class: "row" }, h("a", { class: "btn primary", href: `#/report/${job.run_id}`, text: "Open report" }), h("a", { class: "btn", href: `#/review/${job.run_id}`, text: "Review changed answers" }), h("a", { class: "btn", href: "#/home", text: "Back to Home" })));
|
|
571
|
+
body.replaceChildren(...parts);
|
|
572
|
+
};
|
|
573
|
+
const poll = async () => {
|
|
574
|
+
try {
|
|
575
|
+
const job = await api(`/api/jobs/${encodeURIComponent(jobId)}`);
|
|
576
|
+
draw(job);
|
|
577
|
+
if (job.state === "running") pollTimer = setTimeout(poll, 1000);
|
|
578
|
+
} catch (e) { body.replaceChildren(h("div", { class: "notice fail", text: e.message })); }
|
|
579
|
+
};
|
|
580
|
+
poll();
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function screenReport(runId) {
|
|
584
|
+
const url = `/api/runs/${encodeURIComponent(runId)}/report`;
|
|
585
|
+
mount(shell("Report", h("div", { style: "display:grid;gap:12px" },
|
|
586
|
+
h("div", { class: "row" }, h("a", { class: "btn", href: "#/home", text: "← Home" }),
|
|
587
|
+
h("a", { class: "btn", href: url, target: "_blank", rel: "noopener", text: "Open in a new tab" }),
|
|
588
|
+
h("a", { class: "btn", href: `#/review/${encodeURIComponent(runId)}`, text: "Review changed answers" }),
|
|
589
|
+
h("span", { class: "hint mono", text: runId })),
|
|
590
|
+
h("div", { class: "iframe-wrap" }, h("iframe", { src: url, title: "Report" }))), "#/home"));
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
async function screenModels() {
|
|
594
|
+
const body = h("div", { class: "stack" }, h("p", { class: "muted", text: "Loading…" }));
|
|
595
|
+
mount(shell("Models", body, "#/models", h("a", { class: "btn primary", href: "#/models/discover", onclick: (e) => { e.preventDefault(); document.getElementById("discover")?.scrollIntoView({ behavior: "smooth" }); } }, svgEl(ICONS.plus, "ico"), "Add model")));
|
|
596
|
+
try {
|
|
597
|
+
const [cached, sys, runs, suggested, active] = await Promise.all([api("/api/models"), api("/api/system"), api("/api/runs"), api("/api/models/suggested"), api("/api/jobs/active")]);
|
|
598
|
+
const ram = sys.hardware.ram_gb, free = sys.hardware.free_disk_gb;
|
|
599
|
+
const base = (id) => id.replace(/-(\d+bit)$/, "").replace(/-GGUF$/i, "");
|
|
600
|
+
const short = (id) => base(id).split("/").pop();
|
|
601
|
+
// group the Hugging Face cache by model: one row per model, one chip per version on disk
|
|
602
|
+
const groups = new Map();
|
|
603
|
+
for (const m of cached) {
|
|
604
|
+
const bits = (m.id.match(/-(\d+bit)$/) || [])[1];
|
|
605
|
+
const gguf = /gguf/i.test(m.id);
|
|
606
|
+
if (!bits && !gguf) continue; // embedding, speech and other non-LLM downloads are not shown
|
|
607
|
+
const key = base(m.id);
|
|
608
|
+
const g = groups.get(key) || { id: key, versions: [], mb: 0, source: gguf ? "Hugging Face · GGUF" : "Hugging Face · MLX" };
|
|
609
|
+
g.versions.push(bits ? bits.replace("bit", "-bit") : "GGUF"); g.mb += m.size_mb; groups.set(key, g);
|
|
610
|
+
}
|
|
611
|
+
const rows = [...groups.values()].sort((a, b) => b.mb - a.mb);
|
|
612
|
+
const ollama = sys.ollama_models.map((n) => ({ id: n, versions: [n.split(":")[1] || "latest"], mb: null, source: "Ollama · GGUF", ollama: true }));
|
|
613
|
+
const status = (r) => {
|
|
614
|
+
const same = (m) => m && base(m).toLowerCase() === r.id.toLowerCase();
|
|
615
|
+
if (active && same(active.model)) return ["ok live", "Testing now"];
|
|
616
|
+
const run = runs.find((x) => same(x.model));
|
|
617
|
+
if (!run) return ["plain", "Not tested yet"];
|
|
618
|
+
if (run.status === "recommended") return ["ok", `Tested · ${run.recommended}`];
|
|
619
|
+
if (run.status === "none_safe") return ["warn", "Tested · none safe"];
|
|
620
|
+
return ["plain", "Tested · inconclusive"];
|
|
621
|
+
};
|
|
622
|
+
const usedGB = rows.reduce((a, r) => a + r.mb / 1000, 0), total = usedGB + free;
|
|
623
|
+
const shades = ["var(--primary)", "var(--bright)", "var(--mint)", "#A7F3D0"];
|
|
624
|
+
const disk = h("section", { class: "card md-disk" },
|
|
625
|
+
h("div", { class: "md-diskh" }, h("b", { text: "Disk used by models" }), h("span", { class: "mono", text: `${usedGB.toFixed(1)} GB used · ${free} GB free` })),
|
|
626
|
+
h("div", { class: "md-bar", role: "img", "aria-label": "Disk used by each model" }, ...rows.slice(0, 4).map((r, i) => h("i", { style: `width:${(r.mb / 1000 / total) * 100}%;background:${shades[i]}`, title: short(r.id) }))),
|
|
627
|
+
h("div", { class: "mu md-legend" }, ...rows.slice(0, 4).map((r, i) => h("span", {}, h("b", { style: `background:${shades[i]}` }), ` ${short(r.id)}`)), rows.length > 4 ? h("span", { text: `+${rows.length - 4} more` }) : null));
|
|
628
|
+
const tr = (r) => {
|
|
629
|
+
const [cls, label] = status(r);
|
|
630
|
+
return h("tr", {}, h("td", {}, h("a", { class: "md-name", href: `#/model/${encodeURIComponent(r.id)}`, text: short(r.id) }), h("div", { class: "mu md-src", text: r.source })),
|
|
631
|
+
h("td", {}, h("span", { class: "md-chips" }, r.versions.sort().map((v) => h("span", { class: "chip nodot md-v", text: v })))),
|
|
632
|
+
h("td", { class: "mono", text: r.mb === null ? "—" : `${(r.mb / 1000).toFixed(1)} GB` }),
|
|
633
|
+
h("td", {}, h("span", { class: `chip ${cls}`, text: label })),
|
|
634
|
+
h("td", { class: "md-act" }, r.ollama ? h("span", { class: "mu md-src", text: "Test from MLX or GGUF files" }) : h("a", { class: "btn md-test", href: `#/new/model:${encodeURIComponent(r.id)}`, text: "Test" })));
|
|
635
|
+
};
|
|
636
|
+
const all = [...rows, ...ollama];
|
|
637
|
+
const table = all.length ? h("section", { class: "card md-tw" }, h("table", { class: "md-tbl" },
|
|
638
|
+
h("thead", {}, h("tr", {}, h("th", { text: "Model" }), h("th", { text: "Versions on disk" }), h("th", { text: "Size" }), h("th", { text: "Status" }), h("th", {}, h("span", { class: "visually-hidden", text: "Action" })))), h("tbody", {}, all.map(tr))))
|
|
639
|
+
: emptyCard(ICONS.models, "No models on this Mac", `Models download the first time you test them. Pick one that fits your ${ram} GB under Discover.`, [h("a", { class: "btn primary", href: "#/models/discover", text: "Find a model", onclick: (e) => { e.preventDefault(); document.getElementById("discover")?.scrollIntoView({ behavior: "smooth" }); } })]);
|
|
640
|
+
// Discover: sizes are estimates (parameters x bits / 8 + 10%), shown with a "~"
|
|
641
|
+
const est = (p, bits) => (p * bits) / 8 * 1.1, fits = (gb) => gb < ram - 2;
|
|
642
|
+
const state = { fit: true, indian: false, small: false };
|
|
643
|
+
const grid = h("div", { class: "md-grid" });
|
|
644
|
+
const chips = h("div", { class: "md-fil" });
|
|
645
|
+
const drawDiscover = () => {
|
|
646
|
+
chips.replaceChildren(...[["fit", "Fits this Mac"], ["indian", "Indian languages"], ["small", "Under 10B"]].map(([k, t]) =>
|
|
647
|
+
h("button", { type: "button", class: `chip nodot md-f ${state[k] ? "on" : ""}`, "aria-pressed": String(state[k]), onclick: () => { state[k] = !state[k]; drawDiscover(); } }, t)));
|
|
648
|
+
const list = suggested.filter((s) => (!state.indian || s.indian) && (!state.small || s.params_b < 10) && (!state.fit || fits(est(s.params_b, 4))));
|
|
649
|
+
grid.replaceChildren(...(list.length ? list.map((s) => {
|
|
650
|
+
const ok = [4, 6, 8].filter((b) => fits(est(s.params_b, b)));
|
|
651
|
+
const none = !ok.length, label = none ? "Won't fit this Mac" : ok.length === 3 ? "All versions fit" : ok.length === 1 ? `${ok[0]}-bit fits` : `${ok[0]}-bit and ${ok[1]}-bit fit`;
|
|
652
|
+
return h("div", { class: `card md-card ${none ? "dim" : ""}` }, h("div", { class: "md-ch" }, h("b", { text: s.name }), h("span", { class: "chip nodot mono md-v", text: `${s.params_b}B` })),
|
|
653
|
+
h("span", { class: "mu md-note", text: s.note }), h("span", { class: "mono md-sz", text: `~${est(s.params_b, 3).toFixed(1)}–${est(s.params_b, 8).toFixed(1)} GB` }),
|
|
654
|
+
h("span", { class: `chip ${none ? "fail" : "ok"}`, text: label }),
|
|
655
|
+
h("div", { class: "md-go" }, none ? h("span", { class: "mu md-src", text: "Needs a cloud GPU (Team, later)" }) : h("a", { class: "btn md-test", href: `#/new/model:${encodeURIComponent(s.mlx_id)}`, text: "Test this model" })));
|
|
656
|
+
}) : [h("p", { class: "mu", text: "Nothing matches these filters." })]));
|
|
657
|
+
};
|
|
658
|
+
drawDiscover();
|
|
659
|
+
body.replaceChildren(...[
|
|
660
|
+
h("div", { class: "nt-title" }, h("h2", { class: "nt-h1", text: "Models" }), h("p", { class: "mu nt-sub", text: "What's on this Mac, and what else would fit." })),
|
|
661
|
+
h("div", { class: "md-tabs" }, h("span", { class: "chip nodot md-f on", text: `On this Mac · ${all.length}` }), h("a", { href: "#/models/discover", class: "chip nodot md-f", text: "Discover", onclick: (e) => { e.preventDefault(); document.getElementById("discover")?.scrollIntoView({ behavior: "smooth" }); } })),
|
|
662
|
+
free < 10 ? alertCard("warn", `Only ${free} GB free on this Mac`, "Models need several GB each. Remove models you no longer use from the Hugging Face cache folder, or pick a smaller one under Discover.", [h("a", { class: "btn primary", href: "#/models/discover", text: "Choose a smaller model", onclick: (e) => { e.preventDefault(); document.getElementById("discover")?.scrollIntoView({ behavior: "smooth" }); } })]) : null,
|
|
663
|
+
rows.length ? disk : null, table,
|
|
664
|
+
h("section", { id: "discover", class: "md-disc" }, h("div", { class: "md-dh" }, h("h2", { text: "Discover" }), h("span", { class: "mu", text: `Filtered for ${ram} GB memory` }), chips),
|
|
665
|
+
h("p", { class: "mu md-note2", text: "A short list we keep by hand. Nothing is fetched from the internet to build it. Sizes are estimates; models download from Hugging Face the first time you test them." }), grid)].filter(Boolean));
|
|
666
|
+
} catch (e) { body.replaceChildren(h("div", { class: "notice fail", text: e.message })); }
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
async function screenModelDetail(id) {
|
|
670
|
+
const body = h("div", { class: "stack" }, h("p", { class: "muted", text: "Loading…" }));
|
|
671
|
+
const name = (id || "").split("/").pop();
|
|
672
|
+
mount(shell(["Models", name], body, "#/models"));
|
|
673
|
+
try {
|
|
674
|
+
const d = await api(`/api/model?id=${encodeURIComponent(id)}`);
|
|
675
|
+
const n = d.versions.length, ram = d.ram_gb;
|
|
676
|
+
const label = (v) => (v.format === "GGUF" ? "GGUF" : v.label.replace("bit", "-bit"));
|
|
677
|
+
const card = (cls, lbl, big, sub, mono) => h("div", { class: `card md2-card ${cls || ""}` }, h("div", { class: "lbl", text: lbl }), h("div", { class: mono ? "mono md2-big" : "md2-big md2-rec", text: big }), h("div", { class: "mu md2-sub", text: sub }));
|
|
678
|
+
const verdict = (v) => {
|
|
679
|
+
if (!v.fits) return ["fail", "Won't fit this Mac"];
|
|
680
|
+
const r = v.result;
|
|
681
|
+
if (!r) return ["plain", "Not tested"];
|
|
682
|
+
if (r.is_reference) return ["plain", "Reference"];
|
|
683
|
+
if (r.recommended) return ["ok", "Recommended for you"];
|
|
684
|
+
if (r.verdict === "unsafe") return ["fail", "Below bar"];
|
|
685
|
+
if (r.verdict === "uncertain") return ["warn", "Too close to call"];
|
|
686
|
+
if (r.n_worse) return ["warn", `${r.n_worse} regression${r.n_worse === 1 ? "" : "s"}`];
|
|
687
|
+
return ["ok", "Passed"];
|
|
688
|
+
};
|
|
689
|
+
const rows = d.versions.map((v) => {
|
|
690
|
+
const [cls, text] = verdict(v), pct = Math.min(100, Math.round((v.memory_gb / ram) * 100));
|
|
691
|
+
return h("tr", { class: d.recommended && v.label === d.recommended ? "md2-hi" : "" },
|
|
692
|
+
h("td", { class: "md2-v", text: label(v) }), h("td", { class: "mu", text: v.format === "GGUF" ? "GGUF · llama.cpp" : "MLX" }),
|
|
693
|
+
h("td", { class: "mono", text: `${v.size_gb} GB` }),
|
|
694
|
+
h("td", {}, h("div", { class: "md2-mem" }, h("div", { class: "track md2-trk" }, h("i", { style: `width:${pct}%;background:${v.fits ? "var(--bright)" : "var(--fail)"}` })),
|
|
695
|
+
h("span", { class: "mono md2-m", text: `${v.memory_gb} GB`, title: v.memory_measured ? "Measured in your run" : "Estimate: file size plus about 10%" }), v.memory_measured ? null : h("span", { class: "mu md2-est", text: "est." }))),
|
|
696
|
+
h("td", {}, h("span", { class: `chip ${cls}`, text })), h("td", { class: "md2-on" }, h("span", { class: "mu", text: "On disk" })));
|
|
697
|
+
});
|
|
698
|
+
const table = n ? h("section", { class: "card md2-tw" }, h("div", { class: "md2-th" }, h("h2", { text: "All versions" }), h("span", { class: "mu", text: `Memory shown against your ${ram} GB` })),
|
|
699
|
+
h("div", { class: "md2-scroll" }, h("table", { class: "md-tbl" }, h("thead", {}, h("tr", {}, ["Version", "Format", "File size", "Memory when running", "Your result", ""].map((t) => h("th", { text: t })))), h("tbody", {}, rows))))
|
|
700
|
+
: emptyCard(ICONS.models, "No versions of this model on disk", "Models download the first time you test them. Start a test to fetch the versions.", [h("a", { class: "btn primary", href: `#/new/model:${encodeURIComponent(id)}`, text: "Test this model" })]);
|
|
701
|
+
body.replaceChildren(...[
|
|
702
|
+
h("div", { class: "md2-head" }, h("div", { class: "md2-hl" }, h("div", { class: "row", style: "gap:10px" }, h("h2", { class: "md2-name", text: d.name }), d.params ? h("span", { class: "chip nodot mono md-v", text: d.params }) : null),
|
|
703
|
+
h("p", { class: "mu nt-sub", text: `${d.id} · ${n} version${n === 1 ? "" : "s"} on this Mac` })),
|
|
704
|
+
h("a", { class: "btn primary", href: `#/new/model:${encodeURIComponent(d.id)}` }, svgEl(["M6 4l14 8-14 8z"], "ico"), "Test versions")),
|
|
705
|
+
h("section", { class: "md2-cards" },
|
|
706
|
+
card("rec", "Your recommendation", d.recommended ? d.recommended.replace("bit", "-bit") : d.run_id && d.reference ? `Keep ${d.reference.replace("bit", "-bit")}` : "—", d.recommended ? `From test set ${d.from_test}` : d.run_id ? "Not proven yet: no smaller version was shown safe" : "Not tested yet"),
|
|
707
|
+
card("", "Versions on disk", String(n), `${d.total_gb} GB total`, true),
|
|
708
|
+
card("", "Largest that fits", d.largest_fit ? d.largest_fit.replace("bit", "-bit") : "—", d.largest_fit ? `Leaves ${d.free_after_gb} GB for other apps` : "Nothing on disk fits this Mac", true),
|
|
709
|
+
card("", "Your tests", String(d.tests.length), d.tests.length ? d.tests.join(" · ") : "None yet", true)),
|
|
710
|
+
table].filter(Boolean));
|
|
711
|
+
} catch (e) { body.replaceChildren(h("div", { class: "notice fail", text: e.message }), h("a", { class: "btn", href: "#/models", text: "Back to Models" })); }
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
async function screenCompare(arg) {
|
|
715
|
+
const body = h("div", { class: "stack" }, h("p", { class: "muted", text: "Loading…" }));
|
|
716
|
+
mount(shell("Compare", body, "#/compare"));
|
|
717
|
+
try {
|
|
718
|
+
const d = await api(`/api/compare${arg ? `?tests=${encodeURIComponent(arg)}` : ""}`);
|
|
719
|
+
const head = h("div", { class: "nt-title" }, h("h2", { class: "nt-h1", text: "Compare models" }), h("p", { class: "mu nt-sub", text: "Same test set, same Mac: which model and size gives the best answers for the memory?" }));
|
|
720
|
+
if (d.rows.length < 2) {
|
|
721
|
+
const only = d.rows.length === 1 ? d.rows[0].model : null;
|
|
722
|
+
body.replaceChildren(head, emptyCard(["M3 3v18h18", "M7 15l4-4 3 3 6-7"], "Compare needs 2 runs",
|
|
723
|
+
`Test a second model on the same test set to see which gives the best answers for the memory.${only ? ` So far only ${only} was tested${d.tests ? ` on ${d.tests}` : ""}.` : ""}`,
|
|
724
|
+
[h("a", { class: "btn primary", href: "#/new", text: "Test another model" })]));
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const setSel = h("select", { "aria-label": "Test set", onchange: (e) => { location.hash = `#/compare/${encodeURIComponent(e.target.value)}`; } },
|
|
728
|
+
d.test_sets.map((t) => h("option", { value: t.name, selected: t.name === d.tests, text: `${t.name} · ${t.models} model${t.models === 1 ? "" : "s"}` })));
|
|
729
|
+
const pct = (x) => (x === null || x === undefined ? dash : `${(x * 100).toFixed(1)}%`);
|
|
730
|
+
const best = [...d.rows].filter((r) => r.proven && r.memory_gb).sort((a, b) => a.memory_gb - b.memory_gb)[0];
|
|
731
|
+
// chart: quality (up) against memory (right); amber = no smaller version was shown safe
|
|
732
|
+
const W = 720, H = 280, L = 60, R = 700, T = 20, B = 240;
|
|
733
|
+
const mems = d.rows.map((r) => r.memory_gb).filter((x) => x !== null), quals = d.rows.map((r) => r.quality).filter((x) => x !== null);
|
|
734
|
+
const mx0 = Math.max(0, Math.floor(Math.min(...mems) - 1)), mx1 = Math.ceil(Math.max(...mems) + 1);
|
|
735
|
+
const qy0 = Math.max(0, Math.floor(Math.min(...quals) * 20 - 1) / 20), qy1 = Math.min(1, Math.ceil(Math.max(...quals) * 20 + 1) / 20);
|
|
736
|
+
const X = (m) => L + ((m - mx0) / (mx1 - mx0 || 1)) * (R - L), Y = (q) => B - ((q - qy0) / (qy1 - qy0 || 1)) * (B - T);
|
|
737
|
+
const svg = document.createElementNS(SVG, "svg");
|
|
738
|
+
svg.setAttribute("viewBox", `0 0 ${W} ${H}`); svg.setAttribute("role", "img"); svg.classList.add("cp-svg");
|
|
739
|
+
svg.setAttribute("aria-label", `Quality against memory: ${d.rows.map((r) => `${r.model} ${r.version} ${pct(r.quality)} at ${r.memory_gb} GB`).join("; ")}`);
|
|
740
|
+
const mk = (t, a, txt) => { const e = document.createElementNS(SVG, t); for (const [k, v] of Object.entries(a)) e.setAttribute(k, v); if (txt !== undefined) e.textContent = txt; svg.append(e); return e; };
|
|
741
|
+
mk("line", { x1: L, y1: B, x2: R, y2: B, class: "cp-ax" }); mk("line", { x1: L, y1: T, x2: L, y2: B, class: "cp-ax" });
|
|
742
|
+
mk("text", { x: L - 8, y: T + 4, "text-anchor": "end", class: "cp-t" }, `${Math.round(qy1 * 100)}%`); mk("text", { x: L - 8, y: B + 4, "text-anchor": "end", class: "cp-t" }, `${Math.round(qy0 * 100)}%`);
|
|
743
|
+
mk("text", { x: L, y: B + 20, class: "cp-t" }, `${mx0} GB`); mk("text", { x: R, y: B + 20, "text-anchor": "end", class: "cp-t" }, `${mx1} GB`);
|
|
744
|
+
mk("text", { x: (L + R) / 2, y: H - 2, "text-anchor": "middle", class: "cp-ax-l" }, "Peak memory");
|
|
745
|
+
d.rows.forEach((r) => {
|
|
746
|
+
if (r.memory_gb === null || r.quality === null) return;
|
|
747
|
+
const x = X(r.memory_gb), y = Y(r.quality), left = x > (L + R) / 2;
|
|
748
|
+
mk("circle", { cx: x, cy: y, r: r === best ? 9 : 7, class: r.proven ? (r === best ? "cp-best" : "cp-ok") : "cp-warn" });
|
|
749
|
+
mk("text", { x: left ? x - 14 : x + 14, y: y + 4, "text-anchor": left ? "end" : "start", class: `cp-lbl ${r === best ? "b" : ""}` }, `${r.model} · ${r.version.replace("bit", "-bit")}${r.proven ? "" : ", not proven"}`);
|
|
750
|
+
});
|
|
751
|
+
const chip = (v, cls) => h("span", { class: `mono cp-cell ${cls}`, text: v === null || v === undefined ? dash : `${Math.round(v * 100)}%` });
|
|
752
|
+
const tone = (v, ref) => (v === null || v === undefined ? "" : v >= ref ? "ok" : v >= ref - 0.03 ? "warn" : "fail");
|
|
753
|
+
const refq = Math.max(...quals);
|
|
754
|
+
const tr = (r) => h("tr", { class: r === best ? "cp-hi" : "" },
|
|
755
|
+
h("td", {}, h("a", { class: "cp-m", href: `#/model/${encodeURIComponent(r.model_id)}`, text: r.model }), r === best ? h("span", { class: "chip ok cp-b", text: "Smallest safe" }) : null),
|
|
756
|
+
h("td", { class: "mono cp-v", text: r.proven ? r.version.replace("bit", "-bit") : "—" }), h("td", { class: "mono", text: pct(r.quality) }),
|
|
757
|
+
...d.tags.map((t) => h("td", {}, chip((r.tag_quality || {})[t], tone((r.tag_quality || {})[t], (r.quality || 0) - 0.02)))),
|
|
758
|
+
h("td", { class: "mono", text: r.tok_s ? `${Math.round(r.tok_s)} t/s` : dash }),
|
|
759
|
+
h("td", { class: "mono", text: r.memory_gb ? `${r.memory_gb} GB` : dash, title: r.memory_measured ? "Measured" : "Estimate: file size plus about 10%" }));
|
|
760
|
+
body.replaceChildren(head,
|
|
761
|
+
h("div", { class: "cp-bar" }, h("span", { class: "mu", text: "Test set" }), setSel, h("span", { class: "mu cp-show", text: "Showing each model's recommended version, or its reference when none was shown safe" }), h("a", { href: "#/new", class: "cp-add" }, svgEl(ICONS.plus, "ico"), " Add a run")),
|
|
762
|
+
h("section", { class: "card cp-chart" }, h("div", { class: "cp-ch" }, h("h2", { text: "Quality vs memory" }), h("span", { class: "mu", text: "Up and left is better" })), svg),
|
|
763
|
+
h("section", { class: "card cp-tw" }, h("div", { class: "cp-scroll" }, h("table", { class: "md-tbl" },
|
|
764
|
+
h("thead", {}, h("tr", {}, ["Model", "Best version", "Quality", ...d.tags, "Speed", "Memory"].map((t) => h("th", { text: t })))), h("tbody", {}, d.rows.map(tr))))),
|
|
765
|
+
h("p", { class: "mu cp-foot", text: `${d.rows[0].n_prompts} prompts per model. Quality is the mean score on this test set, so only compare runs that used the same prompts. Differences of a point or two can be noise.` }));
|
|
766
|
+
} catch (e) { body.replaceChildren(h("div", { class: "notice fail", text: e.message })); }
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
async function screenSettings() {
|
|
770
|
+
const body = h("div", { class: "stack" }, h("p", { class: "muted", text: "Loading…" }));
|
|
771
|
+
mount(shell("Settings", body, "#/settings"));
|
|
772
|
+
try {
|
|
773
|
+
const [sys, lim, sets, runs] = await Promise.all([api("/api/system"), api("/api/limits"), api("/api/testsets"), api("/api/runs")]);
|
|
774
|
+
const hw = sys.hardware, d = lim.defaults;
|
|
775
|
+
const row = (title, sub, right) => h("div", { class: "st-row" }, h("div", { class: "st-l" }, h("div", { class: "st-t", text: title }), sub ? h("div", { class: "mu st-s", text: sub }) : null), right);
|
|
776
|
+
const sect = (title, ...rows) => h("section", { class: "card st-card" }, h("h2", { text: title }), ...rows);
|
|
777
|
+
const val = (t, mono) => h("span", { class: mono ? "mono st-v" : "st-v", text: t });
|
|
778
|
+
const box = (t) => h("span", { class: "mono st-box", text: t });
|
|
779
|
+
const usage = (n, max, warn) => {
|
|
780
|
+
const pct = Math.min(100, Math.round((n / max) * 100));
|
|
781
|
+
return h("span", { class: "st-use" }, h("span", { class: "st-track", role: "progressbar", "aria-valuenow": String(pct), "aria-valuemin": "0", "aria-valuemax": "100" }, h("i", { class: warn && n > warn ? "warn" : "", style: `width:${pct}%` })),
|
|
782
|
+
h("span", { class: "mono st-n", text: `${n.toLocaleString()} / ${max.toLocaleString()}` }));
|
|
783
|
+
};
|
|
784
|
+
const ok = sets.filter((s) => !s.error);
|
|
785
|
+
const maxPrompts = Math.max(0, ...ok.map((s) => s.prompts)), maxTools = Math.max(0, ...ok.map((s) => s.tools));
|
|
786
|
+
const maxVers = Math.max(0, ...runs.map((r) => (r.versions || []).length));
|
|
787
|
+
const chip = (text, on) => h("span", { class: `chip ${on ? "ok" : "plain"}`, text });
|
|
788
|
+
const plan = account.plan[0].toUpperCase() + account.plan.slice(1);
|
|
789
|
+
body.replaceChildren(
|
|
790
|
+
h("div", { class: "nt-title" }, h("h2", { class: "nt-h1", text: "Settings" }), h("p", { class: "mu nt-sub", text: "Defaults for every new test. Each result saves the settings it used." })),
|
|
791
|
+
sect("Account",
|
|
792
|
+
row("Signed in as", "Your account stores only your email, plan and devices. Never prompts, answers or models.", val(account.email)),
|
|
793
|
+
row("Plan", "Free forever for local testing", h("span", { class: "chip ok nodot", text: plan })),
|
|
794
|
+
row("Devices", `This ${hw.chip.includes("Apple") ? "Mac" : "computer"} · ${hw.chip}`, null),
|
|
795
|
+
row("Sign out", "Your local runs and reports stay on this Mac", h("button", { class: "btn st-red", type: "button", onclick: signOut, text: "Sign out" }))),
|
|
796
|
+
sect("Plan and limits",
|
|
797
|
+
row("Plan", "Free lab: everything runs on this Mac, with no usage limits. Safety limits keep your Mac fast.", h("a", { class: "btn", href: "#/plans", text: "Compare with Team" })),
|
|
798
|
+
row("Prompts in largest test set", `warning above ${lim.WARN_PROMPTS}`, usage(maxPrompts, lim.MAX_PROMPTS, lim.WARN_PROMPTS)),
|
|
799
|
+
row("Versions per test", "most in one of your runs", usage(maxVers, lim.MAX_VERSIONS)),
|
|
800
|
+
row("Tools in a set", `warning above ${lim.WARN_TOOLS}`, usage(maxTools, lim.MAX_TOOLS, lim.WARN_TOOLS)),
|
|
801
|
+
row("Answer length", `default ${lim.DEFAULT_ANSWER_TOKENS} tokens per answer`, box(`up to ${lim.MAX_ANSWER_TOKENS}`))),
|
|
802
|
+
sect("Appearance", row("Theme", "System follows your Mac. Light and dark use the same green brand.", themeSwitch())),
|
|
803
|
+
sect("Hardware",
|
|
804
|
+
row("Device", "Detected automatically", val(`${hw.chip} · ${hw.ram_gb} GB · ${hw.free_disk_gb} GB free disk`, true)),
|
|
805
|
+
row("Runtimes", "Used to load each version", h("span", { class: "st-chips" }, chip("MLX" + (sys.runtimes.mlx ? "" : " (not installed)"), sys.runtimes.mlx), chip("llama.cpp" + (sys.runtimes.llamacpp ? "" : " (not installed)"), sys.runtimes.llamacpp),
|
|
806
|
+
chip(sys.ollama_models.length ? `Ollama (${sys.ollama_models.length})` : "Ollama (none found)", sys.ollama_models.length > 0)))),
|
|
807
|
+
sect("Scoring",
|
|
808
|
+
row("Judge model", "Compares answers with the reference. Runs on this Mac. Change it under Advanced on New test.", box(`${d.judge_model.split("/").pop()} (local)`)),
|
|
809
|
+
row("Cloud judge", "Off. Not available yet. If it is added, prompts would go to that provider only after you turn it on.", h("span", { class: "chip plain", text: "Off" })),
|
|
810
|
+
row("Default quality bar", "Minimum share of reference quality to recommend. Set per test on New test.", box(`${Math.round(d.quality_limit * 100)}%`))),
|
|
811
|
+
sect("Generation",
|
|
812
|
+
row("Temperature", "0 keeps answers repeatable", box(String(d.temperature))), row("Seed", "Saved with results", box(String(d.seed))), row("Max tokens", "Per answer", box(String(d.max_tokens)))),
|
|
813
|
+
sect("Storage and privacy",
|
|
814
|
+
row("Usage statistics", "QuantCheck sends no usage statistics. Prompts, answers and models never leave this Mac.", h("span", { class: "chip plain", text: "None sent" })),
|
|
815
|
+
row("Runs and reports folder", "Where results and HTML reports are saved", h("span", { class: "mono st-path", text: `${sys.data_dir}/runs` })),
|
|
816
|
+
row("Data folder", "Test sets and settings", h("span", { class: "mono st-path", text: sys.data_dir }))));
|
|
817
|
+
} catch (e) { body.replaceChildren(h("div", { class: "notice fail", text: e.message })); }
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function screenPlans() {
|
|
821
|
+
const tick = () => svgEl(["M5 12l5 5L20 7"], "ico");
|
|
822
|
+
const li = (t) => h("li", {}, tick(), h("span", { text: t }));
|
|
823
|
+
const mark = (v) => (v === true ? h("span", { class: "pl-tick" }, tick()) : v === false ? h("span", { class: "mu", text: "—" }) : h("span", { text: v }));
|
|
824
|
+
const rows = [
|
|
825
|
+
["Local tests, chat and reports", "Unlimited", "Unlimited"],
|
|
826
|
+
["Instructions, documents and tools in tests", true, true],
|
|
827
|
+
["Mix any languages in one test set", true, true],
|
|
828
|
+
["Run on cloud GPUs (NVIDIA, vLLM)", false, true],
|
|
829
|
+
["Shared workspace, invites and roles", false, true],
|
|
830
|
+
["Monitoring and alerts after you deploy", false, true],
|
|
831
|
+
["Import logs from production", "Manual file import", "Automatic, with masking"],
|
|
832
|
+
["Verified \"QuantCheck Tested\" report", false, true],
|
|
833
|
+
["History across devices", "This Mac only", "Synced"],
|
|
834
|
+
["Where your data lives", "This Mac", "India region or your own cloud"],
|
|
835
|
+
];
|
|
836
|
+
const faq = [["Why is the free lab unlimited?", "It runs on your own Mac, so your tests cost us nothing. We only limit what would slow your Mac down."],
|
|
837
|
+
["Will the free lab get worse later?", "No. Features in the free lab today stay free. New team features are added on top."],
|
|
838
|
+
["Does Team see my prompts?", "Only if you choose. The platform can run inside your own cloud, so prompts and answers never leave it."]];
|
|
839
|
+
mount(shell("Free lab vs Team", h("div", { class: "stack" },
|
|
840
|
+
h("div", { class: "nt-title" }, h("h2", { class: "nt-h1", text: "Free lab and Team platform" }), h("p", { class: "mu nt-sub", text: "The lab stays free for everyone. Teams pay for what runs on servers, works across people, and saves them money." })),
|
|
841
|
+
h("div", { class: "pl-two" },
|
|
842
|
+
h("section", { class: "card pl-card" }, h("div", { class: "pl-h" }, h("h2", { text: "Free lab" }), h("span", { class: "chip nodot pl-gray", text: "Your plan" })),
|
|
843
|
+
h("div", {}, h("span", { class: "pl-price", text: "₹0" }), h("span", { class: "mu", text: " forever" })),
|
|
844
|
+
h("p", { class: "pl-p", text: "Everything runs on your Mac, so there are no usage limits. Only safety limits that keep your Mac fast." }),
|
|
845
|
+
h("ul", { class: "pl-ul" }, li("Unlimited tests, chat and reports"), li("Instructions, documents and tools"), li("Your prompts in any language"), li("Open source")),
|
|
846
|
+
h("a", { class: "btn pl-bottom", href: "#/settings", text: "See your limits" })),
|
|
847
|
+
h("section", { class: "pl-team" }, h("div", { class: "pl-h" }, h("h2", { text: "Team platform" }), h("span", { class: "chip nodot pl-early", text: "Early access" })),
|
|
848
|
+
h("div", {}, h("span", { class: "pl-price", text: "20–25%" }), h("span", { class: "pl-soft", text: " of verified savings" })),
|
|
849
|
+
h("p", { class: "pl-p soft", text: "For companies running models in production. If we don't save you money, you pay ₹0. The first 5 companies get a free pilot audit." }),
|
|
850
|
+
h("ul", { class: "pl-ul soft" }, li("Cloud GPU runs and serving search"), li("Shared workspace and roles"), li("Monitoring and alerts after deploy"), li("Verified reports for your customers")),
|
|
851
|
+
h("div", { class: "pl-cta" }, h("button", { class: "btn pl-mint", type: "button", disabled: true, title: "Pilot applications open with the website", text: "Apply for a free pilot" }),
|
|
852
|
+
h("button", { class: "btn pl-ghost", type: "button", disabled: true, title: "The waitlist opens with the website", text: "Join the waitlist" })),
|
|
853
|
+
h("p", { class: "pl-soft pl-note", text: "Applications open when the website launches." }))),
|
|
854
|
+
h("section", { class: "card pl-tw" }, h("table", { class: "pl-tbl" },
|
|
855
|
+
h("thead", {}, h("tr", {}, h("th", { text: "Compare" }), h("th", { class: "c", text: "Free lab" }), h("th", { class: "c team", text: "Team platform" }))),
|
|
856
|
+
h("tbody", {}, rows.map(([k, a, b]) => h("tr", {}, h("th", { scope: "row", text: k }), h("td", { class: "c" }, mark(a)), h("td", { class: "c tm" }, mark(b))))))),
|
|
857
|
+
h("div", { class: "pl-faq" }, faq.map(([q, a]) => h("div", { class: "card pl-q" }, h("b", { text: q }), h("span", { text: a }))))), "#/plans"));
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function screenHelp() {
|
|
861
|
+
const cmd = (c) => h("p", {}, h("code", { text: c }));
|
|
862
|
+
mount(shell("Help", h("div", { class: "card" }, h("h2", { text: "Command line" }),
|
|
863
|
+
cmd("quantcheck run examples/quantcheck.yaml"), cmd("quantcheck report <run-id>"), cmd("quantcheck rescore <run-id>"), cmd("quantcheck hw"),
|
|
864
|
+
h("p", { class: "muted", text: "The lab and the command line use the same code and the same runs folder." })), "#/home"));
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// ---- router ----------------------------------------------------------------------------
|
|
868
|
+
async function route() {
|
|
869
|
+
stopPolling();
|
|
870
|
+
try {
|
|
871
|
+
const status = await fetch("/api/status").then((r) => r.json());
|
|
872
|
+
account = status.account;
|
|
873
|
+
} catch (e) { app.replaceChildren(h("p", { class: "boot", text: "Cannot reach the lab server. Is `quantcheck ui` still running?" })); return; }
|
|
874
|
+
if (!account) { screenSignIn(); return; }
|
|
875
|
+
const hash = location.hash || "#/home";
|
|
876
|
+
const [, name, arg] = hash.match(/^#\/([a-z]+)\/?(.*)$/) || [];
|
|
877
|
+
switch (name) {
|
|
878
|
+
case "new": return screenNew(decodeURIComponent(arg || ""));
|
|
879
|
+
case "model": return screenModelDetail(decodeURIComponent(arg || ""));
|
|
880
|
+
case "chat": return screenChat();
|
|
881
|
+
case "setup": return screenSetup();
|
|
882
|
+
case "compare": return screenCompare(decodeURIComponent(arg || ""));
|
|
883
|
+
case "runs": return screenRuns();
|
|
884
|
+
case "review": return screenReview(arg);
|
|
885
|
+
case "sets": return arg.startsWith("edit/") ? screenSetEditor(decodeURIComponent(arg.slice(5))) : arg === "new" ? screenSetEditor("new") : screenSets(decodeURIComponent(arg || ""));
|
|
886
|
+
case "run": return screenRun(arg);
|
|
887
|
+
case "report": return screenReport(arg);
|
|
888
|
+
case "models": return screenModels();
|
|
889
|
+
case "settings": return screenSettings();
|
|
890
|
+
case "plans": return screenPlans();
|
|
891
|
+
case "help": return screenHelp();
|
|
892
|
+
default: return screenHome();
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
window.addEventListener("hashchange", route);
|
|
896
|
+
route();
|