feat: US-010 - Extinde /voice doctor cu health-check pocket-tts
- 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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user