mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
Update TextChat.jsx
This commit is contained in:
parent
49a9daea34
commit
eb842c699b
1 changed files with 6 additions and 3 deletions
|
|
@ -29,7 +29,7 @@ export default function TextChat({ isSearchView = false }) {
|
||||||
const { ask, stopGenerating } = useMessageHandler();
|
const { ask, stopGenerating } = useMessageHandler();
|
||||||
const isNotAppendable = latestMessage?.unfinished & !isSubmitting || latestMessage?.error;
|
const isNotAppendable = latestMessage?.unfinished & !isSubmitting || latestMessage?.error;
|
||||||
const { conversationId, jailbreak } = conversation || {};
|
const { conversationId, jailbreak } = conversation || {};
|
||||||
|
const { isSpeechSupported, isListening, text: speechText, toggleListening } = useSpeechRecognition();
|
||||||
|
|
||||||
// auto focus to input, when enter a conversation.
|
// auto focus to input, when enter a conversation.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -60,6 +60,9 @@ export default function TextChat({ isSearchView = false }) {
|
||||||
const submitMessage = () => {
|
const submitMessage = () => {
|
||||||
ask({ text });
|
ask({ text });
|
||||||
setText('');
|
setText('');
|
||||||
|
if (isListening) {
|
||||||
|
toggleListening();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleStopGenerating = (e) => {
|
const handleStopGenerating = (e) => {
|
||||||
|
|
@ -81,7 +84,7 @@ export default function TextChat({ isSearchView = false }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.shiftKey && e.altKey && e.key === 'L') {
|
if (e.shiftKey && e.altKey && e.key === 'L') {
|
||||||
toggleListening(e);
|
toggleListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -111,7 +114,7 @@ export default function TextChat({ isSearchView = false }) {
|
||||||
const changeHandler = (e) => {
|
const changeHandler = (e) => {
|
||||||
const { value } = e.target;
|
const { value } = e.target;
|
||||||
|
|
||||||
setText(value);
|
setText(value || speechText);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPlaceholderText = () => {
|
const getPlaceholderText = () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue