diff options
Diffstat (limited to 'app/backends/faster.py')
| -rwxr-xr-x | app/backends/faster.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/app/backends/faster.py b/app/backends/faster.py index 77b9c8a..3dc30dd 100755 --- a/app/backends/faster.py +++ b/app/backends/faster.py @@ -31,6 +31,7 @@ from backends import ( common, envs, format_launch_hint, + probe, servers, ) from backends.common import ( @@ -348,7 +349,6 @@ def detect() -> BackendStatus: cloned = _is_cloned() voices_json = _checkout() / "voices.json" configured = installed and cloned and voices_json.exists() - running = common.server_running(config.FASTER_API_URL) details: List[str] = [] details.append("pip: installed" if installed else "not installed — run setup to pip install") @@ -364,11 +364,31 @@ def detect() -> BackendStatus: "--voices", str(voices_json), "--port", str(_config_port())] specs = [ServerSpec("faster", config.FASTER_API_URL, argv)] launch = format_launch_hint(specs) + managed = servers.manages(specs) + remote_running, remote_urls = _detect_remote(managed) return BackendStatus("faster", "faster-qwen3-tts", installed=installed and cloned, - configured=configured, running=running, + configured=configured, + running=managed or remote_running, details=details, launch_hint=launch, - servers=specs, managed=servers.manages(specs)) + servers=specs, managed=managed, + remote=remote_running, remote_urls=remote_urls) + + +def _detect_remote(managed: bool = False): + """Detect an externally-run faster server at the remote URL. + + Returns ``(running, {spec_name: url})``; see audiocpp._detect_remote for + the shared semantics (empty URL disables, own server not counted twice). + """ + url = (config.FASTER_REMOTE_URL or "").strip() + if not url: + return False, {} + if managed and probe.same_endpoint(url, config.FASTER_API_URL): + return False, {} + if probe.identify_server(url) == probe.IDENTITY_FASTER: + return True, {"faster": url} + return False, {} def _run_voices_only_tui() -> int: |
