diff options
| author | historia <historiavg@proton.me> | 2026-09-01 03:38:50 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-09-01 03:38:50 -0400 |
| commit | d15adb490b634dd22a65a1c8d7f4ec9fa74816b4 (patch) | |
| tree | 8fc5da437ceffc22482968cdf7c2591c81a407cc /app/ui/hub.py | |
| parent | 058b19e7a65b40b1024a4fdeb2233062ff273cfd (diff) | |
| download | tts-audiobook-generator-d15adb490b634dd22a65a1c8d7f4ec9fa74816b4.tar.gz | |
fix: hide speech-to-speech only models from config wizard
Diffstat (limited to 'app/ui/hub.py')
| -rw-r--r-- | app/ui/hub.py | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/app/ui/hub.py b/app/ui/hub.py index 76187d6..8d7dc15 100644 --- a/app/ui/hub.py +++ b/app/ui/hub.py @@ -1303,6 +1303,23 @@ def _audiocpp_fields(stdscr, api_url: Optional[str] = None, return [m for m in models if audiocpp_family_narrates(m.get("family") or "") is False] + def skipped_models_clause() -> str: + """What was skipped and why, e.g. "plex — speech-to-speech, not + TTS: it cannot turn text into audio. Consider deleting the model". + + Speech-to-speech models take audio in and answer with audio — they + have no text-to-speech pipeline, so a picked clone voice has + nothing to be applied to and every request would fail. The words + only: deleting is never prompted here. + """ + skipped = non_narrating_models() + names = ", ".join(str(m.get("id")) for m in skipped) + plural = len(skipped) > 1 + pronoun = "they" if plural else "it" + model_word = "models" if plural else "model" + return (f"{names} — speech-to-speech, not TTS: {pronoun} cannot " + f"turn text into audio. Consider deleting the {model_word}") + def all_voice_union() -> list: """Every voice an "All" run can offer. @@ -1374,10 +1391,10 @@ def _audiocpp_fields(stdscr, api_url: Optional[str] = None, "describe the voice in Instructions") skipped = non_narrating_models() if len(skipped) == len(models): - names = ", ".join(str(m.get("id")) for m in skipped) - return ("None of the configured models can synthesize text " - f"({names} only transform audio) — there is nothing " - "for an 'All' run to generate with") + # The clause names the models and why (speech-to-speech, not + # TTS); the refusal adds the All-run consequence. + return (f"{skipped_models_clause()}. There is nothing for an " + "'All' run to generate with") for m in models: if entry_capability(m) != AUDIOCPP_VOICE_CLONE: continue @@ -1714,9 +1731,8 @@ def _audiocpp_fields(stdscr, api_url: Optional[str] = None, for model_id in kwargs["model_ids"]} skipped = non_narrating_models() if skipped: - kwargs["run_notice"] = ( - "skipped non-TTS model(s): " - + ", ".join(str(m.get("id")) for m in skipped)) + kwargs["run_notice"] = \ + f"skipped {skipped_models_clause()}" return ("convert", BACKEND_AUDIOCPP, kwargs) model_id = result[prefix + "model_id"] # The picked voice (a built-in speaker name on a CustomVoice entry, |
