halbot 1995.1.35 → 1995.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web/turn.html +16 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another AI powered Telegram bot, which is simple design, easy to use, extendable and fun.",
|
|
4
|
-
"version": "1995.1.
|
|
4
|
+
"version": "1995.1.36",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
package/web/turn.html
CHANGED
|
@@ -488,12 +488,25 @@
|
|
|
488
488
|
// Render loop
|
|
489
489
|
let delay = 0;
|
|
490
490
|
if (chatData.messages && Array.isArray(chatData.messages)) {
|
|
491
|
-
chatData.messages.forEach(msg => {
|
|
491
|
+
chatData.messages.forEach((msg, index) => {
|
|
492
492
|
setTimeout(() => {
|
|
493
493
|
renderMessage(msg);
|
|
494
|
-
// Scroll to bottom
|
|
495
494
|
const main = document.getElementById('chatMain');
|
|
496
|
-
|
|
495
|
+
|
|
496
|
+
// Check if it is the last message
|
|
497
|
+
if (index === chatData.messages.length - 1) {
|
|
498
|
+
// For the last message, scroll to its top (start) with a small offset
|
|
499
|
+
const lastMsgElement = document.getElementById('chatContainer').lastElementChild;
|
|
500
|
+
if (lastMsgElement) {
|
|
501
|
+
main.scrollTo({
|
|
502
|
+
top: lastMsgElement.offsetTop - 25,
|
|
503
|
+
behavior: 'smooth'
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
} else {
|
|
507
|
+
// For other messages, keep scrolling to bottom
|
|
508
|
+
main.scrollTop = main.scrollHeight;
|
|
509
|
+
}
|
|
497
510
|
}, delay);
|
|
498
511
|
delay += 800; // Keep delay effect
|
|
499
512
|
});
|