feat(clients): google cloud voice: generic client, TTS, STT, Gemini audio, live voice page
src/google: GoogleClient over molo::clients (key in x-goog-api-key, never in
URLs), Service base, TextToSpeech, SpeechToText, Generative (replies, audio
in, audio out), Recognizer/Synthesizer seams with cloud, gemini and vertex
backends, VoicePipeline with bounded history. Example: /voice live
conversation page, /voice/{say,hear,turn,reset}, /google/status. Keys load
from env, .env.json.local, .env.json. Paid routes are excluded from locust.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,10 @@ HERE = Path(__file__).resolve().parent
|
||||
APP = HERE / "app"
|
||||
LOCUST = HERE / "locustfile.py"
|
||||
|
||||
# Routes that call paid Google APIs: never load tested. The check fails if
|
||||
# locust references one, and does not require them to be covered.
|
||||
EXCLUDED = {"/voice/say", "/voice/hear", "/voice/turn", "/voice/reset"}
|
||||
|
||||
FILLS = {"name": "locust", "id": "1", "status": "404", "tenant": "acme"}
|
||||
|
||||
|
||||
@@ -55,7 +59,7 @@ def main() -> int:
|
||||
routes = collect_routes()
|
||||
urls, methods = collect_locust_urls()
|
||||
missing: list[str] = []
|
||||
for r in sorted(routes):
|
||||
for r in sorted(routes - EXCLUDED):
|
||||
c = fill(r)
|
||||
ok = (
|
||||
c in urls
|
||||
@@ -68,6 +72,9 @@ def main() -> int:
|
||||
)
|
||||
if not ok:
|
||||
missing.append(f"{r} -> {c}")
|
||||
leaked = sorted(EXCLUDED & urls)
|
||||
for r in leaked:
|
||||
print("FORBIDDEN (costs money):", r)
|
||||
required_methods = {"get", "post", "put", "options"}
|
||||
missing_methods = required_methods - methods
|
||||
print(f"routes={len(routes)} urls={len(urls)} methods={sorted(methods)}")
|
||||
@@ -75,10 +82,13 @@ def main() -> int:
|
||||
print("MISSING METHODS:", sorted(missing_methods))
|
||||
for m in missing:
|
||||
print("MISS", m)
|
||||
if leaked:
|
||||
print(f"FAIL: {len(leaked)} paid Google routes in locust")
|
||||
return 1
|
||||
if missing or missing_methods:
|
||||
print(f"FAIL: {len(missing)} missing routes, {len(missing_methods)} missing methods")
|
||||
return 1
|
||||
print(f"OK: {len(routes)}/{len(routes)} routes covered, methods {sorted(methods)}")
|
||||
print(f"OK: {len(routes) - len(EXCLUDED)} routes covered, {len(EXCLUDED)} paid Google routes excluded, methods {sorted(methods)}")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user