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: skip API key check for self-hosted transcription servers (#835)
Alcahest69cb74be7dcf
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex aa08f105e..28d0e2370 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -11,6 +11,7 @@ import {recordLocalSpeechWindow,} from "./localSpeechGate";import { getSettings, getEffectiveCleanupModel, isCloudCleanupMode } from "../stores/settingsStore";+import { shouldSkipTranscriptionApiKey } from "./transcriptionAuth";import { detectAgentName } from "../config/agentDetection";import { resolvePrompt } from "../config/prompts";import { syncService } from "../services/SyncService.js";@@ -826,6 +827,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);async getAPIKey() {const s = getSettings();+ if (shouldSkipTranscriptionApiKey(s)) {+ return null;+ }+const provider = s.cloudTranscriptionProvider || "openai";// Check cache (invalidate if provider changed)diff --git a/src/helpers/transcriptionAuth.js b/src/helpers/transcriptionAuth.jsnew file mode 100644index 000000000..9c08f14c7--- /dev/null+++ b/src/helpers/transcriptionAuth.js@@ -0,0 +1,5 @@+export function shouldSkipTranscriptionApiKey(settings) {+ const transcriptionMode = (settings.transcriptionMode || "").trim();+ const remoteUrl = (settings.remoteTranscriptionUrl || "").trim();+ return transcriptionMode === "self-hosted" && remoteUrl.length > 0;+}diff --git a/test/helpers/transcriptionAuth.test.js b/test/helpers/transcriptionAuth.test.jsnew file mode 100644index 000000000..217a7e5c8--- /dev/null+++ b/test/helpers/transcriptionAuth.test.js@@ -0,0 +1,75 @@+const test = require("node:test");+const assert = require("node:assert/strict");++test("returns true for self-hosted mode with configured URL", async () => {+ const { shouldSkipTranscriptionApiKey } = await import(+ "../../src/helpers/transcriptionAuth.js"+ );+ assert.equal(+ shouldSkipTranscriptionApiKey({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ }),+ true+ );+});++test("returns false for self-hosted mode without URL", async () => {+ const { shouldSkipTranscriptionApiKey } = await import(+ "../../src/helpers/transcriptionAuth.js"+ );+ assert.equal(+ shouldSkipTranscriptionApiKey({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: "",+ }),+ false+ );+});++test("returns false for self-hosted mode with whitespace-only URL", async () => {+ const { shouldSkipTranscriptionApiKey } = await import(+ "../../src/helpers/transcriptionAuth.js"+ );+ assert.equal(+ shouldSkipTranscriptionApiKey({+ transcriptionMode: "self-hosted",+ remoteTranscriptionUrl: " ",+ }),+ false+ );+});++test("returns false for openai cloud provider mode", async () => {+ const { shouldSkipTranscriptionApiKey } = await import(+ "../../src/helpers/transcriptionAuth.js"+ );+ assert.equal(+ shouldSkipTranscriptionApiKey({+ transcriptionMode: "",+ cloudTranscriptionProvider: "openai",+ remoteTranscriptionUrl: "",+ }),+ false+ );+});++test("returns false when transcriptionMode is missing from settings", async () => {+ const { shouldSkipTranscriptionApiKey } = await import(+ "../../src/helpers/transcriptionAuth.js"+ );+ assert.equal(shouldSkipTranscriptionApiKey({}), false);+});++test("returns false for non-self-hosted mode even with URL configured", async () => {+ const { shouldSkipTranscriptionApiKey } = await import(+ "../../src/helpers/transcriptionAuth.js"+ );+ assert.equal(+ shouldSkipTranscriptionApiKey({+ transcriptionMode: "cloud",+ remoteTranscriptionUrl: "http://localhost:8000/v1",+ }),+ false+ );+});