From 18c604baa997fd6cfa3438e63459f1cb8fd49d5d Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 20 Aug 2026 22:03:55 +0200 Subject: [PATCH] fix: voice mode produces no audio when the task model returns empty content (#28724) With "show emoji in call" enabled, voice mode stayed completely silent and no request ever reached the configured TTS server. Reasoning models served with a reasoning parser return `message.content` as null and put the text in `reasoning_content`, and the emoji helper called `.replace()` on that null value and threw. The call overlay ran the emoji request first, inside the same `try` block as speech synthesis, so that error skipped the entire TTS section. The audio cache was never filled, and the playback loop kept re-queueing the same content every 200 ms without ever playing it. Read aloud was unaffected because it synthesizes speech directly, which is why the failure looked specific to voice mode. Fixed on both sides: the optional chain in `generateEmoji` now covers `content`, and the emoji request in the call overlay gets its own catch, matching the speech synthesis call directly below it. An emoji failure now costs the emoji instead of the whole reply. --- src/lib/apis/index.ts | 2 +- src/lib/components/chat/MessageInput/CallOverlay.svelte | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/apis/index.ts b/src/lib/apis/index.ts index 3409b88ed5..65046b4004 100644 --- a/src/lib/apis/index.ts +++ b/src/lib/apis/index.ts @@ -937,7 +937,7 @@ export const generateEmoji = async ( throw error; } - const response = res?.choices[0]?.message?.content.replace(/["']/g, '') ?? null; + const response = res?.choices[0]?.message?.content?.replace(/["']/g, '') ?? null; if (response) { if (/\p{Extended_Pictographic}/u.test(response)) { diff --git a/src/lib/components/chat/MessageInput/CallOverlay.svelte b/src/lib/components/chat/MessageInput/CallOverlay.svelte index 17003e6ad4..28e3dbf9de 100644 --- a/src/lib/components/chat/MessageInput/CallOverlay.svelte +++ b/src/lib/components/chat/MessageInput/CallOverlay.svelte @@ -489,7 +489,12 @@ try { // Set the emoji for the content if needed if ($settings?.showEmojiInCall ?? false) { - const emoji = await generateEmoji(localStorage.token, modelId, content, chatId); + const emoji = await generateEmoji(localStorage.token, modelId, content, chatId).catch( + (error) => { + console.error(error); + return null; + } + ); if (emoji) { emojiCache.set(content, emoji); }