Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(local-models): the card says whether its model can do the job

rubenluetke10-beepa697e7d64433
diff --git a/jarvis/ui/web/frontend/src/hooks/useLocalModels.ts b/jarvis/ui/web/frontend/src/hooks/useLocalModels.ts
index d179db1cd2..67162959b8 100644
--- a/jarvis/ui/web/frontend/src/hooks/useLocalModels.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useLocalModels.ts
@@ -56,10 +56,26 @@ export interface RunningModelRow {
expires_at: string;
context_length: number | null;
digest: string;
+ /** The download this entry's weights belong to (an alias folded back). */
+ base_tag?: string;
+ /** "model" | "tune_profile" | "voice_profile". */
+ kind?: string;
}
export interface LocalModelRow {
name: string;
+ /**
+ * Readable parts from the backend's `ollama_names.describe`: the model
+ * line ("Qwen 3.5"), the line with its size ("Qwen 3.5 4B"), the size
+ * ("4B"), the quantisation ("Q4_K_M"), the source namespace of an import
+ * ("hf.co/unsloth") and the tag's variant markers ("it-qat").
+ */
+ display_name?: string;
+ display_label?: string;
+ params_label?: string;
+ quant_label?: string;
+ source?: string;
+ variant?: string;
size_bytes: number;
digest: string;
modified_at: string;
@@ -74,8 +90,12 @@ export interface LocalModelRow {
/** False when /api/show failed for this row — "unknown", not "none". */
probed: boolean;
used_by: LocalModelRole[];
+ /** The download or one of its aliases sits in memory; `loaded_as` names which. */
loaded: boolean;
+ loaded_as?: string;
size_vram_bytes: number;
+ /** What /api/ps reports as the loaded size (weights + context). */
+ loaded_size_bytes?: number;
expires_at: string;
running_context_length: number | null;
}
@@ -114,20 +134,53 @@ export interface DeleteResponse {
// Wire types — roles
// ---------------------------------------------------------------------------
+/** The backend's ONE verdict on a model doing a job (`ollama_roles.FITS`). */
+export type RoleFit = "fits" | "slow" | "unfit" | "unknown";
+
+/** One installed download judged for one job — the picker's row. */
+export interface RoleChoice {
+ tag: string;
+ fit: RoleFit | string;
+ /** Short clause saying why; "" when it fits. */
+ reason: string;
+}
+
+/** A shortlist entry that would do the job here and is not on disk. */
+export interface RoleDownload {
+ tag: string;
+ label: string;
+ size_gb: number;
+ /** "comfortable" | "tight" | "unknown" — the shortlist's own verdict. */
+ fit: string;
+ note: string;
+}
+
export interface RoleRow {
id: LocalModelRoleId;
/** i18n key, e.g. "local_models.role_chat". */
label_key: string;
/** Dotted config path for the footnote. */
config_key: string;
+ /** "card" | "row" | "footnote" — where the section shows the role. */
+ layout?: "card" | "row" | "footnote" | string;
/** Configured tag; "" = the plugin discovers one. */
current: string;
/** `current` is on the server right now. */
installed: boolean;
+ /**
+ * The verdict on `current`: a RoleFit, "absent" when configured but not on
+ * the server, "" when nothing is set.
+ */
+ current_fit?: RoleFit | "absent" | "" | string;
+ current_reason?: string;
required: string[];
recommended_capabilities: string[];
- /** Installed tags declaring every required capability. */
+ /** Installed tags that can do the job (fits or slow). */
qualifying: string[];
+ /** Every installed download with its verdict, inventory order. */
+ choices?: RoleChoice[];
+ /** Shortlist downloads that would do the job on this machine. */
+ downloads?: RoleDownload[];
/**
* The pick for this machine: the best qualifying INSTALLED download, or
* the shortlist's download when nothing installed qualifies; "" when
@@ -149,6 +202,8 @@ export interface RoleRow {
* a call answers within a breath); null/absent when the job has none.
*/
max_size_gb?: number | null;
+ /** The smallest native context that can do the job; null = no floor. */
+ min_context_tokens?: number | null;
}
export interface IdleReleaseResponse {
@@ -156,10 +211,32 @@ export interface IdleReleaseResponse {
minutes: number;
}
+/** One distinct download across the roles, with what it costs loaded. */
+export interface ResidentItem {
+ tag: string;
+ display_label: string;
+ roles: LocalModelRole[];
+ weights_gb: number;
+ context_gb: number;
+ context_tokens: number | null;
+ loaded: boolean;
+}
+
+/** What graphics memory holds when every job is loaded at once. */
+export interface ResidentPayload {
+ items: ResidentItem[];
+ /** Kept free beside the voice brain for local speech in/out. */
+ reserve_gb: number;
+ total_gb: number;
+ accelerator_gb: number;
+ over: boolean;
+}
+
export interface RolesResponse {
provider: string;
server: string;
roles: RoleRow[];
+ resident?: ResidentPayload;
error: string | null;
}
@@ -175,7 +252,7 @@ export interface AutostartResponse {
/** One step of `POST …/verify`; `ok: null` = not run (role unset / server down). */
export interface VerifyStep {
- id: "server" | "chat" | "embedding" | string;
+ id: "server" | "chat" | "voice" | "tools_screen" | "embedding" | string;
ok: boolean | null;
model: string;
detail: string;
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json
index 54f5b924b1..f7efc3d4c5 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json
@@ -13,7 +13,22 @@
"memory_over": "Größer als die {gb} GB Grafikspeicher — läuft teilweise auf dem Prozessor",
"memory_unknown": "Grafikspeicher unbekannt",
"memory_aria": "Belegt {percent} % des Grafikspeichers",
- "switch_to": "Auf {model} wechseln"
+ "switch_to": "Auf {model} wechseln",
+ "fit_fits": "Passt zu dieser Aufgabe.",
+ "fit_slow": "Funktioniert, aber {reason}.",
+ "fit_unfit": "Kann diese Aufgabe nicht — {reason}.",
+ "fit_unknown": "Jarvis konnte nicht lesen, was dieses Modell kann.",
+ "fit_alternative": "Nimm stattdessen {model}.",
+ "shared_with": "Geteilt mit {roles} — einmal geladen.",
+ "memory_line": "{weights} + {context} Kontext = {percent} % von {gb} GB Grafikspeicher",
+ "memory_line_voice": "{weights} + {context} Kontext + {reserve} für Sprache rein/raus = {percent} % von {gb} GB",
+ "context_of": "{context} von {native} Kontext",
+ "loaded_now": "jetzt geladen",
+ "details": "Details",
+ "details_config": "Einstellung",
+ "details_required": "Braucht",
+ "details_loaded_as": "Im Speicher als",
+ "details_recommended": "Vorschlag"
},
"launch": {
"aria": "Server einrichten",
@@ -33,9 +48,6 @@
"title": "Lokale Modelle",
"subtitle": "Modelle, die auf diesem Rechner oder auf einem Server deiner Wahl laufen.",
"back": "API-Keys",
- "mode_label": "Detailgrad",
- "mode_simple": "Einfach",
- "mode_advanced": "Erweitert",
"reload": "Aktualisieren",
"tabs_label": "Bereiche der lokalen Modelle",
"tab_overview": "Überblick",
@@ -253,7 +265,14 @@
"setup_brain_hint": "{server} ist eingerichtet, aber {brain} antwortet weiterhin.",
"setup_brain_button": "{server} zum aktiven Gehirn machen",
"setup_brain_switched": "{server} ist jetzt das aktive Gehirn.",
- "setup_brain_failed": "Das Gehirn konnte nicht umgestellt werden: {message}"
+ "setup_brain_failed": "Das Gehirn konnte nicht umgestellt werden: {message}",
+ "resident_title": "Wenn jede Aufgabe gleichzeitig geladen ist",
+ "resident_fits": "{total} von {gb} GB",
+ "resident_over": "{total} von {gb} GB — mehr, als die Karte fasst; Ollama wechselt zwischen Anruf und Chat",
+ "resident_unknown": "{total} insgesamt — Grafikspeicher unbekannt",
+ "resident_context": "Kontext (Schätzung)",
+ "resident_context_short": "Kontext",
+ "resident_reserve": "Reserve für Sprache rein/raus"
},
"installed": {
"title": "Installierte Modelle",
@@ -282,7 +301,9 @@
"skipped": "nicht geprüft",
"result_ok": "Alles hat geantwortet.",
"result_problem": "Problem: {reason}",
- "ms": "{ms} ms"
+ "ms": "{ms} ms",
+ "voice": "Sprache",
+ "tools_screen": "Werkzeuge & Bildschirm"
},
"roles": {
"title": "Rollen",
@@ -318,7 +339,16 @@
"readback_defaults": "Läuft mit den eigenen Vorgaben des Modells.",
"tune_skipped": "Zugewiesen; die Einstellungen bleiben bei den Vorgaben des Modells.",
"voice_context_auto": "Läuft mit {context} Kontext — nach dem Speicher dieses Rechners bemessen. Über „Abstimmen“ selbst festlegen.",
- "voice_context_manual": "Läuft mit {context} Kontext — von dir unter „Abstimmen“ festgelegt."
+ "voice_context_manual": "Läuft mit {context} Kontext — von dir unter „Abstimmen“ festgelegt.",
+ "pick_group_slow": "Funktioniert, aber langsamer",
+ "pick_group_unknown": "Fähigkeiten unbekannt",
+ "pick_group_unfit": "Nicht für diese Aufgabe",
+ "pick_group_downloads": "Einen Vorschlag für diese Aufgabe herunterladen",
+ "pick_search": "Installierte Modelle durchsuchen…",
+ "pick_empty": "Nichts passt.",
+ "pick_download": "Herunterladen",
+ "pick_current": "aktuell",
+ "pick_fits": "passt"
},
"server": {
"host_eyebrow": "Host",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json
index 66bed5943d..0dcae51564 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json
@@ -13,7 +13,22 @@
"memory_over": "Larger than the {gb} GB graphics memory — runs partly on the processor",
"memory_unknown": "Graphics memory unknown",
"memory_aria": "Uses {percent} % of the graphics memory",
- "switch_to": "Switch to {model}"
+ "switch_to": "Switch to {model}",
+ "fit_fits": "Fits this job.",
+ "fit_slow": "Works, but {reason}.",
+ "fit_unfit": "Can’t do this job — {reason}.",
+ "fit_unknown": "Jarvis could not read what this model can do.",
+ "fit_alternative": "Pick {model} instead.",
+ "shared_with": "Shared with {roles} — loaded once.",
+ "memory_line": "{weights} + {context} context = {percent} % of {gb} GB graphics memory",
+ "memory_line_voice": "{weights} + {context} context + {reserve} for speech in/out = {percent} % of {gb} GB",
+ "context_of": "{context} of {native} ctx",
+ "loaded_now": "loaded now",
+ "details": "Details",
+ "details_config": "Setting",
+ "details_required": "Needs",
+ "details_loaded_as": "In memory as",
+ "details_recommended": "Pick"
},
"launch": {
"aria": "Set up the server",
@@ -33,9 +48,6 @@
"title": "Local models",
"subtitle": "Models that run on this machine or on a server you name.",
"back": "API Keys",
- "mode_label": "Detail level",
- "mode_simple": "Simple",
- "mode_advanced": "Advanced",
"reload": "Refresh",
"tabs_label": "Local model areas",
"tab_overview": "Overview",
@@ -253,7 +265,14 @@
"setup_brain_hint": "{server} is set up, but {brain} still answers.",
"setup_brain_button": "Make {server} the active brain",
"setup_brain_switched": "{server} is now the active brain.",
- "setup_brain_failed": "Could not switch the brain: {message}"
+ "setup_brain_failed": "Could not switch the brain: {message}",
+ "resident_title": "If every job is loaded at once",
+ "resident_fits": "{total} of {gb} GB",
+ "resident_over": "{total} of {gb} GB — more than the card holds; Ollama will swap between a call and a chat",
+ "resident_unknown": "{total} in total — graphics memory unknown",
+ "resident_context": "Context (estimate)",
+ "resident_context_short": "context",
+ "resident_reserve": "Speech in/out reserve"
},
"installed": {
"title": "Installed models",
@@ -282,7 +301,9 @@
"skipped": "not tested",
"result_ok": "Everything answered.",
"result_problem": "Problem: {reason}",
- "ms": "{ms} ms"
+ "ms": "{ms} ms",
+ "voice": "Voice",
+ "tools_screen": "Tools & screen"
},
"roles": {
"title": "Roles",
@@ -318,7 +339,16 @@
"readback_defaults": "Runs with the model's own defaults.",
"tune_skipped": "Assigned; the settings stay at the model's defaults.",
"voice_context_auto": "Runs with a {context} context — sized from this machine's memory. Tune to set it yourself.",
- "voice_context_manual": "Runs with a {context} context — set by you in Tune."
+ "voice_context_manual": "Runs with a {context} context — set by you in Tune.",
+ "pick_group_slow": "Works, but slower",
+ "pick_group_unknown": "Capabilities unknown",
+ "pick_group_unfit": "Not for this job",
+ "pick_group_downloads": "Download a pick for this job",
+ "pick_search": "Search installed models…",
+ "pick_empty": "Nothing matches.",
+ "pick_download": "Download",
+ "pick_current": "current",
+ "pick_fits": "fits"
},
"server": {
"host_eyebrow": "Host",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json
index f54ea48fb2..8bdc67f4e3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json
@@ -13,7 +13,22 @@
"memory_over": "Mayor que los {gb} GB de memoria gráfica: se ejecuta en parte en el procesador",
"memory_unknown": "Memoria gráfica desconocida",
"memory_aria": "Ocupa el {percent} % de la memoria gráfica",
- "switch_to": "Cambiar a {model}"
+ "switch_to": "Cambiar a {model}",
+ "fit_fits": "Sirve para esta tarea.",
+ "fit_slow": "Funciona, pero {reason}.",
+ "fit_unfit": "No puede con esta tarea — {reason}.",
+ "fit_unknown": "Jarvis no pudo leer qué sabe hacer este modelo.",
+ "fit_alternative": "Elige {model} en su lugar.",
+ "shared_with": "Compartido con {roles} — se carga una vez.",
+ "memory_line": "{weights} + {context} de contexto = {percent} % de {gb} GB de memoria gráfica",
+ "memory_line_voice": "{weights} + {context} de contexto + {reserve} para voz = {percent} % de {gb} GB",
+ "context_of": "{context} de {native} de contexto",
+ "loaded_now": "cargado ahora",
+ "details": "Detalles",
+ "details_config": "Ajuste",
+ "details_required": "Necesita",
+ "details_loaded_as": "En memoria como",
+ "details_recommended": "Sugerencia"
},
"launch": {
"aria": "Configurar el servidor",
@@ -33,9 +48,6 @@
"title": "Modelos locales",
"subtitle": "Modelos que se ejecutan en esta máquina o en un servidor que tú indiques.",
"back": "Claves API",
- "mode_label": "Nivel de detalle",
- "mode_simple": "Sencillo",
- "mode_advanced": "Avanzado",
"reload": "Actualizar",
"tabs_label": "Áreas de modelos locales",
"tab_overview": "Resumen",
@@ -253,7 +265,14 @@
"setup_brain_hint": "{server} está configurado, pero {brain} sigue respondiendo.",
"setup_brain_button": "Hacer de {server} el cerebro activo",
"setup_brain_switched": "{server} es ahora el cerebro activo.",
- "setup_brain_failed": "No se pudo cambiar el cerebro: {message}"
+ "setup_brain_failed": "No se pudo cambiar el cerebro: {message}",
+ "resident_title": "Si todas las tareas se cargan a la vez",
+ "resident_fits": "{total} de {gb} GB",
+ "resident_over": "{total} de {gb} GB — más de lo que cabe en la tarjeta; Ollama alternará entre llamada y chat",
+ "resident_unknown": "{total} en total — memoria gráfica desconocida",
+ "resident_context": "Contexto (estimación)",
+ "resident_context_short": "contexto",
+ "resident_reserve": "Reserva para voz"
},
"installed": {
"title": "Modelos instalados",
@@ -282,7 +301,9 @@
"skipped": "sin probar",
"result_ok": "Todo respondió.",
"result_problem": "Problema: {reason}",
- "ms": "{ms} ms"
+ "ms": "{ms} ms",
+ "voice": "Voz",
+ "tools_screen": "Herramientas y pantalla"
},
"roles": {
"title": "Roles",
@@ -318,7 +339,16 @@
"readback_defaults": "Corre con los valores propios del modelo.",
"tune_skipped": "Asignado; los ajustes se quedan en los valores del modelo.",
"voice_context_auto": "Funciona con un contexto de {context}, dimensionado según la memoria de este equipo. Ajústalo tú en «Ajustar».",
- "voice_context_manual": "Funciona con un contexto de {context}, fijado por ti en «Ajustar»."
+ "voice_context_manual": "Funciona con un contexto de {context}, fijado por ti en «Ajustar».",
+ "pick_group_slow": "Funciona, pero más lento",
+ "pick_group_unknown": "Capacidades desconocidas",
+ "pick_group_unfit": "No para esta tarea",
+ "pick_group_downloads": "Descargar una sugerencia para esta tarea",
+ "pick_search": "Buscar modelos instalados…",
+ "pick_empty": "Nada coincide.",
+ "pick_download": "Descargar",
+ "pick_current": "actual",
+ "pick_fits": "sirve"
},
"server": {
"host_eyebrow": "Host",
diff --git a/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsx b/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsx
index 4ef1d187ce..8616431ec4 100644
--- a/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsx
@@ -92,10 +92,7 @@ vi.mock("@/hooks/useLocalModels", () => ({
useReloadLocalModels: () => mockReload,
}));
-import {
- LOCAL_MODELS_MODE_KEY,
- LocalModelsView,
-} from "@/views/LocalModelsView";
+import { LocalModelsView } from "@/views/LocalModelsView";
import { LOCAL_MODELS_SEED_KEY } from "@/lib/localModelsSeed";
const OLLAMA = {
@@ -106,7 +103,6 @@ const OLLAMA = {
};
beforeEach(() => {
- window.localStorage.removeItem(LOCAL_MODELS_MODE_KEY);
window.localStorage.removeItem(LOCAL_MODELS_SEED_KEY);
mockState.setActiveSection = vi.fn();
mockProviders.providers = [OLLAMA];
@@ -119,7 +115,7 @@ afterEach(() => {
});
describe("LocalModelsView", () => {
- it("renders the header, the Simple rail and the overview by default", () => {
+ it("renders the header, every tab and the overview by default", () => {
render(<LocalModelsView />);
expect(screen.getByText("local_models.title")).toBeDefined();
@@ -132,13 +128,13 @@ describe("LocalModelsView", () => {
expect(
screen.getByRole("tab", { name: "local_models.tab_server" }),
).toBeDefined();
- // Simple hides the Advanced-only tabs.
+ // No detail level: the ledger and Hugging Face are always one click away.
expect(
- screen.queryByRole("tab", { name: "local_models.tab_models" }),
- ).toBeNull();
+ screen.getByRole("tab", { name: "local_models.tab_models" }),
+ ).toBeDefined();
expect(
- screen.queryByRole("tab", { name: "local_models.tab_huggingface" }),
- ).toBeNull();
+ screen.getByRole("tab", { name: "local_models.tab_huggingface" }),
+ ).toBeDefined();
expect(screen.getByTestId("local-models-overview")).toBeDefined();
});
@@ -176,20 +172,9 @@ describe("LocalModelsView", () => {
expect(mockState.setActiveSection).toHaveBeenCalledWith("apikeys");
});
- it("reveals Models in Advanced and remembers the choice", () => {
+ it("mounts the Models ledger and Hugging Face from their tabs", () => {
render(<LocalModelsView />);
- fireEvent.click(
- screen.getByRole("tab", { name: "local_models.mode_advanced" }),
- );
- expect(
- screen.getByRole("tab", { name: "local_models.tab_models" }),
- ).toBeDefined();
- expect(
- screen.getByRole("tab", { name: "local_models.tab_huggingface" }),
- ).toBeDefined();
- expect(window.localStorage.getItem(LOCAL_MODELS_MODE_KEY)).toBe("advanced");
-
fireEvent.click(
screen.getByRole("tab", { name: "local_models.tab_models" }),
);
@@ -199,17 +184,7 @@ describe("LocalModelsView", () => {
screen.getByRole("tab", { name: "local_models.tab_huggingface" }),
);
expect(screen.getByTestId("huggingface-panel")).toBeDefined();
-
- // Back to Simple: the rail drops Models and the view falls back to Overview.
- fireEvent.click(
- screen.getByRole("tab", { name: "local_models.mode_simple" }),
- );
- expect(
- screen.queryByRole("tab", { name: "local_models.tab_models" }),
- ).toBeNull();
- expect(screen.getByTestId("local-models-overview")).toBeDefined();
});
-
it("goes back to API Keys and says so when no server can pull models", () => {
mockProviders.providers = [{ id: "openai", label: "OpenAI" }];
render(<LocalModelsView />);
diff --git a/jarvis/ui/web/frontend/src/views/LocalModelsView.tsx b/jarvis/ui/web/frontend/src/views/LocalModelsView.tsx
index 2bf5e93a9f..e7728d73c0 100644
--- a/jarvis/ui/web/frontend/src/views/LocalModelsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/LocalModelsView.tsx
@@ -1,14 +1,17 @@
/**
* Local models — the section for the models that run on this machine (or on
* a server the user names): the Ollama runtime, the installed models, the
- * public catalogue and, later, Hugging Face.
+ * public catalogue and Hugging Face.
*
- * The column runs the full window width (a catalogue is browsed, not read), the header carries a Simple |
- * Advanced switch (persisted per browser) and a rail of tabs. Simple shows
- * Overview (server facts + the four roles), Catalogue and Server; Advanced
- * adds Models (the installed ledger with the Tune sheet) and Hugging Face.
- * "Tune" from a role row opens the Tune sheet for that model right under the
- * overview, so a non-developer never has to find the model in the ledger.
+ * The column runs the full window width (a catalogue is browsed, not read)
+ * and the header carries a rail of tabs: Overview (what sits in memory, the
+ * jobs, the server button), Models (the installed ledger with the Tune
+ * sheet), Browse models, Hugging Face and Server. Every tab is always
+ * there — the Simple/Advanced switch that used to hide two of them is gone,
+ * because a control that is hidden is a control that is searched for.
+ * "Tune" from a job card opens the Tune sheet for that model right under
+ * the overview, so a non-developer never has to find the model in the
+ * ledger.
*
* Everything is gated on the capability `supports_model_pull`, never on a
* provider name — a second pull-capable server later gets the same section.
@@ -46,38 +49,9 @@ import { TuneSheet } from "@/views/local-models/TuneSheet";
import { useEventStore } from "@/store/events";
import { useLocaleChunk, useT } from "@/i18n";
-export type LocalModelsMode = "simple" | "advanced";
export type LocalModelsTab =
"overview" | "models" | "catalogue" | "huggingface" | "server";
-/** Browser-local preference; a private window simply starts on Simple. */
-export const LOCAL_MODELS_MODE_KEY = "jarvis.localModels.mode";
-
-const ADVANCED_ONLY: ReadonlySet<LocalModelsTab> = new Set([
- "models",
- "huggingface",
-]);
-
-function readStoredMode(): LocalModelsMode {
- try {
- return window.localStorage.getItem(LOCAL_MODELS_MODE_KEY) === "advanced"
- ? "advanced"
- : "simple";
- } catch {
- // Storage can be blocked (privacy mode, embedded WebView policies); the
- // preference is a convenience, so the default is the honest answer.
- return "simple";
- }
-}
-
-function storeMode(mode: LocalModelsMode): void {
- try {
- window.localStorage.setItem(LOCAL_MODELS_MODE_KEY, mode);
- } catch {
- // Same as above: nothing to recover, the in-memory state still applies.
- }
-}
-
/**
* The Tune sheet opened from a role row. The sheet wants the inventory row
* (capabilities, native context, size), so it is looked up here; a model the
@@ -140,22 +114,17 @@ export function LocalModelsView() {
}, [loading, descriptor]);
const providerId: string | null = descriptor?.id ?? (loading ? seed : null);
- const [mode, setMode] = useState<LocalModelsMode>(readStoredMode);
const [tab, setTab] = useState<LocalModelsTab>("overview");
// The model whose Tune sheet is open under the overview ("" = none).
const [tuneModel, setTuneModel] = useState<string>("");
const openBrowse = useCallback(() => setTab("catalogue"), []);
+ const openManage = useCallback(() => setTab("models"), []);
const openApiKeys = useCallback(
() => setActiveSection("apikeys"),
[setActiveSection],
);
const closeTune = useCallback(() => setTuneModel(""), []);
- const changeMode = useCallback((next: LocalModelsMode) => {
- setMode(next);
- storeMode(next);
- }, []);
-
// Refresh: drops the painted snapshot and every cached answer, then reads
// the server again. The one recovery from a snapshot taken while the
// server was silent, which otherwise paints a wiped machine (BUG-188).
@@ -166,31 +135,18 @@ export function LocalModelsView() {
setReloading(true);
void reload().finally(() => setReloading(false));
}, [reload, reloading]);
- // "Manage" on the overview's installed list: the full ledger lives on the
- // Advanced-only Models tab, so the switch flips along with the tab.
- const openManage = useCallback(() => {
- changeMode("advanced");
- setTab("models");
- }, [changeMode]);
-
- // Leaving Advanced while on an Advanced-only tab must not strand the user on
- // a tab the rail no longer shows.
- useEffect(() => {
- if (mode === "simple" && ADVANCED_ONLY.has(tab)) setTab("overview");
- }, [mode, tab]);
- const tabs = useMemo(() => {
- const all: { id: LocalModelsTab; label: string }[] = [
- { id: "overview", label: t("local_models.tab_overview") },
- { id: "models", label: t("local_models.tab_models") },
- { id: "catalogue", label: t("local_models.tab_catalogue") },
- { id: "huggingface", label: t("local_models.tab_huggingface") },
- { id: "server", label: t("local_models.tab_server") },
- ];
- return mode === "advanced"
- ? all
- : all.filter((o) => !ADVANCED_ONLY.has(o.id));
- }, [mode, t]);
+ const tabs = useMemo(
+ () =>
+ [
+ { id: "overview", label: t("local_models.tab_overview") },
+ { id: "models", label: t("local_models.tab_models") },
+ { id: "catalogue", label: t("local_models.tab_catalogue") },
+ { id: "huggingface", label: t("local_models.tab_huggingface") },
+ { id: "server", label: t("local_models.tab_server") },
+ ] as { id: LocalModelsTab; label: string }[],
+ [t],
+ );
return (
<div className="flex h-full min-h-0 w-full flex-col">
@@ -204,9 +160,6 @@ export function LocalModelsView() {
subtitle={t("local_models.subtitle")}
/>
- {/* The rail and the detail level belong together: the switch adds two
- areas to this very row (and detail to the rows below), so it sits
- beside what it changes instead of alone in the header. */}
<div className="flex flex-wrap items-center justify-between gap-3">
<SegmentedFilter<LocalModelsTab>
label={t("local_models.tabs_label")}
@@ -214,33 +167,19 @@ export function LocalModelsView() {
onChange={setTab}
options={tabs}
/>
- <div className="flex items-center gap-2">
- <SoftButton
- onClick={onReload}
- disabled={!providerId || reloading}
- ariaLabel={t("local_models.reload")}
- className="h-8"
- >
- {reloading ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- ) : (
- <RefreshCw className="h-3.5 w-3.5" />
- )}
- {t("local_models.reload")}
- </SoftButton>
- <span className="text-[11px] uppercase tracking-[0.14em] text-muted-foreground">
- {t("local_models.mode_label")}
- </span>
- <SegmentedFilter<LocalModelsMode>
- label={t("local_models.mode_label")}
- value={mode}
- onChange={changeMode}
- options={[
- { id: "simple", label: t("local_models.mode_simple") },
- { id: "advanced", label: t("local_models.mode_advanced") },
- ]}
- />
- </div>
+ <SoftButton
+ onClick={onReload}
+ disabled={!providerId || reloading}
+ ariaLabel={t("local_models.reload")}
+ className="h-8"
+ >
+ {reloading ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : (
+ <RefreshCw className="h-3.5 w-3.5" />
+ )}
+ {t("local_models.reload")}
+ </SoftButton>
</div>
</div>
@@ -268,7 +207,6 @@ export function LocalModelsView() {
onOpenApiKeys={openApiKeys}
onBrowse={openBrowse}
onManage={openManage}
- advanced={mode === "advanced"}
/>
{tuneModel && (
<RoleTuneDrawer
diff --git a/jarvis/ui/web/frontend/src/views/local-models/InstalledPanel.tsx b/jarvis/ui/web/frontend/src/views/local-models/InstalledPanel.tsx
index 2e1cfd1204..d99e5293fa 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/InstalledPanel.tsx
+++ b/jarvis/ui/web/frontend/src/views/local-models/InstalledPanel.tsx
@@ -23,8 +23,9 @@ import type { LocalModelRow, RoleRow } from "@/hooks/useLocalModels";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
-import { formatGb } from "./localModelsFormat";
+import { formatContext, formatGb } from "./localModelsFormat";
import { canonical } from "./localSetup";
+import { modelLabel } from "./modelNames";
export interface InstalledPanelProps {
models: LocalModelRow[];
@@ -176,15 +177,21 @@ export function InstalledPanel({
<StatusDot
tone={row.loaded ? "ok" : "off"}
label={
- <span className="font-mono text-xs text-foreground/85">
- {row.name}
+ <span className="text-sm text-foreground">
+ {modelLabel(row)}
</span>
}
/>
<div className="ml-4 mt-0.5 text-[11px] text-muted-foreground">
- {[row.parameter_size, formatGb(row.size_bytes)]
+ <span className="font-mono text-foreground/70">{row.name}</span>
+ {[
+ row.quant_label || row.quantization_level,
+ formatGb(row.size_bytes),
+ row.context_length ? formatContext(row.context_length) : "",
+ ]
.filter(Boolean)
- .join(" · ")}
+ .map((part) => ` · ${part}`)
+ .join("")}
{row.loaded ? ` · ${k("loaded")}` : ""}
</div>
</div>
diff --git a/jarvis/ui/web/frontend/src/views/local-models/MemoryStrip.tsx b/jarvis/ui/web/frontend/src/views/local-models/MemoryStrip.tsx
new file mode 100644
index 0000000000..5e0a78f9c7
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/local-models/MemoryStrip.tsx
@@ -0,0 +1,112 @@
+/**
+ * What sits in graphics memory when every job is loaded at once.
+ *
+ * The card's own bar answers "does THIS model fit"; this strip answers the
+ * question that decides a local setup — whether the chat model, the voice
+ * brain and the embedder fit TOGETHER, because a call arrives while a chat
+ * is loaded. The backend adds it up (`roles.resident`: one segment per
+ * distinct download, its context estimate, the speech stack's reserve); the
+ * strip only draws it, with the total against the card and one sentence
+ * when it does not fit — Ollama then swaps, and the user hears the pause.
+ */
+import type { LocalModelRole, ResidentPayload } from "@/hooks/useLocalModels";
+import { fill, useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+
+import { formatGb } from "./localModelsFormat";
+
+export interface MemoryStripProps {
+ resident: ResidentPayload | undefined;
+ roleLabel: (role: LocalModelRole) => string;
+}
+
+const GIB = 1024 ** 3;
+
+export function MemoryStrip({ resident, roleLabel }: MemoryStripProps) {
+ const t = useT();
+ if (!resident || resident.items.length === 0) return null;
+ const k = (key: string) => t(`local_models.overview.${key}`);
+ const budget = resident.accelerator_gb;
+ const total = resident.total_gb;
+ const scale = budget > 0 ? Math.max(budget, total) : total || 1;
+ const width = (gb: number) => `${Math.max(0, (gb / scale) * 100)}%`;
+ const gb = (value: number) => formatGb(value * GIB);
+
+ const headline =
+ budget > 0
+ ? fill(k(resident.over ? "resident_over" : "resident_fits"), {
+ total: gb(total),
+ gb: budget.toFixed(1),
+ })
+ : fill(k("resident_unknown"), { total: gb(total) });
+
+ return (
+ <section
+ className="rounded-2xl border border-border bg-card/40 px-4 py-3"
+ data-testid="memory-strip"
+ data-over={resident.over ? "true" : "false"}
+ aria-label={k("resident_title")}
+ >
+ <div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1">
+ <p className="text-xs text-muted-foreground">{k("resident_title")}</p>
+ <p
+ className={cn(
+ "text-xs font-medium tabular-nums",
+ resident.over ? "text-amber-700 dark:text-amber-400" : "text-foreground",
+ )}
+ data-testid="memory-strip-total"
+ >
+ {headline}
+ </p>
+ </div>
+ <div
+ className="mt-2 flex h-2.5 overflow-hidden rounded-full bg-sheen/[0.08]"
+ role="img"
+ aria-label={headline}
+ >
+ {resident.items.map((item, i) => (
+ <span key={item.tag} className="contents">
+ <span
+ className={cn("h-full bg-primary", i % 2 === 1 && "opacity-75")}
+ style={{ width: width(item.weights_gb) }}
+ title={`${item.display_label || item.tag} · ${gb(item.weights_gb)}`}
+ />
+ <span
+ className="h-full bg-primary/40"
+ style={{ width: width(item.context_gb) }}
+ title={`${k("resident_context")} · ${gb(item.context_gb)}`}
+ />
+ </span>
+ ))}
+ {resident.reserve_gb > 0 && (
+ <span
+ className="h-full bg-sheen/25"
+ style={{ width: width(resident.reserve_gb) }}
+ title={`${k("resident_reserve")} · ${gb(resident.reserve_gb)}`}
+ />
+ )}
+ </div>
+ <ul className="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-muted-foreground">
+ {resident.items.map((item) => (
+ <li key={item.tag} className="flex items-center gap-1.5" data-testid={`memory-strip-${item.tag}`}>
+ <i className="inline-block h-2 w-2 rounded-[2px] bg-primary" aria-hidden />
+ <span className="text-foreground/90">{item.display_label || item.tag}</span>
+ <span>
+ {item.roles.map(roleLabel).join(" · ")} · {gb(item.weights_gb)}
+ {item.context_gb > 0 ? ` + ${gb(item.context_gb)} ${k("resident_context_short")}` : ""}
+ {item.loaded ? ` · ${t("local_models.installed.loaded")}` : ""}
+ </span>
+ </li>
+ ))}
+ {resident.reserve_gb > 0 && (
+ <li className="flex items-center gap-1.5">
+ <i className="inline-block h-2 w-2 rounded-[2px] bg-sheen/25" aria-hidden />
+ <span>
+ {k("resident_reserve")} · {gb(resident.reserve_gb)}
+ </span>
+ </li>
+ )}
+ </ul>
+ </section>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/local-models/ModelCard.tsx b/jarvis/ui/web/frontend/src/views/local-models/ModelCard.tsx
index c46ac8de8b..f770c027de 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/ModelCard.tsx
+++ b/jarvis/ui/web/frontend/src/views/local-models/ModelCard.tsx
@@ -1,22 +1,25 @@
/**
- * One job, one card, one model.
+ * One job, one card, one model — and an honest verdict on the pairing.
*
- * A local setup is not a sequence of steps — chat, tools, deep and
- * embeddings are four peers, and numbering them would claim an order that
- * does not exist. So the page is a grid of equals, and this is one tile:
- * what the job is, in a sentence a non-developer recognises; the model doing
- * it right now; and the picker that changes it.
+ * A local setup is not a sequence of steps — chat, voice, tools & screen
+ * and deep are peers, and numbering them would claim an order that does
+ * not exist. So the page is a grid of equals, and this is one tile: what
+ * the job is, in a sentence a non-developer recognises; the model doing it
+ * right now, by its readable name with the tag small beside it; and one
+ * line saying whether that model can actually do the job.
*
- * The card's signature is the memory bar. Every other model picker in the
- * world shows a list of names; the question that actually decides a local
- * setup is "does this fit on my graphics card". The bar answers it before
- * the download starts: the model's size against the accelerator this machine
- * reported, amber once the model is larger than the card can hold.
+ * That line is the card's point. The old card knew ready / missing / empty
+ * and said "ready" while the tools & screen job sat on a model without
+ * vision. Now the backend's verdict on the current pick (`current_fit`,
+ * one rule for every surface) becomes the card's state: `unfit` is a
+ * warning ring and a sentence naming what is missing, `slow` names the
+ * cost, and the recommendation button appears only when there is a reason
+ * for it — never as a standing nag to switch away from a fine choice.
*
- * `state` is derived, never passed: a card is `ready` when its model is set
- * AND on disk, `missing` when a tag is configured that is not installed,
- * `empty` when nothing is set. The border carries it, so a glance across the
- * grid says what is left to do without reading a word.
+ * The memory row stays the signature ("does this fit on my graphics
+ * card"), but it now counts what the model actually costs loaded: the
+ * weights plus the context window — plus, for the voice brain, the memory
+ * the local speech stack keeps free beside it.
*/
import { Download, Loader2, SlidersHorizontal } from "lucide-react";
@@ -25,11 +28,19 @@ import type { LocalModelRow, RoleRow } from "@/hooks/useLocalModels";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
-import { formatGb } from "./localModelsFormat";
+import { estimateContextGb, formatContext, formatGb } from "./localModelsFormat";
+import { capabilityChips, findModel, labelFor, modelLabel } from "./modelNames";
import { RolePicker } from "./RolePicker";
import type { RoleProgress } from "./useRoleActions";
-export type ModelCardState = "ready" | "missing" | "empty" | "blocked";
+export type ModelCardState =
+ | "ready"
+ | "slow"
+ | "unfit"
+ | "unknown"
+ | "missing"
+ | "empty"
+ | "blocked";
export interface ModelCardProps {
row: RoleRow;
@@ -37,26 +48,23 @@ export interface ModelCardProps {
models: LocalModelRow[];
/** Graphics memory this machine reported, in GB; 0 = unknown. */
acceleratorGb: number;
+ /** Memory the local speech stack keeps free beside this job's model (voice). */
+ reserveGb?: number;
+ /** Labels of the other jobs served by the same download. */
+ sharedWith?: string[];
progress: RoleProgress;
busy: boolean;
onPick: (model: string) => void;
onUseRecommended: () => void;
- /** Advanced only: opens the Tune sheet for the model on this card. */
+ /** Downloads a shortlist pick and assigns it to this job. */
+ onInstall?: (model: string) => void;
+ /** Opens the Tune sheet for the model on this card. */
onTune?: (model: string) => void;
- /** Adds the required-capability badges and the Tune button. */
- advanced?: boolean;
}
-/** Human window size: 16384 -> "16k". */
-function contextLabel(numCtx: number): string {
- return numCtx >= 1024 ? `${Math.round(numCtx / 1024)}k` : String(numCtx);
-}
-
-/** The capabilities a job is gated on, as one short phrase. */
-function capabilityLine(row: LocalModelRow | null): string {
- if (!row || !row.probed) return "";
- return row.capabilities.filter((c) => c !== "completion").join(" · ");
-}
+const GIB = 1024 ** 3;
+/** The window an unloaded, untuned model is assumed to open with. */
+const DEFAULT_CONTEXT_TOKENS = 8192;
export function cardState(row: RoleRow): ModelCardState {
// A job served by something other than Ollama, or whose own server is not
@@ -64,41 +72,173 @@ export function cardState(row: RoleRow): ModelCardState {
// to be refused is worse than a sentence naming what is missing.
if (!row.writable || (row.note !== "" && row.current === "")) return "blocked";
if (!row.current) return "empty";
- return row.installed ? "ready" : "missing";
+ if (!row.installed || row.current_fit === "absent") return "missing";
+ switch (row.current_fit) {
+ case "unfit":
+ return "unfit";
+ case "slow":
+ return "slow";
+ case "unknown":
+ return "unknown";
+ default:
+ return "ready";
+ }
}
const RING: Record<ModelCardState, string> = {
ready: "border-border",
- // Amber and emerald carry meanings the token set has no name for, and each
- // needs its own value per theme — the same pairing StatTile uses.
+ unknown: "border-border",
+ // Amber and red carry meanings the token set has no name for; the accent
+ // stays for the memory bar and the primary button.
+ slow: "border-amber-500/40",
+ unfit: "border-destructive/50",
missing: "border-amber-500/50",
empty: "border-dashed border-border",
blocked: "border-border/60",
};
+const VERDICT_TONE: Record<ModelCardState, string> = {
+ ready: "text-emerald-600 dark:text-emerald-400",
+ unknown: "text-muted-foreground",
+ slow: "text-amber-700 dark:text-amber-400",
+ unfit: "text-destructive",
+ missing: "text-amber-700 dark:text-amber-400",
+ empty: "text-muted-foreground",
+ blocked: "text-muted-foreground",
+};
+
+const VERDICT_MARK: Record<ModelCardState, string> = {
+ ready: "✓",
+ unknown: "?",
+ slow: "!",
+ unfit: "✕",
+ missing: "!",
+ empty: "·",
+ blocked: "·",
+};
+
+function Chip({ children, on = false }: { children: React.ReactNode; on?: boolean }) {
+ return (
+ <span
+ className={cn(
+ "inline-flex shrink-0 items-center rounded border px-1.5 py-px text-[10px] tabular-nums",
+ on ? "border-border text-foreground/90" : "border-border/70 text-muted-foreground",
+ )}
+ >
+ {children}
+ </span>
+ );
+}
+
export function ModelCard({
row,
models,
acceleratorGb,
+ reserveGb = 0,
+ sharedWith = [],
progress,
busy,
onPick,
onUseRecommended,
+ onInstall,
onTune,
- advanced = false,
}: ModelCardProps) {
const t = useT();
const state = cardState(row);
- const current = models.find((m) => m.name === row.current) ?? null;
- const sizeBytes = current?.size_bytes ?? 0;
- const budgetBytes = acceleratorGb * 1024 ** 3;
- const share = budgetBytes > 0 && sizeBytes > 0 ? sizeBytes / budgetBytes : 0;
+ const current = findModel(models, row.current);
+ const weightsBytes = current?.size_bytes ?? 0;
+ const weightsGb = weightsBytes / GIB;
+
+ // The context the model runs with: the live figure when loaded, the voice
+ // brain's sized window, the tuned/default window otherwise.
+ const contextTokens =
+ (current?.loaded ? current.running_context_length : null) ??
+ row.context_tokens ??
+ DEFAULT_CONTEXT_TOKENS;
+ const contextGb =
+ current?.loaded && (current.loaded_size_bytes ?? 0) > weightsBytes
+ ? ((current.loaded_size_bytes ?? 0) - weightsBytes) / GIB
+ : weightsGb > 0
+ ? estimateContextGb(contextTokens, weightsGb)
+ : 0;
+ const totalGb = weightsGb + contextGb + reserveGb;
+ const share = acceleratorGb > 0 && totalGb > 0 ? totalGb / acceleratorGb : 0;
const overBudget = share > 1;
- const caps = capabilityLine(current);
- const canUseRecommended =
- row.writable && row.recommended !== "" && row.recommended !== row.current;
- const recommendedInstalled = models.some((m) => m.name === row.recommended);
+ const recommendedLabel = labelFor(models, row.recommended);
+ const recommendedInstalled = findModel(models, row.recommended) !== null;
+ const wantsRecommendation =
+ row.writable &&
+ row.recommended !== "" &&
+ row.recommended !== row.current &&
+ (state === "empty" || state === "missing" || state === "unfit" || state === "slow");
+
+ const verdict = (() => {
+ switch (state) {
+ case "ready":
+ return sharedWith.length > 0
+ ? `${t("local_models.jobs.fit_fits")} ${fill(t("local_models.jobs.shared_with"), {
+ roles: sharedWith.join(", "),
+ })}`
+ : t("local_models.jobs.fit_fits");
+ case "slow":
+ return fill(t("local_models.jobs.fit_slow"), { reason: row.current_reason ?? "" });
+ case "unfit": {
+ const base = fill(t("local_models.jobs.fit_unfit"), { reason: row.current_reason ?? "" });
+ return wantsRecommendation
+ ? `${base} ${fill(t("local_models.jobs.fit_alternative"), { model: recommendedLabel })}`
+ : base;
+ }
+ case "unknown":
+ return t("local_models.jobs.fit_unknown");
+ case "missing":
+ return t("local_models.jobs.not_on_disk");
+ case "empty":
+ return t("local_models.jobs.empty");
+ case "blocked":
+ return row.note || t("local_models.roles.read_only");
+ }
+ })();
+
+ const chips: Array<{ text: string; on?: boolean }> = [];
+ if (current) {
+ if (current.params_label) chips.push({ text: current.params_label, on: true });
+ if (current.quant_label || current.quantization_level)
+ chips.push({ text: current.quant_label || current.quantization_level });
+ chips.push({ text: formatGb(current.size_bytes) });
+ if (current.context_length) {
+ chips.push({
+ text:
+ row.id === "voice" && row.context_tokens
+ ? fill(t("local_models.jobs.context_of"), {
+ context: formatContext(row.context_tokens),
+ native: formatContext(current.context_length),
+ })
+ : `${formatContext(current.context_length)} ctx`,
+ on: row.id === "voice",
+ });
+ }
+ for (const cap of capabilityChips(current)) chips.push({ text: cap, on: true });
+ if (current.source) chips.push({ text: current.source });
+ if (current.loaded) chips.push({ text: t("local_models.jobs.loaded_now"), on: true });
+ }
+
+ const memoryText = (() => {
+ if (share <= 0) return t("local_models.jobs.memory_unknown");
+ if (overBudget)
+ return fill(t("local_models.jobs.memory_over"), { gb: acceleratorGb.toFixed(1) });
+ const values = {
+ weights: formatGb(weightsBytes),
+ context: formatGb(contextGb * GIB),
+ reserve: formatGb(reserveGb * GIB),
+ percent: Math.round(share * 100),
+ gb: acceleratorGb.toFixed(1),
+ };
+ return fill(
+ t(reserveGb > 0 ? "local_models.jobs.memory_line_voice" : "local_models.jobs.memory_line"),
+ values,
+ );
+ })();
return (
<article
@@ -110,129 +250,141 @@ export function ModelCard({
data-state={state}
aria-label={t(row.label_key)}
>
- {/* The job. An eyebrow, because the job is the category and the model
+ {/* The job: an eyebrow, because the job is the category and the model
below it is the value — not the other way round. */}
- <div className="flex items-start justify-between gap-2">
+ <div className="flex items-baseline justify-between gap-2">
<p className="text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground">
{t(row.label_key)}
</p>
- {advanced && row.required.length > 0 && (
- <div className="flex shrink-0 flex-wrap justify-end gap-1">
- {row.required.map((cap) => (
- <span
- key={cap}
- className="rounded border border-border px-1 py-px text-[10px] uppercase tracking-wider text-muted-foreground"
- >
- {cap}
- </span>
- ))}
- </div>
- )}
+ <p className="truncate text-[11px] text-muted-foreground/80">
+ {t(`local_models.jobs.${row.id}_purpose`)}
+ </p>
</div>
- {/* Two lines reserved: a sentence that wraps on a narrow card must
- not push this card's picker below its neighbours'. */}
- <p className="mt-1 min-h-[2.5rem] text-xs leading-relaxed text-muted-foreground">
- {t(`local_models.jobs.${row.id}_purpose`)}
- </p>
- {/* The model. The largest thing on the card, because it is the answer
- the card exists to give. Fixed height: the pickers below are scanned
- as a column and must line up across cards that carry a fact more. */}
- <div className="mt-3.5 min-h-[4.5rem]">
+ {/* The model: the largest thing on the card, by a name a person can
+ read; the tag small beside it, so the address is never lost. */}
+ <div className="mt-3 min-h-[5.25rem]">
{row.current ? (
<>
- <p
- className="truncate font-mono text-[15px] font-medium text-foreground"
- title={row.current}
- data-testid={`model-card-current-${row.id}`}
- >
- {row.current}
- </p>
- <p className="mt-0.5 truncate text-[11px] text-muted-foreground">
- {state === "missing"
- ? t("local_models.jobs.not_on_disk")
- : [sizeBytes ? formatGb(sizeBytes) : "", caps]
- .filter(Boolean)
- .join(" · ") || t("local_models.jobs.no_facts")}
+ <p className="flex flex-wrap items-baseline gap-x-2">
+ <span
+ className="font-display text-lg font-semibold tracking-tight text-foreground"
+ data-testid={`model-card-current-${row.id}`}
+ >
+ {modelLabel(current, row.current)}
+ </span>
+ <span
+ className="truncate font-mono text-[11px] text-muted-foreground"
+ title={row.current}
+ data-testid={`model-card-tag-${row.id}`}
+ >
+ {row.current}
+ </span>
</p>
+ {chips.length > 0 ? (
+ <p className="mt-1.5 flex flex-wrap gap-1" data-testid={`model-card-chips-${row.id}`}>
+ {chips.map((chip) => (
+ <Chip key={chip.text} on={chip.on}>
+ {chip.text}
+ </Chip>
+ ))}
+ </p>
+ ) : (
+ <p className="mt-1 text-[11px] text-muted-foreground">
+ {state === "missing"
+ ? t("local_models.jobs.not_on_disk")
+ : t("local_models.jobs.no_facts")}
+ </p>
+ )}
</>
) : (
- <p className="text-sm text-muted-foreground">
- {state === "blocked"
- ? row.note || t("local_models.roles.read_only")
- : t("local_models.jobs.empty")}
- </p>
+ <p className="text-sm text-muted-foreground">{verdict}</p>
)}
- {/* Speech runs with a window sized for this machine; a call is
- judged by its first word, so that number belongs on the card. */}
- {row.id === "voice" && row.context_tokens ? (
- <p
- className="mt-1 text-[11px] leading-snug text-muted-foreground"
- data-testid="voice-context"
- >
- {fill(
- t(
- row.context_source === "manual"
- ? "local_models.roles.voice_context_manual"
- : "local_models.roles.voice_context_auto",
- ),
- { context: contextLabel(row.context_tokens) },
- )}
- </p>
- ) : null}
</div>
- {/* The memory bar: this model against this machine's graphics memory. */}
- {state !== "blocked" && (
+ {/* The verdict: one line, one rule, the same the picker uses. */}
+ {row.current && (
+ <p
+ className={cn("mt-2 flex gap-1.5 text-xs leading-snug", VERDICT_TONE[state])}
+ data-testid={`model-card-verdict-${row.id}`}
+ >
+ <span aria-hidden className="w-3 shrink-0 text-center font-semibold">
+ {VERDICT_MARK[state]}
+ </span>
+ <span>{verdict}</span>
+ </p>
+ )}
+
+ {/* The memory bar: this model, loaded, against this machine's card. */}
+ {state !== "blocked" && state !== "empty" && (
<div className="mt-2.5" data-testid={`model-card-memory-${row.id}`}>
<div
- className="h-1.5 overflow-hidden rounded-full bg-sheen/[0.08]"
+ className="flex h-1.5 overflow-hidden rounded-full bg-sheen/[0.08]"
role="img"
aria-label={
share > 0
- ? fill(t("local_models.jobs.memory_aria"), {
- percent: Math.round(share * 100),
- })
+ ? fill(t("local_models.jobs.memory_aria"), { percent: Math.round(share * 100) })
: t("local_models.jobs.memory_unknown")
}
>
<div
className={cn(
- "h-full rounded-full transition-[width] duration-500 ease-out",
+ "h-full transition-[width] duration-500 ease-out",
overBudget ? "bg-amber-500" : "bg-primary",
)}
- style={{ width: `${Math.min(100, Math.round(share * 100))}%` }}
+ style={{
+ width: `${Math.min(100, Math.round((weightsGb / Math.max(acceleratorGb, totalGb, 0.01)) * 100))}%`,
+ }}
data-testid={`model-card-memory-fill-${row.id}`}
/>
+ <div
+ className={cn("h-full", overBudget ? "bg-amber-500/50" : "bg-primary/40")}
+ style={{
+ width: `${Math.min(100, Math.round((contextGb / Math.max(acceleratorGb, totalGb, 0.01)) * 100))}%`,
+ }}
+ />
+ {reserveGb > 0 && (
+ <div
+ className="h-full bg-sheen/25"
+ style={{
+ width: `${Math.min(100, Math.round((reserveGb / Math.max(acceleratorGb, totalGb, 0.01)) * 100))}%`,
+ }}
+ />
+ )}
</div>
- <p className="mt-1 text-[10px] tabular-nums text-muted-foreground">
- {share > 0
- ? overBudget
- ? fill(t("local_models.jobs.memory_over"), {
- gb: acceleratorGb.toFixed(1),
- })
- : fill(t("local_models.jobs.memory_share"), {
- percent: Math.round(share * 100),
- gb: acceleratorGb.toFixed(1),
- })
- : t("local_models.jobs.memory_unknown")}
- </p>
+ <p className="mt-1 text-[10px] tabular-nums text-muted-foreground">{memoryText}</p>
</div>
)}
- {/* The control. Always present, always the same shape. */}
- <div className="mt-3.5 space-y-2">
- {state !== "blocked" ? (
- <RolePicker
- row={row}
- models={models}
- disabled={busy}
- onPick={onPick}
- />
- ) : null}
+ {/* The controls. Always the same shape, always present. */}
+ <div className="mt-3.5 flex flex-col gap-2">
+ {state !== "blocked" && (
+ <div className="flex gap-2">
+ <RolePicker
+ row={row}
+ models={models}
+ disabled={busy}
+ onPick={onPick}
+ onInstall={onInstall}
+ className="min-w-0 flex-1"
+ />
+ {onTune && row.current && row.installed && (
+ <SoftButton
+ onClick={() => onTune(row.current)}
+ disabled={busy}
+ ariaLabel={fill(t("local_models.tune.aria"), { model: row.current })}
+ className="h-9 shrink-0"
+ >
+ <SlidersHorizontal className="h-3.5 w-3.5" />
+ {t("local_models.roles.tune")}
+ </SoftButton>
+ )}
+ </div>
+ )}
- {canUseRecommended && (
+ {wantsRecommendation && (
<SoftButton
+ primary={state === "unfit" || state === "empty"}
onClick={onUseRecommended}
disabled={busy}
className="h-8 w-full justify-center"
@@ -243,28 +395,49 @@ export function ModelCard({
<Download className="h-3.5 w-3.5" />
)}
{recommendedInstalled
- ? fill(t("local_models.jobs.switch_to"), {
- model: row.recommended,
- })
- : fill(t("local_models.roles.download_recommended"), {
- model: row.recommended,
- })}
- </SoftButton>
- )}
-
- {advanced && onTune && row.current && row.installed && (
- <SoftButton
- onClick={() => onTune(row.current)}
- disabled={busy}
- className="h-8 w-full justify-center"
- >
- <SlidersHorizontal className="h-3.5 w-3.5" />
- {t("local_models.roles.tune")}
+ ? fill(t("local_models.jobs.switch_to"), { model: recommendedLabel })
+ : fill(t("local_models.roles.download_recommended"), { model: recommendedLabel })}
</SoftButton>
)}
</div>
<CardProgress progress={progress} t={t} />
+
+ {/* The plumbing, one click away: where the pick lives, what the job
+ asks for, what the recommendation would be and why. */}
+ <details className="mt-3 border-t border-dashed border-border/70 pt-2 text-[11px] text-muted-foreground">
+ <summary className="cursor-pointer select-none">{t("local_models.jobs.details")}</summary>
+ <dl className="mt-1.5 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1">
+ <dt>{t("local_models.jobs.details_config")}</dt>
+ <dd className="truncate font-mono">{row.config_key}</dd>
+ {row.required.filter((c) => c !== "completion").length > 0 && (
+ <>
+ <dt>{t("local_models.jobs.details_required")}</dt>
+ <dd className="flex flex-wrap gap-1">
+ {row.required
+ .filter((c) => c !== "completion")
+ .map((cap) => (
+ <Chip key={cap}>{cap}</Chip>
+ ))}
+ </dd>
+ </>
+ )}
+ {current?.loaded && current.loaded_as && current.loaded_as !== current.name && (
+ <>
+ <dt>{t("local_models.jobs.details_loaded_as")}</dt>
+ <dd className="truncate font-mono">{current.loaded_as}</dd>
+ </>
+ )}
+ {row.recommended && row.recommended_reason && (
+ <>
+ <dt>{t("local_models.jobs.details_recommended")}</dt>
+ <dd>
+ {recommendedLabel} — {row.recommended_reason}
+ </dd>
+ </>
+ )}
+ </dl>
+ </details>
</article>
);
}
@@ -283,11 +456,8 @@ function CardProgress({
switch (progress.phase) {
case "pulling": {
const pct =
- typeof progress.percent === "number"
- ? `${Math.round(progress.percent)} %`
- : "";
- text =
- `${t("local_models.roles.progress_pulling")} ${pct} ${progress.message ?? ""}`.trim();
+ typeof progress.percent === "number" ? `${Math.round(progress.percent)} %` : "";
+ text = `${t("local_models.roles.progress_pulling")} ${pct} ${progress.message ?? ""}`.trim();
break;
}
case "assigning":
@@ -302,14 +472,10 @@ function CardProgress({
break;
default:
tone = "text-destructive";
- text =
- `${t("local_models.roles.progress_error")} ${progress.message ?? ""}`.trim();
+ text = `${t("local_models.roles.progress_error")} ${progress.message ?? ""}`.trim();
}
return (
- <p
- className={cn("mt-2.5 text-[11px] leading-snug", tone)}
- data-testid="role-progress"
- >
+ <p className={cn("mt-2.5 text-[11px] leading-snug", tone)} data-testid="role-progress">
{text}
</p>
);
diff --git a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsx b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsx
index cbe6ec56e5..c3377d4c68 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsx
@@ -50,6 +50,7 @@ function role(overrides: Partial<Record<string, unknown>>) {
id: "chat",
label_key: "local_models.role_chat",
config_key: "brain.providers.ollama.model",
+ layout: "card",
current: "",
installed: false,
required: ["tools"],
@@ -71,6 +72,13 @@ const ROLES = [
qualifying: ["qwen3.5:4b"],
recommended: "qwen3.8:27b",
}),
+ role({
+ id: "voice",
+ label_key: "local_models.role_voice",
+ current: "qwen3.5:4b",
+ installed: true,
+ qualifying: ["qwen3.5:4b"],
+ }),
role({
id: "tools_screen",
label_key: "local_models.role_tools_screen",
@@ -87,19 +95,14 @@ const ROLES = [
role({
id: "embedding",
label_key: "local_models.role_embedding",
+ layout: "row",
required: ["embedding"],
recommended: "qwen3-embedding:4b",
}),
- role({
- id: "voice",
- label_key: "local_models.role_voice",
- current: "qwen3.5:4b",
- installed: true,
- qualifying: ["qwen3.5:4b"],
- }),
role({
id: "ack",
label_key: "local_models.role_ack",
+ layout: "footnote",
writable: false,
advanced: true,
current: "qwen3.5:4b",
@@ -133,8 +136,10 @@ const SERVER = {
interface Fixture {
roles?: unknown[];
- models?: Array<{ name: string; size_bytes?: number; capabilities?: string[] }>;
+ models?: Array<{ name: string; size_bytes?: number; capabilities?: string[] } & Record<string, unknown>>;
server?: Record<string, unknown>;
+ /** `roles.resident` — what sits in memory when every job is loaded at once. */
+ resident?: Record<string, unknown>;
accelerator_gb?: number;
/** "404" = a backend without the route (the four legacy reads compose);
* "live" = the route answers with the composed payload. */
@@ -143,7 +148,6 @@ interface Fixture {
function installFetchMock(fx: Fixture = {}) {
const models = (fx.models ?? [{ name: "qwen3.5:4b" }]).map((m) => ({
- name: m.name,
size_bytes: m.size_bytes ?? 1,
digest: "",
modified_at: "",
@@ -159,6 +163,7 @@ function installFetchMock(fx: Fixture = {}) {
size_vram_bytes: 0,
expires_at: "",
running_context_length: null,
+ ...m,
}));
const ok = (body: unknown) =>
({ ok: true, status: 200, json: async () => body }) as Response;
@@ -166,6 +171,7 @@ function installFetchMock(fx: Fixture = {}) {
provider: "ollama",
server: "",
roles: fx.roles ?? ROLES,
+ resident: fx.resident,
error: null,
};
const inventoryBody = {
@@ -468,9 +474,9 @@ describe("OverviewPanel grid", () => {
await screen.findByTestId("model-card-chat");
const bar = screen.getByTestId("model-card-memory-chat");
- // 4 of 16 GB.
+ // 4 GB of weights plus the context estimate, against 16 GB.
await waitFor(() =>
- expect(bar.textContent).toContain("local_models.jobs.memory_share25|16.0"),
+ expect(bar.textContent).toContain("local_models.jobs.memory_line4.0 GB"),
);
expect(
(screen.getByTestId("model-card-memory-fill-chat") as HTMLElement).style.width,
@@ -490,9 +496,10 @@ describe("OverviewPanel grid", () => {
expect(bar.textContent).toContain("local_models.jobs.memory_over8.0"),
);
// Clamped, not spilling out of its track.
- expect(
- (screen.getByTestId("model-card-memory-fill-chat") as HTMLElement).style.width,
- ).toBe("100%");
+ const width = (screen.getByTestId("model-card-memory-fill-chat") as HTMLElement)
+ .style.width;
+ expect(parseInt(width, 10)).toBeGreaterThan(0);
+ expect(parseInt(width, 10)).toBeLessThanOrEqual(100);
});
it("writes a pick through PUT roles/{role}", async () => {
@@ -500,9 +507,8 @@ describe("OverviewPanel grid", () => {
renderPanel();
await screen.findByTestId("model-card-deep");
- fireEvent.change(screen.getByTestId("role-picker-deep"), {
- target: { value: "qwen3.5:4b" },
- });
+ fireEvent.click(screen.getByTestId("role-picker-deep"));
+ fireEvent.click(screen.getByTestId("role-option-qwen3.5:4b"));
await waitFor(() => {
const put = fetchMock.mock.calls.find(
@@ -518,7 +524,12 @@ describe("OverviewPanel grid", () => {
});
it("downloads, assigns and tunes the recommendation from the card", async () => {
- const fetchMock = installFetchMock();
+ const fetchMock = installFetchMock({
+ // An empty chat job: the recommendation button has a reason to be there.
+ roles: ROLES.map((r) =>
+ r.id === "chat" ? { ...r, current: "", installed: false } : r,
+ ),
+ });
renderPanel();
await screen.findByTestId("model-card-chat");
@@ -538,6 +549,7 @@ describe("OverviewPanel grid", () => {
it("gives speech a card of its own, with the window it runs on", async () => {
installFetchMock({
+ models: [{ name: "qwen3.5:4b", size_bytes: 3 * 1024 ** 3, context_length: 262144 }],
roles: ROLES.map((r) =>
r.id === "voice"
? { ...r, context_tokens: 32768, context_source: "automatic" }
@@ -549,11 +561,86 @@ describe("OverviewPanel grid", () => {
const card = await screen.findByTestId("model-card-voice");
expect(card.textContent).toContain("local_models.jobs.voice_purpose");
expect(screen.getByTestId("role-picker-voice")).toBeDefined();
- expect(screen.getByTestId("voice-context").textContent).toContain(
- "local_models.roles.voice_context_auto32k",
+ // The window the call runs with, against the model's native one.
+ expect(screen.getByTestId("model-card-chips-voice").textContent).toContain(
+ "local_models.jobs.context_of32k|256k",
);
});
+ it("names what is missing when the job's model cannot do it, and offers the pick", async () => {
+ installFetchMock({
+ roles: ROLES.map((r) =>
+ r.id === "tools_screen"
+ ? {
+ ...r,
+ current: "qwen3.5:4b",
+ installed: true,
+ current_fit: "unfit",
+ current_reason: "no vision",
+ recommended: "gemma4:12b-it-qat",
+ }
+ : r,
+ ),
+ });
+ renderPanel();
+
+ const card = await screen.findByTestId("model-card-tools_screen");
+ expect(card.dataset.state).toBe("unfit");
+ expect(screen.getByTestId("model-card-verdict-tools_screen").textContent).toContain(
+ "local_models.jobs.fit_unfitno vision",
+ );
+ expect(card.textContent).toContain(
+ "local_models.roles.download_recommendedgemma4:12b-it-qat",
+ );
+ // A fine choice is not nagged: the chat card, on a fit, shows no switch button.
+ expect(screen.getByTestId("model-card-chat").textContent).not.toContain(
+ "local_models.jobs.switch_to",
+ );
+ });
+
+ it("shows the readable name with the tag beside it, and the strip of what is loaded at once", async () => {
+ installFetchMock({
+ models: [
+ {
+ name: "qwen3.5:4b",
+ size_bytes: 3 * 1024 ** 3,
+ display_label: "Qwen 3.5 4B",
+ params_label: "4B",
+ quant_label: "Q4_K_M",
+ },
+ ],
+ resident: {
+ items: [
+ {
+ tag: "qwen3.5:4b",
+ display_label: "Qwen 3.5 4B",
+ roles: ["chat", "voice"],
+ weights_gb: 3.0,
+ context_gb: 0.7,
+ context_tokens: 8192,
+ loaded: true,
+ },
+ ],
+ reserve_gb: 4.0,
+ total_gb: 7.7,
+ accelerator_gb: 16,
+ over: false,
+ },
+ });
+ renderPanel();
+
+ await screen.findByTestId("model-card-chat");
+ expect(screen.getByTestId("model-card-current-chat").textContent).toBe("Qwen 3.5 4B");
+ expect(screen.getByTestId("model-card-tag-chat").textContent).toBe("qwen3.5:4b");
+ const strip = screen.getByTestId("memory-strip");
+ expect(strip.dataset.over).toBe("false");
+ expect(screen.getByTestId("memory-strip-total").textContent).toContain(
+ "local_models.overview.resident_fits7.7 GB|16.0",
+ );
+ expect(strip.textContent).toContain("local_models.role_chat · local_models.role_voice");
+ expect(strip.textContent).toContain("local_models.overview.resident_reserve");
+ });
+
it("blocks the card, rather than offering a doomed picker, when a job has no server", async () => {
installFetchMock({
roles: ROLES.map((r) =>
@@ -590,25 +677,17 @@ describe("OverviewPanel grid", () => {
expect(within(side).getByTestId("role-picker-embedding")).toBeDefined();
});
- it("the detail level adds detail, never takes the picker away", async () => {
+ it("keeps every control on the card, and the plumbing one fold away", async () => {
installFetchMock();
- const { unmount } = renderPanel({ onTune: vi.fn() });
- await screen.findByTestId("model-card-chat");
- expect(screen.getByTestId("role-picker-chat")).toBeDefined();
- expect(screen.queryByText("tools")).toBeNull();
- expect(screen.queryByText("local_models.roles.tune")).toBeNull();
- expect(screen.queryByTestId("roles-more")).toBeNull();
- unmount();
-
- installFetchMock();
- renderPanel({ advanced: true, onTune: vi.fn() });
+ renderPanel({ onTune: vi.fn() });
await screen.findByTestId("model-card-chat");
expect(screen.getByTestId("role-picker-chat")).toBeDefined();
+ // Tune sits beside the picker on every card with an installed model.
+ expect(screen.getAllByText("local_models.roles.tune").length).toBeGreaterThan(0);
+ // The job's requirements are in the Details fold, not on the face.
expect(screen.getAllByText("tools").length).toBeGreaterThan(0);
- expect(
- screen.getAllByText("local_models.roles.tune").length,
- ).toBeGreaterThan(0);
- // The jobs that follow another card's pick.
+ expect(screen.getAllByText("local_models.jobs.details").length).toBeGreaterThan(0);
+ // The jobs that follow another card's pick, as a footnote.
expect(screen.getByTestId("roles-more").textContent).toContain(
"local_models.role_ack",
);
@@ -624,7 +703,7 @@ describe("OverviewPanel launch bar", () => {
],
accelerator_gb: 16,
roles: ROLES.map((r) =>
- r.id === "voice"
+ r.id === "voice" || r.id === "embedding"
? { ...r, current: "qwen3-embedding:4b", installed: true }
: r.id === "tools_screen" || r.id === "deep"
? { ...r, current: "qwen3.5:4b", installed: true }
@@ -634,7 +713,7 @@ describe("OverviewPanel launch bar", () => {
renderPanel();
const facts = await screen.findByTestId("launch-facts");
- // chat + tools + deep share qwen3.5:4b, voice adds 2 GB -> 5 GB.
+ // chat + tools + deep share qwen3.5:4b, voice + embeddings add 2 GB -> 5 GB.
await waitFor(() =>
expect(facts.textContent).toContain(
"local_models.launch.total_on_disk5.0 GB",
@@ -653,10 +732,10 @@ describe("OverviewPanel launch bar", () => {
renderPanel();
const launch = await screen.findByTestId("server-launch");
- // chat and voice are set in the fixture, tools & deep are not: 2 of 4.
+ // chat and voice are set in the fixture, tools, deep & embeddings are not: 2 of 5.
await waitFor(() =>
expect(launch.textContent).toContain(
- "local_models.launch.partly_picked2|4",
+ "local_models.launch.partly_picked2|5",
),
);
const button = within(screen.getByTestId("launch-run")).getByRole("button");
diff --git a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsx b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsx
index bb0ae223bc..9765870611 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsx
+++ b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsx
@@ -1,27 +1,29 @@
/**
- * Local models, front page: a grid of jobs, then the server that runs them.
+ * Local models, front page: what sits in memory, the jobs, the server.
*
- * The page answers one question — "which model does what on my machine" —
- * and it answers it the way the machine is actually shaped. Chat, speech,
- * tools & screen and deep & coding are four PEERS, not four steps: you can
- * fill them in any order, and a number beside each would claim a sequence
- * that does not exist. So they are a grid of equal cards (`ModelCard`), each
- * carrying its own model, its own memory bar and its own picker.
+ * The page answers one question — "which model does what on my machine,
+ * and does it actually work" — and it answers it the way the machine is
+ * actually shaped. Chat, voice, tools & screen and deep & coding are PEERS,
+ * not steps: you can fill them in any order, and a number beside each would
+ * claim a sequence that does not exist. So they are a grid of equal cards
+ * (`ModelCard`), each carrying its own model, its own verdict and its own
+ * picker.
*
- * All four answer the user directly, which is what earns a card. Embeddings
- * does not — it indexes the wiki in the background, is picked once and then
- * forgotten — so it keeps its picker in the side row below instead of taking
- * a quarter of the page.
+ * Which roles are cards, which one is the quiet row below (embeddings:
+ * picked once, then forgotten) and which are footnotes (the read-only
+ * consumers) is the backend's `layout` per role — the page iterates what
+ * the server sends instead of keeping a second list of role ids to sync by
+ * hand, so a role added there lands here by construction.
*
- * Under the grid, `ServerLaunch` adds up what the picks cost and offers the
- * one button that puts a working server behind them.
+ * Above the grid, `MemoryStrip` adds up what every job costs loaded at
+ * once — the question the per-card bar cannot answer. Under the grid,
+ * `ServerLaunch` offers the one button that puts a working, tested,
+ * autostarting server behind the picks.
*
- * `advanced` adds capability badges, per-model Tune and the read-only jobs.
- * It never removes a control — the picker is on every card at every detail
- * level, which is half of what BUG-188 was about.
- *
- * Props take `providerId` — the id of the card that declares
- * `supports_model_pull` — never a provider name.
+ * There is no Simple/Advanced switch any more: every control is on the
+ * card at every time (the picker, Tune), and the plumbing sits behind a
+ * "Details" fold on each card. Advanced never removed a control (BUG-188);
+ * now nothing hides one either.
*/
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Loader2 } from "lucide-react";
@@ -44,7 +46,9 @@ import { cn } from "@/lib/utils";
import { InstalledPanel } from "./InstalledPanel";
import { canonical } from "./localSetup";
import type { SetupStep, SetupSummary } from "./localSetup";
+import { MemoryStrip } from "./MemoryStrip";
import { ModelCard } from "./ModelCard";
+import { labelFor, modelLabel, findModel } from "./modelNames";
import { RolePicker } from "./RolePicker";
import { ServerLaunch } from "./ServerLaunch";
import { useLocalSetup } from "./useLocalSetup";
@@ -60,30 +64,17 @@ export interface OverviewPanelProps {
onOpenApiKeys?: () => void;
/** Opens the catalogue ("Browse models"); the link hides without it. */
onBrowse?: () => void;
- /** Opens the full installed ledger (Advanced → Models). */
+ /** Opens the full installed ledger (Models tab). */
onManage?: () => void;
- /** Adds capability badges, Tune and the read-only jobs. */
- advanced?: boolean;
}
-/**
- * The jobs the grid shows, in the order you meet them: type, talk, let it
- * work the screen, hand it something long.
- *
- * All four answer YOU. Embeddings does not — it indexes the wiki in the
- * background, is picked once and then forgotten — so it sits in the side row
- * below with its own picker rather than taking a quarter of the page.
- * `ack`/`polish` follow other cards and are read-only.
- */
-export const GRID_JOBS: readonly LocalModelRole[] = [
- "chat",
- "voice",
- "tools_screen",
- "deep",
-];
-
-/** The jobs below the grid: set here too, just not part of the conversation. */
-export const SIDE_JOBS: readonly LocalModelRole[] = ["embedding"];
+/** Where a role lands when an older payload carries no `layout`. */
+function layoutOf(row: RoleRow): "card" | "row" | "footnote" {
+ if (row.layout === "card" || row.layout === "row" || row.layout === "footnote")
+ return row.layout;
+ if (!row.writable || row.advanced) return "footnote";
+ return row.id === "embedding" ? "row" : "card";
+}
/** Bytes to a short gigabyte figure ("12.4 GB"); "0 GB" below a megabyte. */
export function formatGigabytes(bytes: number): string {
@@ -99,7 +90,6 @@ export function OverviewPanel({
onOpenApiKeys,
onBrowse,
onManage,
- advanced = false,
}: OverviewPanelProps) {
const t = useT();
const overview = useOverview(providerId);
@@ -110,6 +100,7 @@ export function OverviewPanel({
const inventory = overview.data?.inventory;
const models = useMemo(() => inventory?.models ?? [], [inventory]);
const acceleratorGb = overview.data?.recommended?.accelerator_gb ?? 0;
+ const resident = overview.data?.roles.resident;
const serverSilent = Boolean(inventory?.error);
const marked = useRef(false);
@@ -126,23 +117,13 @@ export function OverviewPanel({
}, [models]);
const actions = useRoleActions(providerId, installedNames);
- const allRows = overview.data?.roles.roles ?? [];
- const byId = useMemo(() => {
- const map = new Map<string, RoleRow>();
- for (const row of allRows) map.set(row.id, row);
- return map;
- }, [allRows]);
- const gridRows = useMemo(
- () => GRID_JOBS.map((id) => byId.get(id)).filter((r): r is RoleRow => !!r),
- [byId],
+ const allRows = useMemo(() => overview.data?.roles.roles ?? [], [overview.data]);
+ const cardRows = useMemo(() => allRows.filter((r) => layoutOf(r) === "card"), [allRows]);
+ const sideRows = useMemo(() => allRows.filter((r) => layoutOf(r) === "row"), [allRows]);
+ const footnoteRows = useMemo(
+ () => allRows.filter((r) => layoutOf(r) === "footnote"),
+ [allRows],
);
- const sideRows = useMemo(
- () => SIDE_JOBS.map((id) => byId.get(id)).filter((r): r is RoleRow => !!r),
- [byId],
- );
- // Whatever is advanced follows another card's pick and belongs in the quiet
- // list at the bottom.
- const followerRows = allRows.filter((r) => r.advanced);
const serverLabel =
providers.find((p) => p.id === providerId)?.label ||
@@ -153,8 +134,20 @@ export function OverviewPanel({
activeBrain !== null && activeBrain.id !== providerId;
const roleLabel = useCallback(
- (role: LocalModelRole) => t(byId.get(role)?.label_key ?? `local_models.role_${role}`),
- [byId, t],
+ (role: LocalModelRole) =>
+ t(allRows.find((r) => r.id === role)?.label_key ?? `local_models.role_${role}`),
+ [allRows, t],
+ );
+
+ // Which other cards share a card's download — loaded once, said once.
+ const sharedWith = useCallback(
+ (row: RoleRow) =>
+ row.current
+ ? cardRows
+ .filter((r) => r.id !== row.id && r.current && canonical(r.current) === canonical(row.current))
+ .map((r) => t(r.label_key))
+ : [],
+ [cardRows, t],
);
const checking = overview.isFetching && overview.data?.source === "cache";
@@ -211,31 +204,37 @@ export function OverviewPanel({
</div>
)}
- {/* The grid. Four peers, two columns on a wide pane. */}
+ <MemoryStrip resident={resident} roleLabel={roleLabel} />
+
+ {/* The grid. Peers, two columns on a wide pane. */}
<div
className="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4"
data-testid="model-card-grid"
>
- {gridRows.length === 0 && overview.isLoading
- ? GRID_JOBS.map((id) => <CardSkeleton key={id} />)
- : gridRows.map((row) => (
+ {cardRows.length === 0 && overview.isLoading
+ ? ["chat", "voice", "tools_screen", "deep"].map((id) => <CardSkeleton key={id} />)
+ : cardRows.map((row) => (
<ModelCard
key={row.id}
row={row}
models={models}
acceleratorGb={acceleratorGb}
+ reserveGb={row.id === "voice" ? (resident?.reserve_gb ?? 0) : 0}
+ sharedWith={sharedWith(row)}
progress={actions.progress[row.id] ?? IDLE}
busy={actions.isBusy(row.id)}
onPick={(model) => actions.pick(row.id, model)}
onUseRecommended={() => actions.useRecommended(row)}
+ onInstall={(model) => actions.install(row, model)}
onTune={onTune}
- advanced={advanced}
/>
))}
</div>
{actions.writeError && (
- <p className="text-sm text-destructive">{actions.writeError}</p>
+ <p className="text-sm text-destructive" data-testid="role-write-error">
+ {actions.writeError}
+ </p>
)}
{/* Set here, but not part of the conversation. */}
@@ -246,13 +245,18 @@ export function OverviewPanel({
models={models}
busy={actions.isBusy(row.id)}
onPick={(model) => actions.pick(row.id, model)}
- onTune={advanced ? onTune : undefined}
+ onInstall={(model) => actions.install(row, model)}
+ onTune={onTune}
t={t}
/>
))}
+ {footnoteRows.length > 0 && (
+ <FootnoteJobs rows={footnoteRows} models={models} t={t} />
+ )}
+
<ServerLaunch
- rows={gridRows}
+ rows={[...cardRows, ...sideRows]}
models={models}
acceleratorGb={acceleratorGb}
server={s}
@@ -283,10 +287,6 @@ export function OverviewPanel({
onManage={onManage}
onBrowse={onBrowse}
/>
-
- {advanced && followerRows.length > 0 && (
- <FollowerJobs rows={followerRows} t={t} />
- )}
</div>
);
}
@@ -295,7 +295,7 @@ export function OverviewPanel({
function CardSkeleton() {
return (
<div
- className="h-[15rem] animate-pulse rounded-2xl border border-dashed border-border bg-card/30"
+ className="h-[17rem] animate-pulse rounded-2xl border border-dashed border-border bg-card/30"
data-testid="model-card-skeleton"
/>
);
@@ -314,6 +314,7 @@ function SideJobRow({
models,
busy,
onPick,
+ onInstall,
onTune,
t,
}: {
@@ -321,14 +322,16 @@ function SideJobRow({
models: LocalModelRow[];
busy: boolean;
onPick: (model: string) => void;
+ onInstall?: (model: string) => void;
onTune?: (model: string) => void;
t: (key: string) => string;
}) {
const missing = row.current !== "" && !row.installed;
const blocked = !row.writable || (row.note !== "" && row.current === "");
+ const current = findModel(models, row.current);
return (
<div
- className="grid gap-3 rounded-xl border border-border/70 bg-card/40 px-4 py-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,20rem)_auto] lg:items-center"
+ className="grid gap-3 rounded-xl border border-border/70 bg-card/40 px-4 py-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)_auto] lg:items-center"
data-testid={`side-job-${row.id}`}
>
<div className="min-w-0">
@@ -337,6 +340,11 @@ function SideJobRow({
</p>
<p className="mt-0.5 text-xs text-muted-foreground">
{row.note || t(`local_models.jobs.${row.id}_purpose`)}
+ {current && (
+ <span className="ml-2 text-foreground/80">
+ {modelLabel(current)} · {formatGigabytes(current.size_bytes)}
+ </span>
+ )}
</p>
</div>
<div className="min-w-0">
@@ -350,6 +358,7 @@ function SideJobRow({
models={models}
disabled={busy}
onPick={onPick}
+ onInstall={onInstall}
/>
)}
</div>
@@ -359,6 +368,9 @@ function SideJobRow({
{t("local_models.jobs.not_on_disk")}
</span>
)}
+ {row.current_fit === "unfit" && row.current_reason && (
+ <span className="text-xs text-destructive">{row.current_reason}</span>
+ )}
{onTune && row.current && row.installed && (
<SoftButton onClick={() => onTune(row.current)} className="h-8">
{t("local_models.roles.tune")}
@@ -369,37 +381,31 @@ function SideJobRow({
);
}
-/** The jobs that follow another card's pick; read-only, Advanced only. */
-function FollowerJobs({
+/** The jobs that follow another pick or run elsewhere; read-only, one line each. */
+function FootnoteJobs({
rows,
+ models,
t,
}: {
rows: RoleRow[];
+ models: LocalModelRow[];
t: (key: string) => string;
}) {
return (
- <div
- className="divide-y divide-border/70 overflow-hidden rounded-xl border border-border/70 bg-card/40"
- data-testid="roles-more"
- >
- {rows.map((row) => (
- <div
- key={row.id}
- className="grid gap-1 px-4 py-2.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)] sm:items-center"
- >
- <span className="text-sm text-foreground">{t(row.label_key)}</span>
- <span className="text-sm text-muted-foreground">
- {row.current ? (
- <span className="font-mono text-xs text-foreground/85">
- {row.current}
- </span>
- ) : (
- row.note || t("local_models.roles.follows_chat")
- )}
- </span>
- </div>
+ <p className="text-xs text-muted-foreground" data-testid="roles-more">
+ {rows.map((row, i) => (
+ <span key={row.id}>
+ {i > 0 && " · "}
+ <span className="text-foreground/80">{t(row.label_key)}</span>
+ {": "}
+ {row.current ? (
+ <span title={row.current}>{labelFor(models, row.current)}</span>
+ ) : (
+ row.note || t("local_models.roles.follows_chat")
+ )}
+ </span>
))}
- </div>
+ </p>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/local-models/RolePicker.test.tsx b/jarvis/ui/web/frontend/src/views/local-models/RolePicker.test.tsx
index 1f9666eb7b..a5f1995503 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/RolePicker.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/local-models/RolePicker.test.tsx
@@ -1,19 +1,20 @@
/**
- * The role picker's job is to offer every REAL choice and no fake one.
+ * The role picker's job is to offer every REAL choice, name the cost of the
+ * rest, and never hide a model without saying why.
*
- * Two ways it went wrong: `qualifying` alone left one option after an
- * offline sweep (BUG-188), and offering every installed download then put
- * an embedding-only model in the speech list. These tests pin the rule that
- * replaced both — a download is listed when it has the job's capabilities,
- * called a fit when it also sits inside the job's size class, and never
- * listed when it lacks a capability.
+ * The verdict per download comes from the backend (`row.choices`, one rule
+ * for every surface); these tests pin what the picker makes of it — the
+ * groups, the greyed "not for this job" rows with their reason, the
+ * configured tag that is gone from disk, the download group, and the
+ * fallback for a payload that carries no verdicts at all (BUG-188: a list
+ * must never collapse to a single option).
*/
import { fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import type { LocalModelRow, RoleRow } from "@/hooks/useLocalModels";
-import { RolePicker, splitChoices } from "./RolePicker";
+import { buildGroups, RolePicker } from "./RolePicker";
vi.mock("@/i18n", () => ({
useT: () => (key: string) => key,
@@ -28,11 +29,16 @@ function role(extra: Partial<RoleRow> = {}): RoleRow {
id: "chat",
label_key: "local_models.role_chat",
config_key: "brain.providers.ollama.model",
+ layout: "card",
current: "",
installed: false,
+ current_fit: "",
+ current_reason: "",
required: ["completion"],
recommended_capabilities: [],
qualifying: [],
+ choices: [],
+ downloads: [],
recommended: "",
writable: true,
advanced: false,
@@ -46,162 +52,242 @@ function model(
caps: string[] = ["completion", "tools"],
sizeGb = 4,
probed = true,
+ label = "",
): LocalModelRow {
return {
name,
+ display_label: label,
capabilities: caps,
probed,
size_bytes: sizeGb * GIB,
+ quantization_level: "Q4_K_M",
+ context_length: 32768,
used_by: [],
} as unknown as LocalModelRow;
}
-describe("splitChoices", () => {
- it("lists only downloads that have the job's capabilities", () => {
- const { fits, others } = splitChoices(role({ required: ["completion"] }), [
- model("ornith:9b"),
- model("bge-m3:latest", ["embedding"], 1),
- model("deepseek-llm:latest", ["completion"]),
- ]);
- // An embedding-only model cannot answer; it is not a choice at all.
- expect(fits).toEqual(["ornith:9b", "deepseek-llm:latest"]);
- expect(others).toEqual([]);
- });
-
- it("calls a download a fit only inside the job's size class", () => {
- // The voice brain must answer within a breath: under 6 GB.
- const voice = role({ id: "voice", required: ["completion"], max_size_gb: 6 });
- const { fits, others } = splitChoices(voice, [
- model("ornith:9b", ["completion", "tools"], 5.2),
- model("qwen3.5:4b", ["completion", "tools"], 3.2),
- model("nemotron-cascade-2:latest", ["completion", "tools"], 22.6),
- model("deepseek-r1:14b", ["completion", "tools"], 8.4),
- model("bge-m3:latest", ["embedding"], 1.1),
- ]);
- expect(fits).toEqual(["ornith:9b", "qwen3.5:4b"]);
- // Still able, still offered — under a heading that says what it costs.
- expect(others).toEqual(["nemotron-cascade-2:latest", "deepseek-r1:14b"]);
- });
-
- it("requires every capability, not any", () => {
- const tools = role({ id: "tools_screen", required: ["tools", "vision"] });
- const { fits, others } = splitChoices(tools, [
- model("gemma4:12b-it-qat", ["completion", "vision", "tools"]),
- model("ornith:9b", ["completion", "tools"]),
- model("qwen3-vl:2b", ["completion", "vision"]),
+describe("buildGroups", () => {
+ it("lays the backend's verdicts out as fits / slow / unknown / unfit, in that order", () => {
+ const voice = role({
+ id: "voice",
+ max_size_gb: 6,
+ choices: [
+ { tag: "deepseek-llm:latest", fit: "unfit", reason: "no tool calls" },
+ { tag: "ornith:9b", fit: "fits", reason: "" },
+ { tag: "mystery:7b", fit: "unknown", reason: "Jarvis could not read what this model can do." },
+ { tag: "gemma4:12b-it-qat", fit: "slow", reason: "6.7 GB — over 6 GB, slower to answer" },
+ ],
+ });
+ const groups = buildGroups(voice, [
+ model("deepseek-llm:latest", ["completion"], 3.7),
+ model("ornith:9b", ["completion", "tools"], 5.2, true, "Ornith 9B"),
+ model("mystery:7b", [], 4, false),
+ model("gemma4:12b-it-qat", ["completion", "tools", "vision"], 6.7),
]);
- expect(fits).toEqual(["gemma4:12b-it-qat"]);
- expect(others).toEqual([]);
+ expect(groups.map((g) => g.id)).toEqual(["fits", "slow", "unknown", "unfit"]);
+ const unfit = groups.find((g) => g.id === "unfit")!.entries[0];
+ // Listed, not hidden — with the reason, and not selectable.
+ expect(unfit.tag).toBe("deepseek-llm:latest");
+ expect(unfit.reason).toBe("no tool calls");
+ expect(unfit.disabled).toBe(true);
+ const fit = groups.find((g) => g.id === "fits")!.entries[0];
+ expect(fit.label).toBe("Ornith 9B");
+ expect(fit.facts).toContain("5.2 GB");
+ expect(fit.facts).toContain("tools");
});
- it("offers an unprobed download without calling it a fit", () => {
- const { fits, others } = splitChoices(role(), [
- model("known:7b"),
- model("mystery:7b", [], 4, false),
- ]);
- expect(fits).toEqual(["known:7b"]);
- expect(others).toEqual(["mystery:7b"]);
+ it("falls back to every installed download when the payload carries no verdicts", () => {
+ // An older snapshot, a silent server: still every download, never one option.
+ const groups = buildGroups(role(), [model("a:1b"), model("b:1b"), model("c:1b")]);
+ expect(groups).toHaveLength(1);
+ expect(groups[0].id).toBe("unknown");
+ expect(groups[0].entries.map((e) => e.tag)).toEqual(["a:1b", "b:1b", "c:1b"]);
});
- it("keeps a configured tag that is gone from disk, exactly once", () => {
- const { fits, others } = splitChoices(
- role({ current: "removed:7b", qualifying: ["qwen3.5:4b"] }),
+ it("keeps a configured tag that is gone from disk, exactly once, marked absent", () => {
+ const groups = buildGroups(
+ role({ current: "removed:7b", choices: [{ tag: "qwen3.5:4b", fit: "fits", reason: "" }] }),
[model("qwen3.5:4b")],
);
- expect(fits).toEqual(["qwen3.5:4b"]);
- expect(others).toEqual(["removed:7b"]);
+ const unknown = groups.find((g) => g.id === "unknown")!;
+ expect(unknown.entries).toHaveLength(1);
+ expect(unknown.entries[0]).toMatchObject({ tag: "removed:7b", fit: "absent", installed: false });
});
it("treats a bare tag and its :latest as one download", () => {
- const { fits, others } = splitChoices(
- role({ current: "bge-m3", required: ["embedding"], qualifying: ["bge-m3:latest"] }),
+ const groups = buildGroups(
+ role({
+ current: "bge-m3",
+ required: ["embedding"],
+ choices: [{ tag: "bge-m3:latest", fit: "fits", reason: "" }],
+ }),
[model("bge-m3:latest", ["embedding"], 1)],
);
- expect(fits).toEqual(["bge-m3:latest"]);
- expect(others).toEqual([]);
+ expect(groups.map((g) => g.entries.map((e) => e.tag))).toEqual([["bge-m3:latest"]]);
+ });
+
+ it("offers the shortlist's downloads for the job as the last group", () => {
+ const groups = buildGroups(
+ role({
+ choices: [{ tag: "qwen3.5:4b", fit: "fits", reason: "" }],
+ downloads: [
+ { tag: "qwen3.5", label: "Qwen 3.5 9B", size_gb: 6.6, fit: "comfortable", note: "" },
+ ],
+ }),
+ [model("qwen3.5:4b")],
+ );
+ expect(groups.map((g) => g.id)).toEqual(["fits", "downloads"]);
+ expect(groups[1].entries[0]).toMatchObject({ tag: "qwen3.5", label: "Qwen 3.5 9B" });
});
- it("trusts the backend's qualifying list for a row the inventory has not caught up with", () => {
- const { fits } = splitChoices(role({ qualifying: ["fresh:1b"] }), []);
- expect(fits).toEqual(["fresh:1b"]);
+ it("filters by the query on tag and label", () => {
+ const groups = buildGroups(
+ role({
+ choices: [
+ { tag: "qwen3.5:4b", fit: "fits", reason: "" },
+ { tag: "ornith:9b", fit: "fits", reason: "" },
+ ],
+ }),
+ [model("qwen3.5:4b", undefined, 3, true, "Qwen 3.5 4B"), model("ornith:9b")],
+ "qwen",
+ );
+ expect(groups[0].entries.map((e) => e.tag)).toEqual(["qwen3.5:4b"]);
});
});
describe("RolePicker", () => {
- it("groups the options and reports the pick", () => {
+ it("opens a list with the groups, the reasons, and reports the pick", () => {
const onPick = vi.fn();
render(
<RolePicker
- row={role({ current: "gemma4:12b", qualifying: ["gemma4:12b"] })}
- models={[model("gemma4:12b"), model("mystery:7b", [], 4, false)]}
+ row={role({
+ current: "gemma4:12b",
+ installed: true,
+ choices: [
+ { tag: "gemma4:12b", fit: "fits", reason: "" },
+ { tag: "blind:7b", fit: "unfit", reason: "no vision" },
+ { tag: "mystery:7b", fit: "unknown", reason: "" },
+ ],
+ })}
+ models={[
+ model("gemma4:12b", undefined, 7, true, "Gemma 4 12B"),
+ model("blind:7b"),
+ model("mystery:7b", [], 4, false),
+ ]}
onPick={onPick}
/>,
);
- const select = screen.getByTestId("role-picker-chat") as HTMLSelectElement;
- expect([...select.options].map((o) => o.value)).toEqual([
- "",
- "gemma4:12b",
- "mystery:7b",
- ]);
+ const button = screen.getByTestId("role-picker-chat");
+ // The button names the model by its readable label, not the tag.
+ expect(button.textContent).toContain("Gemma 4 12B");
+ expect(screen.queryByRole("listbox")).toBeNull();
+
+ fireEvent.click(button);
+ expect(screen.getByRole("listbox")).toBeDefined();
expect(
- [...select.querySelectorAll("optgroup")].map((g) => g.label),
+ [...screen.getAllByTestId(/^role-picker-group-/)].map((g) =>
+ g.getAttribute("data-testid"),
+ ),
).toEqual([
- "local_models.roles.pick_group_fits",
- "local_models.roles.pick_group_others",
+ "role-picker-group-fits",
+ "role-picker-group-unknown",
+ "role-picker-group-unfit",
]);
+ // The brain roles may go back to discovery.
+ expect(screen.getByTestId("role-option-discovery")).toBeDefined();
+ // The unfit row is greyed with its reason, and a click does nothing.
+ const blind = screen.getByTestId("role-option-blind:7b");
+ expect(blind.getAttribute("aria-disabled")).toBe("true");
+ expect(screen.getByTestId("role-option-verdict-blind:7b").textContent).toBe("no vision");
+ fireEvent.click(blind);
+ expect(onPick).not.toHaveBeenCalled();
- fireEvent.change(select, { target: { value: "mystery:7b" } });
+ fireEvent.click(screen.getByTestId("role-option-mystery:7b"));
expect(onPick).toHaveBeenCalledWith("mystery:7b");
+ // Picking closes the list.
+ expect(screen.queryByRole("listbox")).toBeNull();
});
- it("names the size class on the second heading when the job has one", () => {
+ it("names the size class on the slow heading and offers no discovery for voice", () => {
render(
<RolePicker
- row={role({ id: "voice", current: "ornith:9b", max_size_gb: 6 })}
- models={[
- model("ornith:9b", ["completion"], 5.2),
- model("deepseek-r1:14b", ["completion"], 8.4),
- ]}
+ row={role({
+ id: "voice",
+ current: "ornith:9b",
+ installed: true,
+ max_size_gb: 6,
+ choices: [
+ { tag: "ornith:9b", fit: "fits", reason: "" },
+ { tag: "deepseek-r1:14b", fit: "slow", reason: "8.4 GB — over 6 GB, slower to answer" },
+ ],
+ })}
+ models={[model("ornith:9b", undefined, 5.2), model("deepseek-r1:14b", undefined, 8.4)]}
onPick={vi.fn()}
/>,
);
- const select = screen.getByTestId("role-picker-voice") as HTMLSelectElement;
- expect(
- [...select.querySelectorAll("optgroup")].map((g) => g.label),
- ).toEqual([
- "local_models.roles.pick_group_fits",
- "local_models.roles.pick_group_over_size6",
- ]);
- // The voice server cannot discover a model: no "Let Jarvis pick".
- expect([...select.options].map((o) => o.value)).not.toContain("");
+ fireEvent.click(screen.getByTestId("role-picker-voice"));
+ expect(screen.getByText("local_models.roles.pick_group_over_size6")).toBeDefined();
+ expect(screen.queryByTestId("role-option-discovery")).toBeNull();
+ // The current pick is marked, not repeated as a verdict.
+ expect(screen.getByTestId("role-option-verdict-ornith:9b").textContent).toContain(
+ "local_models.roles.pick_current",
+ );
});
it("marks a configured model that is no longer on the server", () => {
render(
<RolePicker
- row={role({ current: "removed:7b" })}
+ row={role({ current: "removed:7b", choices: [{ tag: "qwen3.5:4b", fit: "fits", reason: "" }] })}
models={[model("qwen3.5:4b")]}
onPick={vi.fn()}
/>,
);
- const select = screen.getByTestId("role-picker-chat") as HTMLSelectElement;
- const gone = [...select.options].find((o) => o.value === "removed:7b");
- expect(gone?.textContent).toContain(
+ fireEvent.click(screen.getByTestId("role-picker-chat"));
+ expect(screen.getByTestId("role-option-removed:7b").textContent).toContain(
"local_models.roles.pick_missing_suffix",
);
});
- it("offers no discovery option for the embedding role once one is set", () => {
+ it("hands a download row to onInstall instead of onPick", () => {
+ const onPick = vi.fn();
+ const onInstall = vi.fn();
+ render(
+ <RolePicker
+ row={role({
+ choices: [],
+ downloads: [
+ { tag: "qwen3.5", label: "Qwen 3.5 9B", size_gb: 6.6, fit: "comfortable", note: "" },
+ ],
+ })}
+ models={[]}
+ onPick={onPick}
+ onInstall={onInstall}
+ />,
+ );
+ fireEvent.click(screen.getByTestId("role-picker-chat"));
+ fireEvent.click(screen.getByTestId("role-option-qwen3.5"));
+ expect(onInstall).toHaveBeenCalledWith("qwen3.5");
+ expect(onPick).not.toHaveBeenCalled();
+ });
+
+ it("closes on Escape and filters as you type", () => {
render(
<RolePicker
- row={role({ id: "embedding", required: ["embedding"], current: "bge-m3:latest" })}
- models={[model("bge-m3:latest", ["embedding"], 1)]}
+ row={role({
+ choices: [
+ { tag: "qwen3.5:4b", fit: "fits", reason: "" },
+ { tag: "ornith:9b", fit: "fits", reason: "" },
+ ],
+ })}
+ models={[model("qwen3.5:4b"), model("ornith:9b")]}
onPick={vi.fn()}
/>,
);
- const select = screen.getByTestId(
- "role-picker-embedding",
- ) as HTMLSelectElement;
- expect([...select.options].map((o) => o.value)).toEqual(["bge-m3:latest"]);
+ fireEvent.click(screen.getByTestId("role-picker-chat"));
+ fireEvent.change(screen.getByTestId("role-picker-search-chat"), { target: { value: "orn" } });
+ expect(screen.queryByTestId("role-option-qwen3.5:4b")).toBeNull();
+ expect(screen.getByTestId("role-option-ornith:9b")).toBeDefined();
+ fireEvent.keyDown(document, { key: "Escape" });
+ expect(screen.queryByRole("listbox")).toBeNull();
});
});
diff --git a/jarvis/ui/web/frontend/src/views/local-models/RolePicker.tsx b/jarvis/ui/web/frontend/src/views/local-models/RolePicker.tsx
index 17ed9f99c9..3bc5272da7 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/RolePicker.tsx
+++ b/jarvis/ui/web/frontend/src/views/local-models/RolePicker.tsx
@@ -1,38 +1,44 @@
/**
- * The model picker of one job.
+ * The model picker of one job: a list that says, per download, whether it
+ * can do THIS job — and why not when it cannot.
*
- * Two failures shaped it. The first (BUG-188): the list was `row.qualifying`
- * alone, so an offline sweep left one option and a pick "jumped back". The
- * over-correction then offered EVERY installed download, which put an
- * embedding-only model in the speech list — a model that cannot answer a
- * call is not a choice, it is a trap that looks like one.
+ * A native <select> could show one string per row, so the old picker could
+ * name neither size nor capabilities nor a verdict, and the verdict itself
+ * was derived twice (backend `qualifying`, client `splitChoices`) with
+ * precedence rules between them. This picker reads the backend's ONE
+ * verdict per (job, model) — `row.choices`, from `ollama_roles.fit_for` —
+ * and lays it out in four groups:
*
- * The list is therefore built from the job's own requirements, on the
- * client, from the inventory it can see:
+ * * fits — can do the job on this machine;
+ * * slow — can do it, at a cost the job feels (over the size class,
+ * spilling past the graphics memory);
+ * * unknown — Jarvis could not read the manifest; offered, not called a fit;
+ * * unfit — lacks a capability, too small a window, or too big for the
+ * card. Shown greyed WITH the reason, never hidden: a model
+ * that silently vanishes from a list reads as a bug
+ * (BUG-188), a model that says "no tool calls" teaches.
*
- * * `fits` — every installed download that declares each capability the
- * job requires AND sits inside the job's size class when it
- * has one (the voice brain answers within a breath, so it
- * stays under 6 GB);
- * * `others` — downloads that have the capabilities but fall outside the
- * size class, or that Jarvis could not probe (`probed: false`
- * means "unknown", never "unable"). A real choice with a
- * stated cost, so it is offered under its own heading.
- *
- * A download that lacks a required capability is not listed at all. The
- * configured tag stays listed even when it is gone from disk, or the row
- * would show a value the picker cannot express.
+ * A fifth group offers the shortlist's downloads that would do the job here
+ * (`row.downloads`), so filling a job never needs another tab. The
+ * configured tag stays listed even when it is gone from disk, or the button
+ * would show a value the list cannot express.
*/
-import { useMemo } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { Check, ChevronDown, Download, Search } from "lucide-react";
import {
canonicalModelName,
type LocalModelRow,
+ type RoleChoice,
+ type RoleDownload,
type RoleRow,
} from "@/hooks/useLocalModels";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
+import { formatContext, formatGb } from "./localModelsFormat";
+import { capabilityChips, findModel, fitTone, modelLabel, type FitTone } from "./modelNames";
+
export interface RolePickerProps {
row: RoleRow;
/** Every download the inventory knows; empty while the server is silent. */
@@ -40,124 +46,387 @@ export interface RolePickerProps {
/** True while a write for this row is in flight. */
disabled?: boolean;
onPick: (model: string) => void;
+ /** Downloads a shortlist pick and assigns it; the group hides without it. */
+ onInstall?: (model: string) => void;
className?: string;
}
-const GIB = 1024 ** 3;
+export type PickerGroupId = "fits" | "slow" | "unknown" | "unfit" | "downloads";
-/** Whether `model` declares every capability `row` requires. */
-export function hasRequired(row: RoleRow, model: LocalModelRow): boolean {
- return row.required.every((cap) => model.capabilities.includes(cap));
+export interface PickerEntry {
+ tag: string;
+ label: string;
+ /** "5.2 GB · Q4_K_M · 256k · tools · thinking" */
+ facts: string;
+ fit: string;
+ reason: string;
+ /** Not selectable (unfit); still listed with its reason. */
+ disabled: boolean;
+ installed: boolean;
+ download?: RoleDownload;
}
-/** Whether `model` sits inside the job's size class (no class = always). */
-export function inSizeClass(row: RoleRow, model: LocalModelRow): boolean {
- const cap = row.max_size_gb;
- if (cap == null || cap <= 0) return true;
- return model.size_bytes / GIB <= cap;
+export interface PickerGroup {
+ id: PickerGroupId;
+ entries: PickerEntry[];
+}
+
+const GROUP_ORDER: readonly PickerGroupId[] = ["fits", "slow", "unknown", "unfit", "downloads"];
+
+function factsOf(model: LocalModelRow | null): string {
+ if (!model) return "";
+ return [
+ formatGb(model.size_bytes),
+ model.quant_label || model.quantization_level,
+ model.context_length ? formatContext(model.context_length) : "",
+ ...capabilityChips(model),
+ ]
+ .filter(Boolean)
+ .join(" · ");
}
/**
- * `fits` first, then `others`, both in inventory order, de-duplicated
- * across `:latest`. Nothing that lacks a required capability appears.
+ * The groups the list shows, from the backend's verdicts. A payload without
+ * `choices` (an older snapshot, a silent server) falls back to every
+ * installed download under "unknown", so the list is never empty while
+ * something is on disk — and never a single option (BUG-188).
*/
-export function splitChoices(
+export function buildGroups(
row: RoleRow,
- models: LocalModelRow[],
-): { fits: string[]; others: string[] } {
+ models: readonly LocalModelRow[],
+ query = "",
+): PickerGroup[] {
const seen = new Set<string>();
- const fits: string[] = [];
- const others: string[] = [];
- const take = (name: string, into: string[]) => {
- const key = canonicalModelName(name);
- if (!name || seen.has(key)) return;
- seen.add(key);
- into.push(name);
+ const byGroup: Record<PickerGroupId, PickerEntry[]> = {
+ fits: [],
+ slow: [],
+ unknown: [],
+ unfit: [],
+ downloads: [],
};
- for (const m of models) {
- if (m.probed) {
- if (!hasRequired(row, m)) continue;
- take(m.name, inSizeClass(row, m) ? fits : others);
- } else {
- // Unknown capabilities: offered, not hidden, and not called a fit.
- take(m.name, others);
- }
+ const choices: RoleChoice[] =
+ row.choices && row.choices.length > 0
+ ? row.choices
+ : models.map((m) => ({ tag: m.name, fit: m.probed ? "unknown" : "unknown", reason: "" }));
+ for (const choice of choices) {
+ const key = canonicalModelName(choice.tag);
+ if (!choice.tag || seen.has(key)) continue;
+ seen.add(key);
+ const model = findModel(models, choice.tag);
+ const fit = choice.fit;
+ const group: PickerGroupId =
+ fit === "fits" ? "fits" : fit === "slow" ? "slow" : fit === "unfit" ? "unfit" : "unknown";
+ byGroup[group].push({
+ tag: choice.tag,
+ label: modelLabel(model, choice.tag),
+ facts: factsOf(model),
+ fit,
+ reason: choice.reason,
+ disabled: fit === "unfit",
+ installed: model !== null,
+ });
+ }
+ if (row.current && !seen.has(canonicalModelName(row.current))) {
+ seen.add(canonicalModelName(row.current));
+ const model = findModel(models, row.current);
+ byGroup.unknown.push({
+ tag: row.current,
+ label: modelLabel(model, row.current),
+ facts: factsOf(model),
+ fit: model ? "unknown" : "absent",
+ reason: "",
+ disabled: false,
+ installed: model !== null,
+ });
}
- // The backend's own verdict wins for anything it named that the client
- // could not see (a row the inventory has not caught up with yet).
- for (const name of row.qualifying) take(name, fits);
- if (row.current) take(row.current, others);
- return { fits, others };
+ for (const download of row.downloads ?? []) {
+ const key = canonicalModelName(download.tag);
+ if (seen.has(key)) continue;
+ seen.add(key);
+ byGroup.downloads.push({
+ tag: download.tag,
+ label: download.label || download.tag,
+ facts: [download.size_gb > 0 ? `${download.size_gb.toFixed(1)} GB` : "", download.note]
+ .filter(Boolean)
+ .join(" · "),
+ fit: download.fit,
+ reason: "",
+ disabled: false,
+ installed: false,
+ download,
+ });
+ }
+ const needle = query.trim().toLowerCase();
+ const matches = (e: PickerEntry) =>
+ !needle || e.tag.toLowerCase().includes(needle) || e.label.toLowerCase().includes(needle);
+ return GROUP_ORDER.map((id) => ({ id, entries: byGroup[id].filter(matches) })).filter(
+ (g) => g.entries.length > 0,
+ );
}
+const TONE_TEXT: Record<FitTone, string> = {
+ ok: "text-emerald-600 dark:text-emerald-400",
+ warn: "text-amber-700 dark:text-amber-400",
+ bad: "text-destructive",
+ muted: "text-muted-foreground",
+};
+
export function RolePicker({
row,
models,
disabled,
onPick,
+ onInstall,
className,
}: RolePickerProps) {
const t = useT();
- const { fits, others } = useMemo(() => splitChoices(row, models), [row, models]);
- const installed = useMemo(() => {
- const names = new Set<string>();
- for (const m of models) names.add(canonicalModelName(m.name));
- return names;
- }, [models]);
-
- const label = (name: string) =>
- installed.has(canonicalModelName(name))
- ? name
- : `${name} ${t("local_models.roles.pick_missing_suffix")}`;
-
- // The second heading says what "other" costs for THIS job.
- const othersLabel =
- row.max_size_gb != null && row.max_size_gb > 0
- ? fill(t("local_models.roles.pick_group_over_size"), {
- gb: String(row.max_size_gb),
- })
- : t("local_models.roles.pick_group_others");
+ const [open, setOpen] = useState(false);
+ const [query, setQuery] = useState("");
+ const root = useRef<HTMLDivElement>(null);
+ const search = useRef<HTMLInputElement>(null);
+
+ const groups = useMemo(() => buildGroups(row, models, query), [row, models, query]);
+ const current = findModel(models, row.current);
+ // The voice server and the wiki cannot discover a model; the brain roles can.
+ const discovers = row.id !== "embedding" && row.id !== "voice";
+ const roleName = t(row.label_key);
+
+ const close = useCallback(() => {
+ setOpen(false);
+ setQuery("");
+ }, []);
+
+ useEffect(() => {
+ if (!open) return;
+ search.current?.focus();
+ const onDown = (event: MouseEvent) => {
+ if (root.current && !root.current.contains(event.target as Node)) close();
+ };
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key === "Escape") close();
+ };
+ document.addEventListener("mousedown", onDown);
+ document.addEventListener("keydown", onKey);
+ return () => {
+ document.removeEventListener("mousedown", onDown);
+ document.removeEventListener("keydown", onKey);
+ };
+ }, [open, close]);
+
+ const choose = (tag: string) => {
+ close();
+ if (canonicalModelName(tag) !== canonicalModelName(row.current)) onPick(tag);
+ };
+
+ const buttonLabel = row.current
+ ? modelLabel(current, row.current)
+ : discovers
+ ? t("local_models.roles.pick_discovery")
+ : t("local_models.roles.pick_none");
+
+ const groupLabel = (id: PickerGroupId) => {
+ switch (id) {
+ case "fits":
+ return t("local_models.roles.pick_group_fits");
+ case "slow":
+ return row.max_size_gb != null && row.max_size_gb > 0
+ ? fill(t("local_models.roles.pick_group_over_size"), { gb: String(row.max_size_gb) })
+ : t("local_models.roles.pick_group_slow");
+ case "unknown":
+ return t("local_models.roles.pick_group_unknown");
+ case "unfit":
+ return t("local_models.roles.pick_group_unfit");
+ case "downloads":
+ return t("local_models.roles.pick_group_downloads");
+ }
+ };
+
+ const listId = `role-picker-list-${row.id}`;
return (
- <select
- aria-label={fill(t("local_models.roles.pick_label"), {
- role: t(row.label_key),
- })}
- value={row.current}
- disabled={disabled}
- onChange={(e) => onPick(e.target.value)}
- data-testid={`role-picker-${row.id}`}
+ <div ref={root} className={cn("relative", className)}>
+ <button
+ type="button"
+ aria-haspopup="listbox"
+ aria-expanded={open}
+ aria-controls={listId}
+ aria-label={fill(t("local_models.roles.pick_label"), { role: roleName })}
+ disabled={disabled}
+ onClick={() => (open ? close() : setOpen(true))}
+ data-testid={`role-picker-${row.id}`}
+ data-value={row.current}
+ className={cn(
+ "flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background/60 px-2.5 text-left text-sm text-foreground",
+ "transition-colors hover:border-border/80 focus:outline-none focus:ring-1 focus:ring-primary",
+ "disabled:cursor-not-allowed disabled:opacity-50",
+ )}
+ >
+ <span className="truncate">{buttonLabel}</span>
+ <ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
+ </button>
+
+ {open && (
+ <div
+ className="absolute left-0 right-0 top-full z-30 mt-1 overflow-hidden rounded-xl border border-border bg-card shadow-xl"
+ data-testid={`role-picker-popover-${row.id}`}
+ >
+ <label className="flex items-center gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground">
+ <Search className="h-3.5 w-3.5" />
+ <input
+ ref={search}
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ placeholder={t("local_models.roles.pick_search")}
+ aria-label={t("local_models.roles.pick_search")}
+ className="w-full bg-transparent text-sm text-foreground placeholder:text-muted-foreground/70 focus:outline-none"
+ data-testid={`role-picker-search-${row.id}`}
+ />
+ </label>
+ <ul
+ id={listId}
+ role="listbox"
+ aria-label={fill(t("local_models.roles.pick_label"), { role: roleName })}
+ className="max-h-80 overflow-y-auto py-1"
+ >
+ {discovers && !query && (
+ <Option
+ selected={row.current === ""}
+ onSelect={() => choose("")}
+ testId="role-option-discovery"
+ >
+ <span className="text-sm text-foreground">
+ {t("local_models.roles.pick_discovery")}
+ </span>
+ <span className="text-[11px] text-muted-foreground">
+ {t("local_models.roles.discovery")}
+ </span>
+ </Option>
+ )}
+ {groups.length === 0 && (
+ <li className="px-3 py-2 text-xs text-muted-foreground" role="presentation">
+ {t("local_models.roles.pick_empty")}
+ </li>
+ )}
+ {groups.map((group) => (
+ <li key={group.id} role="presentation" data-testid={`role-picker-group-${group.id}`}>
+ <p className="px-3 pb-0.5 pt-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground">
+ {groupLabel(group.id)}
+ </p>
+ <ul role="group" aria-label={groupLabel(group.id)}>
+ {group.entries.map((entry) => {
+ const selected =
+ !!row.current &&
+ canonicalModelName(entry.tag) === canonicalModelName(row.current);
+ const tone = fitTone(entry.fit);
+ const isDownload = group.id === "downloads";
+ return (
+ <Option
+ key={entry.tag}
+ selected={selected}
+ disabled={entry.disabled || (isDownload && !onInstall)}
+ onSelect={() => {
+ if (isDownload) {
+ close();
+ onInstall?.(entry.tag);
+ } else {
+ choose(entry.tag);
+ }
+ }}
+ testId={`role-option-${entry.tag}`}
+ >
+ <span className="flex min-w-0 items-baseline gap-2">
+ <span className="truncate text-sm text-foreground">{entry.label}</span>
+ <span className="truncate font-mono text-[10px] text-muted-foreground/80">
+ {entry.tag}
+ </span>
+ {!entry.installed && !isDownload && (
+ <span className="text-[10px] text-muted-foreground">
+ {t("local_models.roles.pick_missing_suffix")}
+ </span>
+ )}
+ </span>
+ <span className="flex items-center justify-between gap-2">
+ <span className="truncate text-[11px] text-muted-foreground">
+ {entry.facts}
+ </span>
+ <span
+ className={cn(
+ "shrink-0 text-[11px]",
+ isDownload ? "text-primary" : TONE_TEXT[tone],
+ )}
+ data-testid={`role-option-verdict-${entry.tag}`}
+ >
+ {isDownload ? (
+ <span className="inline-flex items-center gap-1">
+ <Download className="h-3 w-3" />
+ {t("local_models.roles.pick_download")}
+ </span>
+ ) : selected ? (
+ <span className="inline-flex items-center gap-1">
+ <Check className="h-3 w-3" />
+ {t("local_models.roles.pick_current")}
+ </span>
+ ) : entry.reason ? (
+ entry.reason
+ ) : entry.fit === "fits" ? (
+ t("local_models.roles.pick_fits")
+ ) : (
+ ""
+ )}
+ </span>
+ </span>
+ </Option>
+ );
+ })}
+ </ul>
+ </li>
+ ))}
+ </ul>
+ </div>
+ )}
+ </div>
+ );
+}
+
+function Option({
+ children,
+ selected,
+ disabled = false,
+ onSelect,
+ testId,
+}: {
+ children: React.ReactNode;
+ selected: boolean;
+ disabled?: boolean;
+ onSelect: () => void;
+ testId: string;
+}) {
+ return (
+ <li
+ role="option"
+ aria-selected={selected}
+ aria-disabled={disabled || undefined}
+ tabIndex={disabled ? -1 : 0}
+ data-testid={testId}
+ onClick={() => {
+ if (!disabled) onSelect();
+ }}
+ onKeyDown={(event) => {
+ if (disabled) return;
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+ onSelect();
+ }
+ }}
className={cn(
- "h-9 w-full rounded-lg border border-border bg-background/60 px-2.5 text-sm text-foreground",
- "transition-colors hover:border-border/80 focus:outline-none focus:ring-1 focus:ring-primary",
- "disabled:cursor-not-allowed disabled:opacity-50",
- className,
+ "grid gap-0.5 px-3 py-1.5 outline-none",
+ disabled
+ ? "cursor-not-allowed opacity-50"
+ : "cursor-pointer hover:bg-sheen/[0.05] focus-visible:bg-sheen/[0.07]",
+ selected && "bg-primary/[0.06]",
)}
>
- {row.id !== "embedding" && row.id !== "voice" && (
- <option value="">{t("local_models.roles.pick_discovery")}</option>
- )}
- {(row.id === "embedding" || row.id === "voice") && !row.current && (
- <option value="">{t("local_models.roles.pick_none")}</option>
- )}
- {fits.length > 0 && (
- <optgroup label={t("local_models.roles.pick_group_fits")}>
- {fits.map((name) => (
- <option key={name} value={name}>
- {label(name)}
- </option>
- ))}
- </optgroup>
- )}
- {others.length > 0 && (
- <optgroup label={othersLabel}>
- {others.map((name) => (
- <option key={name} value={name}>
- {label(name)}
- </option>
- ))}
- </optgroup>
- )}
- </select>
+ {children}
+ </li>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/local-models/localSetup.ts b/jarvis/ui/web/frontend/src/views/local-models/localSetup.ts
index 400cbb2a2d..4429243dac 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/localSetup.ts
+++ b/jarvis/ui/web/frontend/src/views/local-models/localSetup.ts
@@ -37,6 +37,7 @@ import {
ollamaRuntimeStart,
} from "@/hooks/useProviders";
import {
+ canonicalModelName,
getOverview,
modelPullStatus,
setAutostart,
@@ -49,15 +50,6 @@ import {
type VerifyResponse,
} from "@/hooks/useLocalModels";
-/** The five slots the flow writes, in the order the rows show them. */
-export const SETUP_ROLES: readonly LocalModelRole[] = [
- "chat",
- "voice",
- "tools_screen",
- "deep",
- "embedding",
-];
-
export type SetupStep =
| {
phase: "server";
@@ -105,9 +97,7 @@ export interface RunLocalSetupOptions {
}
/** "qwen3.5" and "qwen3.5:latest" are the same download. */
-export function canonical(name: string): string {
- return name.endsWith(":latest") ? name.slice(0, -":latest".length) : name;
-}
+export const canonical = canonicalModelName;
function sleep(ms: number): Promise<void> {
return new Promise((resolve) => window.setTimeout(resolve, ms));
@@ -203,16 +193,15 @@ export function planRoles(overview: OverviewResponse): {
const installed = new Set(
overview.inventory.models.map((m) => canonical(m.name)),
);
- const byId = new Map<string, RoleRow>(
- overview.roles.roles.map((r) => [r.id, r]),
- );
const assign: Array<{ role: LocalModelRole; model: string }> = [];
const kept: SetupSummary["kept"] = [];
const skipped: SetupSummary["skipped"] = [];
const pulls: string[] = [];
- for (const role of SETUP_ROLES) {
- const row = byId.get(role);
- if (!row || !row.writable) continue;
+ // The writable roles, in the backend's own order: the one list, so a role
+ // added there is set up here without a second list to keep in step.
+ const rows: RoleRow[] = overview.roles.roles.filter((r) => r.writable);
+ for (const row of rows) {
+ const role = row.id as LocalModelRole;
// Served by something other than this server (the note says what):
// that is a choice the user made elsewhere, not a gap to fill.
if (row.note && !row.current) {
diff --git a/jarvis/ui/web/frontend/src/views/local-models/modelNames.ts b/jarvis/ui/web/frontend/src/views/local-models/modelNames.ts
new file mode 100644
index 0000000000..68c8af4e50
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/local-models/modelNames.ts
@@ -0,0 +1,68 @@
+/**
+ * The readable side of a model row, for every panel that names one.
+ *
+ * The backend describes each download once (`ollama_names.describe`): the
+ * model line, its size, its quantisation. The panels read those parts here
+ * instead of showing the tag — and fall back to the tag when a row from an
+ * older payload has none, so nothing ever renders blank.
+ */
+import {
+ canonicalModelName,
+ type LocalModelRow,
+ type RoleFit,
+} from "@/hooks/useLocalModels";
+
+/** "Qwen 3.5 4B" — or the tag itself when the row carries no label. */
+export function modelLabel(
+ row: LocalModelRow | null | undefined,
+ fallback = "",
+): string {
+ if (!row) return fallback;
+ return row.display_label || row.display_name || row.name || fallback;
+}
+
+/** The inventory row for a tag (`:latest` tolerant), or null. */
+export function findModel(
+ models: readonly LocalModelRow[],
+ name: string,
+): LocalModelRow | null {
+ if (!name) return null;
+ const key = canonicalModelName(name);
+ return models.find((m) => canonicalModelName(m.name) === key) ?? null;
+}
+
+/** The label a tag gets: the row's readable one, else the tag. */
+export function labelFor(models: readonly LocalModelRow[], name: string): string {
+ return modelLabel(findModel(models, name), name);
+}
+
+/** The capabilities a job is gated on; "completion" is every model's. */
+export const ROLE_CAPABILITIES: ReadonlySet<string> = new Set([
+ "tools",
+ "vision",
+ "thinking",
+ "embedding",
+ "audio",
+]);
+
+export function capabilityChips(row: LocalModelRow | null | undefined): string[] {
+ if (!row || !row.probed) return [];
+ return row.capabilities.filter((c) => ROLE_CAPABILITIES.has(c));
+}
+
+export type FitTone = "ok" | "warn" | "bad" | "muted";
+
+/** The colour a verdict carries: semantic, never the accent. */
+export function fitTone(fit: RoleFit | "absent" | "" | string | undefined): FitTone {
+ switch (fit) {
+ case "fits":
+ return "ok";
+ case "slow":
+ return "warn";
+ case "unfit":
+ case "absent":
+ return "bad";
+ default:
+ return "muted";
+ }
+}
diff --git a/jarvis/ui/web/frontend/src/views/local-models/useRoleActions.ts b/jarvis/ui/web/frontend/src/views/local-models/useRoleActions.ts
index 4f3a367517..69854d68d5 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/useRoleActions.ts
+++ b/jarvis/ui/web/frontend/src/views/local-models/useRoleActions.ts
@@ -1,13 +1,15 @@
/**
- * The two writes a model card can make, and the progress line they report.
+ * The writes a model card can make, and the progress line they report.
*
- * Picking a model is one PUT. "Use recommended" is a small flow — download
- * the pick when it is missing, assign it, then write the suggested options
- * silently and read back one sentence — and it has to survive the card
- * unmounting mid-download, so it lives here rather than inside the card.
+ * Picking an installed model is one PUT. Installing one for a job — the
+ * recommended pick, or a download the picker offered — is a small flow:
+ * download it when it is missing, assign it, then write the suggested
+ * options silently and read back one sentence. That flow has to survive
+ * the card unmounting mid-download, so it lives here rather than inside
+ * the card.
*
- * Extracted from the old roles ledger unchanged in behaviour: the cards
- * replaced the rows, the writes did not change.
+ * Whether a role may be written is the row's own `writable` flag, never a
+ * list kept here: the backend is the one place a role is declared.
*/
import { useCallback, useEffect, useRef, useState } from "react";
@@ -40,15 +42,6 @@ export interface RoleProgress {
export const IDLE: RoleProgress = { phase: "idle" };
-/** The roles a user may write from a card. */
-const WRITABLE: readonly LocalModelRole[] = [
- "chat",
- "voice",
- "tools_screen",
- "deep",
- "embedding",
-];
-
export interface RoleActions {
/** Progress per role id; missing means idle. */
progress: Record<string, RoleProgress>;
@@ -58,6 +51,8 @@ export interface RoleActions {
pick: (roleId: string, model: string) => void;
/** Download the shortlist's pick when missing, assign it, tune it. */
useRecommended: (row: RoleRow) => void;
+ /** Download `model` when missing, assign it to the row's job, tune it. */
+ install: (row: RoleRow, model: string) => void;
/** A failed PUT, as one sentence; "" when the last write went through. */
writeError: string;
}
@@ -98,10 +93,9 @@ export function useRoleActions(
[setRoleMutation],
);
- const useRecommended = useCallback(
- (row: RoleRow) => {
- const model = row.recommended;
- if (!model || !WRITABLE.includes(row.id as LocalModelRole)) return;
+ const install = useCallback(
+ (row: RoleRow, model: string) => {
+ if (!model || !row.writable) return;
void (async () => {
try {
if (!isInstalled(model)) {
@@ -132,6 +126,11 @@ export function useRoleActions(
[alive, invalidate, isInstalled, patch, providerId, tuneSilently],
);
+ const useRecommended = useCallback(
+ (row: RoleRow) => install(row, row.recommended),
+ [install],
+ );
+
const isBusy = useCallback(
(roleId: string) => {
const phase = progress[roleId]?.phase;
@@ -150,5 +149,5 @@ export function useRoleActions(
: String(setRoleMutation.error)
: "";
- return { progress, isBusy, pick, useRecommended, writeError };
+ return { progress, isBusy, pick, useRecommended, install, writeError };
}
diff --git a/jarvis/ui/web/frontend/src/views/local-models/verifyLines.ts b/jarvis/ui/web/frontend/src/views/local-models/verifyLines.ts
index 19c73a48c7..c90d808cf4 100644
--- a/jarvis/ui/web/frontend/src/views/local-models/verifyLines.ts
+++ b/jarvis/ui/web/frontend/src/views/local-models/verifyLines.ts
@@ -15,6 +15,10 @@ function stepLabel(step: VerifyStep, t: T): string {
return t("local_models.verify.server");
case "chat":
return t("local_models.verify.chat");
+ case "voice":
+ return t("local_models.verify.voice");
+ case "tools_screen":
+ return t("local_models.verify.tools_screen");
case "embedding":
return t("local_models.verify.embedding");
default: