Add lsvoices command

This commit is contained in:
2026-05-14 20:20:13 +02:00
parent f2ce38c176
commit 456ec8c83f
2 changed files with 38 additions and 0 deletions

View File

@@ -37,6 +37,16 @@ export abstract class BaseEngine {
return this.voices[voice] != null;
}
/** Returns sorted lowercase voice names known to this engine. Empty if the engine accepts any voice. */
listVoices(): string[] {
return Object.keys(this.voices).sort();
}
/** True when this engine has no static voice table and accepts any voice string. */
isFreeformVoice(): boolean {
return Object.keys(this.voices).length === 0;
}
/** Default implementation: subclass should override either this or getSpeechFile. */
async getSpeech(_text: string, _voice?: string, _params?: VoiceParams): Promise<Response> {
throw new Error(`${this.shortName}: getSpeech not implemented`);