8d839e3714
- Add redaction gateway (redaction_gateway.py, redaction/ scrub + tests) - Add embeddings proxy and spark_embed service (Dockerfile + main.py) - Expand audio_proxy with speaker-aware handling; deep_health/health/server updates - Package: configureSparks action + sparkConfig model updates, manifest/main wiring - Docs: AUDIO_API, EMBEDDINGS, REDACTION_GATEWAY; HANDOFF and runbook/known-issues refresh
60 lines
1.5 KiB
Python
60 lines
1.5 KiB
Python
"""User-installed services persist in /data/services-overrides.yaml.
|
|
|
|
Format:
|
|
custom:
|
|
- key: my-riva
|
|
kind: stt
|
|
host: <spark-host-or-ip>
|
|
user: <ssh-user>
|
|
container: riva-asr
|
|
port: 8001
|
|
health_path: /health
|
|
image: nvcr.io/nim/nvidia/riva-multilingual:latest
|
|
"""
|
|
from __future__ import annotations
|
|
import os
|
|
from pathlib import Path
|
|
import yaml
|
|
|
|
|
|
def _path() -> str:
|
|
return os.environ.get("SERVICES_OVERRIDES", "/data/services-overrides.yaml")
|
|
|
|
|
|
def load_custom_services() -> list[dict]:
|
|
try:
|
|
with open(_path()) as f:
|
|
data = yaml.safe_load(f) or {}
|
|
except FileNotFoundError:
|
|
return []
|
|
return data.get("custom") or []
|
|
|
|
|
|
def add_custom_service(entry: dict) -> None:
|
|
p = _path()
|
|
Path(p).parent.mkdir(parents=True, exist_ok=True)
|
|
data: dict = {}
|
|
try:
|
|
with open(p) as f:
|
|
data = yaml.safe_load(f) or {}
|
|
except FileNotFoundError:
|
|
pass
|
|
custom = data.get("custom") or []
|
|
custom = [c for c in custom if c.get("key") != entry["key"]]
|
|
custom.append(entry)
|
|
data["custom"] = custom
|
|
with open(p, "w") as f:
|
|
yaml.safe_dump(data, f, sort_keys=False)
|
|
|
|
|
|
def delete_custom_service(key: str) -> None:
|
|
p = _path()
|
|
try:
|
|
with open(p) as f:
|
|
data = yaml.safe_load(f) or {}
|
|
except FileNotFoundError:
|
|
return
|
|
data["custom"] = [c for c in (data.get("custom") or []) if c.get("key") != key]
|
|
with open(p, "w") as f:
|
|
yaml.safe_dump(data, f, sort_keys=False)
|