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
feat: timestamp-based chronological ordering for meeting transcript segments
Gabriel Steinc4fc16a3c249
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 5c132b5d4..1323eab8c 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -2356,7 +2356,7 @@ class IPCHandlers {streaming.onPartialTranscript = (text) => {send("meeting-transcription-segment", { text, source, type: "partial" });};- streaming.onFinalTranscript = (text) => {+ streaming.onFinalTranscript = (text, timestamp) => {const segments = streaming.completedSegments;const latestSegment = segments.length > 0 ? segments[segments.length - 1] : text;debugLogger.debug("Meeting segment sending to renderer", {@@ -2364,7 +2364,12 @@ class IPCHandlers {text: latestSegment.slice(0, 80),segmentCount: segments.length,});- send("meeting-transcription-segment", { text: latestSegment, source, type: "final" });+ send("meeting-transcription-segment", {+ text: latestSegment,+ source,+ type: "final",+ timestamp,+ });};streaming.onError = (error) => {send("meeting-transcription-error", error.message);diff --git a/src/helpers/openaiRealtimeStreaming.js b/src/helpers/openaiRealtimeStreaming.jsindex 0f2918ac8..85a46f47a 100644--- a/src/helpers/openaiRealtimeStreaming.js+++ b/src/helpers/openaiRealtimeStreaming.js@@ -26,6 +26,7 @@ class OpenAIRealtimeStreaming {this.model = "gpt-4o-mini-transcribe";this.coldStartBuffer = [];this.coldStartBufferSize = 0;+ this.speechStartedAt = null;}getFullTranscript() {@@ -49,6 +50,7 @@ class OpenAIRealtimeStreaming {this.audioBytesSent = 0;this.coldStartBuffer = [];this.coldStartBufferSize = 0;+ this.speechStartedAt = null;const url = "wss://api.openai.com/v1/realtime?intent=transcription";debugLogger.debug("OpenAI Realtime connecting", { model: this.model });@@ -188,7 +190,9 @@ class OpenAIRealtimeStreaming {}this.currentPartial = "";const fullText = this.getFullTranscript();- this.onFinalTranscript?.(fullText);+ const speechTimestamp = this.speechStartedAt || Date.now();+ this.speechStartedAt = null;+ this.onFinalTranscript?.(fullText, speechTimestamp);debugLogger.debug("OpenAI Realtime turn completed", {turnText: transcript.slice(0, 100),totalLength: fullText.length,@@ -198,6 +202,8 @@ class OpenAIRealtimeStreaming {}case "input_audio_buffer.speech_started":+ this.speechStartedAt = Date.now();+ break;case "input_audio_buffer.speech_stopped":case "input_audio_buffer.committed":break;diff --git a/src/hooks/useMeetingTranscription.ts b/src/hooks/useMeetingTranscription.tsindex 1853aa12e..ac4dd1784 100644--- a/src/hooks/useMeetingTranscription.ts+++ b/src/hooks/useMeetingTranscription.ts@@ -8,6 +8,7 @@ export interface TranscriptSegment {id: string;text: string;source: "mic" | "system";+ timestamp?: number;}interface UseMeetingTranscriptionReturn {@@ -414,7 +415,12 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {const partialSetters = { mic: setMicPartial, system: setSystemPartial };const segmentCleanup = window.electronAPI?.onMeetingTranscriptionSegment?.(- (data: { text: string; source: "mic" | "system"; type: "partial" | "final" }) => {+ (data: {+ text: string;+ source: "mic" | "system";+ type: "partial" | "final";+ timestamp?: number;+ }) => {logger.debug("Meeting segment received in renderer",{@@ -430,10 +436,21 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {setPartialForSource(data.text);setPartialTranscript(data.text);} else {- setSegments((prev) => [- ...prev,- { id: `seg-${++segmentCounter}`, text: data.text, source: data.source },- ]);+ const seg: TranscriptSegment = {+ id: `seg-${++segmentCounter}`,+ text: data.text,+ source: data.source,+ timestamp: data.timestamp,+ };+ setSegments((prev) => {+ // Insert in chronological order — scan from the end since most+ // segments arrive in order and this is O(1) in the common case.+ const ts = seg.timestamp ?? Infinity;+ let i = prev.length;+ while (i > 0 && (prev[i - 1].timestamp ?? 0) > ts) i--;+ if (i === prev.length) return [...prev, seg];+ return [...prev.slice(0, i), seg, ...prev.slice(i)];+ });setPartialForSource("");setTranscript((prev) => (prev ? prev + " " + data.text : data.text));setPartialTranscript("");