From fa1bd44a99e5b696bc4b98ed0137add10c629965 Mon Sep 17 00:00:00 2001 From: MrBounty Date: Sun, 4 Aug 2024 10:09:15 +0200 Subject: [PATCH] Changed HTML to use djlint --- views/chat.html | 11 +- views/layouts/main.html | 25 +- views/partials/chat-input.html | 222 ++++++------- views/partials/explain-llm-conv-chat.html | 81 ++--- views/partials/message-bot.html | 206 ++++++------ views/partials/message-edit-form.html | 115 +++---- views/partials/message-user.html | 97 +++--- views/partials/model-selection-btn.html | 19 +- views/partials/popover-conversation.html | 164 +++++----- views/partials/popover-models.html | 226 ++++++++----- views/partials/popover-settings.html | 369 ++++++++++++---------- views/partials/popover-usage.html | 163 +++++----- views/partials/welcome-chat.html | 145 +++++---- 13 files changed, 1004 insertions(+), 839 deletions(-) diff --git a/views/chat.html b/views/chat.html index 19161b0..4ce7b9e 100644 --- a/views/chat.html +++ b/views/chat.html @@ -1,4 +1,7 @@ -
- - -
\ No newline at end of file +
+ + +
diff --git a/views/layouts/main.html b/views/layouts/main.html index 0e1869b..32e244f 100644 --- a/views/layouts/main.html +++ b/views/layouts/main.html @@ -1,13 +1,17 @@ - + - + JADE - - - + + + @@ -19,7 +23,8 @@ - + @@ -31,9 +36,9 @@ go.run(result.instance); }); - + - + {{ embed }} @@ -197,6 +202,6 @@ - + - \ No newline at end of file + diff --git a/views/partials/chat-input.html b/views/partials/chat-input.html index d502b20..4c2ab39 100644 --- a/views/partials/chat-input.html +++ b/views/partials/chat-input.html @@ -1,123 +1,133 @@ {% if IsLogin %} -{% if IsSubscribed or not IsLimiteReached %} -
-
+ {% if IsSubscribed or not IsLimiteReached %} +
+
- +
- - - - - + + + + +
+
-
-{% endif %} + {% endif %} {% endif %} \ No newline at end of file + }); + + document.getElementById('chat-input-textarea').addEventListener('blur', function () { + var buttons = document.getElementsByClassName('to-reduce-opacity'); + for (var i = 0; i < buttons.length; i++) { + buttons[i].style.opacity = 1; + } + }); + + 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-"]'); + 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() { + // TODO: Add the message placeholder using WASM + messagesPlaceholderHTML = generatePlaceholder(textarea.value); + document.getElementById('chat-messages').insertAdjacentHTML('beforeend', messagesPlaceholderHTML); + + setTimeout(function () { + textarea.value = ''; + toggleSendButton(); + }, 20); + } + + function updateIcon(icon, ConversationAreaId) { + var selectedIcon = document.getElementById('selectedIcon-' + ConversationAreaId); + selectedIcon.src = icon; + } + + function handleTextareaKeydown(event) { + if (event.metaKey && event.key === 'Enter' && event.target === textarea && textarea.value.trim() !== '' && document.getElementsByClassName('selected icon-llm').length !== 0) { + // Check if the cursor is in the textarea + // Trigger the same action as the send button + document.getElementById('chat-input-send-btn').click(); + } + } + diff --git a/views/partials/explain-llm-conv-chat.html b/views/partials/explain-llm-conv-chat.html index c3476ac..e87f941 100644 --- a/views/partials/explain-llm-conv-chat.html +++ b/views/partials/explain-llm-conv-chat.html @@ -3,55 +3,30 @@ To use JADE, you need to sign up for an API key. You can enter an API key in the settings menu. Once enter you get access to all models from this provider.

- - Get OpenAI API key - - - Get Anthropic API key - - - Get Mistral API key - - - Get Groq API key - - - Get Google API key - - - Get Perplexity API key - - - Get Fireworks API key - +Get OpenAI API key +Get Anthropic API key +Get Mistral API key +Get Groq API key +Get Google API key +Get Nvidia NIM API key +Get Perplexity API key +Get Fireworks API key

Conversations

@@ -68,10 +43,10 @@

To create a new bot, click the "+" button, enter a name and a model, and - optionally set a temperature and a system prompt. Once created, you can select - a bot by clicking on it and reorder it by dragging. Hold SHIFT and click to - select multiple bots. You can delete selected bots by clicking the trash can - icon. + optionally set a temperature, a max tokens and a system prompt. Once created, + you can select a bot by clicking on it and reorder it by dragging. Hold SHIFT + and click to select multiple bots. You can delete selected bots by clicking + the trash can icon.

Multi-Models

diff --git a/views/partials/message-bot.html b/views/partials/message-bot.html index c77487c..fa91b3a 100644 --- a/views/partials/message-bot.html +++ b/views/partials/message-bot.html @@ -1,114 +1,124 @@
-
- {% if not DontShowName %} -
- - {% if IsPlaceholder %} +
+ {% if not DontShowName %} +
+ + {% if IsPlaceholder %} -
- User Image -
+
+ User Image +
- {% else %} + {% else %} + + {% for message in Messages %} + {% if not message.Hidden %} +
+ User Image +
+ {% endif %} + {% endfor %} + + {% endif %} +
+ {% endif %} + +
+ {% if not IsPlaceholder %} +
+
+ {% for message in Messages %} + {% if not message.Hidden %} + {% if not DontShowName %} +
+

+ {{ message.Name }} {{ message.ModelID }} +

+
+ {% endif %} +
+
{{ message.Content | safe }}
+
+ {% endif %} + {% endfor %} +
+
+
+ {% if not NotClickable %} + {% for message in Messages %} - {% if not message.Hidden %} -
- User Image -
- {% endif %} + {% endfor %} - - {% endif %} + {% endif %}
- {% endif %} -
- {% if not IsPlaceholder %} -
-
- {% for message in Messages %} - {% if not message.Hidden %} - {% if not DontShowName %} -
-

- {{ message.Name }} {{ message.ModelID }} -

-
- {% endif %} -
-
- {{ message.Content | safe }} -
-
- {% endif %} - {% endfor %} -
+ {% elif IsPlaceholder %} +
+
+ +
+

Waiting...

-
- {% if not NotClickable %} - - - {% for message in Messages %} - - {% endfor %} - {% endif %} +
+
+
+ +
+
+
- {% elif IsPlaceholder %} -
-
- -
-

- Waiting... -

-
-
-
-
- -
-
-
-
+
+ -
- - - {% for selectedLLM in SelectedLLMs %} - - {% endfor %} -
- {% endif %} + + + + {% endfor %}
+ {% endif %}
-
\ No newline at end of file +
+
diff --git a/views/partials/message-edit-form.html b/views/partials/message-edit-form.html index 28b1379..b342b71 100644 --- a/views/partials/message-edit-form.html +++ b/views/partials/message-edit-form.html @@ -1,56 +1,63 @@
-
-
-
- User Image -
-
- -
-
-
-
-

- You -

-
-
-
-
-
- -
-
-
-
- -
-
-
- -
-
-
-
-
-
-
+
+
+
+ User Image +
-
\ No newline at end of file + +
+
+
+
+

You

+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
diff --git a/views/partials/message-user.html b/views/partials/message-user.html index 5dd24f2..ed6066c 100644 --- a/views/partials/message-user.html +++ b/views/partials/message-user.html @@ -1,47 +1,54 @@
-
-
-
- User Image -
-
- -
-
-
-
-

- You -

-
-
-
- {{ Content | safe }} -
-
-
-
-
- - - -
-
+
+
+
+ User Image +
-
\ No newline at end of file + +
+
+
+
+

You

+
+
+
{{ Content | safe }}
+
+
+
+
+ + + +
+
+
+
diff --git a/views/partials/model-selection-btn.html b/views/partials/model-selection-btn.html index bc8d406..baec1a2 100644 --- a/views/partials/model-selection-btn.html +++ b/views/partials/model-selection-btn.html @@ -1,7 +1,12 @@ - \ No newline at end of file + diff --git a/views/partials/popover-conversation.html b/views/partials/popover-conversation.html index 4c4f465..54fc9da 100644 --- a/views/partials/popover-conversation.html +++ b/views/partials/popover-conversation.html @@ -1,78 +1,96 @@ -