fix: mod import validation

This commit is contained in:
2026-01-14 22:52:02 -03:00
parent 4932bd18d3
commit 449c4efbb7
+7 -4
View File
@@ -49,13 +49,16 @@ export class TTSManager {
if (!isModule(filePath)) return;
const modRaw = await import(`file://${filePath}`);
if (!modRaw || !modRaw.default) {
this.log.warning('Invalid module format in %s', filePath);
if (!modRaw) {
this.log.warning('Mod import failed for %s', filePath);
return;
}
const mod = modRaw.default as TTSModule;
const mod = (modRaw.default?.default || modRaw.default || modRaw) as TTSModule;
if (!mod.name || typeof mod.generate !== 'function') {
this.log.warning('Invalid module format in %s', filePath);
return;
}
this.log.verbose(`Loaded TTS mode: ${mod.name}`);
this.modules.push(mod);