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:
@@ -5,6 +5,7 @@
|
||||
// Gap: real molo::di::Container and plugin registry in 05-request-routing.md.
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -18,6 +19,9 @@
|
||||
#include "../fw/Observ.hpp"
|
||||
#include "../fw/Stats.hpp"
|
||||
#include "../fw/Templates.hpp"
|
||||
#include "google/client.h"
|
||||
#include "google/voice.h"
|
||||
#include "google/voice_backend.h"
|
||||
|
||||
namespace molo::example::app {
|
||||
|
||||
@@ -49,6 +53,12 @@ struct Services {
|
||||
std::shared_ptr<fw::OpenApi> openapi = std::make_shared<fw::OpenApi>();
|
||||
std::shared_ptr<fw::Environment> templates =
|
||||
std::make_shared<fw::Environment>();
|
||||
// Google Cloud client (null: built from GOOGLE_API_KEY on first use) and
|
||||
// the voice pipeline wired on it. Tests inject a scripted client.
|
||||
std::shared_ptr<google::GoogleClient> google;
|
||||
std::shared_ptr<google::VoicePipeline> voice;
|
||||
// Unset: chosen from GOOGLE_API_BACKEND / the key prefix (see src/google).
|
||||
std::optional<google::VoiceBackend> voice_backend;
|
||||
// Feature matrix rows (feature, route) shown on the index page. Each
|
||||
// register_*_demo adds its own rows with add_feature().
|
||||
std::vector<std::pair<std::string, std::string>> features;
|
||||
@@ -76,6 +86,7 @@ void register_security_extra_demo(fw::Router& router, Services& services);
|
||||
void register_platform_demo(fw::Router& router, Services& services);
|
||||
void register_enterprise_demo(fw::Router& router, Services& services);
|
||||
void register_resilience_demo(fw::Router& router, Services& services);
|
||||
void register_voice_demo(fw::Router& router, Services& services);
|
||||
|
||||
void load_templates(Services& services);
|
||||
void load_embedded(Services& services);
|
||||
|
||||
Reference in New Issue
Block a user