halbot 1995.1.35 → 1995.1.37
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/pipeline/100_chat.mjs +2 -0
- 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.37",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
package/pipeline/100_chat.mjs
CHANGED
|
@@ -70,6 +70,7 @@ const action = async (ctx, next) => {
|
|
|
70
70
|
let lastMsg;
|
|
71
71
|
if (resp.text.trim()) {
|
|
72
72
|
lastMsg = await ok({ processing: false });
|
|
73
|
+
lastMsg = lastMsg[lastMsg.length - 1];
|
|
73
74
|
} else {
|
|
74
75
|
await ctx.deleteMessage(ctx._.done[0].message_id);
|
|
75
76
|
}
|
|
@@ -82,6 +83,7 @@ const action = async (ctx, next) => {
|
|
|
82
83
|
// 2: adding ctx.append feature
|
|
83
84
|
// 3: Consider the layout for small screens, such as the footer and other elements.
|
|
84
85
|
// 4: using webjam config instead of hardcoding the url
|
|
86
|
+
// 5: Add the following links only when web functionality is enabled.
|
|
85
87
|
await ctx.edit(lastMsg.message_id,
|
|
86
88
|
lastMsg.raw
|
|
87
89
|
+ `\n\n\-\-\-\n\n✨ [View in well-formatted page](https://hal.leaskh.com/turns/${ctx._.token}).`
|
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
|
});
|