{orbit(improved || result?.outcome === 'default_confirmed')}
{text}
+ const good = improved || result?.outcome === 'default_confirmed';
+ body = result?.outcome === 'improved' ?
{notice(result.answers?.class)}
:
{text}
{result?.outcome === 'default_confirmed' && result.preset ?
{tr("Saved as '{0}', so it is not tuned again when you reopen the app.", [result.preset.name])}
: null}
- {result?.outcome === 'improved' ? <>
{tr("Speed: {0} → {1} tok/s", [Math.round((result.base?.decode_tok_s ?? 0) * 10) / 10, Math.round((result.chosen?.decode_tok_s ?? 0) * 10) / 10])}
{notice(result.answers?.class)}> : null}
+
{job?.state === 'error' ?
{job.error}
: null}
;
actions = <>{status?.can_undo && result?.outcome === 'improved' ?
void act(async () => { await tuneUndo(model, resourceProfile, vision); setJobId(''); })}>{tr("Undo")} : null}
{tr("Close")}>;
} else {
@@ -104,5 +100,5 @@ export function NativeTune({ open, onClose, model, resourceProfile, vision }: {
{active && status?.state === 'soft' ?
void start('recheck')}>{tr("Check again")} : null}
void start('autotune')}>{tr(active ? "Tune again" : "Start tuning")}>;
}
- return
;
+ return
;
}
diff --git a/apps/host/src/components/PcFitCard.tsx b/apps/host/src/components/PcFitCard.tsx
new file mode 100644
index 00000000..36726f6a
--- /dev/null
+++ b/apps/host/src/components/PcFitCard.tsx
@@ -0,0 +1,26 @@
+import { tr } from '../lib/i18n';
+import type { Fit } from '../lib/native-fit';
+
+const gb = (n: number) => `${Number.isInteger(n) ? n : n.toFixed(1)} GB`;
+
+function Meter({ label, total, use }: { label: string; total: number; use: number }) {
+ const pct = total > 0 ? Math.max(2, Math.min(100, (use / total) * 100)) : 0;
+ return
+
{tr(label)}{gb(use)}{tr("of {0}", [gb(total)])}
+
+
;
+}
+
+/**
+ * "This computer": the graphics memory and RAM, and what the chosen version would take of each. One plain line says whether it fits
+ * or how much would be read from the SSD (the n-gram table, which always sits on the SSD, is not counted).
+ */
+export function PcFitCard({ gpuName, ramGb, vramGb, fit }: { gpuName?: string | null; ramGb: number | null; vramGb: number; fit: Fit | null }) {
+ return
+ {tr("This computer")}
+
{tr(gpuName ? tr("{0} · {1} graphics memory", [gpuName, gb(vramGb)]) : tr("No supported graphics card reported by this installation."))}{ramGb ? tr(" · {0} RAM", [gb(ramGb)]) : ''}
+ {tr(fit?.known && vramGb > 0 ? : null)}
+ {tr(fit?.known && ramGb ? : null)}
+ {tr(fit?.known ? {tr(fit.spillGb >= 1 ? 'About {0} GB will be read from the SSD, so answers can be a little slower.' : 'Fits fully in memory.', [Math.round(fit.spillGb)])}
: null)}
+ ;
+}
diff --git a/apps/host/src/components/TaskDetail.tsx b/apps/host/src/components/TaskDetail.tsx
new file mode 100644
index 00000000..24015efe
--- /dev/null
+++ b/apps/host/src/components/TaskDetail.tsx
@@ -0,0 +1,45 @@
+import { tr, localeTag } from '../lib/i18n';
+import { Icon } from './ui';
+import { Markdown } from './Markdown';
+import { ErrorNotice } from './ui';
+import type { Task } from '../lib/tasks';
+
+const FREQUENCY: Record
= { hourly: 'Every hour', daily: 'Every day', weekdays: 'Weekdays', weekly: 'Every week' };
+const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
+const MODE: Record = { plan: 'Look only, change nothing', manual: 'Stop and tell me before changing anything', bypass: 'Allowed to make changes' };
+
+const when = (iso?: string) => (iso ? new Date(iso).toLocaleString(localeTag(), { dateStyle: 'medium', timeStyle: 'short' }) : '');
+
+/** The schedule in one line: "Weekdays · 08:00", "Every week · Friday · 16:00". */
+export function scheduleText(t: Task): string {
+ const base = tr(FREQUENCY[t.frequency] ?? t.frequency);
+ if (t.frequency === 'hourly') return base;
+ return [base, t.frequency === 'weekly' ? tr(WEEKDAYS[t.weekday] ?? '') : '', t.at].filter(Boolean).join(' · ');
+}
+
+export type TaskState = 'running' | 'active' | 'paused';
+export const taskState = (t: Task): TaskState => (t.status === 'running' ? 'running' : t.enabled ? 'active' : 'paused');
+
+/**
+ * An opened task, skimmable: when it runs, what it may do, what it did last, then the instructions and the last answer.
+ * The title, the state and the actions (pause or resume, delete, Edit, Run now) are in the header the screen draws.
+ */
+export function TaskDetail({ task, modelName }: { task: Task; modelName: string | null }) {
+ const state = taskState(task);
+ const result = task.status === 'running' ? { label: 'Running…', tone: '' }
+ : task.error ? { label: 'Last run failed', tone: 'is-bad' }
+ : task.lastRunAt || task.output ? { label: 'Done', tone: 'is-good' } : { label: 'Not run yet', tone: '' };
+ return
+
+ {tr("Schedule")}{scheduleText(task)}
+ {tr(state === 'paused' ? 'Paused' : task.nextRunAt ? tr("Next: {0}", [when(task.nextRunAt)]) : 'Calculating the next run…')}
+ {tr("What it may do")}{tr(MODE[task.mode ?? 'plan'])}
+ {modelName ? {tr("Model")}{modelName}
: null}
+ {tr("Last result")}{result.tone === 'is-good' ? : null}{tr(result.label)}
+ {when(task.lastRunAt)}
+
+
{tr("What it does")}
{task.prompt}
+
{tr("Last answer")}{task.demo ? tr(' · Example') : ''}
+ {task.error ? : task.output ? : {tr("Run this task to see its first result here.")}
}
+
;
+}
diff --git a/apps/host/src/components/TuneRunView.tsx b/apps/host/src/components/TuneRunView.tsx
new file mode 100644
index 00000000..9ca78cb8
--- /dev/null
+++ b/apps/host/src/components/TuneRunView.tsx
@@ -0,0 +1,73 @@
+import { tr } from '../lib/i18n';
+import { Icon, type IconName } from './ui';
+import type { TuneProgress, TuneResult } from '../lib/native-tune';
+import { tunePhase, tuneSpeeds } from '../lib/tune-phase';
+
+const STEPS: { icon: IconName; title: string; running: string }[] = [
+ { icon: 'cpu', title: 'Checking your PC', running: 'Looking at your graphics card and memory' },
+ { icon: 'gauge', title: 'Measuring the base speed', running: 'Timing your current settings' },
+ { icon: 'sliders', title: 'Trying settings', running: 'Trying other settings, one at a time' },
+ { icon: 'thinking', title: 'Confirming the best one', running: 'Repeating the test to be sure' },
+ { icon: 'disk', title: 'Saving', running: 'Keeping it for this model; you can undo it' },
+];
+
+const fmt = (n: number) => (Math.round(n * 10) / 10).toFixed(1);
+
+function Spark({ values }: { values: number[] }) {
+ if (values.length < 2) return ;
+ const lo = Math.min(...values), hi = Math.max(...values), span = Math.max(0.0001, hi - lo);
+ const pts = values.map((v, i) => [(i / (values.length - 1)) * 220, 56 - ((v - lo) / span) * 46] as const);
+ const line = pts.map(([x, y], i) => `${i ? 'L' : 'M'}${x.toFixed(1)} ${y.toFixed(1)}`).join(' ');
+ const [lx, ly] = pts[pts.length - 1];
+ return ;
+}
+
+/** The tuner at work: five steps, each with its own icon and state, and the speed it has measured so far. */
+export function TuneRunView({ progress, ratio, saving }: { progress: TuneProgress | undefined; ratio: number; saving: boolean }) {
+ const at = saving ? 4 : tunePhase(progress?.stage);
+ const speeds = tuneSpeeds(progress);
+ const base = speeds[0]?.tok_s ?? null;
+ const now = speeds.length ? speeds[speeds.length - 1].tok_s : null;
+ const left = progress?.minutesLeft ?? null;
+ const sub = (i: number): string => {
+ if (i < at) return i === 1 && base != null ? tr("Starting point: {0} tokens per second", [fmt(base)]) : '';
+ if (i === at && progress?.step) return progress.step;
+ return i === at ? tr(STEPS[i].running) : '';
+ };
+ return
+
+ {STEPS.map((s, i) => {
+ const state = i < at ? 'done' : i === at ? 'run' : 'pending';
+ return -
+
+ {tr(s.title)}{sub(i)}
+ {tr(state === 'done' ? 'Done' : state === 'run' ? 'Running' : 'Waiting')}
+
;
+ })}
+
+
+
;
+}
+
+/** The result: the gain large, before and after, and what it was saved as. */
+export function TuneResultView({ result, saved }: { result: TuneResult; saved: string | null }) {
+ const before = result.base?.decode_tok_s ?? 0, after = result.chosen?.decode_tok_s ?? 0;
+ const gain = result.gain_pct ?? (before ? ((after / before) - 1) * 100 : 0);
+ const top = Math.max(before, after, 1);
+ return
+
{tr("Faster answers")}+{Math.round(gain)}%
+
{tr("{0} to {1} tokens per second", [fmt(before), fmt(after)])}
+
+
{tr("Before")}
{fmt(before)}
+
{tr("After")}
{fmt(after)}
+ {saved ?
{tr("Saved as {0}. It is used every time you load this model.", [saved])}
: null}
+
+
;
+}
diff --git a/apps/host/src/components/VersionPicker.tsx b/apps/host/src/components/VersionPicker.tsx
new file mode 100644
index 00000000..346a6bb0
--- /dev/null
+++ b/apps/host/src/components/VersionPicker.tsx
@@ -0,0 +1,74 @@
+import { useRef, useState } from 'react';
+import { tr } from '../lib/i18n';
+import { Icon } from './ui';
+import { FloatingMenu } from './FloatingMenu';
+import { cx } from '../lib/format';
+import type { CatalogVersion } from '../lib/native-catalog';
+import { RECOMMENDED, VERSION_GROUPS, fitOn, type FitHardware } from '../lib/native-fit';
+
+/** The name a version goes by in the list: the quantization, with the maker where the quantization alone is ambiguous. */
+export function versionName(v: CatalogVersion, withMaker = false): string {
+ switch (v.sourceFamily) {
+ case 'swift': return `Swift ${v.model}`;
+ case 'unsloth': return `Unsloth ${v.model}`;
+ case 'coder': return `Coder ${v.model}`;
+ case 'qwen': return withMaker ? `${v.model} (GSQ-RCO)` : v.model;
+ default: return v.model;
+ }
+}
+
+const gb = (n: number) => `${Number.isInteger(n) ? n : n.toFixed(1)} GB`;
+
+/**
+ * The version list of the Models screen: one line per model. The bold figure is the RAM + VRAM it needs together (the n-gram table,
+ * which stays on the SSD, is not in it); the download size is secondary. "Uses SSD N GB" appears only where this computer would read
+ * part of the model from its SSD. The first group is a fixed list of four; the rest fold away.
+ */
+export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnGguf }: {
+ versions: CatalogVersion[];
+ selectedId: string;
+ hardware: FitHardware | null | undefined;
+ onSelect: (id: string) => void;
+ onOwnGguf: () => void;
+}) {
+ const trigger = useRef(null);
+ const [open, setOpen] = useState(false);
+ const [folded, setFolded] = useState>({});
+ const selected = versions.find(v => v.id === selectedId);
+ const recommended = RECOMMENDED.map(r => ({ r, v: versions.find(v => v.sourceFamily === r.family && v.model === r.model) })).filter((x): x is { r: typeof RECOMMENDED[number]; v: CatalogVersion } => !!x.v);
+ const groups = [
+ ...VERSION_GROUPS.map(g => ({ id: g.id, title: g.title, items: versions.filter(v => g.families.includes(v.sourceFamily)) })),
+ { id: 'other', title: 'Qwen3.6 models', items: versions.filter(v => !VERSION_GROUPS.some(g => g.families.includes(v.sourceFamily))) },
+ ].filter(g => g.items.length);
+ const row = (v: CatalogVersion, label: string, note?: string) => {
+ const fit = fitOn(v, hardware);
+ const on = v.id === selectedId;
+ return ;
+ };
+ const fit = selected ? fitOn(selected, hardware) : null;
+ return <>
+
+ {tr(open ? setOpen(false)}>
+
+
{tr("Recommended")}{tr("RAM + VRAM")}{tr("Download")}
+ {tr(recommended.map(({ r, v }) => row(v, versionName(v, true), r.note)))}
+ {tr(groups.map(g => {
+ const closed = folded[g.id] !== false && !g.items.some(v => v.id === selectedId);
+ return
+
+ {tr(!closed ? g.items.map(v => row(v, versionName(v))) : null)}
+
;
+ }))}
+
+
+ : null)}
+ >;
+}
diff --git a/apps/host/src/components/layout.tsx b/apps/host/src/components/layout.tsx
index 6e0096fe..fa3a4285 100644
--- a/apps/host/src/components/layout.tsx
+++ b/apps/host/src/components/layout.tsx
@@ -2,7 +2,8 @@ import { tr } from '../lib/i18n';
/** Screen chrome: a titled header pinned above a scrolling body. */
import type { ReactNode } from 'react';
import { cx } from '../lib/format';
-export function Screen({ title, sub, actions, children, width = 'normal', bare, plainHeader, titleDetail, }: {
+import { Icon } from './ui';
+export function Screen({ title, sub, actions, children, width = 'normal', bare, plainHeader, titleDetail, back, }: {
title: ReactNode;
sub?: ReactNode;
actions?: ReactNode;
@@ -11,11 +12,13 @@ export function Screen({ title, sub, actions, children, width = 'normal', bare,
bare?: boolean;
plainHeader?: boolean;
titleDetail?: ReactNode;
+ /** A way back to the list this screen was opened from, shown before the title (as the chat's navbar shows its own title). */
+ back?: { label: string; onClick: () => void };
}) {
return (<>