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.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-03 08:34)

Ruben Lütke0dc73b1dfed9
diff --git a/jarvis/ui/web/frontend/src/components/OpenRouterTtsVoicePicker.tsx b/jarvis/ui/web/frontend/src/components/OpenRouterTtsVoicePicker.tsx
new file mode 100644
index 0000000000..d33904efd4
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/OpenRouterTtsVoicePicker.tsx
@@ -0,0 +1,413 @@
+import { useEffect, useRef, useState } from "react";
+import { Check, ChevronDown, Loader2, Play, Square } from "lucide-react";
+import {
+ fetchTtsPreview,
+ getBrainProviderModels,
+ getTtsVoices,
+ saveBrainProviderModel,
+ saveTtsVoice,
+ type BrainModelSaveResult,
+ type TtsVoiceEntry,
+} from "@/hooks/useProviders";
+import { BrainModelSelector } from "@/components/BrainModelSelector";
+import { useEventStore } from "@/store/events";
+import { cn } from "@/lib/utils";
+import { useT, useUiLanguage } from "@/i18n";
+
+/**
+ * The OpenRouter-TTS provider card's model + voice controls.
+ *
+ * OpenRouter TTS is the one TTS provider where the user picks BOTH a model and,
+ * within that model, a specific VOICE. This wraps the shared model picker and,
+ * once a model is chosen, renders a language-tagged voice picker with an audio
+ * preview below it. Both the model and the voice write to the global ``[tts]``
+ * block (model → ``[tts] model``, voice → ``[tts] voice_de``/``voice_en``).
+ */
+export function OpenRouterTtsControls({
+ providerId,
+ recommendedModel,
+}: {
+ providerId: string;
+ recommendedModel?: string | null;
+}) {
+ // The currently selected TTS model — seeded from the catalog's current
+ // selection and updated when the model picker below saves a new one, so the
+ // voice picker always lists voices for the RIGHT model.
+ const [model, setModel] = useState<string>("");
+
+ useEffect(() => {
+ let alive = true;
+ void getBrainProviderModels(providerId)
+ .then((r) => {
+ if (alive) setModel(r.current_model || "");
+ })
+ .catch(() => {
+ /* the model picker below surfaces its own load error */
+ });
+ return () => {
+ alive = false;
+ };
+ }, [providerId]);
+
+ async function handleModelSave(m: string): Promise<BrainModelSaveResult> {
+ const res = await saveBrainProviderModel(providerId, m);
+ // Reflect the newly chosen model so the voice list re-fetches for it.
+ setModel(res.model);
+ return res;
+ }
+
+ return (
+ <div className="space-y-3">
+ <BrainModelSelector
+ providerId={providerId}
+ recommendedModel={recommendedModel}
+ onSave={handleModelSave}
+ />
+ {model && <VoicePicker model={model} />}
+ </div>
+ );
+}
+
+/** Flag + short label for a language code; "multi" → 🌐, unknown → the code. */
+function languageChip(
+ t: (k: string) => string,
+ code: string,
+): { flag: string; label: string } {
+ switch (code) {
+ case "de":
+ return { flag: "🇩🇪", label: "DE" };
+ case "en":
+ return { flag: "🇬🇧", label: "EN" };
+ case "es":
+ return { flag: "🇪🇸", label: "ES" };
+ case "fr":
+ return { flag: "🇫🇷", label: "FR" };
+ case "multi":
+ return { flag: "🌐", label: t("apikeys_voice.multilingual") };
+ default:
+ return { flag: "", label: code.toUpperCase() };
+ }
+}
+
+function LanguageChip({ code }: { code: string }) {
+ const t = useT();
+ const { flag, label } = languageChip(t, code);
+ return (
+ <span className="inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-muted px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-muted-foreground">
+ {flag && <span aria-hidden>{flag}</span>}
+ {label}
+ </span>
+ );
+}
+
+/**
+ * Language-tagged voice picker with a per-voice audio preview. Lists the chosen
+ * model's voices (each with a language chip), persists a pick, and plays a short
+ * spoken sample on demand — the sample language is switchable DE/EN.
+ */
+function VoicePicker({ model }: { model: string }) {
+ const t = useT();
+ const uiLang = useUiLanguage();
+ const pushToast = useEventStore((s) => s.pushToast);
+
+ const [voices, setVoices] = useState<TtsVoiceEntry[]>([]);
+ const [pinned, setPinned] = useState<string>("");
+ const [loading, setLoading] = useState(false);
+ const [saving, setSaving] = useState(false);
+ const [open, setOpen] = useState(false);
+ // The sample language — defaults to the app's UI language (falls back to EN
+ // for any non-DE locale, since the sample sentences are DE/EN).
+ const [previewLang, setPreviewLang] = useState<"de" | "en">(
+ uiLang === "de" ? "de" : "en",
+ );
+ // The voice currently PLAYING vs. the voice whose audio is being FETCHED — the
+ // preview button shows a spinner while loading, a stop icon while playing.
+ const [previewingId, setPreviewingId] = useState<string | null>(null);
+ const [loadingId, setLoadingId] = useState<string | null>(null);
+
+ const rootRef = useRef<HTMLDivElement>(null);
+ const audioRef = useRef<HTMLAudioElement | null>(null);
+ const urlRef = useRef<string | null>(null);
+
+ function stopPreview() {
+ if (audioRef.current) {
+ audioRef.current.pause();
+ audioRef.current = null;
+ }
+ if (urlRef.current) {
+ URL.revokeObjectURL(urlRef.current);
+ urlRef.current = null;
+ }
+ setPreviewingId(null);
+ setLoadingId(null);
+ }
+
+ // Load the model's voices; seed the pinned voice from the persisted value (or
+ // the model default). Re-runs whenever the selected model changes.
+ useEffect(() => {
+ let alive = true;
+ setLoading(true);
+ stopPreview();
+ void getTtsVoices(model)
+ .then((r) => {
+ if (!alive) return;
+ setVoices(r.voices);
+ setPinned(r.current || r.default || "");
+ })
+ .catch((e) => {
+ if (alive)
+ pushToast(
+ "error",
+ `${t("apikeys_voice.load_failed")}: ${(e as Error).message}`,
+ );
+ })
+ .finally(() => {
+ if (alive) setLoading(false);
+ });
+ return () => {
+ alive = false;
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [model]);
+
+ // Stop and free any playing preview when the component unmounts.
+ useEffect(() => stopPreview, []);
+
+ // Close the panel on an outside click.
+ useEffect(() => {
+ if (!open) return;
+ function onDown(e: MouseEvent) {
+ if (rootRef.current && !rootRef.current.contains(e.target as Node)) {
+ setOpen(false);
+ }
+ }
+ document.addEventListener("mousedown", onDown);
+ return () => document.removeEventListener("mousedown", onDown);
+ }, [open]);
+
+ async function preview(voiceId: string) {
+ // Toggle: a second click on the currently-playing / loading voice stops it.
+ if (previewingId === voiceId || loadingId === voiceId) {
+ stopPreview();
+ return;
+ }
+ stopPreview();
+ setLoadingId(voiceId);
+ try {
+ const blob = await fetchTtsPreview({ model, voice: voiceId, language: previewLang });
+ const url = URL.createObjectURL(blob);
+ urlRef.current = url;
+ const audio = new Audio(url);
+ audioRef.current = audio;
+ audio.onended = () => stopPreview();
+ audio.onerror = () => stopPreview();
+ setLoadingId(null);
+ setPreviewingId(voiceId);
+ await audio.play();
+ } catch (e) {
+ pushToast(
+ "error",
+ `${t("apikeys_voice.preview_failed")}: ${(e as Error).message}`,
+ );
+ stopPreview();
+ }
+ }
+
+ async function save(voiceId: string) {
+ setSaving(true);
+ setOpen(false);
+ try {
+ const res = await saveTtsVoice(voiceId);
+ setPinned(voiceId);
+ const note = res.restart_required
+ ? ` ${t("apikeys_model.restart_note")}`
+ : res.applied_live
+ ? ` ${t("apikeys_model.live_note")}`
+ : "";
+ pushToast("success", `${t("apikeys_voice.saved")}${note}`);
+ } catch (e) {
+ pushToast("error", (e as Error).message);
+ } finally {
+ setSaving(false);
+ }
+ }
+
+ const pinnedEntry = voices.find((v) => v.id === pinned);
+
+ return (
+ <div
+ ref={rootRef}
+ className="space-y-1.5"
+ onClick={(e) => e.stopPropagation()}
+ onDoubleClick={(e) => e.stopPropagation()}
+ >
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[10px] uppercase tracking-wide text-muted-foreground">
+ {t("apikeys_voice.heading")}
+ </span>
+ {/* Preview-language toggle (the sample sentence's language). */}
+ <div
+ className="inline-flex items-center gap-1"
+ role="group"
+ aria-label={t("apikeys_voice.preview_language")}
+ >
+ <span className="text-[10px] text-muted-foreground">
+ {t("apikeys_voice.preview_in")}
+ </span>
+ {(["de", "en"] as const).map((lng) => (
+ <button
+ key={lng}
+ type="button"
+ onClick={() => setPreviewLang(lng)}
+ aria-pressed={previewLang === lng}
+ className={cn(
+ "rounded-full border px-1.5 py-0.5 text-[10px] uppercase tracking-wide transition-colors",
+ previewLang === lng
+ ? "border-primary/40 bg-primary/20 text-primary"
+ : "border-border bg-muted text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {lng}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {/* Trigger: current voice + a play button for it. */}
+ <div className="flex items-center gap-1.5">
+ <button
+ type="button"
+ aria-label={t("apikeys_voice.voice_label")}
+ aria-expanded={open}
+ onClick={() => setOpen((o) => !o)}
+ disabled={saving}
+ className={cn(
+ "flex min-w-0 flex-1 items-center justify-between gap-2 rounded-md border bg-background px-3 py-2 text-left transition-colors",
+ open
+ ? "border-primary/50 ring-1 ring-primary/20"
+ : "border-input hover:border-primary/40",
+ )}
+ >
+ <span className="flex min-w-0 items-center gap-1.5">
+ {pinnedEntry && <LanguageChip code={pinnedEntry.language} />}
+ <span className={cn("truncate text-xs", !pinned && "text-muted-foreground")}>
+ {pinned || t("apikeys_voice.choose_voice")}
+ </span>
+ </span>
+ {saving ? (
+ <Loader2 className="h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground" />
+ ) : (
+ <ChevronDown
+ className={cn(
+ "h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",
+ open && "rotate-180",
+ )}
+ />
+ )}
+ </button>
+ {pinned && (
+ <PreviewButton
+ active={previewingId === pinned}
+ loading={loadingId === pinned}
+ onClick={() => void preview(pinned)}
+ label={t("apikeys_voice.preview")}
+ />
+ )}
+ </div>
+
+ {/* Inline-expanding voice list. */}
+ {open && (
+ <div className="overflow-hidden rounded-md border border-border bg-popover">
+ <ul className="max-h-56 overflow-y-auto p-1 scrollbar-jarvis">
+ {voices.map((v) => {
+ const isPinned = v.id === pinned;
+ return (
+ <li key={v.id}>
+ <div
+ className={cn(
+ "flex items-center rounded hover:bg-primary/10",
+ isPinned && "bg-primary/20",
+ )}
+ >
+ <PreviewButton
+ active={previewingId === v.id}
+ loading={loadingId === v.id}
+ onClick={() => void preview(v.id)}
+ label={t("apikeys_voice.preview")}
+ className="ml-1"
+ />
+ <button
+ type="button"
+ onClick={() => void save(v.id)}
+ className="flex min-w-0 flex-1 items-center justify-between gap-2 px-2 py-1.5 text-left"
+ >
+ <span
+ className={cn(
+ "flex min-w-0 items-center gap-1.5 truncate text-xs",
+ isPinned && "font-medium text-primary",
+ )}
+ >
+ <LanguageChip code={v.language} />
+ <span className="truncate font-mono">{v.id}</span>
+ </span>
+ {isPinned && <Check className="h-3 w-3 shrink-0 text-primary" />}
+ </button>
+ </div>
+ </li>
+ );
+ })}
+
+ {!voices.length && (
+ <li className="px-2 py-2 text-[11px] text-muted-foreground">
+ {loading ? t("apikeys_model.loading") : t("apikeys_voice.no_voices")}
+ </li>
+ )}
+ </ul>
+ {voices.length > 0 && (
+ <div className="border-t border-border px-2.5 py-1 text-[10px] text-muted-foreground">
+ {t("apikeys_voice.count_hint").replace("{0}", String(voices.length))}
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ );
+}
+
+/** A small play / stop button with a loading spinner while the audio fetches. */
+function PreviewButton({
+ active,
+ loading,
+ onClick,
+ label,
+ className,
+}: {
+ active: boolean;
+ loading?: boolean;
+ onClick: () => void;
+ label: string;
+ className?: string;
+}) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ aria-label={label}
+ title={label}
+ aria-busy={loading || undefined}
+ className={cn(
+ "shrink-0 rounded p-1 text-muted-foreground transition-colors hover:text-primary",
+ (active || loading) && "text-primary",
+ className,
+ )}
+ >
+ {loading ? (
+ <Loader2 className="h-3 w-3 animate-spin" />
+ ) : active ? (
+ <Square className="h-3 w-3 fill-current" />
+ ) : (
+ <Play className="h-3 w-3" />
+ )}
+ </button>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx
index 01b11980be..99e04670b6 100644
--- a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx
@@ -19,6 +19,7 @@ import { ContactsView } from "@/views/contacts/ContactsView";
import { FeedbackView } from "@/views/feedback/FeedbackView";
import { AgentInstructionsView } from "@/views/AgentInstructionsView";
import { TelephonySetupView } from "@/views/TelephonyView";
+import { DictionaryView } from "@/views/DictionaryView";
/**
* Main area to the right of the sidebar. All views are switched the classic
@@ -92,6 +93,8 @@ function SwitchOnActiveSection({ active }: { active: string }) {
case "taskbar":
case "languages":
return <SettingsView />;
+ case "dictionary":
+ return <DictionaryView />;
case "outputs":
return <OutputsView />;
case "socials":
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
index 6fab336ef5..2ed38360d3 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
@@ -2,6 +2,7 @@ import {
MessageSquare,
Users,
Boxes,
+ BookA,
BookOpen,
KeyRound,
Settings,
@@ -108,6 +109,12 @@ const NAV_GROUPS: NavItem[][] = [
icon: Settings,
matchIds: ["settings", "taskbar", "languages"],
},
+ {
+ id: "dictionary",
+ labelKey: "nav.dictionary",
+ icon: BookA,
+ fallbackLabel: "Dictionary",
+ },
{ id: "outputs", labelKey: "nav.outputs", icon: FolderOpen },
],
// 4) Social links + in-app feedback — pinned to the bottom group.
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 6a0c3302b1..f358451c0d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -43,6 +43,7 @@
"wiki": "Wiki",
"apikeys": "API-Keys",
"settings": "Einstellungen",
+ "dictionary": "Wörterbuch",
"telephony": "Telefonie",
"outputs": "Outputs",
"socials": "Socials",
@@ -926,6 +927,20 @@
"filter_hint_frontier": "Wenn der Preis egal ist — die leistungsstärksten Modelle.",
"filter_hint_value": "Die beste Leistung fürs Geld."
},
+ "apikeys_voice": {
+ "heading": "Stimme",
+ "voice_label": "Stimme",
+ "choose_voice": "Stimme wählen…",
+ "multilingual": "Mehrsprachig",
+ "saved": "Stimme gespeichert",
+ "load_failed": "Stimmen konnten nicht geladen werden",
+ "no_voices": "Keine Stimmen für dieses Modell",
+ "count_hint": "{0} Stimmen",
+ "preview": "Stimme anhören",
+ "preview_failed": "Vorschau fehlgeschlagen",
+ "preview_language": "Sprache der Vorschau",
+ "preview_in": "Vorschau in"
+ },
"apikeys_cu_model": {
"heading": "Modell für Computer-Use",
"use_main": "Mein Hauptmodell verwenden",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 79b8ee7eae..b1d531b3cf 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -43,6 +43,7 @@
"wiki": "Wiki",
"apikeys": "API Keys",
"settings": "Settings",
+ "dictionary": "Dictionary",
"telephony": "Telephony",
"outputs": "Outputs",
"socials": "Socials",
@@ -927,6 +928,20 @@
"filter_hint_frontier": "When price doesn't matter — the most capable models.",
"filter_hint_value": "The best performance for the price."
},
+ "apikeys_voice": {
+ "heading": "Voice",
+ "voice_label": "Voice",
+ "choose_voice": "Choose a voice…",
+ "multilingual": "Multilingual",
+ "saved": "Voice saved",
+ "load_failed": "Could not load voices",
+ "no_voices": "No voices for this model",
+ "count_hint": "{0} voices",
+ "preview": "Preview voice",
+ "preview_failed": "Preview failed",
+ "preview_language": "Preview language",
+ "preview_in": "Preview in"
+ },
"apikeys_cu_model": {
"heading": "Computer-Use model",
"use_main": "Use my main model",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 21e57ca238..b72700e8b6 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -43,6 +43,7 @@
"wiki": "Wiki",
"apikeys": "Claves API",
"settings": "Ajustes",
+ "dictionary": "Diccionario",
"telephony": "Telefonía",
"outputs": "Salidas",
"socials": "Redes",
@@ -926,6 +927,20 @@
"filter_hint_frontier": "Cuando el precio no importa — los modelos más capaces.",
"filter_hint_value": "La mejor relación calidad-precio."
},
+ "apikeys_voice": {
+ "heading": "Voz",
+ "voice_label": "Voz",
+ "choose_voice": "Elige una voz…",
+ "multilingual": "Multilingüe",
+ "saved": "Voz guardada",
+ "load_failed": "No se pudieron cargar las voces",
+ "no_voices": "Sin voces para este modelo",
+ "count_hint": "{0} voces",
+ "preview": "Escuchar voz",
+ "preview_failed": "La vista previa falló",
+ "preview_language": "Idioma de la vista previa",
+ "preview_in": "Vista previa en"
+ },
"apikeys_cu_model": {
"heading": "Modelo para Computer-Use",
"use_main": "Usar mi modelo principal",
diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.ts
index d63005bbb8..6ab2fc8725 100644
--- a/jarvis/ui/web/frontend/src/store/events.ts
+++ b/jarvis/ui/web/frontend/src/store/events.ts
@@ -35,7 +35,8 @@ export type SectionId =
| "taskbar"
| "contacts"
| "feedback"
- | "agent-instructions";
+ | "agent-instructions"
+ | "dictionary";
export const SECTION_IDS = [
"chats",
@@ -63,6 +64,7 @@ export const SECTION_IDS = [
"contacts",
"feedback",
"agent-instructions",
+ "dictionary",
] as const satisfies readonly SectionId[];
export function isSectionId(value: unknown): value is SectionId {
@@ -95,6 +97,7 @@ export const SECTION_LABELS: Record<SectionId, string> = {
contacts: "Contacts",
feedback: "Feedback",
"agent-instructions": "Agent Instructions",
+ dictionary: "Dictionary",
};
export interface EventItem {
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
index a124aefa22..21236f2d13 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
@@ -4,6 +4,7 @@ import { ViewHeader } from "@/views/ChatsView";
import { AltCredentialNote } from "@/components/AltCredentialNote";
import { ApiKeyForm } from "@/components/ApiKeyForm";
import { BrainModelSelector } from "@/components/BrainModelSelector";
+import { OpenRouterTtsControls } from "@/components/OpenRouterTtsVoicePicker";
import { CuModelSelector } from "@/components/CuModelSelector";
import { ProviderBillingBadge } from "@/components/ProviderBillingBadge";
import { JarvisAgentSection } from "@/components/JarvisAgentSection";
@@ -716,12 +717,22 @@ function ProviderCard({
{((descriptor.tier === "brain" && isBrainSwitchable) ||
((descriptor.tier === "tts" || descriptor.tier === "stt") &&
descriptor.active &&
- descriptor.configured)) && (
- <BrainModelSelector
- providerId={descriptor.id}
- recommendedModel={descriptor.recommended_model}
- />
- )}
+ descriptor.configured)) &&
+ // OpenRouter TTS is the one provider where the user also picks a VOICE
+ // (per model, language-tagged, with an audio preview) — render the
+ // combined model + voice controls; every other tier keeps the plain
+ // model/voice picker.
+ (descriptor.id === "openrouter-tts" ? (
+ <OpenRouterTtsControls
+ providerId={descriptor.id}
+ recommendedModel={descriptor.recommended_model}
+ />
+ ) : (
+ <BrainModelSelector
+ providerId={descriptor.id}
+ recommendedModel={descriptor.recommended_model}
+ />
+ ))}
{/* TTS/STT model/voice is a single global value, so a configured-but-
inactive provider can't own it — make the capability discoverable with
diff --git a/jarvis/ui/web/frontend/src/views/settings/DictionaryGroup.tsx b/jarvis/ui/web/frontend/src/views/DictionaryView.tsx
similarity index 68%
rename from jarvis/ui/web/frontend/src/views/settings/DictionaryGroup.tsx
rename to jarvis/ui/web/frontend/src/views/DictionaryView.tsx
index c515602377..03595070ab 100644
--- a/jarvis/ui/web/frontend/src/views/settings/DictionaryGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/DictionaryView.tsx
@@ -1,7 +1,7 @@
import { useMemo, useState } from "react";
import {
ArrowRight,
- BookOpen,
+ BookA,
Loader2,
Pencil,
Plus,
@@ -9,6 +9,7 @@ import {
Trash2,
X,
} from "lucide-react";
+import { ViewHeader } from "@/views/ChatsView";
import { Button } from "@/components/ui/button";
import { Switch } from "@/components/ui/switch";
import {
@@ -19,15 +20,16 @@ import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
/**
- * "Dictionary" panel inside the Settings view — the a dictation app-style custom
- * vocabulary for speech recognition. Users add words the STT keeps getting
- * wrong (proper nouns, brand names, e-mail addresses) either as a plain
- * vocabulary word or as an explicit "misheard → correct" fix. Entries apply
- * to the NEXT utterance (the backend corrector live-reloads) — no restart.
+ * "Dictionary" section — the a dictation app-style custom vocabulary for speech
+ * recognition, as its own sidebar destination. Users add words the STT keeps
+ * getting wrong (proper nouns, brand names, e-mail addresses) either as a
+ * plain vocabulary word or as an explicit "misheard → correct" fix. Entries
+ * apply to the NEXT utterance (the backend corrector live-reloads) — no
+ * restart.
*
* Backed by /api/dictionary (GET/POST/PATCH/DELETE) via useDictionary.
*/
-export function DictionaryGroup() {
+export function DictionaryView() {
const t = useT();
const { entries, loading, error, createEntry, updateEntry, removeEntry } =
useDictionary();
@@ -61,20 +63,30 @@ export function DictionaryGroup() {
}
return (
- <div className="mt-2 rounded-lg border border-border bg-card/60 p-4">
- <div className="flex items-start gap-3">
- <BookOpen className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center gap-2">
- <h4 className="font-display text-sm font-semibold">
- {t("dictionary.title")}
- </h4>
+ <div className="flex h-full flex-col">
+ <ViewHeader
+ icon={<BookA className="h-4 w-4 text-primary" />}
+ title={t("dictionary.title")}
+ subtitle={t("dictionary.description")}
+ />
+ <div className="flex-1 overflow-y-auto scrollbar-jarvis p-6">
+ <div className="mx-auto max-w-3xl">
+ <div className="flex items-center gap-3">
+ <div className="relative flex-1">
+ <Search className="absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
+ <input
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ placeholder={t("dictionary.search")}
+ data-testid="dictionary-search"
+ className="w-full rounded-md border border-input bg-background py-1.5 pl-8 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary"
+ />
+ </div>
{entries.length > 0 && (
<span className="rounded-full border border-border bg-muted/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground">
{entries.length}
</span>
)}
- <div className="flex-1" />
<Button
size="sm"
className="gap-1.5"
@@ -88,88 +100,74 @@ export function DictionaryGroup() {
{t("dictionary.add")}
</Button>
</div>
- <p className="mt-1 text-xs text-muted-foreground">
- {t("dictionary.description")}
- </p>
{error && <p className="mt-3 text-xs text-destructive">{error}</p>}
- {entries.length > 3 && (
- <div className="relative mt-3">
- <Search className="absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
- <input
- value={query}
- onChange={(e) => setQuery(e.target.value)}
- placeholder={t("dictionary.search")}
- data-testid="dictionary-search"
- className="w-full rounded-md border border-input bg-background py-1.5 pl-8 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary"
- />
- </div>
- )}
-
- {loading ? (
- <div className="mt-4 flex items-center gap-2 text-xs text-muted-foreground">
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- {t("dictionary.loading")}
- </div>
- ) : entries.length === 0 ? (
- <p className="mt-4 text-xs text-muted-foreground">
- {t("dictionary.empty")}
- </p>
- ) : filtered.length === 0 ? (
- <p className="mt-4 text-xs text-muted-foreground">
- {t("dictionary.no_matches")}
- </p>
- ) : (
- <ul className="mt-3 divide-y divide-border/60" data-testid="dictionary-list">
- {filtered.map((entry) => (
- <li
- key={entry.id}
- className="group flex items-center gap-2 py-2"
- >
- <div className="min-w-0 flex-1 text-sm">
- {entry.misheard.length > 0 ? (
- <span className="flex flex-wrap items-center gap-1.5">
- <span className="text-muted-foreground">
- {entry.misheard.join(", ")}
+ <div className="mt-4 rounded-lg border border-border bg-card/60 px-4 py-2">
+ {loading ? (
+ <div className="flex items-center gap-2 py-3 text-xs text-muted-foreground">
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ {t("dictionary.loading")}
+ </div>
+ ) : entries.length === 0 ? (
+ <p className="py-3 text-xs text-muted-foreground">
+ {t("dictionary.empty")}
+ </p>
+ ) : filtered.length === 0 ? (
+ <p className="py-3 text-xs text-muted-foreground">
+ {t("dictionary.no_matches")}
+ </p>
+ ) : (
+ <ul className="divide-y divide-border/60" data-testid="dictionary-list">
+ {filtered.map((entry) => (
+ <li
+ key={entry.id}
+ className="group flex items-center gap-2 py-2.5"
+ >
+ <div className="min-w-0 flex-1 text-sm">
+ {entry.misheard.length > 0 ? (
+ <span className="flex flex-wrap items-center gap-1.5">
+ <span className="text-muted-foreground">
+ {entry.misheard.join(", ")}
+ </span>
+ <ArrowRight className="h-3 w-3 shrink-0 text-muted-foreground" />
+ <span className="font-medium">{entry.word}</span>
</span>
- <ArrowRight className="h-3 w-3 shrink-0 text-muted-foreground" />
+ ) : (
<span className="font-medium">{entry.word}</span>
- </span>
- ) : (
- <span className="font-medium">{entry.word}</span>
- )}
- </div>
- <button
- type="button"
- aria-label={t("dictionary.edit")}
- data-testid={`dictionary-edit-${entry.id}`}
- onClick={() => {
- setEditing(entry);
- setDialogOpen(true);
- }}
- className="text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus:opacity-100 group-hover:opacity-100"
- >
- <Pencil className="h-3.5 w-3.5" />
- </button>
- <button
- type="button"
- aria-label={t("dictionary.delete")}
- data-testid={`dictionary-delete-${entry.id}`}
- disabled={deletingId === entry.id}
- onClick={() => void onDelete(entry)}
- className="text-muted-foreground opacity-0 transition-opacity hover:text-destructive focus:opacity-100 group-hover:opacity-100 disabled:opacity-50"
- >
- {deletingId === entry.id ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- ) : (
- <Trash2 className="h-3.5 w-3.5" />
- )}
- </button>
- </li>
- ))}
- </ul>
- )}
+ )}
+ </div>
+ <button
+ type="button"
+ aria-label={t("dictionary.edit")}
+ data-testid={`dictionary-edit-${entry.id}`}
+ onClick={() => {
+ setEditing(entry);
+ setDialogOpen(true);
+ }}
+ className="text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus:opacity-100 group-hover:opacity-100"
+ >
+ <Pencil className="h-3.5 w-3.5" />
+ </button>
+ <button
+ type="button"
+ aria-label={t("dictionary.delete")}
+ data-testid={`dictionary-delete-${entry.id}`}
+ disabled={deletingId === entry.id}
+ onClick={() => void onDelete(entry)}
+ className="text-muted-foreground opacity-0 transition-opacity hover:text-destructive focus:opacity-100 group-hover:opacity-100 disabled:opacity-50"
+ >
+ {deletingId === entry.id ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : (
+ <Trash2 className="h-3.5 w-3.5" />
+ )}
+ </button>
+ </li>
+ ))}
+ </ul>
+ )}
+ </div>
<p className="mt-3 text-[11px] text-muted-foreground">
{t("dictionary.applies_note")}
diff --git a/jarvis/ui/web/frontend/src/views/SettingsView.tsx b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
index 1e69afe9ea..85718e15f6 100644
--- a/jarvis/ui/web/frontend/src/views/SettingsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
@@ -14,7 +14,6 @@ import { AppSettingsGroup } from "@/views/settings/AppSettingsGroup";
import { SilenceWindowGroup } from "@/views/settings/SilenceWindowGroup";
import { VolumeGroup } from "@/views/settings/VolumeGroup";
import { SystemPromptGroup } from "@/views/settings/SystemPromptGroup";
-import { DictionaryGroup } from "@/views/settings/DictionaryGroup";
import { useWakeWord, type WakeWordSaveResult } from "@/hooks/useWakeWord";
import {
useKeybinds,
@@ -67,7 +66,6 @@ export function SettingsView() {
<AppSettingsGroup />
<SystemPromptGroup />
<WakeWordPanel />
- <DictionaryGroup />
<SilenceWindowGroup />
<VolumeGroup />
<KeybindsPanel />