From c1414616adde6f8f94307b355690d9b646459bf4 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Sat, 11 Jul 2026 11:16:06 +0000 Subject: [PATCH] feat: US-010 - Extinde /voice doctor cu health-check pocket-tts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - adaugă ping GET /health la pocket-tts (URL din config tts.pockettts_url) - adaugă verificare prezență hf_token în keyring - checks-urile existente (libopus, voice load error) rămân neschimbate gates rulate: tests PASS (1043 passed, 22 preexistente neschimbate), /review (backend) manual PASS --- src/adapters/discord_voice.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/adapters/discord_voice.py b/src/adapters/discord_voice.py index 022f6f8..18630bb 100644 --- a/src/adapters/discord_voice.py +++ b/src/adapters/discord_voice.py @@ -26,6 +26,7 @@ from pathlib import Path from typing import Optional import discord +import httpx from discord import app_commands # Optional DAVE dep (mandatory at runtime when discord.py 2.7.1 is paired with @@ -530,6 +531,23 @@ def register(tree: app_commands.CommandTree, bot: discord.Client) -> app_command checks.append(("libopus", False)) # warmup checks.append(("voice load error", _voice_load_error is None)) + # hf_token în keyring + try: + from src.credential_store import get_secret + + checks.append(("hf_token (keyring)", get_secret("hf_token") is not None)) + except Exception: + checks.append(("hf_token (keyring)", False)) + # pocket-tts /health + pockettts_ok = False + try: + pockettts_url = Config().get("tts.pockettts_url", "http://127.0.0.1:7789") + async with httpx.AsyncClient(timeout=3.0) as client: + resp = await client.get(f"{pockettts_url}/health") + pockettts_ok = resp.status_code == 200 + except Exception: + pockettts_ok = False + checks.append(("pocket-tts /health", pockettts_ok)) # Build response lines = ["**Voice doctor:**"] for label, ok in checks: