halbot 1995.1.45 → 1995.1.47

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 +101 -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.47",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/halbot",
7
7
  "type": "module",
package/web/turn.html CHANGED
@@ -5,6 +5,8 @@
5
5
  <meta charset="UTF-8">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>HAL9000 Chat</title>
8
+ <link rel="icon" type="image/svg+xml"
9
+ href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3CradialGradient id='a' cx='50%25' cy='50%25' r='50%25' fx='50%25' fy='50%25'%3E%3Cstop offset='0%25' stop-color='%23ffeb3b'/%3E%3Cstop offset='20%25' stop-color='%23ff9800'/%3E%3Cstop offset='60%25' stop-color='%23f44336'/%3E%3Cstop offset='100%25' stop-color='%23b71c1c'/%3E%3C/radialGradient%3E%3ClinearGradient id='b' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23e0e0e0'/%3E%3Cstop offset='50%25' stop-color='%239e9e9e'/%3E%3Cstop offset='100%25' stop-color='%23616161'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='50' cy='50' r='48' fill='url(%23b)' stroke='%23333' stroke-width='2'/%3E%3Ccircle cx='50' cy='50' r='42' fill='%23111'/%3E%3Ccircle cx='50' cy='50' r='28' fill='url(%23a)' stroke='%23800000' stroke-width='1'/%3E%3Cellipse cx='60' cy='40' rx='10' ry='6' fill='rgba(255,255,255,0.4)' transform='rotate(-45 60 40)'/%3E%3C/svg%3E">
8
10
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
9
11
  <link rel="stylesheet"
10
12
  href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.6.1/github-markdown-light.min.css">
@@ -204,6 +206,33 @@
204
206
  font-size: 0.85em;
205
207
  }
206
208
 
209
+ .model-info {
210
+ display: inline;
211
+ font-size: 0.85em;
212
+ font-weight: 400;
213
+ color: #666;
214
+ margin-left: 6px;
215
+ }
216
+
217
+ @media (max-width: 600px) {
218
+ .sender-name-inside {
219
+ flex-direction: column;
220
+ align-items: flex-start !important;
221
+ gap: 4px;
222
+ }
223
+
224
+ .message-time {
225
+ align-self: flex-start;
226
+ font-size: 0.8em;
227
+ }
228
+
229
+ .model-info {
230
+ display: block;
231
+ margin-left: 0;
232
+ margin-top: 2px;
233
+ }
234
+ }
235
+
207
236
 
208
237
  .message-bubble {
209
238
  padding: 0;
@@ -274,6 +303,23 @@
274
303
  background-color: #f6f8fa !important;
275
304
  border-radius: 6px !important;
276
305
  position: relative !important;
306
+ overflow: hidden !important;
307
+ transition: height 0.3s ease;
308
+ box-sizing: border-box !important;
309
+ }
310
+
311
+ .markdown-body pre .collapse-btn {
312
+ position: absolute;
313
+ top: 2px;
314
+ right: 8px;
315
+ cursor: pointer;
316
+ color: #666;
317
+ font-size: 20px;
318
+ line-height: 24px;
319
+ z-index: 10;
320
+ user-select: none;
321
+ font-family: monospace;
322
+ font-weight: bold;
277
323
  }
278
324
 
279
325
  .markdown-body pre[data-language]::before {
@@ -471,7 +517,6 @@
471
517
  const group = document.createElement('div');
472
518
  group.className = 'message-group';
473
519
 
474
- // Mapping sender name
475
520
  const senderName = /^\p{Extended_Pictographic}/u.test(msg.role)
476
521
  ? msg.role
477
522
  : (msg.role.includes('HAL9000') ? `🤖 ${msg.role}` : `😺 ${msg.role}`);
@@ -484,7 +529,13 @@
484
529
  nameDiv.className = 'sender-name-inside';
485
530
 
486
531
  const nameSpan = document.createElement('span');
487
- nameSpan.textContent = senderName;
532
+ // Split Model Info (Content in parentheses at the end)
533
+ const match = senderName.match(/^(.*)(\(.*\))$/);
534
+ if (match) {
535
+ nameSpan.innerHTML = `<span class="base-name">${match[1].trim()}</span><span class="model-info">${match[2].trim()}</span>`;
536
+ } else {
537
+ nameSpan.textContent = senderName;
538
+ }
488
539
 
489
540
  const timeSpan = document.createElement('span');
490
541
  timeSpan.className = 'message-time';
@@ -524,12 +575,51 @@
524
575
  lang = cls.replace('language-', '');
525
576
  }
526
577
  });
527
- if (lang) {
528
- block.parentElement.setAttribute('data-language', lang);
529
- }
578
+ if (!lang) lang = 'TXT'; // Default lang for header
579
+ block.parentElement.setAttribute('data-language', lang);
580
+
581
+ // Collapse Button
582
+ const pre = block.parentElement;
583
+ const btn = document.createElement('span');
584
+ let transitionTimeout;
585
+
586
+ btn.className = 'collapse-btn';
587
+ btn.textContent = '-';
588
+
589
+ btn.onclick = (e) => {
590
+ e.stopPropagation();
591
+ if (transitionTimeout) clearTimeout(transitionTimeout);
592
+
593
+ if (pre.classList.contains('collapsed')) {
594
+ // EXPAND
595
+ pre.classList.remove('collapsed');
596
+ btn.textContent = '-';
597
+
598
+ const fullHeight = pre.scrollHeight;
599
+ pre.style.height = '58px'; // Replaced 60px
600
+ pre.offsetHeight; // Force reflow
601
+ pre.style.height = fullHeight + 'px';
602
+
603
+ transitionTimeout = setTimeout(() => {
604
+ if (!pre.classList.contains('collapsed')) {
605
+ pre.style.height = 'auto';
606
+ }
607
+ }, 300);
608
+
609
+ } else {
610
+ // COLLAPSE
611
+ pre.classList.add('collapsed');
612
+ btn.textContent = '+';
613
+
614
+ const fullHeight = pre.offsetHeight;
615
+ pre.style.height = fullHeight + 'px';
616
+ pre.offsetHeight; // Force reflow
617
+ pre.style.height = '58px'; // Replaced 60px
618
+ }
619
+ };
620
+ pre.appendChild(btn);
530
621
 
531
622
  if (block.classList.contains('language-think') || block.classList.contains('language-tools')) {
532
- const pre = block.parentElement;
533
623
  if (block.classList.contains('language-tools')) { pre.classList.add('tools-block'); }
534
624
  else { pre.classList.add('think-block'); }
535
625
 
@@ -537,6 +627,11 @@
537
627
  pre.style.wordBreak = 'break-word';
538
628
  block.style.whiteSpace = 'pre-wrap';
539
629
  block.style.wordBreak = 'break-word';
630
+
631
+ // Default Collapse for think/tools
632
+ pre.classList.add('collapsed');
633
+ pre.style.height = '58px';
634
+ btn.textContent = '+';
540
635
  }
541
636
  });
542
637