From 0b712c2bde77fe7e3e347d71d5de3c9e62f26738 Mon Sep 17 00:00:00 2001 From: H Lohaus Date: Fri, 12 Apr 2024 18:01:54 +0200 Subject: Add unittests for async client (#1830) * Add unittests for async client * Add pollyfill for anext * Update integration tests --- g4f/gui/client/static/js/chat.v1.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'g4f/gui/client') diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index a875761c..46f7e808 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -1262,7 +1262,7 @@ if (SpeechRecognition) { function may_stop() { if (microLabel.classList.contains("recognition")) { - //recognition.stop(); + recognition.stop(); } } @@ -1272,15 +1272,12 @@ 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.value = messageInput.placeholder; - messageInput.placeholder = "Ask a question"; - //messageInput.focus(); + messageInput.focus(); }; recognition.onresult = function(event) { if (!event.results) { @@ -1298,9 +1295,9 @@ if (SpeechRecognition) { lastDebounceTranscript = transcript; } if (transcript) { - messageInput.placeholder = `${startValue ? startValue+"\n" : ""}${transcript.trim()}`; + messageInput.value = `${startValue ? startValue+"\n" : ""}${transcript.trim()}`; if (isFinal) { - startValue = messageInput.placeholder; + startValue = messageInput.value; } messageInput.style.height = messageInput.scrollHeight + "px"; messageInput.scrollTop = messageInput.scrollHeight; -- cgit v1.2.3