Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
💬 feat: Improve speech recognition UX for unsupported browsers (#10964)
Marco Beretta02fc4647e110
diff --git a/client/src/hooks/Input/useSpeechToTextBrowser.ts b/client/src/hooks/Input/useSpeechToTextBrowser.tsindex d4c301367f..373c84d005 100644--- a/client/src/hooks/Input/useSpeechToTextBrowser.ts+++ b/client/src/hooks/Input/useSpeechToTextBrowser.ts@@ -2,16 +2,21 @@ import { useEffect, useRef, useMemo } from 'react';import { useRecoilState } from 'recoil';import { useToastContext } from '@librechat/client';import SpeechRecognition, { useSpeechRecognition } from 'react-speech-recognition';+import { useGetCustomConfigSpeechQuery } from 'librechat-data-provider/react-query';import useGetAudioSettings from './useGetAudioSettings';+import { useLocalize } from '~/hooks';import store from '~/store';const useSpeechToTextBrowser = (setText: (text: string) => void,onTranscriptionComplete: (text: string) => void,) => {+ const localize = useLocalize();const { showToast } = useToastContext();const { speechToTextEndpoint } = useGetAudioSettings();const isBrowserSTTEnabled = speechToTextEndpoint === 'browser';+ const { data: speechConfig } = useGetCustomConfigSpeechQuery({ enabled: true });+ const sttExternal = Boolean(speechConfig?.sttExternal);const lastTranscript = useRef<string | null>(null);const lastInterim = useRef<string | null>(null);@@ -71,7 +76,9 @@ const useSpeechToTextBrowser = (const toggleListening = () => {if (!browserSupportsSpeechRecognition) {showToast({- message: 'Browser does not support SpeechRecognition',+ message: sttExternal+ ? localize('com_ui_speech_not_supported_use_external')+ : localize('com_ui_speech_not_supported'),status: 'error',});return;@@ -79,7 +86,7 @@ const useSpeechToTextBrowser = (if (!isMicrophoneAvailable) {showToast({- message: 'Microphone is not available',+ message: localize('com_ui_microphone_unavailable'),status: 'error',});return;diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.jsonindex a2f99deae6..6ab0116f0a 100644--- a/client/src/locales/en/translation.json+++ b/client/src/locales/en/translation.json@@ -1295,6 +1295,9 @@"com_ui_special_variables": "Special variables:","com_ui_special_variables_more_info": "You can select special variables from the dropdown: `{{current_date}}` (today's date and day of week), `{{current_datetime}}` (local date and time), `{{utc_iso_datetime}}` (UTC ISO datetime), and `{{current_user}}` (your account name).","com_ui_speech_while_submitting": "Can't submit speech while a response is being generated",+ "com_ui_speech_not_supported": "Your browser does not support speech recognition",+ "com_ui_speech_not_supported_use_external": "Your browser does not support speech recognition. Try switching to External STT in Settings > Speech.",+ "com_ui_microphone_unavailable": "Microphone is not available","com_ui_sr_actions_menu": "Open actions menu for \"{{0}}\" prompt","com_ui_sr_global_prompt": "Global prompt group","com_ui_stack_trace": "Stack Trace",