fix(tts): custom engine availability follows health, not the library voice list

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-10-11 05:18:52 +02:00
parent 8c70f06da8
commit e52a73c868
3 changed files with 15 additions and 1 deletions

View File

@ -6,6 +6,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
--- ---
## [Unreleased] ## [Unreleased]
### Fixed
- Custom TTS engines no longer count as available just because the app's own voice library is non-empty: availability follows the engine's health, so a stopped VoiceDesign/CustomVoice container is no longer listed.
--- ---

View File

@ -457,7 +457,8 @@ def _backend_configured(settings: dict, backend: str, voices: list) -> bool:
def _backend_available(backend: str, voices: list, health: bool) -> bool: def _backend_available(backend: str, voices: list, health: bool) -> bool:
if _clean_preview_backend(backend) in {"nvidia_zeroshot", "nvidia_flow", "kokoro", "vibevoice", "fishspeech"}: # A custom engine's voice list is the app's own library, so it proves nothing about the engine.
if backend.startswith("custom:") or _clean_preview_backend(backend) in {"nvidia_zeroshot", "nvidia_flow", "kokoro", "vibevoice", "fishspeech"}:
return health return health
return bool(voices) or health return bool(voices) or health

View File

@ -95,5 +95,16 @@ class GatewayUpstreamProbeTests(unittest.TestCase):
self.assertEqual(get.call_count, 1) # second lookup served from the cache self.assertEqual(get.call_count, 1) # second lookup served from the cache
class CustomAvailabilityTests(unittest.TestCase):
def test_custom_engine_availability_follows_health_not_the_library_voice_list(self):
library = ["EN_F_a", "DE_M_b"]
self.assertFalse(tts._backend_available("custom:abc", library, False))
self.assertTrue(tts._backend_available("custom:abc", [], True))
def test_builtin_backends_keep_their_rules(self):
self.assertTrue(tts._backend_available("voice_clone", ["x"], False))
self.assertFalse(tts._backend_available("kokoro", ["x"], False))
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()