Serve Piper speech assets from dedicated static service
Build and publish frontend / publish (push) Successful in 49s

This commit is contained in:
Ein Anderssono
2026-10-16 07:32:34 +02:00
parent 1458fa8382
commit ed0a8b90a6
12 changed files with 31 additions and 140 deletions
+3 -3
View File
@@ -3,11 +3,11 @@ import {localPiperModelUrl} from './piper-model-routing.mjs';
import {createOnnxWasmPaths} from './piper-onnx-config.mjs';
const VOICE_ID = 'sv_SE-nst-medium';
const ASSET_ROOT = '/tts/piper-wasm-v1';
const ASSET_ROOT = '/static/piper-wasm-v1';
const localFetch = self.fetch.bind(self);
// The pinned TTS library uses a fixed Hugging Face URL. Keep its OPFS cache logic,
// but serve every model/config request from this frontend origin instead.
// Keep the TTS library's OPFS cache logic, but serve models/config from the
// same-origin static asset service instead of its built-in external model URL.
self.fetch = (resource, options) => {
const requestedUrl = resource instanceof Request ? resource.url : String(resource);
const localModelUrl = localPiperModelUrl(requestedUrl, self.location.origin);