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:
@@ -0,0 +1,25 @@
|
||||
// Route: POST /voice/reset (forget one conversation)
|
||||
#include "support/GoogleRig.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
|
||||
int main() {
|
||||
setenv("GOOGLE_GENAI_MODEL", "rig-model", 1);
|
||||
GoogleRig rig;
|
||||
rig.gemini("Hoi!");
|
||||
rig.tts("A");
|
||||
Fixture f(rig.client);
|
||||
f.client->post("/voice/turn?cid=keep1", "{\"text\":\"hallo\"}", "application/json");
|
||||
check(f.services.voice->sessions().history_size("keep1") == 2, "arranged: 2 messages");
|
||||
auto res = f.client->post("/voice/reset?cid=keep1");
|
||||
check(res.status == 200 && contains(res.body, "\"reset\":true"), "reset answered");
|
||||
check(f.services.voice->sessions().history_size("keep1") == 0,
|
||||
"side effect: history gone");
|
||||
check(f.client->post("/voice/reset?cid=never-seen").status == 200,
|
||||
"unknown conversation is a no-op");
|
||||
check(f.client->post("/voice/reset").status == 422, "missing cid is 422");
|
||||
check(f.client->post("/voice/reset?cid=a%2Fb").status == 422, "bad cid is 422");
|
||||
check(f.client->get("/voice/reset").status == 405, "get is 405");
|
||||
unsetenv("GOOGLE_GENAI_MODEL");
|
||||
return finish("voice/reset");
|
||||
}
|
||||
Reference in New Issue
Block a user