mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-26 09:57:24 +03:00
Update chat.v1.js
This commit is contained in:
parent
deb3898e7a
commit
eefbdb6d84
@ -1249,8 +1249,7 @@ function save_storage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
if (window.SpeechRecognition) {
|
||||||
if (SpeechRecognition) {
|
|
||||||
const mircoIcon = microLabel.querySelector("i");
|
const mircoIcon = microLabel.querySelector("i");
|
||||||
mircoIcon.classList.add("fa-microphone");
|
mircoIcon.classList.add("fa-microphone");
|
||||||
mircoIcon.classList.remove("fa-microphone-slash");
|
mircoIcon.classList.remove("fa-microphone-slash");
|
||||||
@ -1272,12 +1271,15 @@ if (SpeechRecognition) {
|
|||||||
recognition.onstart = function() {
|
recognition.onstart = function() {
|
||||||
microLabel.classList.add("recognition");
|
microLabel.classList.add("recognition");
|
||||||
startValue = messageInput.value;
|
startValue = messageInput.value;
|
||||||
|
messageInput.placeholder = "";
|
||||||
lastDebounceTranscript = "";
|
lastDebounceTranscript = "";
|
||||||
timeoutHandle = window.setTimeout(may_stop, 10000);
|
timeoutHandle = window.setTimeout(may_stop, 10000);
|
||||||
};
|
};
|
||||||
recognition.onend = function() {
|
recognition.onend = function() {
|
||||||
microLabel.classList.remove("recognition");
|
microLabel.classList.remove("recognition");
|
||||||
messageInput.focus();
|
messageInput.value = messageInput.placeholder;
|
||||||
|
messageInput.placeholder = "Ask a question";
|
||||||
|
//messageInput.focus();
|
||||||
};
|
};
|
||||||
recognition.onresult = function(event) {
|
recognition.onresult = function(event) {
|
||||||
if (!event.results) {
|
if (!event.results) {
|
||||||
@ -1295,9 +1297,9 @@ if (SpeechRecognition) {
|
|||||||
lastDebounceTranscript = transcript;
|
lastDebounceTranscript = transcript;
|
||||||
}
|
}
|
||||||
if (transcript) {
|
if (transcript) {
|
||||||
messageInput.value = `${startValue ? startValue+"\n" : ""}${transcript.trim()}`;
|
messageInput.placeholder = `${startValue ? startValue+"\n" : ""}${transcript.trim()}`;
|
||||||
if (isFinal) {
|
if (isFinal) {
|
||||||
startValue = messageInput.value;
|
startValue = messageInput.placeholder;
|
||||||
}
|
}
|
||||||
messageInput.style.height = messageInput.scrollHeight + "px";
|
messageInput.style.height = messageInput.scrollHeight + "px";
|
||||||
messageInput.scrollTop = messageInput.scrollHeight;
|
messageInput.scrollTop = messageInput.scrollHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user