diff --git a/client/src/components/Input/TextChat.jsx b/client/src/components/Input/TextChat.jsx index 8af333e4aa..199ca1bd77 100644 --- a/client/src/components/Input/TextChat.jsx +++ b/client/src/components/Input/TextChat.jsx @@ -31,6 +31,14 @@ export default function TextChat({ isSearchView = false }) { const { conversationId, jailbreak } = conversation || {}; const { isSpeechSupported, isListening, text: speechText, toggleListening } = useSpeechRecognition(ask); + useEffect(() => { + if (isListening && speechText) { + setText(speechText); + } else { + setText(''); + } + }, [speechText, isListening, setText]); + // auto focus to input, when enter a conversation. useEffect(() => { if (!conversationId) { @@ -114,7 +122,7 @@ export default function TextChat({ isSearchView = false }) { const changeHandler = (e) => { const { value } = e.target; - setText(value || speechText); + setText(value); }; const getPlaceholderText = () => {