fix(voices): unify default voice set for custom-openai non-kokoro models

Align non-kokoro custom-openai models to use the canonical OpenAI voice set
instead of a separate custom set. Updates logic and tests to reflect this
standardization for improved consistency across OpenAI-compatible providers.
This commit is contained in:
Richard R 2026-06-09 10:56:54 -06:00
parent d581df6f88
commit 0eec914090
2 changed files with 5 additions and 1 deletions

View file

@ -232,7 +232,9 @@ export function getDefaultVoices(provider: TtsProviderId, model: string): string
}
if (provider === 'custom-openai') {
return isKokoroModel(model) ? [...KOKORO_DEFAULT_VOICES] : [...CUSTOM_OPENAI_DEFAULT_VOICES];
// Kokoro models get the kokoro voice set; any other OpenAI-compatible model
// falls back to the canonical OpenAI six, which such servers generally accept.
return isKokoroModel(model) ? [...KOKORO_DEFAULT_VOICES] : [...OPENAI_DEFAULT_VOICES];
}
if (provider === 'replicate') {

View file

@ -41,6 +41,8 @@ describe('tts provider catalog', () => {
test('resolves default voices and instruction support unchanged', () => {
expect(getDefaultVoices('openai', 'gpt-4o-mini-tts')).toContain('sage');
expect(getDefaultVoices('custom-openai', 'kokoro')).toContain('af_sarah');
// Non-kokoro custom-openai models fall back to the canonical OpenAI six.
expect(getDefaultVoices('custom-openai', 'supertonic-3')).toEqual(['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']);
expect(getDefaultVoices('deepinfra', 'ResembleAI/chatterbox')).toEqual(['None']);
expect(getDefaultVoices('deepinfra', 'Zyphra/Zonos-v0.1-transformer')).toEqual(['random']);
expect(supportsTtsInstructions('gpt-4o-mini-tts')).toBe(true);