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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(local-models): the ledger's Used-by badges, the Use-for menu and delete-reassign know the Voice slot
rubenluetke10-beep2d7b21d2524c
diff --git a/jarvis/ui/web/frontend/src/hooks/useLocalModels.ts b/jarvis/ui/web/frontend/src/hooks/useLocalModels.tsindex 7c84b87329..cf72c08cea 100644--- a/jarvis/ui/web/frontend/src/hooks/useLocalModels.ts+++ b/jarvis/ui/web/frontend/src/hooks/useLocalModels.ts@@ -32,10 +32,10 @@ export type { OllamaModelOptions } from "../lib/ollamaModelOptions";// Wire types — inventory// ----------------------------------------------------------------------------/** The four writable slots. */-export type LocalModelRole = "chat" | "tools_screen" | "deep" | "embedding";+/** The five writable slots (voice = the managed voice server's own brain). */+export type LocalModelRole = "chat" | "voice" | "tools_screen" | "deep" | "embedding";/** Every role row the backend renders, read-only ones included. */-export type LocalModelRoleId = LocalModelRole | "voice" | "ack" | "polish";+export type LocalModelRoleId = LocalModelRole | "ack" | "polish";export interface RunningModelRow {name: string;diff --git a/jarvis/ui/web/frontend/src/views/local-models/InventoryPanel.tsx b/jarvis/ui/web/frontend/src/views/local-models/InventoryPanel.tsxindex 7ca555f868..76a69e4536 100644--- a/jarvis/ui/web/frontend/src/views/local-models/InventoryPanel.tsx+++ b/jarvis/ui/web/frontend/src/views/local-models/InventoryPanel.tsx@@ -57,6 +57,7 @@ export interface InventoryPanelProps {const WRITABLE_ROLES: LocalModelRole[] = ["chat",+ "voice","tools_screen","deep","embedding",@@ -65,6 +66,7 @@ const WRITABLE_ROLES: LocalModelRole[] = [/** Which capability a role needs; mirrors `ollama_roles.ROLES.required`. */const ROLE_NEEDS: Record<LocalModelRole, string | null> = {chat: null,+ voice: null,tools_screen: "tools",deep: null,embedding: "embedding",diff --git a/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsx b/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsxindex 6d7bc5a2eb..bf8b0dbb34 100644--- a/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsx+++ b/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsx@@ -68,6 +68,7 @@ interface Progress {const WRITABLE: readonly LocalModelRole[] = ["chat",+ "voice","tools_screen","deep","embedding",diff --git a/jarvis/ui/web/local_models_routes.py b/jarvis/ui/web/local_models_routes.pyindex 5c8e5740e7..7bd73f26e7 100644--- a/jarvis/ui/web/local_models_routes.py+++ b/jarvis/ui/web/local_models_routes.py@@ -54,18 +54,6 @@ log = logging.getLogger(__name__)router = APIRouter(prefix="/api/providers/{provider_id}/local-models", tags=["local-models"])-#: Role id -> where the brain reads it. The three ``[brain.providers.ollama]``-#: model fields plus the wiki's embedding slot (Ollama-backed when-#: ``embedding_provider == "ollama"``). Chunk 5 grows this into-#: ``ollama_roles.ROLES``; the ids are kept stable for that.-ROLE_FIELDS: tuple[tuple[str, str], ...] = (- ("chat", "model"),- ("tools_screen", "tool_model"),- ("deep", "deep_model"),-)-EMBEDDING_ROLE = "embedding"--# ── Response / body models (AP-4, Python half) ───────────────────────────@@ -148,23 +136,17 @@ def _ollama_provider_cfg(cfg: Any) -> Any:def _roles_using(cfg: Any, name: str) -> list[str]:- """Role ids whose configured pick is ``name`` (``:latest`` tolerant)."""+ """Role ids whose configured pick is ``name`` (``:latest`` tolerant).++ Delegates to :func:`jarvis.brain.ollama_roles.roles_using` so the ledger's+ "Used by" badges and the delete refusal agree with the Roles panel — the+ voice slot (read from the voice server's launch command) included.+ """if cfg is None:return []- out: list[str] = []- provider = _ollama_provider_cfg(cfg)- for role, field in ROLE_FIELDS:- value = str(getattr(provider, field, "") or "") if provider is not None else ""- if value and same_model(value, name):- out.append(role)- ultrawiki = getattr(cfg, "ultrawiki", None)- if (- ultrawiki is not None- and str(getattr(ultrawiki, "embedding_provider", "") or "") == "ollama"- and same_model(str(getattr(ultrawiki, "embedding_model", "") or ""), name)- ):- out.append(EMBEDDING_ROLE)- return out+ from jarvis.brain.ollama_roles import roles_using++ return roles_using(cfg, name)def _row(@@ -355,31 +337,19 @@ async def delete_inventory_model(def _reassign_roles(cfg: Any, roles: list[str], target: str) -> list[str]:- """Persist ``target`` for every role in ``roles`` and mirror it into the- live config object so the next read agrees with the TOML."""- from jarvis.core import config_writer+ """Persist ``target`` for every role in ``roles`` through the roles module.++ One writer per slot lives in :mod:`jarvis.brain.ollama_roles` (chat, voice,+ tools/screen, deep, embedding); going through it keeps the delete path+ honest for the voice slot, whose pick is not a plain config field.+ """+ from jarvis.brain.ollama_roles import set_role- fields = [field for role, field in ROLE_FIELDS if role in roles]done: list[str] = []try:- if fields:- config_writer.set_brain_provider_model(- "ollama",- model=target if "model" in fields else None,- deep_model=target if "deep_model" in fields else None,- tool_model=target if "tool_model" in fields else None,- )- provider = _ollama_provider_cfg(cfg)- for field in fields:- if provider is not None:- setattr(provider, field, target)- done.extend(role for role, field in ROLE_FIELDS if field in fields)- if EMBEDDING_ROLE in roles:- config_writer.set_ultrawiki_slot("embedding_model", target)- ultrawiki = getattr(cfg, "ultrawiki", None)- if ultrawiki is not None:- ultrawiki.embedding_model = target- done.append(EMBEDDING_ROLE)+ for role in roles:+ set_role(role, target, cfg=cfg)+ done.append(role)except Exception as exc: # noqa: BLE001 — the delete must not run on a half-written configlog.warning("local-models: reassigning %s to %s failed: %s", roles, target, exc)raise HTTPException(diff --git a/tests/unit/ui/web/test_local_models_routes.py b/tests/unit/ui/web/test_local_models_routes.pyindex 23ecf57cdc..d0c92297f7 100644--- a/tests/unit/ui/web/test_local_models_routes.py+++ b/tests/unit/ui/web/test_local_models_routes.py@@ -158,13 +158,8 @@ def test_delete_with_reassign_rewrites_the_roles_first(server: WebServer, fake,body = resp.json()assert body["reassigned"] == ["chat"]assert body["reassigned_to"] == "gemma4:12b-it-qat"- assert writes == [- (- "brain",- "ollama",- {"model": "gemma4:12b-it-qat", "deep_model": None, "tool_model": None},- )- ]+ # Reassignment goes through ollama_roles.set_role — one writer per slot.+ assert writes == [("brain", "ollama", {"model": "gemma4:12b-it-qat"})]assert "qwen3.5:4b" not in fake.models# The live config agrees with the TOML from now on.assert server.app.state.config.brain.providers["ollama"].model == "gemma4:12b-it-qat"