lotus(#1): make denoise asset base absolute (fixes DTLN/DFN load)
Review found native dynamic import() of the DTLN/DeepFilterNet ESM resolves "./denoise/…" against the bundled JS chunk's URL (-> /assets/…) not the document, so those two models 404'd and silently fell back to raw mic in the default config. Resolve the asset base to an absolute same-origin href against the document; addModule()/fetch() accept absolute too, so all three load paths stay consistent. (rnnoise/speex were unaffected since addModule resolves against the document.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
78350a21f4
commit
e903f98bbe
@@ -39,7 +39,12 @@ import {
|
||||
* malformed value falls back to the bundled "./denoise/".
|
||||
*/
|
||||
function safeAssetBase(raw: string | null): string {
|
||||
const fallback = "./denoise/";
|
||||
// Resolve to an ABSOLUTE same-origin href against the document. Absolute is
|
||||
// required because native dynamic `import()` (DTLN/DeepFilterNet) resolves a
|
||||
// relative specifier against the JS chunk's URL, not the document — so a
|
||||
// relative "./denoise/" would 404. addModule()/fetch() work with absolute
|
||||
// too, so this keeps all three asset-load paths consistent.
|
||||
const fallback = new URL("./denoise/", window.location.href).href;
|
||||
if (!raw) return fallback;
|
||||
try {
|
||||
const u = new URL(raw, window.location.href);
|
||||
|
||||
Reference in New Issue
Block a user