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
feat(voice): switch and transcript view for conversation polish
rubenluetke10-beepc9ef0ee172bf
diff --git a/jarvis/ui/web/frontend/src/components/sessions/TurnCard.test.tsx b/jarvis/ui/web/frontend/src/components/sessions/TurnCard.test.tsxindex 108e98f04f..14eed0459e 100644--- a/jarvis/ui/web/frontend/src/components/sessions/TurnCard.test.tsx+++ b/jarvis/ui/web/frontend/src/components/sessions/TurnCard.test.tsx@@ -3,7 +3,7 @@* assistant text and keeps status phrases/readbacks on a supplemental track.*/import { afterEach, beforeEach, describe, expect, it } from "vitest";-import { cleanup, render, screen } from "@testing-library/react";+import { cleanup, fireEvent, render, screen } from "@testing-library/react";import { useEventStore } from "@/store/events";import { TurnCard, formatTurnPlain } from "./TurnCard";@@ -58,6 +58,54 @@ function spokenLine(over: Partial<VoiceSpokenLine> = {}): VoiceSpokenLine {};}+describe("TurnCard polished transcript", () => {+ const RAW = "so um we should probably move the meeting to the morning";+ const TIDY = "We should probably move the meeting to the morning.";++ it("shows the tidied reading and marks it as one", () => {+ render(<TurnCard turn={turn({ user_text: RAW, user_text_polished: TIDY })} />);++ expect(screen.getByText(TIDY)).toBeTruthy();+ expect(screen.getByTestId("turn-polished-badge")).toBeTruthy();+ // The raw text is not on screen until it is asked for.+ expect(screen.queryByTestId("turn-raw-text")).toBeNull();+ });++ it("keeps what was actually said one click away", () => {+ // A transcript is a RECORD. A view that shows only a model's reading of it,+ // with no way back to the words themselves, is no longer a record.+ render(<TurnCard turn={turn({ user_text: RAW, user_text_polished: TIDY })} />);++ fireEvent.click(screen.getByTestId("turn-polished-toggle"));++ expect(screen.getByTestId("turn-raw-text").textContent).toBe(RAW);+ });++ it("says nothing when no polished reading was stored", () => {+ render(<TurnCard turn={turn({ user_text: RAW })} />);++ expect(screen.getByText(RAW)).toBeTruthy();+ expect(screen.queryByTestId("turn-polished-badge")).toBeNull();+ expect(screen.queryByTestId("turn-polished-toggle")).toBeNull();+ });++ it("claims no rewrite when the stored reading equals what was said", () => {+ // A stored value identical to the raw text is not a rewrite, and a badge+ // for it would claim a change that never happened.+ render(<TurnCard turn={turn({ user_text: RAW, user_text_polished: RAW })} />);++ expect(screen.queryByTestId("turn-polished-badge")).toBeNull();+ });++ it("renders a session recorded before the column existed", () => {+ const { user_text_polished: _omitted, ...legacy } = turn({ user_text: RAW });++ render(<TurnCard turn={legacy as VoiceTurnRow} />);++ expect(screen.getByText(RAW)).toBeTruthy();+ });+});+describe("TurnCard spoken track", () => {it("uses the contiguous display number instead of a stale stored index", () => {render(<TurnCard turn={turn({ idx: 1 })} displayNumber={1} />);diff --git a/jarvis/ui/web/frontend/src/components/sessions/TurnCard.tsx b/jarvis/ui/web/frontend/src/components/sessions/TurnCard.tsxindex a7c4575781..201b5662b2 100644--- a/jarvis/ui/web/frontend/src/components/sessions/TurnCard.tsx+++ b/jarvis/ui/web/frontend/src/components/sessions/TurnCard.tsx@@ -15,7 +15,7 @@ import {Volume2,Wrench,} from "lucide-react";-import { useCallback } from "react";+import { useCallback, useState } from "react";import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";@@ -69,6 +69,16 @@ interface Props {export function TurnCard({ turn, displayNumber, spoken = [] }: Props) {const t = useT();+ const [showRaw, setShowRaw] = useState(false);+ // `null` unless a polished reading exists AND differs from what was said.+ // A stored value equal to the raw text is not a rewrite, and showing a badge+ // for it would claim a change that never happened.+ const rawUserText = turn.user_text ?? "";+ const polishedUserText = (turn.user_text_polished ?? "").trim();+ const polished =+ polishedUserText && polishedUserText !== rawUserText.trim()+ ? polishedUserText+ : null;const pushToast = useEventStore((s) => s.pushToast);const assistantName = useEventStore((s) => s.assistantName);// Desktop shell → save to ~/Downloads via the backend; browser → blob download.@@ -172,10 +182,44 @@ export function TurnCard({ turn, displayNumber, spoken = [] }: Props) {<Badge variant="secondary" className="ml-1 text-[9px]">{turn.user_lang}</Badge>+ {/* Shown only when the two actually differ, so the badge means+ "this was rewritten" rather than "the feature is on". */}+ {polished && (+ <Badge+ variant="outline"+ className="ml-1 text-[9px]"+ data-testid="turn-polished-badge"+ >+ {t("session_turn.polished")}+ </Badge>+ )}</div><div className="min-w-0 whitespace-pre-wrap break-words rounded-md border border-emerald-400/20 bg-emerald-400/5 p-2 text-sm [overflow-wrap:anywhere]">- {turn.user_text}+ {polished ?? turn.user_text}</div>+ {/* The original is never more than one click away. A transcript is+ a RECORD of what was said, and a view that shows only a model's+ reading of it — with no way back — is no longer a record. */}+ {polished && (+ <button+ type="button"+ onClick={() => setShowRaw((v) => !v)}+ className="text-[11px] text-muted-foreground underline-offset-2 hover:underline"+ data-testid="turn-polished-toggle"+ >+ {showRaw+ ? t("session_turn.hide_original")+ : t("session_turn.show_original")}+ </button>+ )}+ {polished && showRaw && (+ <div+ className="min-w-0 whitespace-pre-wrap break-words rounded-md border border-border/60 bg-background/40 p-2 text-[13px] text-muted-foreground [overflow-wrap:anywhere]"+ data-testid="turn-raw-text"+ >+ {turn.user_text}+ </div>+ )}</div>)}diff --git a/jarvis/ui/web/frontend/src/components/sessions/types.ts b/jarvis/ui/web/frontend/src/components/sessions/types.tsindex 3d21207868..35dc206aed 100644--- a/jarvis/ui/web/frontend/src/components/sessions/types.ts+++ b/jarvis/ui/web/frontend/src/components/sessions/types.ts@@ -94,6 +94,14 @@ export interface VoiceTurnRow {started_ms: number;ended_ms: number | null;user_text: string;+ /**+ * The wording pass's reading of `user_text`; "" when it never ran, is+ * switched off, or was refused. Never replaces `user_text` — what was said is+ * the record, so the card shows this and keeps the original one click away.+ *+ * Optional so a session recorded before the column existed still parses.+ */+ user_text_polished?: string;user_lang: string;jarvis_text: string;jarvis_lang: string;diff --git a/jarvis/ui/web/frontend/src/hooks/useDictation.ts b/jarvis/ui/web/frontend/src/hooks/useDictation.tsindex 301212c688..02037d5ca0 100644--- a/jarvis/ui/web/frontend/src/hooks/useDictation.ts+++ b/jarvis/ui/web/frontend/src/hooks/useDictation.ts@@ -317,6 +317,14 @@ export interface DictationSettings {* Applies to a translated dictation too, through the same prompt clause.*/polish_precision: boolean;+ /**+ * Also tidy up the transcripts of ordinary conversations, not just dictation.+ *+ * Never delays a reply: the assistant answers the raw words and the tidied+ * version arrives afterwards, for the transcript view and the session record.+ * What was actually said is always kept alongside. Needs `polish`.+ */+ polish_conversation: boolean;/*** Deliver every dictation in `translate_target`, whatever language was* spoken. Ships OFF: it changes which words come out, not just how they arediff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex ed82e3b2fa..4813b1c7b4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -367,6 +367,9 @@"precision_title": "Wortwahl schärfen","precision_description": "Geht einen Schritt weiter und ändert auch, WELCHE Wörter benutzt werden: Ein vager Platzhalter wird zu dem Wort, das du wirklich gemeint hast, und Füllkonstruktionen werden zum einfachen Verb — aus „eine Entscheidung treffen“ wird „entscheiden“. Einfach und genau. Nie ein längeres Wort, nur damit es klüger klingt.","precision_tradeoff": "Dafür wird eine Sicherheitsprüfung gelockert: Ungewöhnliche Wörter dürfen jetzt ersetzt werden, ein falsch verstandenes Wort wird also eher ausgetauscht als angezeigt. Deine Namen, deine Zahlen und deine Wörterbuch-Einträge bleiben geschützt, und der Originaltext bleibt immer erhalten. Gilt auch für übersetzte Diktate.",+ "conversation_title": "Auch Gespräche aufräumen",+ "conversation_description": "Wendet dieselbe Aufbereitung auf das an, was du im normalen Gespräch sagst — nicht nur aufs Diktat. Die Transkript-Ansicht und dein Gesprächsverlauf lesen sich dann wie geschriebene Sätze statt wie roher Sprechtext.",+ "conversation_latency": "Die Antwort wird dadurch nie langsamer: Der Assistent antwortet sofort auf deine Rohworte, die aufgeräumte Fassung kommt einen Moment später. Was du wirklich gesagt hast, bleibt immer daneben erhalten.","provider_label": "Modell","provider_auto": "Automatisch — nimm den Schlüssel, den ich habe","provider_hint": "Automatisch nimmt einen Schlüssel, den du ohnehin hast, und wechselt zu einem anderen Anbieter, wenn einer am Limit oder ohne Guthaben ist. Feste Wahl nur, wenn ein bestimmtes Konto abgerechnet werden soll.",@@ -3930,5 +3933,10 @@"loading": "Aktuelle Einstellung wird gelesen...","unavailable": "Die aktuelle Einstellung konnte nicht gelesen werden.","save_failed": "Diese Auswahl konnte nicht gespeichert werden."+ },+ "session_turn": {+ "polished": "aufgeräumt",+ "show_original": "Zeigen, was wirklich gesagt wurde",+ "hide_original": "Original ausblenden"}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex e0729ab3db..2ec810627c 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -367,6 +367,9 @@"precision_title": "Sharpen my word choice","precision_description": "Goes one step further and also changes WHICH words are used: a vague placeholder becomes the word you actually meant, and padding collapses into the plain verb — \"make a decision\" becomes \"decide\". Simple and exact. It will never swap a normal word for a longer one just to sound impressive.","precision_tradeoff": "In exchange, one safety check is relaxed: replacing an unusual word is now allowed, so a word the model misheard can be replaced rather than flagged. Your names, your numbers and your dictionary terms stay protected, and the original transcript is always kept. Applies to translated dictation too.",+ "conversation_title": "Also tidy up conversations",+ "conversation_description": "Applies the same clean-up to what you say in an ordinary conversation, not just to dictation — so the transcript view and your session history read as written sentences instead of raw speech.",+ "conversation_latency": "It never slows a reply down: the assistant answers your raw words straight away, and the tidied version arrives a moment later. What was actually said is always kept alongside it.","provider_label": "Model","provider_auto": "Automatic — use whichever key I have","provider_hint": "Automatic takes a key you already have and moves to a different provider when one is rate-limited or out of credit. Pin one only if you want a specific account billed.",@@ -3930,5 +3933,10 @@"loading": "Reading the current setting...","unavailable": "The current setting could not be read.","save_failed": "That choice could not be saved."+ },+ "session_turn": {+ "polished": "tidied up",+ "show_original": "Show what was actually said",+ "hide_original": "Hide the original"}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex ee1c82e493..c21faacb04 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -367,6 +367,9 @@"precision_title": "Afinar mi elección de palabras","precision_description": "Va un paso más allá y también cambia QUÉ palabras se usan: un comodín vago se convierte en la palabra que de verdad querías decir, y el relleno se reduce al verbo simple: «tomar una decisión» pasa a «decidir». Sencillo y exacto. Nunca cambiará una palabra normal por otra más larga solo para sonar impresionante.","precision_tradeoff": "A cambio se relaja una comprobación de seguridad: ahora se permite sustituir una palabra poco común, así que una palabra mal entendida se reemplaza en vez de señalarse. Tus nombres, tus números y los términos de tu diccionario siguen protegidos, y el texto original siempre se conserva. También se aplica al dictado traducido.",+ "conversation_title": "Pulir también las conversaciones",+ "conversation_description": "Aplica la misma limpieza a lo que dices en una conversación normal, no solo al dictado: así la vista de transcripción y tu historial se leen como frases escritas en vez de como habla en bruto.",+ "conversation_latency": "Nunca retrasa una respuesta: el asistente responde de inmediato a tus palabras tal cual, y la versión pulida llega un momento después. Lo que dijiste realmente siempre se conserva al lado.","provider_label": "Modelo","provider_auto": "Automático: usa la clave que ya tengo","provider_hint": "El modo automático usa una clave que ya tienes y cambia a otro proveedor cuando uno alcanza su límite o se queda sin saldo. Fija uno solo si quieres que se cobre a una cuenta concreta.",@@ -3930,5 +3933,10 @@"loading": "Leyendo la configuración actual...","unavailable": "No se pudo leer la configuración actual.","save_failed": "No se pudo guardar esa selección."+ },+ "session_turn": {+ "polished": "pulido",+ "show_original": "Mostrar lo que se dijo realmente",+ "hide_original": "Ocultar el original"}}diff --git a/jarvis/ui/web/frontend/src/views/voice/LanguageTab.test.tsx b/jarvis/ui/web/frontend/src/views/voice/LanguageTab.test.tsxindex 066bfd6e31..20841b07e3 100644--- a/jarvis/ui/web/frontend/src/views/voice/LanguageTab.test.tsx+++ b/jarvis/ui/web/frontend/src/views/voice/LanguageTab.test.tsx@@ -572,6 +572,73 @@ describe("LanguageTab — the wording pass", () => {);});+ // ------------------------------------------------------------------+ // Conversation transcripts — the same pass, a second source+ // ------------------------------------------------------------------++ it("keeps conversation polish off until it is asked for", async () => {+ installFetchMock(routes());+ render(<LanguageTab hideHeader />);++ const toggle = await waitFor(() =>+ screen.getByTestId("dictation-conversation-toggle"),+ );+ // Off by default on COST, not safety: a conversation produces a turn every+ // few seconds and each one would spend a model call.+ expect(toggle.getAttribute("aria-checked")).toBe("false");+ // And the latency question is answered before anyone has to ask it.+ expect(+ screen.getByTestId("dictation-conversation-latency").textContent,+ ).toBeTruthy();+ });++ it("saves the conversation switch", async () => {+ const calls = installFetchMock(+ routes({+ "PUT /api/dictation/settings": () => ({+ body: {+ settings: { ...SETTINGS, polish_conversation: true },+ persisted: true,+ },+ }),+ }),+ );+ render(<LanguageTab hideHeader />);++ fireEvent.click(+ await waitFor(() => screen.getByTestId("dictation-conversation-toggle")),+ );++ await waitFor(() => {+ const put = calls.find(+ (c) => c.method === "PUT" && c.url === "/api/dictation/settings",+ );+ expect(JSON.parse(put?.body ?? "{}")).toMatchObject({+ polish_conversation: true,+ persist: true,+ });+ });+ });++ it("hides the conversation switch when the formatter is off", async () => {+ // Unlike precision, this one genuinely needs the formatter — it switches+ // the same pass on for a second source. A visible switch that saves, reads+ // as on and does nothing is the AP-31 shape.+ installFetchMock(+ routes({+ "GET /api/dictation/settings": () => ({+ body: { settings: { ...SETTINGS, polish: false }, choices: CHOICES },+ }),+ }),+ );+ render(<LanguageTab hideHeader />);++ await waitFor(() =>+ expect(screen.queryByTestId("dictation-polish-toggle")).toBeTruthy(),+ );+ expect(screen.queryByTestId("dictation-conversation-toggle")).toBeNull();+ });+// ------------------------------------------------------------------// Translation — same tab, and the switch that changes which words come out// ------------------------------------------------------------------diff --git a/jarvis/ui/web/frontend/src/views/voice/LanguageTab.tsx b/jarvis/ui/web/frontend/src/views/voice/LanguageTab.tsxindex 6ccb4c82ab..a7c2e7a731 100644--- a/jarvis/ui/web/frontend/src/views/voice/LanguageTab.tsx+++ b/jarvis/ui/web/frontend/src/views/voice/LanguageTab.tsx@@ -4,6 +4,7 @@ import {Info,Languages,Loader2,+ MessageSquare,PlugZap,Scissors,Wand2,@@ -112,6 +113,15 @@ export function LanguageTab({ hideHeader = false }: LanguageTabProps = {}) {}}+ async function onToggleConversation(next: boolean) {+ try {+ await saveSettings({ polish_conversation: next });+ pushToast("success", t("dictation.saved"));+ } catch (e) {+ pushToast("error", (e as Error).message);+ }+ }+async function onTogglePrecision(next: boolean) {// Clearing matters more here than on the other switches: the dry run uses a// DIFFERENT sample in precision mode, so a stale result would sit next to@@ -167,6 +177,7 @@ export function LanguageTab({ hideHeader = false }: LanguageTabProps = {}) {// Default OFF, unlike the switch above, and the card says why: this one// relaxes a guard rather than only costing a formatting pass.const precisionOn = settings?.polish_precision ?? false;+ const conversationOn = settings?.polish_conversation ?? false;const polishProvider = settings?.polish_provider ?? "auto";const served = choices?.polish_provider ?? ["auto"];// A pin the served list does not contain would otherwise render as the first@@ -327,6 +338,48 @@ export function LanguageTab({ hideHeader = false }: LanguageTabProps = {}) {{polishOn && (<>+ {/* INSIDE the block, unlike the precision row above: this one+ genuinely needs the formatter, because it switches the same+ pass on for a second source rather than being a pass of its+ own. Showing it while the formatter is off would be a switch+ that saves, reads as on, and does nothing (AP-31). */}+ <div+ className="mt-3 flex items-start justify-between gap-4 border-t border-border/60 pt-3"+ data-testid="dictation-conversation-row"+ >+ <div className="min-w-0">+ <h5 className="flex items-center gap-2 text-xs font-semibold">+ <MessageSquare+ aria-hidden="true"+ className="h-3 w-3 text-primary"+ />+ {t("voice.polish.conversation_title")}+ </h5>+ <p+ className="mt-1 text-[11px] text-muted-foreground"+ data-testid="dictation-conversation-description"+ >+ {t("voice.polish.conversation_description")}+ </p>+ {/* The question anyone asks about a model call on the voice+ path, answered before it is asked. It runs beside the+ reply, never in front of it. */}+ <p+ className="mt-1.5 text-[11px] text-muted-foreground"+ data-testid="dictation-conversation-latency"+ >+ {t("voice.polish.conversation_latency")}+ </p>+ </div>+ <Switch+ checked={conversationOn}+ disabled={loading}+ onCheckedChange={(next) => void onToggleConversation(next)}+ aria-label={t("voice.polish.conversation_title")}+ data-testid="dictation-conversation-toggle"+ />+ </div>+{/* The same themed control as the language picker above it —a native <select> sitting right beside one would put theoperating system's own grey list back on the card. No