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: forward complete STT metadata and client e2e latency to API (#321)
Gabriel Stein9741781470d6
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 06d1d7932..157e260be 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -1094,7 +1094,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);const audioFormat = audioBlob.type;const opts = {};if (language) opts.language = language;- if (settings.useReasoningModel && !this.skipReasoning) opts.sendLogs = "false";+ const reasoningMode = settings.cloudReasoningMode || "openwhispr";+ if (settings.useReasoningModel && !this.skipReasoning && reasoningMode === "openwhispr") {+ opts.sendLogs = "false";+ }const dictionaryPrompt = this.getCustomDictionaryPrompt();if (dictionaryPrompt) opts.prompt = dictionaryPrompt;@@ -1130,6 +1133,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);sttProvider: result.sttProvider,sttModel: result.sttModel,sttProcessingMs: result.sttProcessingMs,+ sttWordCount: result.sttWordCount,+ sttLanguage: result.sttLanguage,audioDurationMs: result.audioDurationMs,audioSizeBytes,audioFormat,@@ -2160,6 +2165,12 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor););const stSettings = getSettings();+ const streamingSttModel = stopResult?.model || "nova-3";+ const streamingSttProcessingMs = Math.round(tTerminate - t0);+ const streamingAudioBytesSent = stopResult?.audioBytesSent || 0;+ const streamingSttLanguage = getBaseLanguageCode(stSettings.preferredLanguage) || undefined;+ const streamingSttWordCount = finalText ? finalText.split(/\s+/).filter(Boolean).length : 0;+let usedCloudReasoning = false;if (stSettings.useReasoningModel && finalText && !this.skipReasoning) {const reasoningStart = performance.now();@@ -2176,8 +2187,13 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);language: stSettings.preferredLanguage || "auto",locale: stSettings.uiLanguage || "en",sttProvider: "deepgram",- sttModel: "nova-3",+ sttModel: streamingSttModel,+ sttProcessingMs: streamingSttProcessingMs,+ sttWordCount: streamingSttWordCount,+ sttLanguage: streamingSttLanguage,audioDurationMs: durationSeconds ? Math.round(durationSeconds * 1000) : undefined,+ audioSizeBytes: streamingAudioBytesSent || undefined,+ audioFormat: "linear16",});if (!res.success) {const err = new Error(res.error || "Cloud reasoning failed");@@ -2252,6 +2268,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);if (finalText) {const tBeforePaste = performance.now();+ const clientTotalMs = Math.round(tBeforePaste - t0);this.onTranscriptionComplete?.({success: true,text: finalText,@@ -2265,7 +2282,16 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);const res = await window.electronAPI.cloudStreamingUsage(finalText,durationSeconds ?? 0,- { sendLogs: !usedCloudReasoning }+ {+ sendLogs: !usedCloudReasoning,+ sttProvider: "deepgram",+ sttModel: streamingSttModel,+ sttProcessingMs: streamingSttProcessingMs,+ sttLanguage: streamingSttLanguage,+ audioSizeBytes: streamingAudioBytesSent || undefined,+ audioFormat: "linear16",+ clientTotalMs,+ });if (!res.success) {const err = new Error(res.error || "Streaming usage recording failed");diff --git a/src/helpers/deepgramStreaming.js b/src/helpers/deepgramStreaming.jsindex 0b8459074..93a74642e 100644--- a/src/helpers/deepgramStreaming.js+++ b/src/helpers/deepgramStreaming.js@@ -99,6 +99,7 @@ class DeepgramStreaming {this.proactiveRefreshTimer = null;this._generation = 0;this.audioBytesSent = 0;+ this.currentModel = "nova-3";this.resultsReceived = 0;this.livenessTimer = null;this.replayBuffer = [];@@ -116,6 +117,7 @@ class DeepgramStreaming {const baseLang = lang ? lang.split("-")[0].toLowerCase() : null;const useNova3 = !lang || NOVA3_LANGUAGES.has(lang) || NOVA3_LANGUAGES.has(baseLang);const model = useNova3 ? "nova-3" : "nova-2";+ this.currentModel = model;if (!useNova3) {debugLogger.debug("Deepgram falling back to nova-2", { language: lang });diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex c88b6a737..8785591b3 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -1700,6 +1700,8 @@ class IPCHandlers {sttProvider: data.data.sttProvider,sttModel: data.data.sttModel,sttProcessingMs: data.data.sttProcessingMs,+ sttWordCount: data.data.sttWordCount,+ sttLanguage: data.data.sttLanguage,audioDurationMs: data.data.audioDurationMs,};} catch (error) {@@ -1748,9 +1750,12 @@ class IPCHandlers {sttProvider: opts.sttProvider,sttModel: opts.sttModel,sttProcessingMs: opts.sttProcessingMs,+ sttWordCount: opts.sttWordCount,+ sttLanguage: opts.sttLanguage,audioDurationMs: opts.audioDurationMs,audioSizeBytes: opts.audioSizeBytes,audioFormat: opts.audioFormat,+ clientTotalMs: opts.clientTotalMs,}),});@@ -1802,6 +1807,13 @@ class IPCHandlers {clientType: "desktop",appVersion: app.getVersion(),clientVersion: app.getVersion(),+ sttProvider: opts.sttProvider,+ sttModel: opts.sttModel,+ sttProcessingMs: opts.sttProcessingMs,+ sttLanguage: opts.sttLanguage,+ audioSizeBytes: opts.audioSizeBytes,+ audioFormat: opts.audioFormat,+ clientTotalMs: opts.clientTotalMs,sendLogs: opts.sendLogs,}),});@@ -2631,12 +2643,14 @@ class IPCHandlers {ipcMain.handle("deepgram-streaming-stop", async () => {try {+ const model = this.deepgramStreaming?.currentModel || "nova-3";+ const audioBytesSent = this.deepgramStreaming?.audioBytesSent || 0;let result = { text: "" };if (this.deepgramStreaming) {result = await this.deepgramStreaming.disconnect(true);}- return { success: true, text: result?.text || "" };+ return { success: true, text: result?.text || "", model, audioBytesSent };} catch (error) {debugLogger.error("Deepgram streaming stop error", { error: error.message });return { success: false, error: error.message };diff --git a/src/types/electron.ts b/src/types/electron.tsindex 57dc9462e..e90e772e9 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -703,7 +703,16 @@ declare global {cloudStreamingUsage?: (text: string,audioDurationSeconds: number,- opts?: { sendLogs?: boolean }+ opts?: {+ sendLogs?: boolean;+ sttProvider?: string;+ sttModel?: string;+ sttProcessingMs?: number;+ sttLanguage?: string;+ audioSizeBytes?: number;+ audioFormat?: string;+ clientTotalMs?: number;+ }) => Promise<{success: boolean;wordsUsed?: number;