Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(whisper): stop local transcription splitting words mid-word (#1348) (#1369)

Gabriel Steinf4f4fa2c2877
diff --git a/scripts/download-whisper-cpp.js b/scripts/download-whisper-cpp.js
index 2e7f01032..505cf90db 100644
--- a/scripts/download-whisper-cpp.js
+++ b/scripts/download-whisper-cpp.js
@@ -13,8 +13,9 @@ const {
const WHISPER_CPP_REPO = "OpenWhispr/whisper.cpp";
-// Version can be pinned via environment variable for reproducible builds
-const VERSION_OVERRIDE = process.env.WHISPER_CPP_VERSION || null;
+// Pinned to a tested build. Tracking the latest release let an upstream whisper.cpp bump
+// change transcription output between app releases with no diff to review. See #1348.
+const WHISPER_CPP_TAG = process.env.WHISPER_CPP_VERSION || "0.0.8";
const BINARIES = {
"darwin-arm64": {
@@ -47,11 +48,7 @@ let cachedRelease = null;
async function getRelease() {
if (cachedRelease) return cachedRelease;
- if (VERSION_OVERRIDE) {
- cachedRelease = await fetchLatestRelease(WHISPER_CPP_REPO, { tagPrefix: VERSION_OVERRIDE });
- } else {
- cachedRelease = await fetchLatestRelease(WHISPER_CPP_REPO);
- }
+ cachedRelease = await fetchLatestRelease(WHISPER_CPP_REPO, { tag: WHISPER_CPP_TAG });
return cachedRelease;
}
@@ -112,11 +109,7 @@ async function downloadBinary(platformArch, config, release, isForce = false) {
}
async function main() {
- if (VERSION_OVERRIDE) {
- console.log(`\n[whisper-server] Using pinned version: ${VERSION_OVERRIDE}`);
- } else {
- console.log("\n[whisper-server] Fetching latest release...");
- }
+ console.log(`\n[whisper-server] Using pinned version: ${WHISPER_CPP_TAG}`);
const release = await getRelease();
if (!release) {
diff --git a/src/helpers/whisperServer.js b/src/helpers/whisperServer.js
index cf2817c1b..de32f69ae 100644
--- a/src/helpers/whisperServer.js
+++ b/src/helpers/whisperServer.js
@@ -143,6 +143,13 @@ function buildWhisperServerArgs({
// explicitly pass "auto" to enable language auto-detection
args.push("--language", language || "auto");
+ // whisper.cpp v1.9.x turned token timestamps on for every request, which enables the
+ // server's 60-character segment wrap. split_on_word is off, so the wrap lands on a token
+ // boundary and breaks words mid-word ("abschalten" -> "abs" + "chalten"); we join segments
+ // into one string, so the break surfaces as a stray space. We only read `text`, never
+ // per-token timings, so turn timestamps off and the wrap goes with them. See #1348.
+ args.push("--no-timestamps");
+
if (isVadActive({ vadEnabled, vadModelPath })) {
const cfg = sanitizeWhisperVadConfig(vadConfig || DEFAULT_WHISPER_VAD_CONFIG);
args.push(
diff --git a/test/helpers/whisperServerVadArgs.test.js b/test/helpers/whisperServerVadArgs.test.js
index dbefed2f2..35b6fd4b6 100644
--- a/test/helpers/whisperServerVadArgs.test.js
+++ b/test/helpers/whisperServerVadArgs.test.js
@@ -29,6 +29,7 @@ test("buildWhisperServerArgs includes VAD flags when enabled and model path prov
"8180",
"--language",
"auto",
+ "--no-timestamps",
"--vad",
"--vad-model",
"/tmp/ggml-silero-v5.1.2.bin",
@@ -60,6 +61,16 @@ test("buildWhisperServerArgs omits VAD flags when vadModelPath is missing", () =
assert.equal(args.includes("--vad-model"), false);
});
+test("buildWhisperServerArgs disables timestamps so segments aren't wrapped mid-word", () => {
+ const args = WhisperServerManager.buildWhisperServerArgs({
+ modelPath: "/tmp/model.bin",
+ port: 8180,
+ language: "auto",
+ });
+
+ assert.equal(args.includes("--no-timestamps"), true);
+});
+
test("buildWhisperServerArgs includes thread count when provided", () => {
const args = WhisperServerManager.buildWhisperServerArgs({
modelPath: "/tmp/model.bin",