Files
oh-my-pi/packages/coding-agent/src/tts/runtime.ts
T
can1357 b830f7912b feat: unified speech setup and introduced local STT/TTS capabilities
- Added unified `omp setup speech` flow with JSON/check modes and model picker.
- Added local STT pipeline with sherpa workers, recorder/download flow, and streaming inference.
- Added local TTS pipeline with `omp say`, backend selection, and streaming vocalization.
- Replaced legacy speech settings with unified `speech`/`speechgen` configuration keys.
2026-06-14 16:07:44 +02:00

22 lines
825 B
TypeScript

import * as path from "node:path";
import { getTinyModelsCacheDir } from "@oh-my-pi/pi-utils";
export const KOKORO_PACKAGE = "kokoro-js";
export const KOKORO_VERSION = "1.2.1";
export const ONNXRUNTIME_NODE_PACKAGE = "onnxruntime-node";
export const ONNXRUNTIME_NODE_VERSION = "1.26.0";
export function getTtsRuntimeDir(): string {
const runtimeKey = KOKORO_VERSION.replace(/[^A-Za-z0-9._-]/g, "_");
return path.join(path.dirname(getTinyModelsCacheDir()), "tts-runtime", `kokoro-${runtimeKey}`);
}
export async function isTtsRuntimeCached(): Promise<boolean> {
try {
const pkg = await Bun.file(path.join(getTtsRuntimeDir(), "node_modules", KOKORO_PACKAGE, "package.json")).json();
return typeof pkg === "object" && pkg !== null && "version" in pkg && pkg.version === KOKORO_VERSION;
} catch {
return false;
}
}