Spaces:
Running
Running
Sync from felladrin/MiniSearch@74f42b1
Browse filesFiles changed (10)
- changelog.md+2
- client/components/Pages/Main/Menu/VoiceSettingsForm.test.tsx+34-1
- client/components/Pages/Main/Menu/VoiceSettingsForm.tsx+32-8
- client/modules/textToSpeech.test.ts+117-8
- client/modules/textToSpeech.ts+135-11
- docs/ai-integration.md+14-1
- docs/configuration.md+1-1
- docs/failure-injection.md+1
- package-lock.json+48
- package.json+1
6 unmodified lines7891011126 unmodified lines- The in-browser engine, wllama, moves from 3.8.1 to 3.13.0. It now handles a model download that stopped midway by itself, so MiniSearch no longer deletes those files before each load.- Dictation's on-device model is now Qwen3-ASR 0.6B, run through wllama, instead of Moonshine. It understands every language MiniSearch answers in, not only English, so the setting that prefers it is now on by default for every browser; a profile saved before keeps its value, so a non-English profile turns it on in the Voice settings. The text now appears when the user stops recording rather than while they speak (about 2 seconds for a short query on WebGPU), and a recording ends on its own after two minutes. The first press downloads about 700 MB from Hugging Face, against 51 MB before, and later presses load it from the browser's storage in about 2 seconds; leaving the page or turning dictation off mid-download aborts it. The Moonshine runtime leaves the build, which shrinks from 35.7 MB to 22.2 MB, and the `/dictation-models/` route and `DICTATION_MODELS_DIR` are gone, since the server no longer serves model files. `docs/speech-model-evaluation.md` records the speech models tried for dictation and reading aloud, and why the others were turned down.## 2026-11-08- MiniSearch now checks that the GPU can run wllama's shaders before using it, instead of only checking that the browser has WebGPU. The shaders use subgroups and the `subgroup_id` builtin, so the GPU is used only when the browser's shader compiler supports `subgroup_id`, an adapter answers within 5 seconds, it is not a software fallback, and it has the `subgroups` feature. Otherwise the model runs on the CPU and a new profile starts on the CPU default model. On Chrome 137, which has WebGPU but not `subgroup_id`, every model used to abort; it now answers on the CPU with LittleLamb 290M. The logs say which check failed.6 unmodified lines78910111213146 unmodified lines- The in-browser engine, wllama, moves from 3.8.1 to 3.13.0. It now handles a model download that stopped midway by itself, so MiniSearch no longer deletes those files before each load.- Dictation's on-device model is now Qwen3-ASR 0.6B, run through wllama, instead of Moonshine. It understands every language MiniSearch answers in, not only English, so the setting that prefers it is now on by default for every browser; a profile saved before keeps its value, so a non-English profile turns it on in the Voice settings. The text now appears when the user stops recording rather than while they speak (about 2 seconds for a short query on WebGPU), and a recording ends on its own after two minutes. The first press downloads about 700 MB from Hugging Face, against 51 MB before, and later presses load it from the browser's storage in about 2 seconds; leaving the page or turning dictation off mid-download aborts it. The Moonshine runtime leaves the build, which shrinks from 35.7 MB to 22.2 MB, and the `/dictation-models/` route and `DICTATION_MODELS_DIR` are gone, since the server no longer serves model files. `docs/speech-model-evaluation.md` records the speech models tried for dictation and reading aloud, and why the others were turned down.- Reading answers aloud now speaks the answer's language. With no voice chosen, the voice is picked for the language the answer is written in, detected with `franc-min`, instead of the browser's: on an English browser, an answer in Portuguese is read by a Portuguese voice. The Voice settings panel lists every local voice (124 in 34 languages today) grouped by language, with the browser's language first, where it used to list only the browser's language, and the engine is no longer labeled "English-only". The detector is a new dependency, a 109 KB script (51 KB compressed) loaded on the first Listen press rather than with the page. A browser language the detector does not know (Danish, Finnish and Catalan among them) keeps its voice, as before, and a chosen voice reads every answer. Japanese, Korean and Hindi have no local voice, so their answers are read by an OS voice of that language.## 2026-11-08- MiniSearch now checks that the GPU can run wllama's shaders before using it, instead of only checking that the browser has WebGPU. The shaders use subgroups and the `subgroup_id` builtin, so the GPU is used only when the browser's shader compiler supports `subgroup_id`, an adapter answers within 5 seconds, it is not a software fallback, and it has the `subgroups` feature. Otherwise the model runs on the CPU and a new profile starts on the CPU default model. On Chrome 137, which has WebGPU but not `subgroup_id`, every model used to abort; it now answers on the CPU with LittleLamb 290M. The logs say which check failed.
8 unmodified lines91011121314151682 unmodified lines9910010110210310441 unmodified lines1461471481491501511528 unmodified lineslabel: "lessac • English (high)",engine: "local",languageCode: "en_US",};const systemVoice: VoiceOption = {value: "system:os-voice",label: "OS Voice • en-US",82 unmodified lines]);});it("lists only the system voices while the system engine is selected", async () => {settings.current.textToSpeechEngine = "system";renderForm();41 unmodified linesconst engine = screen.getAllByRole("combobox")[0] as HTMLElement;fireEvent.click(openSelect(engine).getByRole("option", {name: "System voices (Multi-lingual)",hidden: true,}),);8 unmodified lines91011121314151617181920212223242582 unmodified lines10810911011111211311411511611711811912012112212312412512612712812913013113213313413513613741 unmodified lines1791801811821831841858 unmodified lineslabel: "lessac • English (high)",engine: "local",languageCode: "en_US",languageName: "English",};const portugueseVoices: VoiceOption[] = ["pt_BR", "pt_PT"].map((code) => ({value: `piper:${code}-voice-medium`,label: `voice • Portuguese (medium)`,engine: "local",languageCode: code,languageName: "Portuguese",}));const systemVoice: VoiceOption = {value: "system:os-voice",label: "OS Voice • en-US",82 unmodified lines]);});it("groups the local voices by language, in the order they are listed", async () => {listVoices.mockResolvedValue([...portugueseVoices, localVoice]);renderForm();await screen.findByText("Voice Selection");const listbox = openSelect(voiceInput());const groups = listbox.getAllByRole("group", { hidden: true }).map((group) => [group.firstElementChild?.textContent,within(group).getAllByRole("option", { hidden: true }).map((option) => option.textContent),]);expect(groups).toEqual([["Portuguese",["🇧🇷 voice • Portuguese (medium)", "🇵🇹 voice • Portuguese (medium)"],],["English", ["🇺🇸 lessac • English (high)"]],]);});it("lists only the system voices while the system engine is selected", async () => {settings.current.textToSpeechEngine = "system";renderForm();41 unmodified linesconst engine = screen.getAllByRole("combobox")[0] as HTMLElement;fireEvent.click(openSelect(engine).getByRole("option", {name: "System voices",hidden: true,}),);
123447 unmodified lines52535455565730 unmodified lines88899091929394951 unmodified line979899100101102103104105106107108109110111112113import { Select, Stack, Switch, Text } from "@mantine/core";import { useForm } from "@mantine/form";import getUnicodeFlagIcon from "country-flag-icons/unicode";import { usePubSub } from "create-pubsub/react";47 unmodified lines};}, [settings.textToSpeechEngine]);return (<Stack gap="xs"><Switch30 unmodified lines}));}}data={[{ value: "local", label: "Local neural voice (English-only)" },{ value: "system", label: "System voices (Multi-lingual)" },]}allowDeselect={false}/>1 unmodified line<Text size="xs" c="dimmed">Choose the voice to use when reading AI responses aloud. Only the voicesof the selected engine are listed. Leave it empty to pick oneautomatically for your language.</Text><Select// Remounting drops the label Mantine keeps for the previous value, which// would otherwise filter the new engine's list as if it were typed.key={settings.textToSpeechEngine}{...form.getInputProps("selectedVoiceId")}data={voiceOptions.map((option) => ({value: option.value,label: `${getCountryFlag(option.languageCode)} ${option.label}`,}))}searchablenothingFoundMessage="No voices found"placeholder="Auto-detected"123456789101147 unmodified lines5960616263646566676869707172737475767778798081828330 unmodified lines1141151161171181191201211 unmodified line123124125126127128129130131132133134135136137import {type ComboboxItem,type ComboboxItemGroup,Select,Stack,Switch,Text,} from "@mantine/core";import { useForm } from "@mantine/form";import getUnicodeFlagIcon from "country-flag-icons/unicode";import { usePubSub } from "create-pubsub/react";47 unmodified lines};}, [settings.textToSpeechEngine]);// `listVoices` keeps each language's voices together, so a group only ever// continues the one before it.const voiceData: (ComboboxItem | ComboboxItemGroup<ComboboxItem>)[] = [];for (const option of voiceOptions) {const item = {value: option.value,label: `${getCountryFlag(option.languageCode)} ${option.label}`,};const previous = voiceData.at(-1);if (!option.languageName) voiceData.push(item);else if (previous &&"group" in previous &&previous.group === option.languageName)previous.items.push(item);else voiceData.push({ group: option.languageName, items: [item] });}return (<Stack gap="xs"><Switch30 unmodified lines}));}}data={[{ value: "local", label: "Local neural voice (many languages)" },{ value: "system", label: "System voices" },]}allowDeselect={false}/>1 unmodified line<Text size="xs" c="dimmed">Choose the voice to use when reading AI responses aloud. Only the voicesof the selected engine are listed. Leave it empty to pick oneautomatically for the language of each response; a voice you choosereads every response, whatever its language.</Text><Select// Remounting drops the label Mantine keeps for the previous value, which// would otherwise filter the new engine's list as if it were typed.key={settings.textToSpeechEngine}{...form.getInputProps("selectedVoiceId")}data={voiceData}searchablenothingFoundMessage="No voices found"placeholder="Auto-detected"
40 unmodified lines4142434445468 unmodified lines5556575859604 unmodified lines65666768697040 unmodified lines111112113114115116117118220 unmodified lines33934034134234334437 unmodified lines38238338438538638738838939039139239339439540 unmodified lineslanguage: { code: "en_US", name_english: "English" },};/** A worker stub the test drives by hand, standing in for the real one. */function createFakeWorker() {const sent: WorkerRequest[] = [];8 unmodified lines}let spoken: string[] = [];let createdObjectUrls = 0;let handlersAtSourceClear: {onended: (() => void) | null;4 unmodified linesvi.clearAllMocks();vi.resetModules();spoken = [];settings.selectedVoiceId = "";settings.textToSpeechEngine = "local";mockVoices.mockResolvedValue([englishVoice]);40 unmodified lines{ voiceURI: "os-voice", name: "OS Voice", lang: "en-US" },],cancel: vi.fn(),speak: (utterance: { text: string; onend: (() => void) | null }) => {spoken.push(utterance.text);queueMicrotask(() => utterance.onend?.());},});220 unmodified linesexpect(mockUpdateState).toHaveBeenLastCalledWith("idle");});it("stops playback without falling back to the system voice", async () => {const worker = createFakeWorker();tts.setWorkerFactory(() => worker as unknown as Worker);37 unmodified lines});describe("listVoices", () => {it("offers only the local voices for the language", async () => {const options = await tts.listVoices("en-US");expect(options).toEqual([expect.objectContaining({value: "piper:en_US-lessac-high",engine: "local",}),]);});40 unmodified lines414243444546474849505152535455565758596061626364656667686970717273747576778 unmodified lines868788899091924 unmodified lines97989910010110210340 unmodified lines144145146147148149150151152153154155156220 unmodified lines37737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945037 unmodified lines48848949049149249349449549649749849950050150250350440 unmodified lineslanguage: { code: "en_US", name_english: "English" },};const portugueseVoice = {key: "pt_BR-faber-medium",name: "faber",quality: "medium",language: { code: "pt_BR", name_english: "Portuguese" },};const germanVoice = {key: "de_DE-thorsten-medium",name: "thorsten",quality: "medium",language: { code: "de_DE", name_english: "German" },};const swedishVoice = {key: "sv_SE-nst-medium",name: "nst",quality: "medium",language: { code: "sv_SE", name_english: "Swedish" },};const danishVoice = {key: "da_DK-talesyntese-medium",name: "talesyntese",quality: "medium",language: { code: "da_DK", name_english: "Danish" },};const portugueseAnswer ="A Torre Eiffel foi construída em 1889 para a Exposição Universal de Paris e tem cerca de 330 metros de altura.";/** A worker stub the test drives by hand, standing in for the real one. */function createFakeWorker() {const sent: WorkerRequest[] = [];8 unmodified lines}let spoken: string[] = [];let spokenLanguages: string[] = [];let createdObjectUrls = 0;let handlersAtSourceClear: {onended: (() => void) | null;4 unmodified linesvi.clearAllMocks();vi.resetModules();spoken = [];spokenLanguages = [];settings.selectedVoiceId = "";settings.textToSpeechEngine = "local";mockVoices.mockResolvedValue([englishVoice]);40 unmodified lines{ voiceURI: "os-voice", name: "OS Voice", lang: "en-US" },],cancel: vi.fn(),speak: (utterance: {text: string;lang: string;onend: (() => void) | null;}) => {spoken.push(utterance.text);spokenLanguages.push(utterance.lang);queueMicrotask(() => utterance.onend?.());},});220 unmodified linesexpect(mockUpdateState).toHaveBeenLastCalledWith("idle");});it("picks the local voice for the answer's language, not the browser's", async () => {mockVoices.mockResolvedValue([englishVoice, portugueseVoice]);const worker = createFakeWorker();tts.setWorkerFactory(() => worker as unknown as Worker);void tts.speak(portugueseAnswer);await vi.waitFor(() => expect(worker.sent).toHaveLength(1));expect(worker.sent[0].voiceId).toBe("pt_BR-faber-medium");});it("keeps a chosen voice whatever the answer's language", async () => {mockVoices.mockResolvedValue([englishVoice, portugueseVoice]);settings.selectedVoiceId = "piper:en_US-lessac-high";const worker = createFakeWorker();tts.setWorkerFactory(() => worker as unknown as Worker);void tts.speak(portugueseAnswer);await vi.waitFor(() => expect(worker.sent).toHaveLength(1));expect(worker.sent[0].voiceId).toBe("en_US-lessac-high");});it("keeps the browser language when the detector cannot recognize it", async () => {// franc-min has no Danish and reads this sentence as Swedish.vi.stubGlobal("navigator", { language: "da-DK" });mockVoices.mockResolvedValue([swedishVoice, danishVoice]);const worker = createFakeWorker();tts.setWorkerFactory(() => worker as unknown as Worker);void tts.speak("Eiffeltårnet blev bygget i 1889 til verdensudstillingen i Paris og er omkring 330 meter højt.",);await vi.waitFor(() => expect(worker.sent).toHaveLength(1));expect(worker.sent[0].voiceId).toBe("da_DK-talesyntese-medium");});it("uses the browser language when the detector fails to load", async () => {vi.doMock("franc-min", () => {throw new Error("chunk failed to load");});try {tts = await import("./textToSpeech");mockVoices.mockResolvedValue([englishVoice, portugueseVoice]);const worker = createFakeWorker();tts.setWorkerFactory(() => worker as unknown as Worker);void tts.speak(portugueseAnswer);await vi.waitFor(() => expect(worker.sent).toHaveLength(1));expect(worker.sent[0].voiceId).toBe("en_US-lessac-high");expect(mockAddLogEntry).toHaveBeenCalledWith(expect.stringContaining("Could not detect the answer's language"),);} finally {vi.doUnmock("franc-min");}});it("asks the system engine for the answer's language", async () => {settings.textToSpeechEngine = "system";await tts.speak(portugueseAnswer);expect(spokenLanguages).toEqual(["pt"]);});it("stops playback without falling back to the system voice", async () => {const worker = createFakeWorker();tts.setWorkerFactory(() => worker as unknown as Worker);37 unmodified lines});describe("listVoices", () => {it("offers the local voices of every language, the given language first", async () => {mockVoices.mockResolvedValue([germanVoice, englishVoice, portugueseVoice]);const options = await tts.listVoices("pt-BR");expect(options.map(({ value, languageName }) => [value, languageName]),).toEqual([["piper:pt_BR-faber-medium", "Portuguese"],["piper:en_US-lessac-high", "English"],["piper:de_DE-thorsten-medium", "German"],]);});
22 unmodified lines23242526272840 unmodified lines69707172737413 unmodified lines888990919293949596974 unmodified lines10210310410510610710810911011111211311473 unmodified lines1881891901911921934 unmodified lines198199200201202203210 unmodified lines41441541641741841942042142242342442542619 unmodified lines44644744844945045145222 unmodified lineslabel: string;engine: TextToSpeechEngine;languageCode: string;}/** The markers come from user settings, so a character like `(` must not be read as syntax. */40 unmodified linesreturn code.replace("_", "-").split("-")[0].toLowerCase();}let cachedLocalVoices: Promise<Voice[]> | null = null;/**13 unmodified lines}/*** Lists only the voices the given engine can actually play: the local voices for* the given language, or every `speechSynthesis` voice. Listing the local* voices means fetching the catalogue over the network, so it must not happen* when the user has opted out of the local engine.*/export async function listVoices(languageCode: string = navigator.language,4 unmodified linesif (engine !== "system") {try {for (const voice of await getLocalVoices()) {if (primaryLanguage(voice.language.code) !== wanted) continue;options.push({value: `${LOCAL_VOICE_PREFIX}${voice.key}`,label: `${voice.name} • ${voice.language.name_english} (${voice.quality})`,engine: "local",languageCode: voice.language.code,});}} catch (error) {73 unmodified linesfunction speakWithSystemVoice(text: string,storedVoiceId: string,session: SpeechSession,): Promise<void> {return new Promise((resolve) => {4 unmodified lines}const utterance = new SpeechSynthesisUtterance(text);const wantedUri = storedVoiceId.startsWith(SYSTEM_VOICE_PREFIX)? storedVoiceId.slice(SYSTEM_VOICE_PREFIX.length): storedVoiceId;210 unmodified linesconst wantsSystemVoice =settings.textToSpeechEngine === "system" ||storedVoiceId.startsWith(SYSTEM_VOICE_PREFIX);if (!wantsSystemVoice) {try {const voiceId = await resolveLocalVoiceId(storedVoiceId,navigator.language,);if (stopRequested) return;if (voiceId) {// Returning here is what keeps a stop silent: `speakWithLocalVoice`19 unmodified lines}if (stopRequested) return;await speakWithSystemVoice(spokenText, storedVoiceId, session);} finally {// A session that has already been replaced must not clear the live one.if (activeSession === session) {22 unmodified lines232425262728293040 unmodified lines717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918013 unmodified lines1941951961971981992002012022032044 unmodified lines20921021121221321421521621721821922022122222322422522622722873 unmodified lines3023033043053063073084 unmodified lines313314315316317318319320210 unmodified lines53153253353453553653753853954054154254354454519 unmodified lines56556656756856957057157257357457557622 unmodified lineslabel: string;engine: TextToSpeechEngine;languageCode: string;/** Set on local voices only, which the settings form groups by language. */languageName?: string;}/** The markers come from user settings, so a character like `(` must not be read as syntax. */40 unmodified linesreturn code.replace("_", "-").split("-")[0].toLowerCase();}/*** franc-min names languages in ISO 639-3, while the voices use the two-letter* codes. Its languages without a two-letter code are left out.*/const LANGUAGE_BY_FRANC_CODE: Record<string, string> = {amh: "am",arb: "ar",azj: "az",bel: "be",ben: "bn",bos: "bs",bul: "bg",ces: "cs",cmn: "zh",deu: "de",ell: "el",eng: "en",fra: "fr",guj: "gu",hau: "ha",hin: "hi",hrv: "hr",hun: "hu",ibo: "ig",ind: "id",ita: "it",jav: "jv",jpn: "ja",kan: "kn",kaz: "kk",kin: "rw",kor: "ko",lin: "ln",mal: "ml",mar: "mr",mya: "my",nld: "nl",npi: "ne",nya: "ny",pan: "pa",pbu: "ps",pes: "fa",plt: "mg",pol: "pl",por: "pt",ron: "ro",run: "rn",rus: "ru",sin: "si",som: "so",spa: "es",srp: "sr",sun: "su",swe: "sv",swh: "sw",tam: "ta",tel: "te",tgl: "tl",tha: "th",tur: "tr",ukr: "uk",urd: "ur",uzn: "uz",vie: "vi",yor: "yo",zlm: "ms",zul: "zu",};const DETECTABLE_LANGUAGES = new Set(Object.values(LANGUAGE_BY_FRANC_CODE));/*** The language an answer is written in, which can differ from the browser's:* the model answers in the language of the question. Falls back to the browser* language when the text is too short to tell, and keeps it outright when* franc-min cannot recognize it (Danish, Finnish, Catalan...), because it would* then read an answer in that language as a neighbouring one.*/async function detectAnswerLanguage(text: string,browserLanguage: string,): Promise<string> {const browserPrimary = primaryLanguage(browserLanguage);if (!DETECTABLE_LANGUAGES.has(browserPrimary)) return browserLanguage;try {const { franc } = await import("franc-min");const detected =LANGUAGE_BY_FRANC_CODE[franc(text, { only: Object.keys(LANGUAGE_BY_FRANC_CODE) })];return !detected || detected === browserPrimary? browserLanguage: detected;} catch (error) {addLogEntry(`Could not detect the answer's language, using the browser's: ${error instanceof Error ? error.message : "unknown error"}`,);return browserLanguage;}}let cachedLocalVoices: Promise<Voice[]> | null = null;/**13 unmodified lines}/*** Lists only the voices the given engine can actually play: every local voice,* those of the given language first and the rest by language name, or every* `speechSynthesis` voice. Listing the local voices means fetching the* catalogue over the network, so it must not happen when the user has opted* out of the local engine.*/export async function listVoices(languageCode: string = navigator.language,4 unmodified linesif (engine !== "system") {try {const rank = (voice: Voice) =>primaryLanguage(voice.language.code) === wanted ? 0 : 1;const sorted = [...(await getLocalVoices())].sort((a, b) =>rank(a) - rank(b) ||a.language.name_english.localeCompare(b.language.name_english),);for (const voice of sorted) {options.push({value: `${LOCAL_VOICE_PREFIX}${voice.key}`,label: `${voice.name} • ${voice.language.name_english} (${voice.quality})`,engine: "local",languageCode: voice.language.code,languageName: voice.language.name_english,});}} catch (error) {73 unmodified linesfunction speakWithSystemVoice(text: string,storedVoiceId: string,languageCode: string,session: SpeechSession,): Promise<void> {return new Promise((resolve) => {4 unmodified lines}const utterance = new SpeechSynthesisUtterance(text);// Without a voice, the OS picks its own voice for this language.utterance.lang = languageCode;const wantedUri = storedVoiceId.startsWith(SYSTEM_VOICE_PREFIX)? storedVoiceId.slice(SYSTEM_VOICE_PREFIX.length): storedVoiceId;210 unmodified linesconst wantsSystemVoice =settings.textToSpeechEngine === "system" ||storedVoiceId.startsWith(SYSTEM_VOICE_PREFIX);const languageCode = await detectAnswerLanguage(spokenText,navigator.language,);if (stopRequested) return;if (!wantsSystemVoice) {try {const voiceId = await resolveLocalVoiceId(storedVoiceId, languageCode);if (stopRequested) return;if (voiceId) {// Returning here is what keeps a stop silent: `speakWithLocalVoice`19 unmodified lines}if (stopRequested) return;await speakWithSystemVoice(spokenText,storedVoiceId,languageCode,session,);} finally {// A session that has already been replaced must not clear the live one.if (activeSession === session) {
367 unmodified lines368369370371372373374367 unmodified linesThe catalogue is fetched at runtime from the published voice index rather thanhardcoded: it already lists more voices than the package's own `VoiceId` union,and a stale copy would offer voices that fail to download. The settings formgroups local voices for the current language separately from the OS voices.### Third-party requests367 unmodified lines368369370371372373374375376377378379380381382383384385386387367 unmodified linesThe catalogue is fetched at runtime from the published voice index rather thanhardcoded: it already lists more voices than the package's own `VoiceId` union,and a stale copy would offer voices that fail to download. The settings formlists every local voice, grouped by language, with the browser's languagefirst. It lists the OS voices only when the system engine is selected.With no voice chosen, `speak()` picks one for the language of the answer,which follows the question's language rather than the browser's. `franc-min`detects it, loaded on the first Listen press rather than with the page, and thefirst local voice of that language reads the answer. With the system engine,or when no local voice speaks that language (Japanese, Korean and Hindi havenone), the language is passed to `speechSynthesis` so the OS picks its ownvoice. The browser's language is used instead when the detector cannot tell,fails to load, or does not know the browser's language at all (Danish, Finnishand Catalan among them), since it would then read an answer in that languageas a neighbouring one. A chosen voice reads every answer, whatever itslanguage.### Third-party requests
215 unmodified lines216217218219220221222215 unmodified lines| Setting | Type | Default | Description || --------------------------- | --------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || `selectedVoiceId` | string | `""` | Voice for reading answers aloud. `piper:<voice>` picks a local neural voice, `system:<voiceURI>` an OS voice, and `""` picks one automatically for the browser language. The Voice settings panel lists only the voices of the selected engine, and switching that engine resets this to `""`. A bare value stored by an earlier version is read as an OS voice whenever the system engine runs; with the local engine it is ignored in favor of a language match || `textToSpeechEngine` | `"local" \| "system"` | `"local"` | Which engine reads answers aloud, and which set of voices the Voice settings panel lists. `"system"` also overrides a local voice picked above, and stops the voice list from being fetched, so it never contacts a third-party host. A profile that had picked an OS voice before this setting existed starts on `"system"`, so the upgrade does not replace that choice with a model download || `enableDictation` | boolean | `true` | Shows the microphone button inside the search field and the chat follow-up field, which fills whichever one it sits in while the user speaks. Turning this off hides the button and loads nothing. The button is also hidden outside a secure context, so an instance served over plain HTTP on a LAN will not show it: no browser grants microphone access there || `enableLocalDictationModel` | boolean | `true` | Whether the dictation button prefers the on-device Qwen3-ASR model, which transcribes many languages without the audio leaving the device. The first press downloads ~700 MB from Hugging Face, and later presses load it from the browser's storage. The model writes the text once the recording stops, and a recording ends on its own after two minutes. With this off, the button uses the browser's built-in `SpeechRecognition`, which shows the text while the user speaks but may send the audio to the browser vendor. The preference reorders the two engines and never removes one: on browsers without `SpeechRecognition` the on-device model is used regardless. Until the model became multilingual, the default was `true` only for an English browser, and a profile saved back then keeps its stored value, so the Voice settings panel is where a non-English profile turns it on |215 unmodified lines216217218219220221222215 unmodified lines| Setting | Type | Default | Description || --------------------------- | --------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || `selectedVoiceId` | string | `""` | Voice for reading answers aloud. `piper:<voice>` picks a local neural voice, `system:<voiceURI>` an OS voice, and `""` picks one automatically for the language of each answer (see [ai-integration.md](ai-integration.md#voices)). The Voice settings panel lists only the voices of the selected engine, the local ones in every language, and switching that engine resets this to `""`. A bare value stored by an earlier version is read as an OS voice whenever the system engine runs; with the local engine it is ignored in favor of a language match || `textToSpeechEngine` | `"local" \| "system"` | `"local"` | Which engine reads answers aloud, and which set of voices the Voice settings panel lists. `"system"` also overrides a local voice picked above, and stops the voice list from being fetched, so it never contacts a third-party host. A profile that had picked an OS voice before this setting existed starts on `"system"`, so the upgrade does not replace that choice with a model download || `enableDictation` | boolean | `true` | Shows the microphone button inside the search field and the chat follow-up field, which fills whichever one it sits in while the user speaks. Turning this off hides the button and loads nothing. The button is also hidden outside a secure context, so an instance served over plain HTTP on a LAN will not show it: no browser grants microphone access there || `enableLocalDictationModel` | boolean | `true` | Whether the dictation button prefers the on-device Qwen3-ASR model, which transcribes many languages without the audio leaving the device. The first press downloads ~700 MB from Hugging Face, and later presses load it from the browser's storage. The model writes the text once the recording stops, and a recording ends on its own after two minutes. With this off, the button uses the browser's built-in `SpeechRecognition`, which shows the text while the user speaks but may send the audio to the browser vendor. The preference reorders the two engines and never removes one: on browsers without `SpeechRecognition` the on-device model is used regardless. Until the model became multilingual, the default was `true` only for an English browser, and a profile saved back then keeps its stored value, so the Voice settings panel is where a non-English profile turns it on |
76 unmodified lines77787980818276 unmodified lines| Generation interrupted mid-stream | Partial answer preserved, state stays `interrupted` | `client/modules/textGeneration.degradation.test.ts` || The local voice catalogue cannot be fetched | The local engine is skipped and the answer is read by an OS voice | `client/modules/textToSpeech.test.ts` › falls back when the voice catalogue cannot be reached || No local voice matches the language | Same, with a log entry naming the reason | `client/modules/textToSpeech.test.ts` › falls back when no local voice matches the language || The synthesis worker fails before anything is audible | The answer is read by an OS voice instead | `client/modules/textToSpeech.test.ts` › falls back to the system voice when the local engine cannot load, falls back when the worker fails and no chunk was ever audible || Every synthesized chunk fails to play (blocked autoplay) | Treated as a local-engine failure, so an OS voice reads the answer rather than the user getting silence | `client/modules/textToSpeech.test.ts` › falls back when every synthesized chunk fails to play || The browser provides no `speechSynthesis` at all and the local engine failed | Playback resolves and returns to idle with a log entry, instead of an unhandled rejection | `client/modules/textToSpeech.test.ts` › resolves and logs when the local engine failed and there are no OS voices |76 unmodified lines7778798081828376 unmodified lines| Generation interrupted mid-stream | Partial answer preserved, state stays `interrupted` | `client/modules/textGeneration.degradation.test.ts` || The local voice catalogue cannot be fetched | The local engine is skipped and the answer is read by an OS voice | `client/modules/textToSpeech.test.ts` › falls back when the voice catalogue cannot be reached || No local voice matches the language | Same, with a log entry naming the reason | `client/modules/textToSpeech.test.ts` › falls back when no local voice matches the language || The language detector fails to load | The answer is read in the browser's language, with a log entry naming the reason | `client/modules/textToSpeech.test.ts` › uses the browser language when the detector fails to load || The synthesis worker fails before anything is audible | The answer is read by an OS voice instead | `client/modules/textToSpeech.test.ts` › falls back to the system voice when the local engine cannot load, falls back when the worker fails and no chunk was ever audible || Every synthesized chunk fails to play (blocked autoplay) | Treated as a local-engine failure, so an OS voice reads the answer rather than the user getting silence | `client/modules/textToSpeech.test.ts` › falls back when every synthesized chunk fails to play || The browser provides no `speechSynthesis` at all and the local engine failed | Playback resolves and returns to idle with a log entry, instead of an unhandled rejection | `client/modules/textToSpeech.test.ts` › resolves and logs when the local engine failed and there are no OS voices |
30 unmodified lines3132333435363086 unmodified lines312331243125312631273128570 unmodified lines3699370037013702370337042073 unmodified lines5778577957805781578257831578 unmodified lines73627363736473657366736730 unmodified lines"dexie": "^4.0.11","dotenv": "^18.0.0","embla-carousel-react": "^8.3.0","gpt-tokenizer": "^4.0.0","hash-wasm": "4.12.0","helper-git-hash": "^1.0.0",3086 unmodified lines"node": ">=6"}},"node_modules/comma-separated-tokens": {"version": "2.0.3","resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",570 unmodified lines"node": ">=18.14.0"}},"node_modules/fsevents": {"version": "2.3.3","resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",2073 unmodified lines"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==","license": "MIT"},"node_modules/nanoid": {"version": "3.3.20","resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",1578 unmodified lines"node": "^22.14.0 || >=24.0.0"}},"node_modules/trim-lines": {"version": "3.0.1","resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",30 unmodified lines313233343536373086 unmodified lines3124312531263127312831293130313131323133313431353136313731383139570 unmodified lines37103711371237133714371537163717371837193720372137223723372437253726372737282073 unmodified lines58025803580458055806580758085809581058115812581358145815581658171578 unmodified lines7396739773987399740074017402740374047405740674077408740974107411741274137414741530 unmodified lines"dexie": "^4.0.11","dotenv": "^18.0.0","embla-carousel-react": "^8.3.0","franc-min": "^6.2.0","gpt-tokenizer": "^4.0.0","hash-wasm": "4.12.0","helper-git-hash": "^1.0.0",3086 unmodified lines"node": ">=6"}},"node_modules/collapse-white-space": {"version": "2.1.0","resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz","integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==","license": "MIT","funding": {"type": "github","url": "https://github.com/sponsors/wooorm"}},"node_modules/comma-separated-tokens": {"version": "2.0.3","resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",570 unmodified lines"node": ">=18.14.0"}},"node_modules/franc-min": {"version": "6.2.0","resolved": "https://registry.npmjs.org/franc-min/-/franc-min-6.2.0.tgz","integrity": "sha512-1uDIEUSlUZgvJa2AKYR/dmJC66v/PvGQ9mWfI9nOr/kPpMFyvswK0gPXOwpYJYiYD008PpHLkGfG58SPjQJFxw==","license": "MIT","dependencies": {"trigram-utils": "^2.0.0"},"funding": {"type": "github","url": "https://github.com/sponsors/wooorm"}},"node_modules/fsevents": {"version": "2.3.3","resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",2073 unmodified lines"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==","license": "MIT"},"node_modules/n-gram": {"version": "2.0.2","resolved": "https://registry.npmjs.org/n-gram/-/n-gram-2.0.2.tgz","integrity": "sha512-S24aGsn+HLBxUGVAUFOwGpKs7LBcG4RudKU//eWzt/mQ97/NMKQxDWHyHx63UNWk/OOdihgmzoETn1tf5nQDzQ==","license": "MIT","funding": {"type": "github","url": "https://github.com/sponsors/wooorm"}},"node_modules/nanoid": {"version": "3.3.20","resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",1578 unmodified lines"node": "^22.14.0 || >=24.0.0"}},"node_modules/trigram-utils": {"version": "2.0.1","resolved": "https://registry.npmjs.org/trigram-utils/-/trigram-utils-2.0.1.tgz","integrity": "sha512-nfWIXHEaB+HdyslAfMxSqWKDdmqY9I32jS7GnqpdWQnLH89r6A5sdk3fDVYqGAZ0CrT8ovAFSAo6HRiWcWNIGQ==","license": "MIT","dependencies": {"collapse-white-space": "^2.0.0","n-gram": "^2.0.0"},"funding": {"type": "github","url": "https://github.com/sponsors/wooorm"}},"node_modules/trim-lines": {"version": "3.0.1","resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
63 unmodified lines64656667686963 unmodified lines"dexie": "^4.0.11","dotenv": "^18.0.0","embla-carousel-react": "^8.3.0","gpt-tokenizer": "^4.0.0","hash-wasm": "4.12.0","helper-git-hash": "^1.0.0",63 unmodified lines6465666768697063 unmodified lines"dexie": "^4.0.11","dotenv": "^18.0.0","embla-carousel-react": "^8.3.0","franc-min": "^6.2.0","gpt-tokenizer": "^4.0.0","hash-wasm": "4.12.0","helper-git-hash": "^1.0.0",
changelog.md+2
client/components/Pages/Main/Menu/VoiceSettingsForm.test.tsx+34-1
client/components/Pages/Main/Menu/VoiceSettingsForm.tsx+32-8
client/modules/textToSpeech.test.ts+117-8
client/modules/textToSpeech.ts+135-11
docs/ai-integration.md+14-1
docs/configuration.md+1-1
docs/failure-injection.md+1
package-lock.json+48
package.json+1