aboutsummaryrefslogtreecommitdiff
path: root/app/ui
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-29 13:57:40 -0400
committerhistoria <historiavg@proton.me>2026-08-29 13:57:40 -0400
commitdf4a81c6101d33fe745b6ac249c736e088760c85 (patch)
tree7103e8e2d33a1c2b9afecd47d309147bbeed3c34 /app/ui
parent8a128b3859b8f398e162d3168ff328ab3199d307 (diff)
downloadtts-audiobook-generator-df4a81c6101d33fe745b6ac249c736e088760c85.tar.gz
fix: crash on bad model_specs from audio.cpp, sanitized
Diffstat (limited to 'app/ui')
-rw-r--r--app/ui/hub.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/ui/hub.py b/app/ui/hub.py
index 24c779f..ef41d0b 100644
--- a/app/ui/hub.py
+++ b/app/ui/hub.py
@@ -1163,17 +1163,25 @@ def _audiocpp_fields(stdscr, api_url: Optional[str] = None,
entry.get("id") or "")
def reset_voice(fields) -> None:
- """Re-point the Voice field at the newly selected model's voice."""
+ """Re-point the Voice field at the newly selected model's voice.
+
+ A model switch that keeps the same voice list (two clone entries
+ sharing one server's voices) keeps the current pick: only a value
+ the new list cannot offer is re-pointed at its default.
+ """
voice_field = next(f for f in fields
if f.get("key") == prefix + "audiocpp_voice")
capability = model_capability(fields)
if capability == AUDIOCPP_VOICE_DESIGN:
voice_field["value"] = None
- elif capability == AUDIOCPP_VOICE_SPEAKER:
- voice_field["value"] = QWEN3_TTS_SPEAKERS[0]
+ return
+ if capability == AUDIOCPP_VOICE_SPEAKER:
+ voices = QWEN3_TTS_SPEAKERS
else: # clone
voices = voices_for(_field_value(fields, prefix + "model_id"))
- voice_field["value"] = voices[0] if voices else ""
+ if voice_field.get("value") in voices:
+ return # the new list still offers the pick: keep it
+ voice_field["value"] = voices[0] if voices else ""
def voice_choices(fields) -> list:
capability = model_capability(fields)