Can't send empty message
This commit is contained in:
parent
d6ebfdc712
commit
d5c9ba6e21
@ -1,21 +1,19 @@
|
|||||||
<div class="chat-container mt-5">
|
<div class="chat-container mt-5">
|
||||||
|
|
||||||
<hx hx-get="/loadChat" hx-trigger="load once" hx-swap="outerHTML"></hx>
|
<hx hx-get="/loadChat" hx-trigger="load once" hx-swap="outerHTML"></hx>
|
||||||
|
|
||||||
|
|
||||||
<div class="chat-input-container mb-5">
|
<div class="chat-input-container mb-5">
|
||||||
<div class="textarea-wrapper">
|
<div class="textarea-wrapper">
|
||||||
<textarea {% if not IsLogin or not HaveKey %}disabled{% endif %} class="textarea"
|
<textarea {% if not IsLogin or not HaveKey %}disabled{% endif %} class="textarea"
|
||||||
placeholder="Type your message here..." name="message"></textarea>
|
placeholder="Type your message here..." name="message" oninput="toggleSendButton(this)"></textarea>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
<hx hx-get="/loadSettings" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
|
<hx hx-get="/loadSettings" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
|
||||||
<hx hx-get="/loadKeys" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
|
<hx hx-get="/loadKeys" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
|
||||||
<hx hx-get="/loadUsageKPI" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
|
<hx hx-get="/loadUsageKPI" hx-trigger="load" hx-swap="outerHTML" hx-target="this"></hx>
|
||||||
<hx hx-get="/loadModelSelection" 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 %}disabled{% endif %} type="submit"
|
<button disabled type="submit" class="send-button button is-primary is-small"
|
||||||
class="send-button button is-primary is-small" hx-post="/requestMultipleMessages"
|
hx-post="/requestMultipleMessages" hx-swap="beforeend settle:200ms" hx-target="#chat-messages"
|
||||||
hx-swap="beforeend settle:200ms" hx-target="#chat-messages" id="chat-input-send-btn"
|
id="chat-input-send-btn" class="chat-input" hx-include="[name='message'], [name^='model-check-']"
|
||||||
class="chat-input" hx-include="[name='message'], [name^='model-check-']" onclick="clearTextArea()">
|
onclick="clearTextArea()">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i class="fa-solid fa-chevron-right"></i>
|
<i class="fa-solid fa-chevron-right"></i>
|
||||||
</span>
|
</span>
|
||||||
@ -25,4 +23,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script> function clearTextArea() { setTimeout(function () { document.querySelector('.textarea').value = ''; }, 200); } </script>
|
<script>
|
||||||
|
function toggleSendButton(textarea) {
|
||||||
|
var sendButton = document.getElementById('chat-input-send-btn');
|
||||||
|
sendButton.disabled = textarea.value.trim() === '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearTextArea() {
|
||||||
|
setTimeout(function () {
|
||||||
|
document.querySelector('.textarea').value = '';
|
||||||
|
toggleSendButton(document.querySelector('.textarea'));
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user