Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(transcription): make self-hosted model configurable (#1043)
Alcahest Malus Dienheimcd78550668c1
diff --git a/src/components/SelfHostedPanel.tsx b/src/components/SelfHostedPanel.tsxindex 8ffedb435..e40d7b560 100644--- a/src/components/SelfHostedPanel.tsx+++ b/src/components/SelfHostedPanel.tsx@@ -5,9 +5,17 @@ interface SelfHostedPanelProps {service: "transcription" | "reasoning";url: string;onUrlChange: (url: string) => void;+ model?: string;+ onModelChange?: (model: string) => void;}-export default function SelfHostedPanel({ service, url, onUrlChange }: SelfHostedPanelProps) {+export default function SelfHostedPanel({+ service,+ url,+ onUrlChange,+ model,+ onModelChange,+}: SelfHostedPanelProps) {const { t } = useTranslation();const placeholderUrl =@@ -26,6 +34,17 @@ export default function SelfHostedPanel({ service, url, onUrlChange }: SelfHosteclassName="h-8 text-sm"/></div>+ {onModelChange && (+ <div className="space-y-1.5">+ <label className="block text-xs font-medium text-foreground">{t("common.model")}</label>+ <Input+ value={model ?? ""}+ onChange={(e) => onModelChange(e.target.value)}+ placeholder="Whisper-Large-v3-Turbo"+ className="h-8 text-sm"+ />+ </div>+ )}</div>);}diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 7af2f6257..8be019c35 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -213,6 +213,8 @@ interface TranscriptionSectionProps {setTranscriptionMode: (mode: InferenceMode) => void;remoteTranscriptionUrl: string;setRemoteTranscriptionUrl: (url: string) => void;+ remoteTranscriptionModel: string;+ setRemoteTranscriptionModel: (model: string) => void;showTranscriptionPreview: boolean;setShowTranscriptionPreview: (value: boolean) => void;toast: (opts: {@@ -250,6 +252,8 @@ function TranscriptionSection({setTranscriptionMode,remoteTranscriptionUrl,setRemoteTranscriptionUrl,+ remoteTranscriptionModel,+ setRemoteTranscriptionModel,showTranscriptionPreview,setShowTranscriptionPreview,toast,@@ -387,6 +391,8 @@ function TranscriptionSection({service="transcription"url={remoteTranscriptionUrl}onUrlChange={setRemoteTranscriptionUrl}+ model={remoteTranscriptionModel}+ onModelChange={setRemoteTranscriptionModel}/>)}@@ -735,6 +741,8 @@ export default function SettingsPage({setTranscriptionMode,remoteTranscriptionUrl,setRemoteTranscriptionUrl,+ remoteTranscriptionModel,+ setRemoteTranscriptionModel,notificationsEnabled,setNotificationsEnabled,notifyMeetingDetection,@@ -3963,6 +3971,8 @@ EOF`,setTranscriptionMode={setTranscriptionMode}remoteTranscriptionUrl={remoteTranscriptionUrl}setRemoteTranscriptionUrl={setRemoteTranscriptionUrl}+ remoteTranscriptionModel={remoteTranscriptionModel}+ setRemoteTranscriptionModel={setRemoteTranscriptionModel}showTranscriptionPreview={showTranscriptionPreview}setShowTranscriptionPreview={setShowTranscriptionPreview}toast={toast}diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex c1038d078..169fc8c4a 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -25,6 +25,10 @@ import {} from "../stores/settingsStore";import { getTranscriptionProvider } from "../models/ModelRegistry";import { shouldSkipTranscriptionApiKey } from "./transcriptionAuth";+import {+ isSelfHostedTranscription,+ resolveSelfHostedTranscriptionModel,+} from "./selfHostedTranscription";import { detectAgentName } from "../config/agentDetection";import { resolveDictationRouteKind, resolveDictationAgentReachability } from "./dictationRouting";import { resolvePrompt } from "../config/prompts";@@ -2072,6 +2076,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);getTranscriptionModel() {try {const s = getSettings();+ const selfHostedModel = resolveSelfHostedTranscriptionModel(s);+ if (selfHostedModel) return selfHostedModel;const provider = s.cloudTranscriptionProvider || "openai";const trimmedModel = (s.cloudTranscriptionModel || "").trim();@@ -2121,7 +2127,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);const remoteUrl = (s.remoteTranscriptionUrl || "").trim();const deployment = (deploymentName || "").trim();- const isSelfHosted = transcriptionMode === "self-hosted" && remoteUrl.length > 0;+ const isSelfHosted = isSelfHostedTranscription(s);const isCustomEndpoint = isSelfHosted || currentProvider === "custom";if (@@ -2437,6 +2443,9 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);const s = getSettings();if (s.useLocalWhisper) return false;+ // Self-hosted transcription is batch HTTP to the user's server, never cloud realtime WS.+ if (isSelfHostedTranscription(s)) return false;+// Corti (BYOK) streams over its own WSS — independent of OpenWhispr Cloud.if (s.cloudTranscriptionProvider === "corti" && s.cloudTranscriptionMode === "byok") {return !!(s.cortiClientId && s.cortiClientSecret);diff --git a/src/helpers/selfHostedTranscription.js b/src/helpers/selfHostedTranscription.jsnew file mode 100644index 000000000..b6a05522f--- /dev/null+++ b/src/helpers/selfHostedTranscription.js@@ -0,0 +1,18 @@+export function isSelfHostedTranscription(settings) {+ const mode =+ typeof settings?.transcriptionMode === "string" ? settings.transcriptionMode.trim() : "";+ const remoteUrl =+ typeof settings?.remoteTranscriptionUrl === "string"+ ? settings.remoteTranscriptionUrl.trim()+ : "";+ return mode === "self-hosted" && remoteUrl.length > 0;+}++export function resolveSelfHostedTranscriptionModel(settings) {+ if (!isSelfHostedTranscription(settings)) return null;+ const model =+ typeof settings?.remoteTranscriptionModel === "string"+ ? settings.remoteTranscriptionModel.trim()+ : "";+ return model.length > 0 ? model : null;+}diff --git a/src/helpers/transcriptionAuth.js b/src/helpers/transcriptionAuth.jsindex 9c08f14c7..c15bded39 100644--- a/src/helpers/transcriptionAuth.js+++ b/src/helpers/transcriptionAuth.js@@ -1,5 +1,5 @@+import { isSelfHostedTranscription } from "./selfHostedTranscription.js";+export function shouldSkipTranscriptionApiKey(settings) {- const transcriptionMode = (settings.transcriptionMode || "").trim();- const remoteUrl = (settings.remoteTranscriptionUrl || "").trim();- return transcriptionMode === "self-hosted" && remoteUrl.length > 0;+ return isSelfHostedTranscription(settings);}diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex 97a21c18d..0c4d70565 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -22,6 +22,7 @@ export interface TranscriptionSettings {transcriptionMode: InferenceMode;remoteTranscriptionType: SelfHostedType;remoteTranscriptionUrl: string;+ remoteTranscriptionModel: string;customDictionary: string[];snippets: Snippet[];assemblyAiStreaming: boolean;@@ -225,6 +226,7 @@ function useSettingsInternal() {transcriptionMode: store.transcriptionMode,remoteTranscriptionType: store.remoteTranscriptionType,remoteTranscriptionUrl: store.remoteTranscriptionUrl,+ remoteTranscriptionModel: store.remoteTranscriptionModel,cleanupMode: store.cleanupMode,cleanupRemoteUrl: store.cleanupRemoteUrl,customDictionary: store.customDictionary,@@ -269,6 +271,7 @@ function useSettingsInternal() {setTranscriptionMode: store.setTranscriptionMode,setRemoteTranscriptionType: store.setRemoteTranscriptionType,setRemoteTranscriptionUrl: store.setRemoteTranscriptionUrl,+ setRemoteTranscriptionModel: store.setRemoteTranscriptionModel,setCleanupMode: store.setCleanupMode,setCleanupRemoteUrl: store.setCleanupRemoteUrl,setCustomDictionary: store.setCustomDictionary,diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex a9909aee6..ad2b3ba2e 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -437,6 +437,7 @@ export interface SettingsStatetranscriptionMode: InferenceMode;remoteTranscriptionType: SelfHostedType;remoteTranscriptionUrl: string;+ remoteTranscriptionModel: string;cleanupMode: InferenceMode;cleanupRemoteUrl: string;@@ -497,6 +498,7 @@ export interface SettingsStatesetTranscriptionMode: (mode: InferenceMode) => void;setRemoteTranscriptionType: (type: SelfHostedType) => void;setRemoteTranscriptionUrl: (url: string) => void;+ setRemoteTranscriptionModel: (model: string) => void;setCleanupMode: (mode: InferenceMode) => void;setCleanupRemoteUrl: (url: string) => void;@@ -1002,6 +1004,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({return v === "openai-compatible" ? "openai-compatible" : ("lan" as SelfHostedType);})(),remoteTranscriptionUrl: readString("remoteTranscriptionUrl", ""),+ remoteTranscriptionModel: readString("remoteTranscriptionModel", ""),cleanupMode: (() => {const v = readString("cleanupMode", "openwhispr");if (@@ -1079,6 +1082,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({type: SelfHostedType) => void,setRemoteTranscriptionUrl: createStringSetter("remoteTranscriptionUrl"),+ setRemoteTranscriptionModel: createStringSetter("remoteTranscriptionModel"),setCleanupMode: createStringSetter("cleanupMode") as (mode: InferenceMode) => void,setCleanupRemoteUrl: createStringSetter("cleanupRemoteUrl"),diff --git a/test/helpers/selfHostedTranscription.test.js b/test/helpers/selfHostedTranscription.test.jsnew file mode 100644index 000000000..68672331a--- /dev/null+++ b/test/helpers/selfHostedTranscription.test.js@@ -0,0 +1,135 @@+const test = require("node:test");+const assert = require("node:assert/strict");++test("isSelfHostedTranscription returns true for self-hosted mode with configured URL", async () => {+ const { isSelfHostedTranscription } = await import("../../src/helpers/selfHostedTranscription.js");+ assert.equal(+ isSelfHostedTranscription({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ }),+ true+ );+});++test("isSelfHostedTranscription returns false for providers mode even with configured URL", async () => {+ const { isSelfHostedTranscription } = await import("../../src/helpers/selfHostedTranscription.js");+ assert.equal(+ isSelfHostedTranscription({+ transcriptionMode: "providers",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ }),+ false+ );+});++test("isSelfHostedTranscription returns false for empty URL", async () => {+ const { isSelfHostedTranscription } = await import("../../src/helpers/selfHostedTranscription.js");+ assert.equal(+ isSelfHostedTranscription({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "",+ }),+ false+ );+});++test("isSelfHostedTranscription returns false for whitespace-only URL", async () => {+ const { isSelfHostedTranscription } = await import("../../src/helpers/selfHostedTranscription.js");+ assert.equal(+ isSelfHostedTranscription({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: " ",+ }),+ false+ );+});++test("isSelfHostedTranscription returns false for empty settings object", async () => {+ const { isSelfHostedTranscription } = await import("../../src/helpers/selfHostedTranscription.js");+ assert.equal(isSelfHostedTranscription({}), false);+});++test("resolveSelfHostedTranscriptionModel returns the trimmed model", async () => {+ const { resolveSelfHostedTranscriptionModel } = await import(+ "../../src/helpers/selfHostedTranscription.js"+ );+ assert.equal(+ resolveSelfHostedTranscriptionModel({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ remoteTranscriptionModel: " custom-whisper ",+ }),+ "custom-whisper"+ );+});++test("resolveSelfHostedTranscriptionModel returns null for empty model", async () => {+ const { resolveSelfHostedTranscriptionModel } = await import(+ "../../src/helpers/selfHostedTranscription.js"+ );+ assert.equal(+ resolveSelfHostedTranscriptionModel({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ remoteTranscriptionModel: "",+ }),+ null+ );+});++test("resolveSelfHostedTranscriptionModel returns null for whitespace-only model", async () => {+ const { resolveSelfHostedTranscriptionModel } = await import(+ "../../src/helpers/selfHostedTranscription.js"+ );+ assert.equal(+ resolveSelfHostedTranscriptionModel({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ remoteTranscriptionModel: " ",+ }),+ null+ );+});++test("resolveSelfHostedTranscriptionModel returns null when mode is not self-hosted", async () => {+ const { resolveSelfHostedTranscriptionModel } = await import(+ "../../src/helpers/selfHostedTranscription.js"+ );+ assert.equal(+ resolveSelfHostedTranscriptionModel({+ transcriptionMode: "providers",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ remoteTranscriptionModel: "custom-whisper",+ }),+ null+ );+});++test("resolveSelfHostedTranscriptionModel returns null when URL is empty", async () => {+ const { resolveSelfHostedTranscriptionModel } = await import(+ "../../src/helpers/selfHostedTranscription.js"+ );+ assert.equal(+ resolveSelfHostedTranscriptionModel({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "",+ remoteTranscriptionModel: "custom-whisper",+ }),+ null+ );+});++test("resolveSelfHostedTranscriptionModel returns null when remoteTranscriptionModel is not a string", async () => {+ const { resolveSelfHostedTranscriptionModel } = await import(+ "../../src/helpers/selfHostedTranscription.js"+ );+ assert.equal(+ resolveSelfHostedTranscriptionModel({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ remoteTranscriptionModel: 42,+ }),+ null+ );+});