Skip to content

Commit

Permalink
possible fix for speech recognition on android
Browse files Browse the repository at this point in the history
  • Loading branch information
cogentapps authored Mar 20, 2023
1 parent ac2a40f commit 1917bc1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/src/components/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ export default function MessageInput(props: MessageInputProps) {

speechRecognition.onresult = (event) => {
let transcript = '';
for (let i = 0; i < event.results.length; ++i) {
transcript += event.results[i][0].transcript;
for (let i = 0; i < event.results.length; i++) {
if (event.results[i].isFinal && event.results[i][0].confidence) {
transcript += event.results[i][0].transcript;
}
}
dispatch(setMessage(initialMessage + ' ' + transcript));
};
Expand Down Expand Up @@ -279,4 +281,4 @@ export default function MessageInput(props: MessageInputProps) {
</div>
</div>
</Container>;
}
}

0 comments on commit 1917bc1

Please sign in to comment.