θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content

speech to text typo correction #3330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ v-env
aws_cf_deploy_anything_llm.json
yarn.lock
*.bak
.idea
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function SpeechToText({ sendCommand }) {
});
}

function endTTSSession() {
function endSTTSession() {
SpeechRecognition.stopListening();
if (transcript.length > 0) {
sendCommand(transcript, true);
Expand All @@ -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);
}
}
Expand All @@ -85,7 +85,7 @@ export default function SpeechToText({ sendCommand }) {
sendCommand(transcript, false);
clearTimeout(timeout);
timeout = setTimeout(() => {
endTTSSession();
endSTTSession();
}, SILENCE_INTERVAL);
}
}, [transcript, listening]);
Expand All @@ -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" : ""
}`}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/WorkspaceChat/ChatContainer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down