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(uploads): normalize provider names and clamp verbose segment timestamps (#1800)
Henry Sud9499f59ffd9
diff --git a/src/helpers/uploadTimestamps.js b/src/helpers/uploadTimestamps.jsindex c768dd710..8ae7e0841 100644--- a/src/helpers/uploadTimestamps.js+++ b/src/helpers/uploadTimestamps.js@@ -28,10 +28,13 @@ function mapVerboseSegments(responseData) {for (const seg of segments) {const text = typeof seg?.text === "string" ? seg.text.trim() : "";if (!text || !Number.isFinite(seg.start)) continue;+ const start = Math.max(0, seg.start);+ const rawEnd = Number.isFinite(seg.end) ? seg.end : start;+ const end = Math.max(start, rawEnd);mapped.push({text,- start: seg.start,- end: Number.isFinite(seg.end) ? seg.end : seg.start,+ start,+ end,});}return mapped.length ? mapped : null;diff --git a/test/helpers/uploadTimestamps.test.js b/test/helpers/uploadTimestamps.test.jsindex 030e5f50b..e88b1eeb8 100644--- a/test/helpers/uploadTimestamps.test.js+++ b/test/helpers/uploadTimestamps.test.js@@ -67,6 +67,20 @@ test("malformed verbose segments are dropped, never thrown", () => {]);});+test("verbose segments clamp negative start timestamps and inverted end timestamps", () => {+ const mapped = mapVerboseSegments({+ segments: [+ { start: -2.5, end: 3, text: "negative start clamped" },+ { start: 6, end: 2, text: "inverted end clamped" },+ ],+ });++ assert.deepEqual(mapped, [+ { text: "negative start clamped", start: 0, end: 3 },+ { text: "inverted end clamped", start: 6, end: 6 },+ ]);+});+test("responses without usable segments map to null", () => {assert.equal(mapVerboseSegments({ text: "plain json response" }), null);assert.equal(mapVerboseSegments({ segments: "not-an-array" }), null);