Instantly display placeholder when click on send using wasm

This commit is contained in:
2024-06-14 17:57:56 +02:00
parent e6bde72771
commit 35d498c6e1
8 changed files with 618 additions and 21 deletions
+4 -12
View File
@@ -12,18 +12,6 @@
<hx hx-get="/loadUsageKPI" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
<hx hx-get="/loadConversationSelection" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
<hx hx-get="/loadModelSelection" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
<!--button {% if not IsLogin or not HaveKey %}style="display: none;" {%endif%}
class="button is-small to-reduce-opacity" onclick="clearTextArea()" id="clear-button"
hx-post="/clearChat" hx-swap="outerHTML" hx-target="#chat-container" title="Clear chat">
<span class="icon">
<i class="fa-solid fa-broom"></i>
</span>
</button-->
<!--button type="submit" class="button is-small" hx-get="/test" hx-swap="beforeend">
<span class="icon">
<i class="fa-solid fa-vials"></i>
</span>
</button-->
<button disabled type="submit" class="send-button button is-primary is-small" hx-post="/generatePlaceholder"
hx-swap="beforeend" hx-target="#chat-messages" id="chat-input-send-btn" class="chat-input"
hx-include="[name='message']" hx-vals="js:{selectedLLMIds: getSelectedModelsIDs()}"
@@ -95,6 +83,10 @@
}
function onClickSendButton() {
// TODO: Add the message placeholder using WASM
messagesPlaceholderHTML = generateMessagePlaceholder(textarea.value);
document.getElementById('chat-messages').insertAdjacentHTML('beforeend', messagesPlaceholderHTML);
setTimeout(function () {
textarea.value = '';
toggleSendButton();
+1
View File
@@ -71,6 +71,7 @@
</div>
</div>
</div>
<script>
function findSelectedConversationID() {
return document.getElementsByClassName('icon-conv selected')[0].getAttribute('data-id');