halbot 1995.1.45 → 1995.1.46

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/web/turn.html +94 -6
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.45",
4
+ "version": "1995.1.46",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/halbot",
7
7
  "type": "module",
package/web/turn.html CHANGED
@@ -204,6 +204,33 @@
204
204
  font-size: 0.85em;
205
205
  }
206
206
 
207
+ .model-info {
208
+ display: inline;
209
+ font-size: 0.85em;
210
+ font-weight: 400;
211
+ color: #666;
212
+ margin-left: 6px;
213
+ }
214
+
215
+ @media (max-width: 600px) {
216
+ .sender-name-inside {
217
+ flex-direction: column;
218
+ align-items: flex-start !important;
219
+ gap: 4px;
220
+ }
221
+
222
+ .message-time {
223
+ align-self: flex-start;
224
+ font-size: 0.8em;
225
+ }
226
+
227
+ .model-info {
228
+ display: block;
229
+ margin-left: 0;
230
+ margin-top: 2px;
231
+ }
232
+ }
233
+
207
234
 
208
235
  .message-bubble {
209
236
  padding: 0;
@@ -274,6 +301,23 @@
274
301
  background-color: #f6f8fa !important;
275
302
  border-radius: 6px !important;
276
303
  position: relative !important;
304
+ overflow: hidden !important;
305
+ transition: height 0.3s ease;
306
+ box-sizing: border-box !important;
307
+ }
308
+
309
+ .markdown-body pre .collapse-btn {
310
+ position: absolute;
311
+ top: 2px;
312
+ right: 8px;
313
+ cursor: pointer;
314
+ color: #666;
315
+ font-size: 20px;
316
+ line-height: 24px;
317
+ z-index: 10;
318
+ user-select: none;
319
+ font-family: monospace;
320
+ font-weight: bold;
277
321
  }
278
322
 
279
323
  .markdown-body pre[data-language]::before {
@@ -471,7 +515,6 @@
471
515
  const group = document.createElement('div');
472
516
  group.className = 'message-group';
473
517
 
474
- // Mapping sender name
475
518
  const senderName = /^\p{Extended_Pictographic}/u.test(msg.role)
476
519
  ? msg.role
477
520
  : (msg.role.includes('HAL9000') ? `🤖 ${msg.role}` : `😺 ${msg.role}`);
@@ -484,7 +527,13 @@
484
527
  nameDiv.className = 'sender-name-inside';
485
528
 
486
529
  const nameSpan = document.createElement('span');
487
- nameSpan.textContent = senderName;
530
+ // Split Model Info (Content in parentheses at the end)
531
+ const match = senderName.match(/^(.*)(\(.*\))$/);
532
+ if (match) {
533
+ nameSpan.innerHTML = `<span class="base-name">${match[1].trim()}</span><span class="model-info">${match[2].trim()}</span>`;
534
+ } else {
535
+ nameSpan.textContent = senderName;
536
+ }
488
537
 
489
538
  const timeSpan = document.createElement('span');
490
539
  timeSpan.className = 'message-time';
@@ -524,12 +573,51 @@
524
573
  lang = cls.replace('language-', '');
525
574
  }
526
575
  });
527
- if (lang) {
528
- block.parentElement.setAttribute('data-language', lang);
529
- }
576
+ if (!lang) lang = 'TXT'; // Default lang for header
577
+ block.parentElement.setAttribute('data-language', lang);
578
+
579
+ // Collapse Button
580
+ const pre = block.parentElement;
581
+ const btn = document.createElement('span');
582
+ let transitionTimeout;
583
+
584
+ btn.className = 'collapse-btn';
585
+ btn.textContent = '-';
586
+
587
+ btn.onclick = (e) => {
588
+ e.stopPropagation();
589
+ if (transitionTimeout) clearTimeout(transitionTimeout);
590
+
591
+ if (pre.classList.contains('collapsed')) {
592
+ // EXPAND
593
+ pre.classList.remove('collapsed');
594
+ btn.textContent = '-';
595
+
596
+ const fullHeight = pre.scrollHeight;
597
+ pre.style.height = '60px'; // Replaced 42px
598
+ pre.offsetHeight; // Force reflow
599
+ pre.style.height = fullHeight + 'px';
600
+
601
+ transitionTimeout = setTimeout(() => {
602
+ if (!pre.classList.contains('collapsed')) {
603
+ pre.style.height = 'auto';
604
+ }
605
+ }, 300);
606
+
607
+ } else {
608
+ // COLLAPSE
609
+ pre.classList.add('collapsed');
610
+ btn.textContent = '+';
611
+
612
+ const fullHeight = pre.offsetHeight;
613
+ pre.style.height = fullHeight + 'px';
614
+ pre.offsetHeight; // Force reflow
615
+ pre.style.height = '60px'; // Replaced 42px
616
+ }
617
+ };
618
+ pre.appendChild(btn);
530
619
 
531
620
  if (block.classList.contains('language-think') || block.classList.contains('language-tools')) {
532
- const pre = block.parentElement;
533
621
  if (block.classList.contains('language-tools')) { pre.classList.add('tools-block'); }
534
622
  else { pre.classList.add('think-block'); }
535
623