Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Gemini Live: let the person choose Gemini's voice

Bugfixer 20e4322d57910
diff --git a/packages/phone-protocol/src/live-call-wire.ts b/packages/phone-protocol/src/live-call-wire.ts
index f82ed59d4b..0c5459b702 100644
--- a/packages/phone-protocol/src/live-call-wire.ts
+++ b/packages/phone-protocol/src/live-call-wire.ts
@@ -68,6 +68,8 @@ export interface LiveSettings {
/** The Azure deployment of gpt-live-1; empty means "gpt-live-1". */
azureDeployment?: string;
voice: string;
+ /** The Gemini Live voice for "gemini" calls; absent means Gemini's default. */
+ geminiVoice?: string;
readTypedReplies: boolean;
idleMinutes: number;
}
diff --git a/server/live-call-controller.test.ts b/server/live-call-controller.test.ts
index 7830d5a76e..8dc34ae299 100644
--- a/server/live-call-controller.test.ts
+++ b/server/live-call-controller.test.ts
@@ -505,6 +505,17 @@ describe("LiveCallController lifecycle", () => {
expect(started).not.toHaveProperty("sessionId");
});
+ it("starts in the Gemini voice chosen for Gemini calls, never the GPT-Live one", async () => {
+ const t = gemini();
+ Object.assign(t.settings, { voice: "cedar", geminiVoice: "Charon" });
+ await t.controller.start({ auth: owner, ...BOT, client: "web" });
+ expect(t.deps.createSession).toHaveBeenCalledWith(expect.objectContaining({ voice: "Charon" }));
+ const plain = gemini();
+ Object.assign(plain.settings, { voice: "cedar" });
+ await plain.controller.start({ auth: owner, ...BOT, client: "web" });
+ expect(plain.deps.createSession).toHaveBeenCalledWith(expect.objectContaining({ voice: "Puck" }));
+ });
+
it("refuses with the reason as a 403 before any session is taken", async () => {
const t = gemini({ geminiRefusal: () => "not you" });
await expect(t.controller.start({ auth: owner, ...BOT, client: "web" })).rejects.toMatchObject({ status: 403, message: "not you" });
diff --git a/server/live-call-controller.ts b/server/live-call-controller.ts
index 49b6a0ad88..8e0b32283c 100644
--- a/server/live-call-controller.ts
+++ b/server/live-call-controller.ts
@@ -4,7 +4,7 @@ import { spokenConsent } from "../shared/call-consent.ts";
import {
LIVE_COPY, liveCardKind, liveStepLabel, spokenApprovalPrompt, spokenConnectorPrompt, spokenQuestionPrompt, spokenReviewPrompt, spokenSecretPrompt, spokenSignInPrompt,
} from "../shared/live-approval.ts";
-import { clampAppend, commentaryChunks, LiveTranscript } from "../shared/live-call.ts";
+import { clampAppend, commentaryChunks, geminiLiveVoice, LiveTranscript } from "../shared/live-call.ts";
import { signInWaits } from "../shared/sign-in-request.ts";
import type { LiveCallRecord, LiveCallState, LiveClient, LiveEndReason, LiveFishTransport, LiveGeminiTransport, LiveProvider } from "../shared/wire.ts";
import { FISH_AGENT_VOICE } from "./live-fish.ts";
@@ -60,7 +60,7 @@ export interface LiveCallDeps {
activity(botId: string, threadId: string): LiveActivity;
broadcast(frame: { kind: "live.call"; botId: string; threadId: string; call: LiveCallState | null }): void;
/** `endpoint` null, or a `setupProblem`, refuses the call with that message (409). */
- settings(): { key: string; endpoint: LiveEndpoint | null; setupProblem?: string | null; provider?: LiveProvider; voice: string; readTypedReplies: boolean; idleMinutes: number };
+ settings(): { key: string; endpoint: LiveEndpoint | null; setupProblem?: string | null; provider?: LiveProvider; voice: string; geminiVoice?: string; readTypedReplies: boolean; idleMinutes: number };
/** Why this caller may not hold a call through Azure OpenAI; null when they may. Required, so no wiring can leave it out. */
azureRefusal(auth: RequestAuth): string | null;
/** The same for Fish Audio and Gemini, where the harness hears the call only through its client's reports. Required too. */
@@ -194,7 +194,7 @@ export class LiveCallController {
const endpoint = settings.endpoint;
if (settings.setupProblem || !key || !endpoint) throw new LiveSessionError(settings.setupProblem || LIVE_NEEDS_KEY, 409);
if (relayed !== (endpoint.provider === "fish" || endpoint.provider === "gemini" ? endpoint.provider : null)) throw new LiveSessionError(settings.setupProblem || LIVE_NEEDS_KEY, 409);
- const voice = relayed ? FISH_AGENT_VOICE : liveVoice(settings.voice);
+ const voice = relayed === "gemini" ? geminiLiveVoice(settings.geminiVoice) : relayed ? FISH_AGENT_VOICE : liveVoice(settings.voice);
const call = this.newCall(input, key, endpoint, voice);
// Taken before the first await: a second start in the same tick is refused.
this.call = call;
diff --git a/server/live-config.ts b/server/live-config.ts
index ca04b7dd5e..5f9503fe3b 100644
--- a/server/live-config.ts
+++ b/server/live-config.ts
@@ -4,7 +4,7 @@ import { z } from "zod";
export const LIVE_KEY_NEEDS_ENDPOINT = "Save the Azure endpoint first: a Live key works only with the endpoint it was saved for.";
const NOWHERE = "nowhere";
-/** Live calls: `key` is a key for Live calls only; with `provider` "openai" (the default) a call without one uses `openai.key`, with "azure" it is the Azure resource's key and is required, with "fish" or "gemini" it is not used: Fish Audio calls use the Fish Audio key (`tts.fishKey`) and Gemini calls the Gemini key (`tts.geminiKey`). `keyFor` says where `key` may go (`liveKeyTarget`): the server sets it when the key is saved and never takes it from a request; absent, the key is from before Azure was offered, so OpenAI's. `azureEndpoint` is the resource URL and `azureDeployment` the gpt-live-1 deployment name. `fishAgentId` is the Fish Audio agent a "fish" call starts, which the harness sets up on the account of the key whose `fishKeyPrint` is `fishAgentFor`; without `fishAgentFor` (an operator's OMB_FISH_LIVE_AGENT_ID) it is used with any key. `voice` is a GPT-Live voice. */
+/** Live calls: `key` is a key for Live calls only; with `provider` "openai" (the default) a call without one uses `openai.key`, with "azure" it is the Azure resource's key and is required, with "fish" or "gemini" it is not used: Fish Audio calls use the Fish Audio key (`tts.fishKey`) and Gemini calls the Gemini key (`tts.geminiKey`). `keyFor` says where `key` may go (`liveKeyTarget`): the server sets it when the key is saved and never takes it from a request; absent, the key is from before Azure was offered, so OpenAI's. `azureEndpoint` is the resource URL and `azureDeployment` the gpt-live-1 deployment name. `fishAgentId` is the Fish Audio agent a "fish" call starts, which the harness sets up on the account of the key whose `fishKeyPrint` is `fishAgentFor`; without `fishAgentFor` (an operator's OMB_FISH_LIVE_AGENT_ID) it is used with any key. `voice` is a GPT-Live voice, `geminiVoice` a Gemini Live voice. */
export const liveConfigSchema = z.object({
key: z.string().optional(),
keyFor: z.string().max(300).optional(),
@@ -14,6 +14,7 @@ export const liveConfigSchema = z.object({
fishAgentId: z.string().trim().max(128).optional(),
fishAgentFor: z.string().max(64).optional(),
voice: z.string().trim().max(40).regex(/^[a-z]*$/, "a Live voice is a lowercase built-in voice name").optional(),
+ geminiVoice: z.string().trim().max(40).regex(/^[A-Za-z]*$/, "a Gemini Live voice is a built-in voice name").optional(),
readTypedReplies: z.boolean().optional(),
idleMinutes: z.number().int().min(1).max(60).optional(),
});
@@ -27,6 +28,7 @@ export interface LiveConfig {
fishAgentId?: string;
fishAgentFor?: string;
voice?: string;
+ geminiVoice?: string;
readTypedReplies?: boolean;
idleMinutes?: number;
}
diff --git a/server/live-gemini.test.ts b/server/live-gemini.test.ts
index 47e68b6068..fcb8cf8061 100644
--- a/server/live-gemini.test.ts
+++ b/server/live-gemini.test.ts
@@ -9,8 +9,8 @@ function fakeGemini(answer: () => Response = () => new Response(JSON.stringify({
return vi.fn(async (_url: string | URL | Request, _init?: RequestInit) => answer());
}
-const create = (fetchImpl: typeof fetch, key = " gemini-secret ") =>
- createGeminiLiveSession({ key, endpoint: ENDPOINT, bot: { name: "Rigel" }, history: [], cloudHome: false, fetchImpl, now: () => NOW });
+const create = (fetchImpl: typeof fetch, key = " gemini-secret ", voice = "Kore") =>
+ createGeminiLiveSession({ key, endpoint: ENDPOINT, voice, bot: { name: "Rigel" }, history: [], cloudHome: false, fetchImpl, now: () => NOW });
describe("Gemini Live endpoint", () => {
it("talks to Google's v1beta API with the default Live model", () => {
@@ -37,10 +37,10 @@ describe("a Gemini Live call's token", () => {
expect(init!.headers).toMatchObject({ "x-goog-api-key": "gemini-secret" });
const body = JSON.parse(String(init!.body));
expect(body).toMatchObject({ uses: 1, newSessionExpireTime: "2026-11-14T10:01:00.000Z", expireTime: "2026-11-14T11:00:00.000Z" });
- expect(body.bidiGenerateContentSetup).toMatchObject({ model: `models/${GEMINI_LIVE_MODEL}`, generationConfig: { responseModalities: ["AUDIO"] } });
+ expect(body.bidiGenerateContentSetup).toMatchObject({ model: `models/${GEMINI_LIVE_MODEL}`, generationConfig: { responseModalities: ["AUDIO"], speechConfig: { voiceConfig: { prebuiltVoiceConfig: { voiceName: "Kore" } } } } });
expect(body.bidiGenerateContentSetup.systemInstruction.parts[0].text).toContain("Rigel");
expect(body.bidiGenerateContentSetup.tools[0].functionDeclarations[0]).toMatchObject({ name: FISH_DELEGATE_TOOL, behavior: "NON_BLOCKING" });
- expect(body.fieldMask.split(",")).toEqual(expect.arrayContaining(["model", "generationConfig.responseModalities", "systemInstruction.parts", "tools", "contextWindowCompression.slidingWindow"]));
+ expect(body.fieldMask.split(",")).toEqual(expect.arrayContaining(["model", "generationConfig.responseModalities", "generationConfig.speechConfig", "systemInstruction.parts", "tools", "contextWindowCompression.slidingWindow"]));
expect(body.fieldMask).not.toContain("sessionResumption");
expect(JSON.stringify(session)).not.toContain("gemini-secret");
expect(session).toEqual({
@@ -53,13 +53,24 @@ describe("a Gemini Live call's token", () => {
});
it("locks every field it sets, nested ones by their inner keys", () => {
- expect(geminiFieldMask(geminiLiveSetup("m", "hi"))).toBe(
- "model,generationConfig.responseModalities,systemInstruction.parts,tools,inputAudioTranscription,outputAudioTranscription,contextWindowCompression.slidingWindow");
+ expect(geminiFieldMask(geminiLiveSetup("m", "hi", "Puck"))).toBe(
+ "model,generationConfig.responseModalities,generationConfig.speechConfig,systemInstruction.parts,tools,inputAudioTranscription,outputAudioTranscription,contextWindowCompression.slidingWindow");
+ });
+
+ it("speaks in the chosen Gemini voice, and in Gemini's default for a name Gemini does not have", async () => {
+ const voiceOf = async (voice: string) => {
+ const fetchImpl = fakeGemini();
+ await create(fetchImpl, "k", voice);
+ return JSON.parse(String(fetchImpl.mock.calls[0]![1]!.body)).bidiGenerateContentSetup.generationConfig.speechConfig.voiceConfig.prebuiltVoiceConfig.voiceName;
+ };
+ expect(await voiceOf("Charon")).toBe("Charon");
+ expect(await voiceOf("")).toBe("Puck");
+ expect(await voiceOf("marin")).toBe("Puck");
});
it("connects a loopback override over ws", async () => {
const endpoint = geminiLiveEndpoint({ OMB_GEMINI_LIVE_URL: "http://127.0.0.1:9123" });
- const session = await createGeminiLiveSession({ key: "k", endpoint, bot: { name: "R" }, history: [], cloudHome: false, fetchImpl: fakeGemini(), now: () => NOW });
+ const session = await createGeminiLiveSession({ key: "k", endpoint, voice: "Puck", bot: { name: "R" }, history: [], cloudHome: false, fetchImpl: fakeGemini(), now: () => NOW });
expect(session.ws_url).toBe("ws://127.0.0.1:9123/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContentConstrained");
});
diff --git a/server/live-gemini.ts b/server/live-gemini.ts
index 9721489353..dbef582087 100644
--- a/server/live-gemini.ts
+++ b/server/live-gemini.ts
@@ -1,6 +1,7 @@
// Gemini Live calls. The Gemini key never leaves the harness: the client gets only a single-use ephemeral token whose setup
// (model, instructions, the `delegate` tool) the harness locks here, and it relays what was said as a Fish Audio call does.
import { randomBytes } from "node:crypto";
+import { geminiLiveVoice } from "../shared/live-call.ts";
import type { LiveGeminiSession } from "../shared/wire.ts";
import { LiveSessionError, type LiveBot, type LiveEndpoint, type LiveHistoryMessage } from "./live-call.ts";
import { FISH_DELEGATE_TOOL, fishInstructions } from "./live-fish.ts";
@@ -28,10 +29,10 @@ export function geminiLiveEndpoint(env: NodeJS.ProcessEnv = process.env): LiveEn
}
/** The setup every connection of the call gets, whatever the client sends: Gemini Live API `BidiGenerateContentSetup`. */
-export function geminiLiveSetup(model: string, instructions: string): Record<string, unknown> {
+export function geminiLiveSetup(model: string, instructions: string, voice: string): Record<string, unknown> {
return {
model: `models/${model}`,
- generationConfig: { responseModalities: ["AUDIO"] },
+ generationConfig: { responseModalities: ["AUDIO"], speechConfig: { voiceConfig: { prebuiltVoiceConfig: { voiceName: geminiLiveVoice(voice) } } } },
systemInstruction: { parts: [{ text: instructions }] },
tools: [{ functionDeclarations: [{
name: FISH_DELEGATE_TOOL,
@@ -57,6 +58,8 @@ export function geminiFieldMask(setup: Record<string, unknown>): string {
export interface CreateGeminiSessionInput {
key: string;
endpoint: LiveEndpoint;
+ /** A Gemini prebuilt voice name; anything else gets the default voice. */
+ voice: string;
bot: LiveBot;
history: LiveHistoryMessage[];
cloudHome: boolean;
@@ -70,7 +73,7 @@ export async function createGeminiLiveSession(input: CreateGeminiSessionInput):
const key = input.key.trim();
if (!key) throw new LiveSessionError("Add a Gemini API key in Settings → API keys to use Live calls.", 409);
const now = (input.now ?? Date.now)();
- const setup = geminiLiveSetup(input.endpoint.model, fishInstructions(input.bot, input.history, { cloudHome: input.cloudHome }));
+ const setup = geminiLiveSetup(input.endpoint.model, fishInstructions(input.bot, input.history, { cloudHome: input.cloudHome }), input.voice);
const expiresAt = new Date(now + CONNECT_WITHIN_MS).toISOString();
let response: Response;
try {
diff --git a/server/live-session-wiring.ts b/server/live-session-wiring.ts
index 96a96c1688..b8749b0a26 100644
--- a/server/live-session-wiring.ts
+++ b/server/live-session-wiring.ts
@@ -59,7 +59,7 @@ export function liveSessionWiring(input: LiveSessionWiringInput): {
geminiRefusal: (auth) => geminiLiveCallRefusal(auth, { othersOnLoopback: input.othersOnLoopback() }),
createSession: async ({ key, endpoint, sdp, botId, threadId, voice }) => {
if (endpoint.provider === "gemini") {
- const session = await createGeminiLiveSession({ key, endpoint, bot: input.bot(botId), history: input.history(threadId), cloudHome: input.cloudHome, fetchImpl });
+ const session = await createGeminiLiveSession({ key, endpoint, voice, bot: input.bot(botId), history: input.history(threadId), cloudHome: input.cloudHome, fetchImpl });
// Gemini has nothing to end: the session ends when the client closes it, and the token is single use.
const { token } = relays.open(session.session_id, async () => undefined);
return { sessionId: session.session_id, gemini: { type: "gemini", session, relayToken: token } };
diff --git a/server/live-settings.test.ts b/server/live-settings.test.ts
index 49bca951b3..b3b3c94825 100644
--- a/server/live-settings.test.ts
+++ b/server/live-settings.test.ts
@@ -17,6 +17,11 @@ describe("live settings", () => {
expect(settings).toEqual({ configured: true, keySource: "live", voice: "sol", readTypedReplies: false, idleMinutes: 12 });
expect(JSON.stringify(settings)).not.toContain("sk-test");
});
+
+ it("reports a saved Gemini voice beside the GPT-Live one, and nothing when it is cleared", () => {
+ expect(liveSettingsFor({ live: { voice: "cedar", geminiVoice: "Kore" } } as AppConfig)).toMatchObject({ voice: "cedar", geminiVoice: "Kore" });
+ expect(liveSettingsFor({ live: { geminiVoice: "" } } as AppConfig)).not.toHaveProperty("geminiVoice");
+ });
});
describe("the key a Live call uses", () => {
diff --git a/server/live-settings.ts b/server/live-settings.ts
index 21d1c0deda..225bdf303d 100644
--- a/server/live-settings.ts
+++ b/server/live-settings.ts
@@ -71,6 +71,7 @@ export function liveSettingsFor(cfg: AppConfig): LiveSettings {
...(cfg.live?.azureEndpoint ? { azureEndpoint: cfg.live.azureEndpoint } : {}),
...(cfg.live?.azureDeployment ? { azureDeployment: cfg.live.azureDeployment } : {}),
voice: cfg.live?.voice ?? "",
+ ...(cfg.live?.geminiVoice ? { geminiVoice: cfg.live.geminiVoice } : {}),
readTypedReplies: cfg.live?.readTypedReplies ?? true,
idleMinutes: Number.isInteger(minutes) && minutes! >= 1 && minutes! <= 60 ? minutes! : LIVE_IDLE_MINUTES_DEFAULT,
};
diff --git a/server/routes/live.test.ts b/server/routes/live.test.ts
index e79f4ffc39..243b9da62d 100644
--- a/server/routes/live.test.ts
+++ b/server/routes/live.test.ts
@@ -139,7 +139,10 @@ describe("live routes", () => {
expect((await request(d, "PATCH", "/api/live/settings", { idleMinutes: 0 })).status).toBe(400);
expect((await request(d, "PATCH", "/api/live/settings", { idleMinutes: 61 })).status).toBe(400);
expect((await request(d, "PATCH", "/api/live/settings", { voice: "Marin!" })).status).toBe(400);
- expect(d.saved).toEqual([{ idleMinutes: 10, readTypedReplies: false }]);
+ expect((await request(d, "PATCH", "/api/live/settings", { geminiVoice: "marin" })).status).toBe(400);
+ expect((await request(d, "PATCH", "/api/live/settings", { geminiVoice: "Kore" })).status).toBe(200);
+ expect((await request(d, "PATCH", "/api/live/settings", { geminiVoice: "" })).status).toBe(200);
+ expect(d.saved).toEqual([{ idleMinutes: 10, readTypedReplies: false }, { geminiVoice: "Kore" }, { geminiVoice: "" }]);
});
it("saves an Azure provider, endpoint and deployment, refusing a host the key must not reach", async () => {
const d = deps();
diff --git a/server/routes/live.ts b/server/routes/live.ts
index 74cba983e2..58f3138838 100644
--- a/server/routes/live.ts
+++ b/server/routes/live.ts
@@ -2,6 +2,7 @@
import type { IncomingMessage } from "node:http";
import { z } from "zod";
import type { LiveFishRelayCommand, LiveFishRelayEvent, LiveProvider, LiveSettings } from "../../shared/wire.ts";
+import { GEMINI_LIVE_VOICE_OPTIONS } from "../../shared/live-call.ts";
import { azureLiveDeployment, azureOpenAiRoot, LiveSessionError, MAX_SDP_BYTES } from "../live-call.ts";
import { LiveCallBusyError, type LiveCallController } from "../live-call-controller.ts";
import { RELAY_POLL_MS } from "../live-fish.ts";
@@ -11,7 +12,7 @@ export interface LiveRouteDeps {
calls: Pick<LiveCallController, "start" | "end" | "current" | "deviceRevoked">;
resolveTarget(botId: string, threadId: string | undefined): { botId: string; botName: string; threadId: string } | null;
settings(): LiveSettings;
- saveSettings(patch: { provider?: LiveProvider; azureEndpoint?: string; azureDeployment?: string; voice?: string; readTypedReplies?: boolean; idleMinutes?: number }): Promise<LiveSettings>;
+ saveSettings(patch: { provider?: LiveProvider; azureEndpoint?: string; azureDeployment?: string; voice?: string; geminiVoice?: string; readTypedReplies?: boolean; idleMinutes?: number }): Promise<LiveSettings>;
/** A running Fish Audio or Gemini call's relay, only for the token its start answered with. */
fishRelay(sessionId: string, token: string): { receive(events: LiveFishRelayEvent[], from?: number): void; poll(waitMs: number): Promise<{ commands: LiveFishRelayCommand[]; closed: boolean }> } | null;
}
@@ -48,6 +49,8 @@ const settingsBody = z.object({
azureEndpoint: z.string().trim().max(300).refine((url) => url === "" || azureOpenAiRoot(url) !== null).optional(),
azureDeployment: z.string().trim().max(64).refine((name) => name === "" || azureLiveDeployment(name) === name).optional(),
voice: z.string().trim().max(40).regex(/^[a-z]*$/).optional(),
+ // "" goes back to the default voice.
+ geminiVoice: z.string().trim().refine((name) => name === "" || GEMINI_LIVE_VOICE_OPTIONS.some((option) => option.id === name)).optional(),
readTypedReplies: z.boolean().optional(),
idleMinutes: z.number().int().min(1).max(60).optional(),
}).strict();
diff --git a/shared/live-call.ts b/shared/live-call.ts
index c3358499e3..0b0e054894 100644
--- a/shared/live-call.ts
+++ b/shared/live-call.ts
@@ -178,6 +178,26 @@ export const LIVE_VOICE_OPTIONS: ReadonlyArray<{ id: string; label: string }> =
{ id: "tempo", label: "Tempo — Brazilian Portuguese, masculine" },
];
+/** Gemini Live's prebuilt voices (Gemini API docs, "Live API capabilities", voices), with the docs' one-word character.
+ * Gemini names them with a capital letter. */
+export const GEMINI_LIVE_VOICE_OPTIONS: ReadonlyArray<{ id: string; label: string }> = [
+ { id: "Puck", label: "Puck — upbeat (default)" },
+ { id: "Charon", label: "Charon — informative" },
+ { id: "Kore", label: "Kore — firm" },
+ { id: "Fenrir", label: "Fenrir — excitable" },
+ { id: "Aoede", label: "Aoede — breezy" },
+ { id: "Leda", label: "Leda — youthful" },
+ { id: "Orus", label: "Orus — firm" },
+ { id: "Zephyr", label: "Zephyr — bright" },
+];
+
+export const GEMINI_LIVE_DEFAULT_VOICE = "Puck";
+
+/** A saved Gemini voice when it is one of Gemini's, else the default. */
+export function geminiLiveVoice(voice: string | undefined): string {
+ return GEMINI_LIVE_VOICE_OPTIONS.find((option) => option.id === voice?.trim())?.id ?? GEMINI_LIVE_DEFAULT_VOICE;
+}
+
/** A call's length as a clock: m:ss under an hour ("0:07", "1:42"),
* h:mm:ss from an hour on ("1:02:05"). Whole seconds; a value that is not a
* length reads as 0:00. */
diff --git a/src/components/LiveCallBar.render.test.ts b/src/components/LiveCallBar.render.test.ts
index 15a221b41d..52dd77a16e 100644
--- a/src/components/LiveCallBar.render.test.ts
+++ b/src/components/LiveCallBar.render.test.ts
@@ -161,6 +161,19 @@ describe("LiveCallSettings", () => {
expect(none).not.toContain("Remove key");
});
+ it("offers Gemini's own voices for Gemini calls, not GPT-Live's", () => {
+ const withLive = (live: LiveSettings) => {
+ const value = { state: { ...initialState, config: { live } as AppState["config"] }, dispatch: vi.fn(), flushBotPatches: async () => null, refreshInstances: async () => {}, refreshModels: async () => {} };
+ return renderToStaticMarkup(createElement(BotEditorStore, { value, children: createElement(LiveCallSettings, { onClose: vi.fn() }) }));
+ };
+ const base = { configured: true, provider: "gemini" as const, keySource: "gemini" as const, voice: "marin", readTypedReplies: true, idleMinutes: 5 };
+ const plain = withLive(base);
+ expect(plain).toMatch(/<option value="Puck" selected="">Puck — upbeat \(default\)<\/option>/);
+ expect(plain).toContain("Charon — informative");
+ expect(plain).not.toContain("Marin (default)");
+ expect(withLive({ ...base, geminiVoice: "Kore" })).toMatch(/<option value="Kore" selected="">/);
+ });
+
it("says the key stays on the Cloud when the chat is on the person's Cloud", () => {
const markup = renderOnCloud(createElement(LiveCallSettings, { onClose: vi.fn() }));
expect(markup).toContain(CLOUD_DISCLOSURE);
diff --git a/src/components/LiveCallSettings.tsx b/src/components/LiveCallSettings.tsx
index 468db87e0a..ec7d730fef 100644
--- a/src/components/LiveCallSettings.tsx
+++ b/src/components/LiveCallSettings.tsx
@@ -1,6 +1,6 @@
import { useCallback, useId, useState } from "react";
-import { LIVE_VOICE_OPTIONS } from "../../shared/live-call";
+import { GEMINI_LIVE_VOICE_OPTIONS, geminiLiveVoice, LIVE_VOICE_OPTIONS } from "../../shared/live-call";
import { t } from "@/lib/i18n";
import { liveDisclosure, liveKeyCopy } from "@/lib/call-mode";
import { api, useStore, type ConfigStatus } from "@/state/store";
@@ -30,10 +30,12 @@ export function LiveCallSettings({ onClose }: { onClose: () => void }) {
const gemini = live.provider === "gemini";
const copy = liveKeyCopy(live.provider);
const hasKey = live.keySource === (fish ? "fishAudio" : gemini ? "gemini" : "live");
- const voice = live.voice || "marin";
- const known = LIVE_VOICE_OPTIONS.some((option) => option.id === voice);
+ // Gemini has its own voices, kept apart from the GPT-Live one.
+ const voiceOptions = gemini ? GEMINI_LIVE_VOICE_OPTIONS : LIVE_VOICE_OPTIONS;
+ const voice = gemini ? geminiLiveVoice(live.geminiVoice) : live.voice || "marin";
+ const known = voiceOptions.some((option) => option.id === voice);
- const save = async (patch: Partial<Pick<LiveSettings, "voice" | "readTypedReplies" | "idleMinutes">>) => {
+ const save = async (patch: Partial<Pick<LiveSettings, "voice" | "geminiVoice" | "readTypedReplies" | "idleMinutes">>) => {
setSaving(true);
setError(null);
try {
@@ -75,18 +77,18 @@ export function LiveCallSettings({ onClose }: { onClose: () => void }) {
}}
>
<LiveProviderSettings locked={keySaving} onSaving={setProviderSaving} />
- {/* Relayed calls speak in the provider's own voice. */}
- {!fish && !gemini && <>
+ {/* Fish Audio calls speak in the agent's own voice. */}
+ {!fish && <>
<label className="flex items-center justify-between gap-2">
<span className="text-ink-secondary">{t("call.live.voice")}</span>
<Select
size="sm"
value={voice}
disabled={saving}
- onChange={(event) => void save({ voice: event.target.value })}
+ onChange={(event) => void save(gemini ? { geminiVoice: event.target.value } : { voice: event.target.value })}
>
{!known && <option value={voice}>{voice}</option>}
- {LIVE_VOICE_OPTIONS.map((option) => <option key={option.id} value={option.id}>{option.label}</option>)}
+ {voiceOptions.map((option) => <option key={option.id} value={option.id}>{option.label}</option>)}
</Select>
</label>
<div className="-mt-2 text-[12px] text-ink-tertiary">{t("call.live.voiceNext")}</div>