aboutsummaryrefslogtreecommitdiff
path: root/app/backends/qwen.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-24 04:53:43 -0400
committerhistoria <historiavg@proton.me>2026-08-24 04:53:43 -0400
commit0512a932bbf3b87619b6a250f87eb7904d22d1f7 (patch)
treedd2b0eb45823c0690ad2bc86f5aa9be2771f5b17 /app/backends/qwen.py
parent9fb2434dcc8a1ed7bd085b453859d473de64448a (diff)
downloadtts-audiobook-generator-0512a932bbf3b87619b6a250f87eb7904d22d1f7.tar.gz
feat: hide convert/config/start-stop menus if no valid installation
Diffstat (limited to 'app/backends/qwen.py')
-rw-r--r--app/backends/qwen.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/app/backends/qwen.py b/app/backends/qwen.py
index 21280a0..64f3996 100644
--- a/app/backends/qwen.py
+++ b/app/backends/qwen.py
@@ -27,6 +27,7 @@ from backends import (
common,
envs,
format_launch_hint,
+ servers,
)
from converter import config
from ui import tui
@@ -215,10 +216,15 @@ def detect() -> BackendStatus:
installed = _is_installed()
custom_port = _config_port(config.QWEN_API_URL, DEFAULT_CUSTOM_PORT)
clone_port = _config_port(config.CLONE_API_URL, DEFAULT_CLONE_PORT)
- # Running when either server is up — CustomVoice (speaker mode) or Base
- # (voice clone) each suffice for a conversion on their own.
- running = (common.server_running(config.QWEN_API_URL)
- or common.server_running(config.CLONE_API_URL))
+ # Probe each port separately: whichever answers names the running
+ # model — CustomVoice (speaker mode) or Base (voice clone); either
+ # suffices for a conversion on its own.
+ custom_up = common.server_running(config.QWEN_API_URL)
+ clone_up = common.server_running(config.CLONE_API_URL)
+ running = custom_up or clone_up
+ running_models = [name for name, up in
+ (("Base", clone_up), ("CustomVoice", custom_up))
+ if up]
details: List[str] = []
details.append("pip: installed" if installed else
"not installed — run setup to pip install qwen-tts")
@@ -226,7 +232,7 @@ def detect() -> BackendStatus:
details.append(f"Base (clone) port: {clone_port}")
details.append(f"speaker: {config.SPEAKER}")
demo = str(envs.env_script("qwen-tts-demo"))
- servers = [
+ specs = [
ServerSpec("qwen-custom", config.QWEN_API_URL,
[demo, QWEN_CUSTOMVOICE_MODEL, "--ip", "127.0.0.1",
"--port", str(custom_port)]),
@@ -237,8 +243,10 @@ def detect() -> BackendStatus:
return BackendStatus("qwen", "qwen-tts",
installed=installed, configured=installed,
running=running, details=details,
- launch_hint=format_launch_hint(servers),
- servers=servers)
+ launch_hint=format_launch_hint(specs),
+ servers=specs,
+ managed=servers.manages(specs),
+ running_models=running_models)
configure_actions: List[ConfigureAction] = [