mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-26 09:57:24 +03:00
Fix SpeechRecognition on Phone
This commit is contained in:
parent
cec2a10eaa
commit
307ccd8781
@ -1262,7 +1262,7 @@ if (SpeechRecognition) {
|
|||||||
recognition.maxAlternatives = 1;
|
recognition.maxAlternatives = 1;
|
||||||
|
|
||||||
let startValue;
|
let startValue;
|
||||||
let shouldStop = false;
|
let shouldStop;
|
||||||
let lastDebounceTranscript;
|
let lastDebounceTranscript;
|
||||||
recognition.onstart = function() {
|
recognition.onstart = function() {
|
||||||
microLabel.classList.add("recognition");
|
microLabel.classList.add("recognition");
|
||||||
@ -1272,7 +1272,6 @@ if (SpeechRecognition) {
|
|||||||
};
|
};
|
||||||
recognition.onend = function() {
|
recognition.onend = function() {
|
||||||
if (shouldStop) {
|
if (shouldStop) {
|
||||||
microLabel.classList.remove("recognition");
|
|
||||||
messageInput.focus();
|
messageInput.focus();
|
||||||
} else {
|
} else {
|
||||||
recognition.start();
|
recognition.start();
|
||||||
@ -1305,6 +1304,7 @@ if (SpeechRecognition) {
|
|||||||
if (microLabel.classList.contains("recognition")) {
|
if (microLabel.classList.contains("recognition")) {
|
||||||
shouldStop = true;
|
shouldStop = true;
|
||||||
recognition.stop();
|
recognition.stop();
|
||||||
|
microLabel.classList.remove("recognition");
|
||||||
} else {
|
} else {
|
||||||
const lang = document.getElementById("recognition-language")?.value;
|
const lang = document.getElementById("recognition-language")?.value;
|
||||||
recognition.lang = lang || navigator.language;
|
recognition.lang = lang || navigator.language;
|
||||||
|
Loading…
Reference in New Issue
Block a user