halbot 1995.1.44 → 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 +111 -10
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.44",
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;
@@ -231,6 +258,17 @@
231
258
  color: #333;
232
259
  }
233
260
 
261
+ /* Think & Tools Block Auto-Wrap */
262
+ .markdown-body pre.think-block,
263
+ .markdown-body pre.think-block code,
264
+ .markdown-body pre.tools-block,
265
+ .markdown-body pre.tools-block code {
266
+ white-space: pre-wrap !important;
267
+ word-wrap: break-word !important;
268
+ overflow-wrap: break-word !important;
269
+ word-break: break-word !important;
270
+ }
271
+
234
272
  /* Markdown Styles */
235
273
  /* Markdown Overrides */
236
274
  .markdown-body {
@@ -263,6 +301,23 @@
263
301
  background-color: #f6f8fa !important;
264
302
  border-radius: 6px !important;
265
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;
266
321
  }
267
322
 
268
323
  .markdown-body pre[data-language]::before {
@@ -460,7 +515,6 @@
460
515
  const group = document.createElement('div');
461
516
  group.className = 'message-group';
462
517
 
463
- // Mapping sender name
464
518
  const senderName = /^\p{Extended_Pictographic}/u.test(msg.role)
465
519
  ? msg.role
466
520
  : (msg.role.includes('HAL9000') ? `🤖 ${msg.role}` : `😺 ${msg.role}`);
@@ -473,7 +527,13 @@
473
527
  nameDiv.className = 'sender-name-inside';
474
528
 
475
529
  const nameSpan = document.createElement('span');
476
- 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
+ }
477
537
 
478
538
  const timeSpan = document.createElement('span');
479
539
  timeSpan.className = 'message-time';
@@ -499,8 +559,8 @@
499
559
 
500
560
  // Highlight Code
501
561
  contentDiv.querySelectorAll('pre code').forEach((block) => {
502
- // Trim think block content
503
- if (block.classList.contains('language-think')) {
562
+ // Trim think/tools block content
563
+ if (block.classList.contains('language-think') || block.classList.contains('language-tools')) {
504
564
  block.textContent = block.textContent.trim();
505
565
  }
506
566
 
@@ -513,13 +573,54 @@
513
573
  lang = cls.replace('language-', '');
514
574
  }
515
575
  });
516
- if (lang) {
517
- block.parentElement.setAttribute('data-language', lang);
518
- }
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);
619
+
620
+ if (block.classList.contains('language-think') || block.classList.contains('language-tools')) {
621
+ if (block.classList.contains('language-tools')) { pre.classList.add('tools-block'); }
622
+ else { pre.classList.add('think-block'); }
519
623
 
520
- if (block.classList.contains('language-think')) {
521
- const pre = block.parentElement;
522
- pre.classList.add('think-block');
523
624
  pre.style.whiteSpace = 'pre-wrap';
524
625
  pre.style.wordBreak = 'break-word';
525
626
  block.style.whiteSpace = 'pre-wrap';