mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-21 16:52:40 +00:00
Fix local WAV transcription startup (#7103)
* fix(speech): complete local transcription providers * test(speech): document lazy worker assumption Co-authored-by: LauraGPT <18321252+LauraGPT@users.noreply.github.com> --------- Co-authored-by: LauraGPT <lauragpt@users.noreply.github.com> Co-authored-by: LauraGPT <18321252+LauraGPT@users.noreply.github.com>
This commit is contained in:
co-authored by
LauraGPT
LauraGPT
parent
8388f16186
commit
4117dce2d3
@@ -0,0 +1,40 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { afterEach, describe, expect, test } from "vitest";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
afterEach(() => {
|
||||
for (const dir of tempDirs.splice(0)) {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
describe("transcribe-local-wav CLI", () => {
|
||||
test("initializes the complete speech provider configuration", () => {
|
||||
const modelsDir = mkdtempSync(path.join(tmpdir(), "paseo-transcribe-local-"));
|
||||
tempDirs.push(modelsDir);
|
||||
const missingWav = path.join(modelsDir, "missing.wav");
|
||||
const scriptPath = fileURLToPath(new URL("./transcribe-local-wav.ts", import.meta.url));
|
||||
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
["--import", "tsx", scriptPath, missingWav, "--models-dir", modelsDir],
|
||||
{
|
||||
encoding: "utf8",
|
||||
timeout: 15_000,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.status).not.toBe(0);
|
||||
// The worker client is lazy, so reaching the missing WAV proves provider initialization completed first.
|
||||
expect(result.stderr).toContain("ENOENT");
|
||||
expect(result.stderr).toContain(missingWav);
|
||||
expect(result.stderr).not.toContain("Cannot read properties of undefined");
|
||||
});
|
||||
});
|
||||
@@ -120,6 +120,7 @@ async function main(): Promise<void> {
|
||||
|
||||
const providers: RequestedSpeechProviders = {
|
||||
dictationStt: { provider: "local", explicit: true },
|
||||
voiceTurnDetection: { provider: "local", explicit: false, enabled: false },
|
||||
voiceStt: { provider: "local", explicit: true },
|
||||
// Not used here, but required by the shared runtime config shape.
|
||||
voiceTts: { provider: "openai", explicit: false },
|
||||
|
||||
Reference in New Issue
Block a user