mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
Update SpeechRecognition.tsx
This commit is contained in:
parent
776daa1bc5
commit
c02d43bd36
1 changed files with 16 additions and 0 deletions
|
|
@ -65,6 +65,22 @@ const useSpeechRecognition = (ask) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleKeyDown = (event) => {
|
||||||
|
if (e.shiftKey && e.altKey && e.key === 'L') {
|
||||||
|
if (isSpeechSupported) {
|
||||||
|
toggleListening();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('keydown', handleKeyDown);
|
||||||
|
};
|
||||||
|
}, [isListening]);
|
||||||
|
|
||||||
return { isSpeechSupported, isListening, text, toggleListening };
|
return { isSpeechSupported, isListening, text, toggleListening };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue