From b02ff544597755624953ecc15290bee19348ca54 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 25 Oct 2026 00:32:45 +0200 Subject: [PATCH] fix: Call button shows while speech-to-text is unavailable (#32970) * fix: Call button shows while speech-to-text is unavailable Unless realtime voice is set up, a call needs the server to turn the user's speech into text. The Call button still showed when the speech-to-text engine is "Web API", where clicking it only answered "Call feature is not supported when using Web STT engine", and to users without the speech-to-text permission, where the call opened but nothing they said was transcribed. The button now shows only when a call can work: realtime voice is on, a call is already running, or the engine is not "Web API" and the user has the speech-to-text permission. Refs #32830 * fix: keyboard shortcut also needs the speech-to-text permission for calls The call shortcut and call links now follow the same speech-to-text rule as the Call button. * refac: keep the whole Call button condition in one place Also drops the Web API speech-to-text message from the Call button, since the button no longer shows for that engine. * refac: keep the call permission check unchanged in the call shortcut The speech-to-text rule for the call shortcut is now its own check after the existing call permission check, which stays as it was. --- src/lib/components/chat/Chat.svelte | 8 ++++++++ src/lib/components/chat/MessageInput.svelte | 17 +++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index c4f1e7dfff..0b3df2aae5 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -2603,6 +2603,14 @@ return; } + if ( + $user?.role !== 'admin' && + !($user?.permissions?.chat?.stt ?? true) && + !$config?.audio?.realtime?.enabled + ) { + return; + } + if (selectedModels.length > 1) { toast.error($i18n.t('Select only one model to call')); return; diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 54689fc545..dcb72879f5 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -913,6 +913,14 @@ $config?.features?.enable_code_interpreter && ($_user.role === 'admin' || $_user?.permissions?.features?.code_interpreter); + let showCallButton = false; + $: showCallButton = + ($_user?.role === 'admin' || ($_user?.permissions?.chat?.call ?? true)) && + (callActive || + $config?.audio?.realtime?.enabled || + ($config?.audio?.stt?.engine !== 'web' && + ($_user?.role === 'admin' || ($_user?.permissions?.chat?.stt ?? true)))); + // Disable code interpreter when terminal is active (mutually exclusive) $: if ($selectedTerminalId && codeInterpreterEnabled) { codeInterpreterEnabled = false; @@ -2838,7 +2846,7 @@ {/if} {/if} - {#if callEnabled && !embedded && prompt === '' && files.length === 0 && ($_user?.role === 'admin' || ($_user?.permissions?.chat?.call ?? true))} + {#if callEnabled && !embedded && prompt === '' && files.length === 0 && showCallButton}