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>
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
#pragma once
|
|
|
|
// Picks the three voice parts for a credential. One switch, three backends:
|
|
// kCloud classic Cloud Text-to-Speech + Speech-to-Text (need OAuth or an
|
|
// old-style key) with Gemini on generativelanguage for replies
|
|
// kGemini Gemini audio in/out on generativelanguage (AI Studio key)
|
|
// kVertex Gemini audio in/out on Vertex AI (express key, "AQ." prefix)
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "google/client.h"
|
|
#include "google/voice.h"
|
|
|
|
namespace molo::google {
|
|
|
|
enum class VoiceBackend { kCloud, kGemini, kVertex };
|
|
|
|
const char* voice_backend_name(VoiceBackend backend);
|
|
// GOOGLE_API_BACKEND (cloud|gemini|vertex) wins; else keys starting with
|
|
// "AQ." are Vertex express keys; everything else is classic cloud.
|
|
VoiceBackend voice_backend_from_env();
|
|
|
|
struct VoiceParts {
|
|
std::shared_ptr<Recognizer> recognizer;
|
|
std::shared_ptr<Responder> responder;
|
|
std::shared_ptr<Synthesizer> synthesizer;
|
|
};
|
|
|
|
VoiceParts make_voice_parts(std::shared_ptr<GoogleClient> client,
|
|
VoiceBackend backend);
|
|
|
|
} // namespace molo::google
|