Run browser file transcription through the long-form pipeline when asked and the VAD model is available
Adds an Advanced "Skip silence in uploaded files" option (off by default pending measurement), the vad/longForm protocol fields, the old-path fallback when the VAD model is missing, and a plain message for files with no speech. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0c3a83c23c
commit
f55ea6ecf8
14 files changed
+363
-8
No files matched your search
@@ -0,0 +1,55 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { emptyTranscriptNotice } from "../src/lib/export";
|
||||
import {
|
||||
LONG_FORM_DEFAULT,
|
||||
LONG_FORM_KEY,
|
||||
loadLongFormChoice,
|
||||
saveLongFormChoice,
|
||||
} from "../src/lib/longForm";
|
||||
|
||||
function memoryStorage(initial: Record<string, string> = {}) {
|
||||
const data = { ...initial };
|
||||
return {
|
||||
data,
|
||||
getItem: (key: string) => data[key] ?? null,
|
||||
setItem: (key: string, value: string) => {
|
||||
data[key] = value;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("long-form setting persistence (D-WS3a)", () => {
|
||||
test("defaults when nothing is stored or storage is unavailable", () => {
|
||||
expect(loadLongFormChoice(memoryStorage())).toBe(LONG_FORM_DEFAULT);
|
||||
expect(loadLongFormChoice(null)).toBe(LONG_FORM_DEFAULT);
|
||||
const throwing = {
|
||||
getItem: () => {
|
||||
throw new Error("denied");
|
||||
},
|
||||
setItem: () => {
|
||||
throw new Error("denied");
|
||||
},
|
||||
};
|
||||
expect(loadLongFormChoice(throwing)).toBe(LONG_FORM_DEFAULT);
|
||||
expect(() => saveLongFormChoice(true, throwing)).not.toThrow();
|
||||
});
|
||||
|
||||
test("round-trips an explicit choice", () => {
|
||||
const storage = memoryStorage();
|
||||
saveLongFormChoice(!LONG_FORM_DEFAULT, storage);
|
||||
expect(storage.data[LONG_FORM_KEY]).toBeDefined();
|
||||
expect(loadLongFormChoice(storage)).toBe(!LONG_FORM_DEFAULT);
|
||||
});
|
||||
});
|
||||
|
||||
describe("emptyTranscriptNotice (plan 001-0 Review Focus 4)", () => {
|
||||
test("a finished transcript with no words says so plainly", () => {
|
||||
expect(emptyTranscriptNotice({ text: "" })).toBe("No speech was found in this recording.");
|
||||
expect(emptyTranscriptNotice({ text: " \n" })).toBe("No speech was found in this recording.");
|
||||
});
|
||||
|
||||
test("no notice while running or when there is text", () => {
|
||||
expect(emptyTranscriptNotice(null)).toBeNull();
|
||||
expect(emptyTranscriptNotice({ text: " Hello." })).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user