mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-21 00:49:54 +01:00
25 lines
853 B
HTML
25 lines
853 B
HTML
<div class="chat chat-end">
|
|
<div class="chat-header">User</div>
|
|
<div class="chat-bubble">
|
|
{{user_message.content}}
|
|
</div>
|
|
</div>
|
|
<div class="chat chat-start">
|
|
<div class="chat-header">AI</div>
|
|
<div class="chat-bubble" hx-ext="sse" sse-connect="/chat/response-stream?message_id={{user_message.id}}"
|
|
sse-swap="chat_message" sse-close="close_stream" hx-swap="beforeend">
|
|
<span class="loading loading-dots loading-sm loading-id-{{user_message.id}}"></span>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
document.body.addEventListener('htmx:sseBeforeMessage', (e) => {
|
|
const targetElement = e.detail.elt;
|
|
const loadingSpinner = targetElement.querySelector('.loading-id-{{user_message.id}}');
|
|
|
|
// Hiding the loading spinner before data is swapped in
|
|
if (loadingSpinner) {
|
|
loadingSpinner.style.display = 'none';
|
|
}
|
|
}
|
|
)
|
|
</script> |