fix: ensure chat scrolls to bottom during streaming renders
Some checks failed
BotUI CI/CD / build (push) Has been cancelled

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-14 16:41:57 -03:00
parent 1a4b39d6cf
commit a46f6d20c3

View file

@ -994,6 +994,7 @@ function addMessage(sender, content, msgId) {
if (isTagBalanced(cleanContent) || (Date.now() - lastRenderTime > 2000)) {
msgContent.innerHTML = renderMentionInMessage(cleanContent);
lastRenderTime = Date.now();
if (!isUserScrolling) scrollToBottom(true);
}
} else {
// Standard markdown/text rendering
@ -1002,6 +1003,7 @@ function addMessage(sender, content, msgId) {
: escapeHtml(cleanContent);
parsed = renderMentionInMessage(parsed);
msgContent.innerHTML = parsed;
if (!isUserScrolling) scrollToBottom(true);
}
}
@ -1019,6 +1021,7 @@ function addMessage(sender, content, msgId) {
el.querySelector(".message-content").innerHTML = parsed;
el.removeAttribute("id");
setupMentionClickHandlers(el);
if (!isUserScrolling) scrollToBottom(true);
}
streamingMessageId = null;
currentStreamingContent = "";