Skip to content

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

Show the bot's Live call voice in its voice settings

AdityaUmalede8a3419dd0a
diff --git a/src/components/BotLiveVoiceSelect.tsx b/src/components/BotLiveVoiceSelect.tsx
new file mode 100644
index 0000000000..9dad182440
--- /dev/null
+++ b/src/components/BotLiveVoiceSelect.tsx
@@ -0,0 +1,21 @@
+import { botCallVoice, GEMINI_LIVE_VOICE_OPTIONS, LIVE_VOICE_OPTIONS } from "../../shared/live-call";
+import { t } from "@/lib/i18n";
+import type { Bot } from "@/state/store";
+import { Select } from "./Select";
+
+/** The bot's own Live call voice. Empty follows the app's default call voice; a saved voice of the other provider's kind shows as the default. */
+export function BotLiveVoiceSelect({ bot, gemini, onChange }: {
+ bot: Pick<Bot, "name" | "liveVoice">;
+ gemini: boolean;
+ onChange: (liveVoice: string) => void;
+}) {
+ return (
+ <label className="flex items-center justify-between gap-2">
+ <span className="text-ink-secondary">{t("call.live.botVoice", { name: bot.name })}</span>
+ <Select size="sm" value={botCallVoice(bot.liveVoice, "", gemini)} onChange={(event) => onChange(event.target.value)}>
+ <option value="">{t("call.live.botVoiceDefault")}</option>
+ {(gemini ? GEMINI_LIVE_VOICE_OPTIONS : LIVE_VOICE_OPTIONS).map((option) => <option key={option.id} value={option.id}>{option.label}</option>)}
+ </Select>
+ </label>
+ );
+}
diff --git a/src/components/LiveCallSettings.tsx b/src/components/LiveCallSettings.tsx
index 3df825d5ab..bd9bfcf7ba 100644
--- a/src/components/LiveCallSettings.tsx
+++ b/src/components/LiveCallSettings.tsx
@@ -1,12 +1,13 @@
import { useCallback, useId, useState } from "react";
-import { botCallVoice, GEMINI_LIVE_VOICE_OPTIONS, geminiLiveVoice, 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, liveKeyFormKey } from "@/lib/call-mode";
import { api, useStore, type Bot, type ConfigStatus } from "@/state/store";
import type { LiveSettings } from "../../shared/wire";
import { LiveKeySetup } from "./LiveKeySetup";
import { LiveProviderSettings } from "./LiveProviderSettings";
+import { BotLiveVoiceSelect } from "./BotLiveVoiceSelect";
import { KeysLink } from "./keys/KeysLink";
import { Select } from "./Select";
@@ -37,8 +38,6 @@ export function LiveCallSettings({ bot, onClose }: { bot?: Pick<Bot, "id" | "nam
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);
- // A bot's own voice of the other provider's kind stays saved and shows as the default here.
- const botVoice = bot ? botCallVoice(bot.liveVoice, "", gemini) : "";
const save = async (patch: Partial<Pick<LiveSettings, "voice" | "geminiVoice" | "readTypedReplies" | "idleMinutes">>) => {
setSaving(true);
@@ -85,17 +84,7 @@ export function LiveCallSettings({ bot, onClose }: { bot?: Pick<Bot, "id" | "nam
{/* Fish Audio and ElevenLabs calls speak in their agent's own voice. */}
{!fish && !elevenlabs && <>
{bot && (
- <label className="flex items-center justify-between gap-2">
- <span className="text-ink-secondary">{t("call.live.botVoice", { name: bot.name })}</span>
- <Select
- size="sm"
- value={botVoice}
- onChange={(event) => dispatch({ type: "updateBot", botId: bot.id, patch: { liveVoice: event.target.value } })}
- >
- <option value="">{t("call.live.botVoiceDefault")}</option>
- {voiceOptions.map((option) => <option key={option.id} value={option.id}>{option.label}</option>)}
- </Select>
- </label>
+ <BotLiveVoiceSelect bot={bot} gemini={gemini} onChange={(liveVoice) => dispatch({ type: "updateBot", botId: bot.id, patch: { liveVoice } })} />
)}
<label className="flex items-center justify-between gap-2">
<span className="text-ink-secondary">{t(bot ? "call.live.defaultVoice" : "call.live.voice")}</span>
diff --git a/src/components/bot-settings/VoiceSection.dom.test.ts b/src/components/bot-settings/VoiceSection.dom.test.ts
new file mode 100644
index 0000000000..7a91f698cc
--- /dev/null
+++ b/src/components/bot-settings/VoiceSection.dom.test.ts
@@ -0,0 +1,80 @@
+// @vitest-environment happy-dom
+// A bot's own Live call voice, in a real DOM, on the bot's voice settings beside the read-aloud voice.
+import { createElement } from "react";
+import { flushSync } from "react-dom";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { setLocale } from "@/lib/i18n";
+import { BotEditorStore, initialState, type AppState, type Bot } from "@/state/store";
+import type { LiveSettings } from "../../../shared/wire";
+import { BotEditorContext } from "./BotEditorContext";
+import { VoiceSection } from "./VoiceSection";
+import type { useBotSettingsDerived } from "./useBotSettingsDerived";
+
+const atlas: Bot = {
+ id: "atlas", threadId: "thread-atlas", name: "Atlas", title: "", description: "", notifications: true, color: "green",
+ unread: false, modelSelection: { instanceId: "claude", model: "test" }, messages: [],
+};
+const openAiLive: LiveSettings = { configured: true, voice: "marin", readTypedReplies: true, idleMinutes: 5 };
+
+let host: HTMLDivElement;
+let root: Root;
+const patch = vi.fn();
+const render = (live: LiveSettings | undefined, bot: Bot = atlas, draft = false) => {
+ const value = { state: { ...initialState, config: { live } as AppState["config"] }, dispatch: vi.fn(), flushBotPatches: async () => null, refreshInstances: async () => {}, refreshModels: async () => {} };
+ const derived = { patch } as unknown as ReturnType<typeof useBotSettingsDerived>;
+ const section = createElement(VoiceSection, { bot, derived });
+ const editor = createElement(BotEditorContext.Provider, { value: { request: vi.fn(), draft }, children: section });
+ flushSync(() => root.render(createElement(BotEditorStore, { value, children: editor })));
+};
+const card = () => host.querySelector("[data-live-call-voice]");
+const picker = () => card()?.querySelector("select") ?? null;
+
+beforeEach(() => {
+ setLocale("en");
+ patch.mockReset();
+ host = document.createElement("div");
+ document.body.append(host);
+ root = createRoot(host);
+});
+
+afterEach(() => {
+ flushSync(() => root.unmount());
+ host.remove();
+});
+
+describe("a bot's Live call voice in its voice settings", () => {
+ it("shows the bot's own call voice and saves a new pick to the same setting the call uses", () => {
+ render(openAiLive, { ...atlas, liveVoice: "cedar" });
+ expect(card()?.textContent).toContain("Live call voice");
+ expect(card()?.textContent).toContain("Voice for Atlas");
+ expect(picker()?.value).toBe("cedar");
+ picker()!.value = "marin";
+ flushSync(() => picker()!.dispatchEvent(new Event("change", { bubbles: true })));
+ expect(patch).toHaveBeenCalledWith({ liveVoice: "marin" });
+ });
+
+ it("follows the default call voice until the bot has one of the provider's own", () => {
+ render(openAiLive);
+ expect(picker()?.value).toBe("");
+ render({ ...openAiLive, provider: "gemini" }, { ...atlas, liveVoice: "cedar" });
+ expect(picker()?.value).toBe("");
+ expect([...picker()!.options].map((option) => option.value)).toContain("Kore");
+ });
+
+ it("is not there when Live calls are not set up, or the call speaks in its agent's own voice", () => {
+ render(undefined);
+ expect(card()).toBeNull();
+ render({ ...openAiLive, configured: false });
+ expect(card()).toBeNull();
+ render({ ...openAiLive, provider: "fish" });
+ expect(card()).toBeNull();
+ render({ ...openAiLive, provider: "elevenlabs" });
+ expect(card()).toBeNull();
+ });
+
+ it("is not on a bot being created, whose defaults keep no call voice", () => {
+ render(openAiLive, atlas, true);
+ expect(card()).toBeNull();
+ });
+});
diff --git a/src/components/bot-settings/VoiceSection.tsx b/src/components/bot-settings/VoiceSection.tsx
index 2b5648cbfe..a95693f334 100644
--- a/src/components/bot-settings/VoiceSection.tsx
+++ b/src/components/bot-settings/VoiceSection.tsx
@@ -1,6 +1,7 @@
import { requestNotificationPermission } from "@/lib/notify";
import { t } from "@/lib/i18n";
-import type { Bot } from "@/state/store";
+import { useStore, type Bot } from "@/state/store";
+import { BotLiveVoiceSelect } from "../BotLiveVoiceSelect";
import { Switch } from "../SettingsPrimitives";
import { VoiceSettings } from "../VoiceSettings";
import type { useBotSettingsDerived } from "./useBotSettingsDerived";
@@ -15,11 +16,27 @@ export function VoiceSection({
}) {
const { patch } = derived;
const { draft } = useBotEditor();
+ const { state } = useStore();
+ const live = state.config?.live;
+ // Fish Audio and ElevenLabs calls speak in their agent's own voice, so only the other providers have a voice to pick.
+ // A bot being created has no call voice yet: new-bot defaults don't keep one.
+ const liveVoicePicker = !draft && live?.configured && live.provider !== "fish" && live.provider !== "elevenlabs";
return (
<div className="flex flex-col gap-4">
<VoiceSettings bot={bot} onPatch={patch} />
+ {liveVoicePicker && (
+ <div data-live-call-voice className="flex flex-col gap-2 rounded-xl bg-card p-4 text-[13px]">
+ <div>
+ <div className="text-[15px] font-medium text-ink">{t("voice.liveCall.title")}</div>
+ <div className="mt-0.5 text-ink-secondary">{t("voice.liveCall.help")}</div>
+ </div>
+ <BotLiveVoiceSelect bot={bot} gemini={live.provider === "gemini"} onChange={(liveVoice) => patch({ liveVoice })} />
+ <div className="text-[12px] text-ink-tertiary">{t("call.live.voiceNext")}</div>
+ </div>
+ )}
+
<div className="flex items-center justify-between gap-4 rounded-xl bg-card p-4">
<div>
<div className="text-[15px] font-medium text-ink">{t("voice.notifications.title")}</div>
diff --git a/src/components/bot-settings/useBotSettingsDerived.ts b/src/components/bot-settings/useBotSettingsDerived.ts
index 62a92392d5..53160c720e 100644
--- a/src/components/bot-settings/useBotSettingsDerived.ts
+++ b/src/components/bot-settings/useBotSettingsDerived.ts
@@ -37,6 +37,7 @@ export type BotPatch = Partial<
| "teamFilesEdit"
| "toolsOff"
| "voice"
+ | "liveVoice"
| "chiefOfStaff"
| "managedSections"
| "composio"
diff --git a/src/locales/de.json b/src/locales/de.json
index b15aa44f16..3376075a94 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -3056,6 +3056,8 @@
"voice.yourVoice": "Deine {provider}-Stimme",
"voice.usesYours": "Dieser Bot spricht mit deiner {provider}-Stimme. Wähl oben eine andere, um ihm eine eigene zu geben.",
"voice.usesOwn": "Dieser Bot spricht mit seiner eigenen Stimme.",
+ "voice.liveCall.title": "Stimme für Live-Anrufe",
+ "voice.liveCall.help": "Live-Anrufe nutzen eigene Stimmen, getrennt von der Vorlesestimme oben.",
"server.voice.noNoteNoVoice": "Keine Sprachnachricht zu dieser Antwort: Für diesen Bot ist noch keine Stimme eingerichtet.",
"server.voice.noNoteFailed": "Keine Sprachnachricht zu dieser Antwort: Die Stimme konnte nicht erzeugt werden ({reason}).",
"server.voice.turnEnded": "Ich habe aufgehört, bevor ich fertig war: {reason}",
diff --git a/src/locales/en.json b/src/locales/en.json
index 66750c1060..a2cfbb843d 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -951,6 +951,8 @@
"voice.yourVoice": "Your {provider} voice",
"voice.usesYours": "This bot speaks in your {provider} voice. Pick another above to give it its own.",
"voice.usesOwn": "This bot speaks in its own voice.",
+ "voice.liveCall.title": "Live call voice",
+ "voice.liveCall.help": "Live calls use their own voices, apart from the read-aloud voice above.",
"voice.notifications.title": "Notifications",
"voice.notifications.help": "Get notified when this agent finishes or needs input",
"voice.notifications.label": "Agent notifications",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index b98283cb05..96728f294b 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -918,6 +918,8 @@
"voice.yourVoice": "Sua voz de {provider}",
"voice.usesYours": "Este bot fala com sua voz do {provider}. Escolha outra acima para dar a ele uma voz própria.",
"voice.usesOwn": "Este bot fala com a própria voz.",
+ "voice.liveCall.title": "Voz nas chamadas ao vivo",
+ "voice.liveCall.help": "As chamadas ao vivo usam vozes próprias, separadas da voz de leitura acima.",
"voice.notifications.title": "Notificações",
"voice.notifications.help": "Receba uma notificação quando este agente terminar ou precisar de você",
"voice.notifications.label": "Notificações do agente",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index d63edea5b5..26bbf06865 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -2,6 +2,8 @@
"version": 1,
"locales": {
"de": {
+ "voice.liveCall.title": "6a6ee8a294afe0ff1a41725f21d387df14e4b2fdf05e4e2f133eb6d4071fafb7",
+ "voice.liveCall.help": "0c934ada95f15e1ff015e08d48cffdd4760ce6471ae72b35f23de4ac63392332",
"server.incidents.folded": "0f3510347ddace2c9fb06627f1759a1358aba45e82546e98aca8e968a5789105",
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
"pro.seePlans": "30d9abfd7c7af513814bdfadcafe7ec4a90bc6bcee519086dc513f63f2cd7384",
@@ -26613,6 +26615,8 @@
"voice.yourVoice": "7a1c7b98060eeaaa9ae1a6497ce8b957d5c64ff3e9d539f831ee4028471d0f7b",
"voice.usesYours": "7789c3be6667be68106104f5f381cf978b8fb2dfd7a6671d8cb852c3252432c3",
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
+ "voice.liveCall.title": "6a6ee8a294afe0ff1a41725f21d387df14e4b2fdf05e4e2f133eb6d4071fafb7",
+ "voice.liveCall.help": "0c934ada95f15e1ff015e08d48cffdd4760ce6471ae72b35f23de4ac63392332",
"voice.notifications.title": "788011833a5a0f22db90c91e8eb7bd8e9f5cd423354ff5ef8c338e7895f44ba9",
"voice.notifications.help": "5be559487eacb98ef0a9cb372c81efc3a515a97e325708952bb2c99665d560de",
"voice.notifications.label": "50c151611ca9af24c87f7a3cfefc7d5a2a74037c5b38aedaaecfdd9ad54644d9",