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.
This commit is contained in:
Classic298 2026-10-25 00:32:45 +02:00 • committed by GitHub
parent 1d6d805587
commit b02ff54459
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 8 deletions

View file

@ -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;

View file

@ -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}
<div class=" flex items-center">
<!-- {$i18n.t('Call')} -->
<Tooltip
@ -2866,13 +2874,6 @@
return;
}
if ($config.audio.stt.engine === 'web') {
toast.error(
$i18n.t('Call feature is not supported when using Web STT engine')
);
return;
}
// check if user has access to getUserMedia
try {
let stream = await navigator.mediaDevices.getUserMedia({