Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Desktop: fix dictation failing with a blocked speech service (#7799)

Nilay96a5a3a241a8
diff --git a/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts b/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts
index 780b26f791e..e525323f21c 100644
--- a/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts
+++ b/studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts
@@ -3,6 +3,7 @@
import { authFetch } from "@/features/auth";
import { hubTokenHeader } from "@/features/hub/lib/hub-token-header";
+import { useSettingsDialogStore } from "@/features/settings/stores/settings-dialog-store";
import {
applyDictationDictionary,
isCuratedSttModel,
@@ -340,7 +341,12 @@ export class StudioModelDictationAdapter implements DictationAdapter {
? error.message
: "A recorded segment could not be transcribed.";
console.error("STT transcription error:", error);
- toast.error(message);
+ toast.error(message, {
+ action: {
+ label: "Open Voice settings",
+ onClick: () => useSettingsDialogStore.getState().openDialog("voice"),
+ },
+ });
};
const buildTranscript = () =>
diff --git a/studio/frontend/src/features/chat/adapters/studio-web-speech-dictation-adapter.ts b/studio/frontend/src/features/chat/adapters/studio-web-speech-dictation-adapter.ts
index 23236831e99..d03f63f559d 100644
--- a/studio/frontend/src/features/chat/adapters/studio-web-speech-dictation-adapter.ts
+++ b/studio/frontend/src/features/chat/adapters/studio-web-speech-dictation-adapter.ts
@@ -8,6 +8,7 @@ import {
resolveDictationLanguage,
useVoiceSettingsStore,
} from "@/features/settings/stores/voice-settings-store";
+import { isTauri } from "@/lib/api-base";
import type { DictationAdapter } from "@assistant-ui/react";
import { toast } from "sonner";
import { useChatRuntimeStore } from "../stores/chat-runtime-store";
@@ -132,6 +133,9 @@ export class StudioWebSpeechDictationAdapter implements DictationAdapter {
static isSupported(): boolean {
return (
typeof window !== "undefined" &&
+ // WKWebView exposes the API but Apple's service refuses it
+ // (service-not-allowed); WebView2 and webkit2gtk have no engine at all.
+ !isTauri &&
window.isSecureContext &&
getSpeechRecognitionAPI() !== undefined &&
navigator.mediaDevices?.getUserMedia !== undefined
diff --git a/studio/frontend/src/features/settings/stores/voice-settings-store.ts b/studio/frontend/src/features/settings/stores/voice-settings-store.ts
index 5f71085981d..f402b71c301 100644
--- a/studio/frontend/src/features/settings/stores/voice-settings-store.ts
+++ b/studio/frontend/src/features/settings/stores/voice-settings-store.ts
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+import { isTauri } from "@/lib/api-base";
import { create } from "zustand";
import { createJSONStorage, persist } from "zustand/middleware";
@@ -199,7 +200,7 @@ export const useVoiceSettingsStore = create<VoiceSettingsState>()(
micDeviceId: "default",
setMicDeviceId: (micDeviceId) => set({ micDeviceId }),
- dictationEngine: "browser",
+ dictationEngine: isTauri ? "model" : "browser",
setDictationEngine: (dictationEngine) => set({ dictationEngine }),
sttModel: DEFAULT_STT_MODEL,
@@ -321,8 +322,9 @@ export const useVoiceSettingsStore = create<VoiceSettingsState>()(
// "gguf" was a short-lived separate engine choice; both local
// backends now live under "model".
const savedEngine = saved?.dictationEngine as string | undefined;
+ // Desktop has no browser speech engine, so always resolve to "model".
const dictationEngine: DictationEngine =
- savedEngine === "model" || savedEngine === "gguf"
+ isTauri || savedEngine === "model" || savedEngine === "gguf"
? "model"
: "browser";
const savedSttModel = normalizeSttModel(saved?.sttModel);
diff --git a/studio/frontend/src/features/settings/tabs/voice-tab.tsx b/studio/frontend/src/features/settings/tabs/voice-tab.tsx
index eeeaecd28d1..15c35a95aba 100644
--- a/studio/frontend/src/features/settings/tabs/voice-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/voice-tab.tsx
@@ -39,6 +39,7 @@ import {
} from "@/features/hub";
import { useDebouncedValue, useWheelScrollRef } from "@/hooks";
import { useT } from "@/i18n";
+import { isTauri } from "@/lib/api-base";
import { ChevronDownStandardIcon } from "@/lib/chevron-icons";
import { MicIcon } from "@/lib/mic-icon";
import { toast } from "@/lib/toast";
@@ -833,38 +834,44 @@ export function VoiceTab() {
: t("settings.voice.dictation.engineBrowserDescription")
}
>
- <Select
- value={dictationEngine}
- onValueChange={(value) => {
- const next = value === "model" ? "model" : "browser";
- if (next !== dictationEngine) {
- // Unload whichever backend was resident for the old engine.
- void unloadSttModel().catch(() => {});
- if (next === "model") {
- setSttPhase("checking");
- setSttDevice(null);
- setSttDownload(null);
+ {isTauri ? (
+ <span className="text-sm text-muted-foreground">
+ {t("settings.voice.dictation.engineModel")}
+ </span>
+ ) : (
+ <Select
+ value={dictationEngine}
+ onValueChange={(value) => {
+ const next = value === "model" ? "model" : "browser";
+ if (next !== dictationEngine) {
+ // Unload whichever backend was resident for the old engine.
+ void unloadSttModel().catch(() => {});
+ if (next === "model") {
+ setSttPhase("checking");
+ setSttDevice(null);
+ setSttDownload(null);
+ }
}
- }
- setDictationEngine(next);
- }}
- >
- <SelectTrigger
- aria-label="Dictation engine"
- className="w-56"
- size="sm"
+ setDictationEngine(next);
+ }}
>
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="browser">
- {t("settings.voice.dictation.engineBrowser")}
- </SelectItem>
- <SelectItem value="model">
- {t("settings.voice.dictation.engineModel")}
- </SelectItem>
- </SelectContent>
- </Select>
+ <SelectTrigger
+ aria-label="Dictation engine"
+ className="w-56"
+ size="sm"
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="browser">
+ {t("settings.voice.dictation.engineBrowser")}
+ </SelectItem>
+ <SelectItem value="model">
+ {t("settings.voice.dictation.engineModel")}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ )}
</SettingsRow>
{isLocalEngine ? (