Fix spinner location
This commit is contained in:
@@ -160,7 +160,9 @@ class Odidere {
|
||||
this.isAutoScrollEnabled = true;
|
||||
this._lastScrollTop = 0;
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
this.$chat.innerHTML = '';
|
||||
this.$chat.querySelectorAll(':scope > .message').forEach((el) => {
|
||||
el.remove();
|
||||
});
|
||||
this.#clearAttachments();
|
||||
this.$textInput.value = '';
|
||||
this.$textInput.style.height = 'auto';
|
||||
@@ -1805,7 +1807,7 @@ class Odidere {
|
||||
this.$send.classList.toggle('loading', loading);
|
||||
this.$send.setAttribute('aria-label', loading ? 'Stop' : 'Send message');
|
||||
// Show/hide the spinner in the chat area.
|
||||
// Positioning is handled by #renderMessages to ensure it's always at the end.
|
||||
// The spinner is a permanent last child of #chat; messages are inserted before it.
|
||||
this.$chatLoading.hidden = !loading;
|
||||
// Keep the send button enabled during loading so it can act as a stop button.
|
||||
this.$ptt.disabled = loading;
|
||||
@@ -2164,11 +2166,6 @@ class Odidere {
|
||||
|
||||
this.#renderAssistantMessage(msg, msg.meta ?? meta, toolResults);
|
||||
}
|
||||
|
||||
// Ensure the loading spinner is always at the end of the chat.
|
||||
if (!this.$chatLoading.hidden) {
|
||||
this.$chat.appendChild(this.$chatLoading);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2218,7 +2215,7 @@ class Odidere {
|
||||
this.#handleDeleteClick(e, message.id),
|
||||
);
|
||||
|
||||
this.$chat.appendChild($msg);
|
||||
this.$chat.insertBefore($msg, this.$chatLoading);
|
||||
this.#scrollToBottom();
|
||||
}
|
||||
|
||||
@@ -2250,7 +2247,7 @@ class Odidere {
|
||||
$msg.querySelector('[data-action="copy"]').remove();
|
||||
$msg.querySelector('[data-action="delete"]').remove();
|
||||
|
||||
this.$chat.appendChild($msg);
|
||||
this.$chat.insertBefore($msg, this.$chatLoading);
|
||||
this.#scrollToBottom();
|
||||
return $msg;
|
||||
}
|
||||
@@ -2465,7 +2462,7 @@ class Odidere {
|
||||
this.#handleDeleteClick(e, message.id),
|
||||
);
|
||||
|
||||
this.$chat.appendChild($msg);
|
||||
this.$chat.insertBefore($msg, this.$chatLoading);
|
||||
this.#scrollToBottom();
|
||||
}
|
||||
|
||||
@@ -2478,7 +2475,7 @@ class Odidere {
|
||||
this.$tplErrorMessage.content.cloneNode(true).firstElementChild;
|
||||
$msg.querySelector('.message__content').textContent = message;
|
||||
|
||||
this.$chat.appendChild($msg);
|
||||
this.$chat.insertBefore($msg, this.$chatLoading);
|
||||
this.#scrollToBottom();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user