Fix Piper ONNX runtime asset URLs
Build and publish frontend / publish (push) Failing after 2s

This commit is contained in:
Ein Anderssono
2026-10-16 07:15:12 +02:00
parent 696a47a9a2
commit c618d2e31e
6 changed files with 41 additions and 7 deletions
+12 -5
View File
@@ -64,10 +64,16 @@ await mkdir(join(assetRoot, 'piper'), {recursive: true});
for (const file of voiceFiles) await downloadVoiceFile(file);
await cp(join(root, 'PIPER_VOICE_NOTICES.txt'), join(assetRoot, 'voices', 'ATTRIBUTION.txt'));
const wasmFiles = (await readdir(onnxSource))
.filter(name => name.endsWith('.wasm'));
if (wasmFiles.length === 0) throw new Error('ONNX Runtime WebAssembly files are missing');
for (const file of wasmFiles) {
const onnxRuntimeFiles = (await readdir(onnxSource))
.filter(name => name.endsWith('.wasm') || name.endsWith('.mjs'));
const requiredOnnxRuntimeFiles = [
'ort-wasm-simd-threaded.wasm',
'ort-wasm-simd-threaded.mjs',
];
for (const file of requiredOnnxRuntimeFiles) {
if (!onnxRuntimeFiles.includes(file)) throw new Error(`Missing ONNX Runtime asset: ${file}`);
}
for (const file of onnxRuntimeFiles) {
await cp(join(onnxSource, file), join(assetRoot, 'onnx', file));
}
for (const file of [piperWasm, piperData]) {
@@ -106,7 +112,8 @@ for (const file of voiceFiles) {
}
const workerBundle = await (await import('node:fs/promises')).readFile(join(assetRoot, 'piper-worker.js'), 'utf8');
if (!workerBundle.includes('https://huggingface.co/diffusionstudio/piper-voices/resolve/main/') ||
!workerBundle.includes('/tts/piper-wasm-v1/voices/')) {
!workerBundle.includes('/tts/piper-wasm-v1/voices/') ||
!workerBundle.includes('/tts/piper-wasm-v1/onnx/')) {
throw new Error('The Piper worker is missing its same-origin model download route.');
}