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: raw transcript now stores original STT text, retry supports cloud
Gabriel Steinb4bf39045c3b
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 6e6831a86..5e743bc40 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -587,12 +587,13 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor););if (result.success && result.text) {+ const rawText = result.text;const reasoningStart = performance.now();const text = await this.processTranscription(result.text, "local");timings.reasoningProcessingDurationMs = Math.round(performance.now() - reasoningStart);if (text !== null && text !== undefined) {- return { success: true, text: text || result.text, source: "local", timings };+ return { success: true, text: text || result.text, rawText, source: "local", timings };} else {throw new Error("No text transcribed");}@@ -660,12 +661,19 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor););if (result.success && result.text) {+ const rawText = result.text;const reasoningStart = performance.now();const text = await this.processTranscription(result.text, "local-parakeet");timings.reasoningProcessingDurationMs = Math.round(performance.now() - reasoningStart);if (text !== null && text !== undefined) {- return { success: true, text: text || result.text, source: "local-parakeet", timings };+ return {+ success: true,+ text: text || result.text,+ rawText,+ source: "local-parakeet",+ timings,+ };} else {throw new Error("No text transcribed");}@@ -1226,6 +1234,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);timings.transcriptionProcessingDurationMs = Math.round(performance.now() - transcriptionStart);// Process with reasoning if enabled+ const rawText = result.text;let processedText = result.text;if (settings.useReasoningModel && processedText && !this.skipReasoning) {const reasoningStart = performance.now();@@ -1279,6 +1288,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);return {success: true,text: processedText,+ rawText,source: "openwhispr",timings,limitReached: result.limitReached,@@ -1431,12 +1441,13 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);if (proxyText && proxyText.trim().length > 0) {timings.transcriptionProcessingDurationMs = Math.round(performance.now() - apiCallStart);+ const rawText = proxyText;const reasoningStart = performance.now();const text = await this.processTranscription(proxyText, "mistral");timings.reasoningProcessingDurationMs = Math.round(performance.now() - reasoningStart);const source = (await this.isReasoningAvailable()) ? "mistral-reasoned" : "mistral";- return { success: true, text, source, timings };+ return { success: true, text, rawText, source, timings };}throw new Error("No text transcribed - Mistral response was empty");@@ -1565,6 +1576,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);// Check for text - handle both empty string and missing fieldif (result.text && result.text.trim().length > 0) {timings.transcriptionProcessingDurationMs = Math.round(performance.now() - apiCallStart);+ const rawText = result.text;const reasoningStart = performance.now();const text = await this.processTranscription(result.text, "openai");@@ -1582,7 +1594,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);},"transcription");- return { success: true, text, source, timings };+ return { success: true, text, rawText, source, timings };} else {// Log at info level so it shows without debug modelogger.info(@@ -2422,6 +2434,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);this.onTranscriptionComplete?.({success: true,text: finalText,+ rawText: finalText,source: `${this.sttConfig?.streamingProvider || "deepgram"}-streaming`,});diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 1616726b4..3ede20adb 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -452,42 +452,6 @@ class IPCHandlers {return result;});- ipcMain.handle("retry-transcription", async (event, id) => {- const buffer = this.audioStorageManager.getAudioBuffer(id);- if (!buffer) return { success: false, error: "Audio file not found" };- try {- let result;- if (this.parakeetManager?.isReady?.()) {- result = await this.parakeetManager.transcribeLocalParakeet(buffer, {});- } else if (this.whisperManager?.serverManager?.isReady?.()) {- result = await this.whisperManager.transcribeLocalWhisper(buffer, {});- } else {- return { success: false, error: "No transcription engine available" };- }- if (result?.text) {- this.databaseManager.updateTranscriptionText(id, result.text, result.text);- const provider = result.source || "local";- const model = result.model || null;- this.databaseManager.updateTranscriptionAudio(id, {- hasAudio: 1,- audioDurationMs: null,- provider,- model,- });- const updated = this.databaseManager.getTranscriptionById(id);- return { success: true, transcription: updated };- }- return { success: false, error: "Transcription returned empty" };- } catch (error) {- debugLogger.error(- "Retry transcription failed",- { id, error: error.message },- "audio-storage"- );- return { success: false, error: error.message };- }- });-ipcMain.handle("get-transcription-by-id", async (event, id) => {return this.databaseManager.getTranscriptionById(id);});@@ -2045,6 +2009,68 @@ class IPCHandlers {}});+ ipcMain.handle("retry-transcription", async (event, id) => {+ const buffer = this.audioStorageManager.getAudioBuffer(id);+ if (!buffer) return { success: false, error: "Audio file not found" };+ try {+ let result;+ // Try local engines first+ if (this.parakeetManager?.isReady?.()) {+ result = await this.parakeetManager.transcribeLocalParakeet(buffer, {});+ } else if (this.whisperManager?.serverManager?.isReady?.()) {+ result = await this.whisperManager.transcribeLocalWhisper(buffer, {});+ }++ // Fall back to cloud transcription+ if (!result?.text) {+ const win = BrowserWindow.fromWebContents(event.sender);+ if (win) {+ const cookieHeader = await getSessionCookiesFromWindow(win);+ if (cookieHeader) {+ const apiUrl = getApiUrl();+ if (apiUrl) {+ const { body, boundary } = buildMultipartBody(buffer, "audio.webm", "audio/webm", {+ clientType: "desktop",+ appVersion: app.getVersion(),+ sessionId: this.sessionId,+ });+ const url = new URL(`${apiUrl}/api/transcribe`);+ const data = await postMultipart(url, body, boundary, {+ Cookie: cookieHeader,+ });+ if (data.statusCode === 200 && data.data?.text) {+ result = { text: data.data.text, source: "openwhispr", model: "cloud" };+ }+ }+ }+ }+ }++ if (!result?.text) {+ return { success: false, error: "No transcription engine available" };+ }++ this.databaseManager.updateTranscriptionText(id, result.text, result.text);+ const provider = result.source || "local";+ const model = result.model || null;+ this.databaseManager.updateTranscriptionAudio(id, {+ hasAudio: 1,+ audioDurationMs: null,+ provider,+ model,+ });+ const updated = this.databaseManager.getTranscriptionById(id);+ return { success: true, transcription: updated };+ } catch (error) {+ debugLogger.error(+ "Retry transcription failed",+ { id, error: error.message },+ "audio-storage"+ );+ return { success: false, error: error.message };+ }+ });+ipcMain.handle("cloud-reason", async (event, text, opts = {}) => {try {const apiUrl = getApiUrl();diff --git a/src/hooks/useAudioRecording.js b/src/hooks/useAudioRecording.jsindex 96645614f..bcc6ba315 100644--- a/src/hooks/useAudioRecording.js+++ b/src/hooks/useAudioRecording.js@@ -117,7 +117,7 @@ export const useAudioRecording = (toast, options = {}) => {"streaming");- audioManagerRef.current.saveTranscription(result.text, result.text);+ audioManagerRef.current.saveTranscription(result.text, result.rawText ?? result.text);if (result.source === "openai" && getSettings().useLocalWhisper) {toast({