diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-11 04:06:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-11 04:06:52 +0200 |
commit | eefbdb6d845d304b0f532ea4eead17fcff965901 (patch) | |
tree | 0b1dc6946ba3035e1b7ffef48e2e9b594f18d2ae | |
parent | Update DeepInfraImage.py (diff) | |
download | gpt4free-eefbdb6d845d304b0f532ea4eead17fcff965901.tar gpt4free-eefbdb6d845d304b0f532ea4eead17fcff965901.tar.gz gpt4free-eefbdb6d845d304b0f532ea4eead17fcff965901.tar.bz2 gpt4free-eefbdb6d845d304b0f532ea4eead17fcff965901.tar.lz gpt4free-eefbdb6d845d304b0f532ea4eead17fcff965901.tar.xz gpt4free-eefbdb6d845d304b0f532ea4eead17fcff965901.tar.zst gpt4free-eefbdb6d845d304b0f532ea4eead17fcff965901.zip |
-rw-r--r-- | g4f/gui/client/static/js/chat.v1.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index 46f7e808..5eac4e77 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -1249,8 +1249,7 @@ function save_storage() { } } -const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; -if (SpeechRecognition) { +if (window.SpeechRecognition) { const mircoIcon = microLabel.querySelector("i"); mircoIcon.classList.add("fa-microphone"); mircoIcon.classList.remove("fa-microphone-slash"); @@ -1272,12 +1271,15 @@ if (SpeechRecognition) { recognition.onstart = function() { microLabel.classList.add("recognition"); startValue = messageInput.value; + messageInput.placeholder = ""; lastDebounceTranscript = ""; timeoutHandle = window.setTimeout(may_stop, 10000); }; recognition.onend = function() { microLabel.classList.remove("recognition"); - messageInput.focus(); + messageInput.value = messageInput.placeholder; + messageInput.placeholder = "Ask a question"; + //messageInput.focus(); }; recognition.onresult = function(event) { if (!event.results) { @@ -1295,9 +1297,9 @@ if (SpeechRecognition) { lastDebounceTranscript = transcript; } if (transcript) { - messageInput.value = `${startValue ? startValue+"\n" : ""}${transcript.trim()}`; + messageInput.placeholder = `${startValue ? startValue+"\n" : ""}${transcript.trim()}`; if (isFinal) { - startValue = messageInput.value; + startValue = messageInput.placeholder; } messageInput.style.height = messageInput.scrollHeight + "px"; messageInput.scrollTop = messageInput.scrollHeight; |