diff --git a/static/main-v0.3.wasm b/static/main-v0.3.wasm deleted file mode 100644 index 34c45ef..0000000 Binary files a/static/main-v0.3.wasm and /dev/null differ diff --git a/views/chat.html b/views/chat.html index 1c014c0..19161b0 100644 --- a/views/chat.html +++ b/views/chat.html @@ -1,4 +1,4 @@
- +
\ No newline at end of file diff --git a/views/partials/chat-input.html b/views/partials/chat-input.html index 07f62be..d502b20 100644 --- a/views/partials/chat-input.html +++ b/views/partials/chat-input.html @@ -41,23 +41,29 @@ } }, 10); - setInterval(function () { + function updateIcons() { if (window.innerWidth < 450) { var elements = document.getElementsByClassName('message-icon'); for (var i = 0; i < elements.length; i++) { - elements[i].classList.remove('is-48x48'); - elements[i].classList.add('is-32x32'); - elements[i].parentElement.style = "padding-right: 0;" + elements[i].classList.remove('is-48x48'); + elements[i].classList.add('is-32x32'); + elements[i].parentElement.style = "padding-right: 0;"; } } else { var elements = document.getElementsByClassName('message-icon'); for (var i = 0; i < elements.length; i++) { - elements[i].classList.remove('is-32x32'); - elements[i].classList.add('is-48x48'); - elements[i].parentElement.style = "" + elements[i].classList.remove('is-32x32'); + elements[i].classList.add('is-48x48'); + elements[i].parentElement.style = ""; } } - }, 300); + } + + // Run when the element is added + document.addEventListener('htmx:afterSwap', updateIcons); + + // Run every 0.01s + setInterval(updateIcons, 100); document.getElementById('chat-input-textarea').addEventListener('focus', function () { var buttons = document.getElementsByClassName('to-reduce-opacity'); @@ -76,13 +82,19 @@ const textarea = document.querySelector('#chat-input-textarea'); textarea.addEventListener('keydown', handleTextareaKeydown); + document.addEventListener('htmx:afterSwap', toggleSendButton) + function toggleSendButton() { // check if generate-multiple-messages exists var generateMultipleMessages = document.getElementById('generate-multiple-messages'); document.getElementById('chat-input-send-btn').disabled = textarea.value.trim().length === 0 || document.getElementsByClassName('selected icon-llm').length === 0 || generateMultipleMessages !== null; // Do the same for all element with an id that start with redo-button- or edit-button- const buttons = document.querySelectorAll('[id^="redo-button-"], [id^="edit-button-"]'); - buttons.forEach(button => button.disabled = document.getElementsByClassName('selected icon-llm').length === 0 || generateMultipleMessages !== null); + if (document.getElementsByClassName('selected icon-llm').length === 0 || generateMultipleMessages !== null) { + buttons.forEach(button => button.classList.add('is-static')); + } else { + buttons.forEach(button => button.classList.remove('is-static')); + } } function onClickSendButton() { diff --git a/views/partials/message-bot-client-placeholder.html b/views/partials/message-bot-client-placeholder.html deleted file mode 100644 index 03be2c9..0000000 --- a/views/partials/message-bot-client-placeholder.html +++ /dev/null @@ -1,30 +0,0 @@ -
-
-
-
- User Image -
- -
-
-
-
-

- Waiting... -

-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
\ No newline at end of file diff --git a/views/partials/message-user-client-placeholder.html b/views/partials/message-user-client-placeholder.html deleted file mode 100644 index 37bc1f8..0000000 --- a/views/partials/message-user-client-placeholder.html +++ /dev/null @@ -1,29 +0,0 @@ -
-
-
-
- User Image -
-
- -
-
-
-
-

- You -

-
-
-
- {{ Content | safe }} -
-
-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/views/partials/message-user.html b/views/partials/message-user.html index 0182797..5dd24f2 100644 --- a/views/partials/message-user.html +++ b/views/partials/message-user.html @@ -28,7 +28,7 @@ -