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 realtime streaming stop errors and calendar API error reporting (#1553)
Gabriel Stein8b0410d0a0b7
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 7f2e5d337..1d9b417ec 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -4054,7 +4054,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);const provider = this.getStreamingProvider();this.streamingProcessor.port.onmessage = (event) => {- if (!this.isStreaming) return;+ // The worklet posts its remaining PCM followed by a "flushed" sentinel+ // on stop; the sentinel must not be sent as audio (realtime backends+ // reject the odd-length non-PCM bytes with "Invalid audio data").+ if (!this.isStreaming || event.data === "flushed") return;provider.send(event.data);};diff --git a/src/helpers/googleCalendarManager.js b/src/helpers/googleCalendarManager.jsindex 493ce8c42..f4c0d8e48 100644--- a/src/helpers/googleCalendarManager.js+++ b/src/helpers/googleCalendarManager.js@@ -325,17 +325,21 @@ class GoogleCalendarManager {useSessionCookies: false,});const text = await response.text();- let parsed;+ let parsed = null;try {parsed = JSON.parse(text);} catch {- throw new Error(`Invalid JSON response: ${text.slice(0, 200)}`);+ // Error statuses can arrive with empty or non-JSON bodies; surface the+ // status below instead of masking it as a parse failure.}if (response.status >= 400) {- const err = new Error(parsed.error?.message || `API error ${response.status}`);+ const err = new Error(parsed?.error?.message || `API error ${response.status}`);err.statusCode = response.status;throw err;}+ if (parsed === null) {+ throw new Error(`Invalid JSON response: ${text.slice(0, 200)}`);+ }return parsed;}}diff --git a/src/helpers/microsoftCalendarManager.js b/src/helpers/microsoftCalendarManager.jsindex 8418e8f53..f20e3dcf8 100644--- a/src/helpers/microsoftCalendarManager.js+++ b/src/helpers/microsoftCalendarManager.js@@ -332,17 +332,21 @@ class MicrosoftCalendarManager {useSessionCookies: false,});const text = await response.text();- let parsed;+ let parsed = null;try {parsed = JSON.parse(text);} catch {- throw new Error(`Invalid JSON response: ${text.slice(0, 200)}`);+ // Error statuses can arrive with empty or non-JSON bodies; surface the+ // status below instead of masking it as a parse failure.}if (response.status >= 400) {- const err = new Error(parsed.error?.message || `API error ${response.status}`);+ const err = new Error(parsed?.error?.message || `API error ${response.status}`);err.statusCode = response.status;throw err;}+ if (parsed === null) {+ throw new Error(`Invalid JSON response: ${text.slice(0, 200)}`);+ }return parsed;}}