Skip to content
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

textarea stt #74

Merged
merged 1 commit into from
Sep 14, 2024
Merged
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
10 changes: 7 additions & 3 deletions client/src/components/Negotiate/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
};
}, [currentUser])

useEffect(() => {

Check warning on line 60 in client/src/components/Negotiate/Chat.jsx

View workflow job for this annotation

GitHub Actions / Lint Client Code

React Hook useEffect has a missing dependency: 'userType'. Either include it or remove the dependency array
if (contacts != null) {
// console.log("contacts ", contacts);
}
Expand Down Expand Up @@ -100,7 +100,7 @@
}
}, [currentRoomID])

useEffect(() => {

Check warning on line 103 in client/src/components/Negotiate/Chat.jsx

View workflow job for this annotation

GitHub Actions / Lint Client Code

React Hook useEffect has missing dependencies: 'prevRoomID' and 'socket'. Either include them or remove the dependency array
// console.log("messages array updated");
if (bottomRef.current) {
bottomRef.current.scrollIntoView({ behavior: 'smooth' });
Expand Down Expand Up @@ -228,9 +228,10 @@
value={message}
onChange={handleChange}
/>
{/* audioRecorder component */}
<div>
<AudioRecorder
onRecordingComplete={(blob)=>handleAudioUpload(blob, lang)} //sending POST request
onRecordingComplete={(blob)=>handleAudioUpload(blob, lang, setmessage)} //sending POST request
audioTrackConstraints={{
noiseSuppression: true,
echoCancellation: true,
Expand Down Expand Up @@ -319,7 +320,7 @@

}

const handleAudioUpload = async (blob, lang) => {
const handleAudioUpload = async (blob, lang, setmessage) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = async () => {
Expand All @@ -336,6 +337,9 @@
lang: lang,
}),
});
console.log(response.json().then((result => { console.log(result.transcription) })));
response.json().then((result)=>{
setmessage(result.transcription);
})

}
}
Loading