diff --git a/.gitignore b/.gitignore index f6a7e551f78..f4e44193206 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ v-env aws_cf_deploy_anything_llm.json yarn.lock *.bak +.idea diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/index.jsx index f4991b4cebd..f5a13c381d7 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/index.jsx @@ -36,7 +36,7 @@ export default function SpeechToText({ sendCommand }) { }); } - function endTTSSession() { + function endSTTSession() { SpeechRecognition.stopListening(); if (transcript.length > 0) { sendCommand(transcript, true); @@ -50,18 +50,18 @@ export default function SpeechToText({ sendCommand }) { (event) => { if (event.ctrlKey && event.keyCode === 77) { if (listening) { - endTTSSession(); + endSTTSession(); } else { startSTTSession(); } } }, - [listening, endTTSSession, startSTTSession] + [listening, endSTTSession, startSTTSession] ); function handlePromptUpdate(e) { if (!e?.detail && timeout) { - endTTSSession(); + endSTTSession(); clearTimeout(timeout); } } @@ -85,7 +85,7 @@ export default function SpeechToText({ sendCommand }) { sendCommand(transcript, false); clearTimeout(timeout); timeout = setTimeout(() => { - endTTSSession(); + endSTTSession(); }, SILENCE_INTERVAL); } }, [transcript, listening]); @@ -97,7 +97,7 @@ export default function SpeechToText({ sendCommand }) { data-tooltip-id="tooltip-text-size-btn" data-tooltip-content="Speak your prompt" aria-label="Speak your prompt" - onClick={listening ? endTTSSession : startSTTSession} + onClick={listening ? endSTTSession : startSTTSession} className={`border-none relative flex justify-center items-center opacity-60 hover:opacity-100 light:opacity-100 light:hover:opacity-60 cursor-pointer ${ !!listening ? "!opacity-100" : "" }`} diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx index 3d2f374ea4b..e84b3bf9b35 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/index.jsx @@ -68,14 +68,14 @@ export default function ChatContainer({ workspace, knownHistory = [] }) { if (listening) { // Stop the mic if the send button is clicked - endTTSSession(); + endSTTSession(); } setChatHistory(prevChatHistory); setMessageEmit(""); setLoadingResponse(true); }; - function endTTSSession() { + function endSTTSession() { SpeechRecognition.stopListening(); resetTranscript(); }