Skip to content

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

Merge #7874: Fish Audio Drama 3 and synthesis settings

milind-soni0cade9168d95
diff --cc server/config.test.ts
index b8672e62be,f351c316da..c640670ad6
--- a/server/config.test.ts
+++ b/server/config.test.ts
@@@ -151,13 -151,16 +151,23 @@@ describe("configuration boundaries", (
expect(() => parseConfigPatch({ tts: { fishModel: "s1" } })).toThrow("fishModel");
});
+ it("accepts only supported voice playback rates", () => {
+ for (const playbackRate of [0.75, 1, 1.25, 1.5, 1.75, 2]) {
+ expect(parseConfigPatch({ tts: { playbackRate } }).tts).toEqual({ playbackRate });
+ }
+ expect(() => parseConfigPatch({ tts: { playbackRate: 1.1 } })).toThrow("playbackRate");
+ });
+
+ it("validates optional Fish Audio synthesis settings", () => {
+ const tts = { fishSynthesis: { temperature: 0, topP: 1, speed: 0.5, mp3Bitrate: 128 } };
+ expect(parseConfigPatch({ tts }).tts).toEqual(tts);
+ expect(parseStoredConfig({ tts }).tts).toEqual(tts);
+ const invalid: Record<string, number>[] = [{ temperature: -0.1 }, { topP: 1.1 }, { speed: 3 }, { mp3Bitrate: 1 }];
+ for (const fishSynthesis of invalid) {
+ expect(() => parseConfigPatch({ tts: { fishSynthesis } })).toThrow("fishSynthesis");
+ }
+ });
+
it("keeps how the person is heard and the language they speak, and refuses anything else", () => {
expect(parseConfigPatch({ tts: { hearWith: "elevenlabs", hearLanguage: " ES " } }).tts).toEqual({ hearWith: "elevenlabs", hearLanguage: "es" });
expect(parseConfigPatch({ tts: { hearWith: "device", hearLanguage: "" } }).tts).toEqual({ hearWith: "device", hearLanguage: "" });
diff --cc server/config.ts
index 4ac13da20d,dc0a5987e3..b305dde43e
--- a/server/config.ts
+++ b/server/config.ts
@@@ -362,7 -359,8 +359,8 @@@ const appConfigSchema = z.object(
.refine((value) => !value || /^https?:\/\//i.test(value), "the Chatterbox server address must start with http:// or https://")
.optional(),
model: optionalText, ...hearingConfigShape,
- fishModel: z.enum(FISH_TTS_MODELS).optional(), everyReply: z.boolean().optional(), playbackRate: z.number().refine((value): value is VoicePlaybackRate => VOICE_PLAYBACK_RATES.includes(value as VoicePlaybackRate), "playbackRate must be a supported voice speed").optional(), // a voice note with every reply unless a bot's voiceNoteEveryReply says otherwise
+ fishModel: z.enum(FISH_TTS_MODELS).optional(), fishSynthesis: fishSynthesisSchema.optional(),
- everyReply: z.boolean().optional(), // a voice note with every reply unless a bot's voiceNoteEveryReply says otherwise
++ everyReply: z.boolean().optional(), playbackRate: z.number().refine((value): value is VoicePlaybackRate => VOICE_PLAYBACK_RATES.includes(value as VoicePlaybackRate), "playbackRate must be a supported voice speed").optional(), // a voice note with every reply unless a bot's voiceNoteEveryReply says otherwise
}).optional(),
decider: deciderConfigSchema.optional(),
live: liveConfigSchema.optional(),
@@@ -456,7 -454,7 +454,7 @@@ export interface AppConfig extends Help
vps?: VpsConfig;
vpsServers?: VpsServer[];
opencodeGo?: { apiKey?: string; providerKeys?: Record<string, string> };
- tts?: { key?: string; fishKey?: string; geminiKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai" | "deepseek"; baseUrl?: string; model?: string; fishModel?: FishTtsModel; everyReply?: boolean; playbackRate?: VoicePlaybackRate; hearWith?: "device" | "elevenlabs"; hearLanguage?: string };
- tts?: { key?: string; fishKey?: string; geminiKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai" | "deepseek"; baseUrl?: string; model?: string; fishModel?: FishTtsModel; fishSynthesis?: FishSynthesis; everyReply?: boolean; hearWith?: "device" | "elevenlabs"; hearLanguage?: string };
++ tts?: { key?: string; fishKey?: string; geminiKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai" | "deepseek"; baseUrl?: string; model?: string; fishModel?: FishTtsModel; fishSynthesis?: FishSynthesis; everyReply?: boolean; playbackRate?: VoicePlaybackRate; hearWith?: "device" | "elevenlabs"; hearLanguage?: string };
decider?: DeciderConfig;
imageGen?: ImageGenerationConfig;
live?: LiveConfig;
diff --cc server/tts/index.ts
index 1c445aa818,d2c89f9e73..3720bd14e2
--- a/server/tts/index.ts
+++ b/server/tts/index.ts
@@@ -111,10 -111,12 +111,13 @@@ export function describeVoice(cfg: AppC
provider,
baseUrl: cfg.tts?.baseUrl ?? "",
model: provider === "gemini" ? (cfg.tts?.model || gemini.DEFAULT_GEMINI_MODEL) : provider === "chatterbox" ? (cfg.tts?.model ?? "") : "",
- ...(provider === "fish" ? { fishModel: cfg.tts?.fishModel ?? fish.DEFAULT_FISH_MODEL } : {}),
+ ...(provider === "fish" ? {
+ fishModel: cfg.tts?.fishModel ?? fish.DEFAULT_FISH_MODEL,
+ ...(cfg.tts?.fishSynthesis ? { fishSynthesis: cfg.tts.fishSynthesis } : {}),
+ } : {}),
...(included ? { included: true as const } : {}),
...(cfg.tts?.everyReply ? { everyReply: true as const } : {}),
+ ...(cfg.tts?.playbackRate !== undefined ? { playbackRate: cfg.tts.playbackRate } : {}),
...(cfg.tts?.hearWith === "elevenlabs" ? { hearWith: "elevenlabs" as const } : {}),
...(cfg.tts?.hearLanguage ? { hearLanguage: cfg.tts.hearLanguage } : {}),
};
diff --cc src/components/VoiceSettings.tsx
index 72ad0eab7f,3aae13bd3a..24e0950f0f
--- a/src/components/VoiceSettings.tsx
+++ b/src/components/VoiceSettings.tsx
@@@ -24,13 -25,12 +25,13 @@@ import { VoicePicker, type PickerVoice
import { Select } from "./Select";
import { Switch } from "./SettingsPrimitives";
import { KeysLink } from "./keys/KeysLink";
+import { VOICE_PLAYBACK_RATES } from "../../shared/voice-playback";
- const FISH_MODELS = [
- { value: "s2.1-pro", label: "voice.fish.modelPro" },
- { value: "s2.1-pro-free", label: "voice.fish.modelFree" },
+ const FISH_SYNTHESIS_FIELDS = [
+ { name: "temperature", label: "voice.fish.temperature", min: 0, max: 1, defaultValue: 0.7 },
+ { name: "topP", label: "voice.fish.topP", min: 0, max: 1, defaultValue: 0.7 },
+ { name: "speed", label: "voice.fish.speed", min: 0.5, max: 2, defaultValue: 1 },
] as const;
- type FishModel = (typeof FISH_MODELS)[number]["value"];
export function VoiceSettings({
bot,
diff --cc src/state/config-status.ts
index 95d35502b6,f7c4787ed5..c3a1871fdd
--- a/src/state/config-status.ts
+++ b/src/state/config-status.ts
@@@ -1,8 -1,8 +1,9 @@@
// What GET /api/config tells the app about the server and its settings (re-exported by store.tsx).
import type { EffortLevel, LiveSettings } from "../../shared/wire";
import type { ImageComplexity, ImageProvider } from "../../shared/image-generation";
+ import type { FishSynthesis, FishTtsModel } from "../../shared/fish-voice";
import type { ToolGroup } from "../../shared/tool-groups";
+import type { VoicePlaybackRate } from "../../shared/voice-playback";
import type { OnboardingStatus } from "@/lib/onboarding";
import type { ModelSelection } from "./store";