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:
@@ -22,6 +22,7 @@ const char kBase[] = R"BASE(<!DOCTYPE html>
|
||||
<a href="/templates/page">Templates</a>
|
||||
<a href="/forms/contact">Forms</a>
|
||||
<a href="/stats">Stats</a>
|
||||
<a href="/voice">Voice</a>
|
||||
<a href="/docs">Docs</a>
|
||||
<a href="/health">Health</a>
|
||||
</nav>
|
||||
@@ -32,6 +33,7 @@ const char kBase[] = R"BASE(<!DOCTYPE html>
|
||||
<a href="/templates/page">Templates</a>
|
||||
<a href="/forms/contact">Forms</a>
|
||||
<a href="/stats">Stats</a>
|
||||
<a href="/voice">Voice</a>
|
||||
<a href="/docs">Docs</a>
|
||||
<a href="/health">Health</a>
|
||||
</nav>
|
||||
@@ -168,6 +170,37 @@ after its connection cap, so auto refresh is off by default.</p>
|
||||
{% endblock %}
|
||||
)STATS";
|
||||
|
||||
const char kVoice[] = R"VOICE({% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Voice conversation</h1>
|
||||
<p class="hint">Talk, pause, and the assistant answers out loud. Google
|
||||
speech-to-text, Gemini, and Google text-to-speech run on the server.
|
||||
Speak over the answer to interrupt it.</p>
|
||||
<p id="v-config" class="hint">Checking Google credentials...</p>
|
||||
<section class="voice">
|
||||
<div class="voice-controls">
|
||||
<button id="v-toggle" type="button" class="primary" disabled>Start conversation</button>
|
||||
<label class="inline">Language
|
||||
<select id="v-lang">
|
||||
<option value="nl-NL">Nederlands</option>
|
||||
<option value="en-US">English</option>
|
||||
<option value="de-DE">Deutsch</option>
|
||||
</select></label>
|
||||
</div>
|
||||
<div class="voice-state"><span id="v-state" class="pill">idle</span>
|
||||
<div class="meter"><div id="v-level"></div></div></div>
|
||||
<p id="v-error" class="error" role="alert"></p>
|
||||
<ol id="v-log" class="voice-log"></ol>
|
||||
<form id="v-form" class="voice-form">
|
||||
<input id="v-text" type="text" maxlength="500" placeholder="Or type a message" autocomplete="off">
|
||||
<button type="submit">Send</button>
|
||||
<button id="v-reset" type="button">Reset</button>
|
||||
</form>
|
||||
</section>
|
||||
<script src="/embedded/voice.js"></script>
|
||||
{% endblock %}
|
||||
)VOICE";
|
||||
|
||||
const char kDocs[] = R"DOCS({% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>API docs</h1>
|
||||
@@ -198,6 +231,7 @@ void load_templates(Services& services) {
|
||||
services.templates->add_template("page.html", kPage);
|
||||
services.templates->add_template("form_page.html", kFormPage);
|
||||
services.templates->add_template("docs.html", kDocs);
|
||||
services.templates->add_template("voice.html", kVoice);
|
||||
services.templates->add_template("stats.html", kStats);
|
||||
services.templates->add_template("error.html", kError);
|
||||
services.templates->add_template("nav_hint.html", kNavHint);
|
||||
|
||||
Reference in New Issue
Block a user