malt666 commited on
Commit
bc4f31d
·
verified ·
1 Parent(s): 49a2030

Upload 6 files

Browse files
Files changed (1) hide show
  1. templates/dashboard.html +82 -2
templates/dashboard.html CHANGED
@@ -416,6 +416,41 @@
416
  background: rgba(111, 66, 193, 0.7);
417
  }
418
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  /* 媒体查询 */
420
  @media (max-width: 768px) {
421
  .container {
@@ -544,6 +579,31 @@
544
  <span class="status-label">输出Token</span>
545
  <span class="status-value token-count">{{ total_tokens.completion|int }}</span>
546
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
  </div>
548
  </div>
549
 
@@ -582,6 +642,7 @@
582
  <span class="card-icon">📈</span>
583
  模型使用统计
584
  </h2>
 
585
  </div>
586
  <div class="table-container">
587
  <table class="data-table">
@@ -596,7 +657,7 @@
596
  </thead>
597
  <tbody>
598
  {% for model, stats in model_stats.items() %}
599
- <tr>
600
  <td>{{ model }}</td>
601
  <td class="call-count">{{ stats.count }}</td>
602
  <td class="token-count">{{ stats.prompt_tokens|int }}</td>
@@ -606,6 +667,9 @@
606
  {% endfor %}
607
  </tbody>
608
  </table>
 
 
 
609
  </div>
610
  </div>
611
 
@@ -647,7 +711,7 @@
647
  // 显示/隐藏回到顶部按钮
648
  window.addEventListener('scroll', () => {
649
  const floatBtn = document.querySelector('.float-btn');
650
- if (window.scrollY > 300) {
651
  floatBtn.style.opacity = '1';
652
  } else {
653
  floatBtn.style.opacity = '0';
@@ -656,6 +720,22 @@
656
 
657
  // 初始化隐藏回到顶部按钮
658
  document.querySelector('.float-btn').style.opacity = '0';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  </script>
660
  </body>
661
  </html>
 
416
  background: rgba(111, 66, 193, 0.7);
417
  }
418
 
419
+ /* 模型统计折叠样式 */
420
+ .hidden-model {
421
+ display: none;
422
+ }
423
+
424
+ .btn-toggle {
425
+ background: rgba(111, 66, 193, 0.2);
426
+ border: 1px solid rgba(111, 66, 193, 0.3);
427
+ border-radius: 4px;
428
+ padding: 0.3rem 0.7rem;
429
+ color: rgba(230, 230, 255, 0.9);
430
+ cursor: pointer;
431
+ transition: all 0.2s;
432
+ font-size: 0.85rem;
433
+ margin-left: auto;
434
+ }
435
+
436
+ .btn-toggle:hover {
437
+ background: rgba(111, 66, 193, 0.4);
438
+ }
439
+
440
+ /* Token注释样式 */
441
+ .token-note {
442
+ margin-top: 0.75rem;
443
+ color: rgba(230, 230, 255, 0.6);
444
+ font-style: italic;
445
+ line-height: 1.4;
446
+ padding: 0.5rem;
447
+ border-top: 1px dashed rgba(255, 255, 255, 0.1);
448
+ }
449
+
450
+ .token-model-table {
451
+ margin-top: 1rem;
452
+ }
453
+
454
  /* 媒体查询 */
455
  @media (max-width: 768px) {
456
  .container {
 
579
  <span class="status-label">输出Token</span>
580
  <span class="status-value token-count">{{ total_tokens.completion|int }}</span>
581
  </div>
582
+ <div class="token-note">
583
+ <small>* 以上数据仅统计通过本代理使用的token数量,不包含在Abacus官网直接使用的token。数值为粗略估计,可能与实际计费有差异。</small>
584
+ </div>
585
+ <div class="table-container">
586
+ <table class="data-table token-model-table">
587
+ <thead>
588
+ <tr>
589
+ <th>模型</th>
590
+ <th>总Token</th>
591
+ <th>输入Token</th>
592
+ <th>输出Token</th>
593
+ </tr>
594
+ </thead>
595
+ <tbody>
596
+ {% for model, stats in model_stats.items() %}
597
+ <tr>
598
+ <td>{{ model }}</td>
599
+ <td class="token-count">{{ stats.total_tokens|int }}</td>
600
+ <td class="token-count">{{ stats.prompt_tokens|int }}</td>
601
+ <td class="token-count">{{ stats.completion_tokens|int }}</td>
602
+ </tr>
603
+ {% endfor %}
604
+ </tbody>
605
+ </table>
606
+ </div>
607
  </div>
608
  </div>
609
 
 
642
  <span class="card-icon">📈</span>
643
  模型使用统计
644
  </h2>
645
+ <button id="toggleModelStats" class="btn-toggle">显示全部</button>
646
  </div>
647
  <div class="table-container">
648
  <table class="data-table">
 
657
  </thead>
658
  <tbody>
659
  {% for model, stats in model_stats.items() %}
660
+ <tr class="model-row {% if loop.index > 5 %}hidden-model{% endif %}">
661
  <td>{{ model }}</td>
662
  <td class="call-count">{{ stats.count }}</td>
663
  <td class="token-count">{{ stats.prompt_tokens|int }}</td>
 
667
  {% endfor %}
668
  </tbody>
669
  </table>
670
+ <div class="token-note">
671
+ <small>* Token计算方式:部分模型使用tiktoken精确计算,其他模型使用估算方法(约4字符=1token),仅供参考。</small>
672
+ </div>
673
  </div>
674
  </div>
675
 
 
711
  // 显示/隐藏回到顶部按钮
712
  window.addEventListener('scroll', () => {
713
  const floatBtn = document.querySelector('.float-btn');
714
+ if (window.pageYOffset > 300) {
715
  floatBtn.style.opacity = '1';
716
  } else {
717
  floatBtn.style.opacity = '0';
 
720
 
721
  // 初始化隐藏回到顶部按钮
722
  document.querySelector('.float-btn').style.opacity = '0';
723
+
724
+ // 模型统计折叠功能
725
+ const toggleBtn = document.getElementById('toggleModelStats');
726
+ const hiddenModels = document.querySelectorAll('.hidden-model');
727
+ let isExpanded = false;
728
+
729
+ if (toggleBtn) {
730
+ toggleBtn.addEventListener('click', () => {
731
+ hiddenModels.forEach(model => {
732
+ model.classList.toggle('hidden-model');
733
+ });
734
+
735
+ isExpanded = !isExpanded;
736
+ toggleBtn.textContent = isExpanded ? '隐藏部分' : '显示全部';
737
+ });
738
+ }
739
  </script>
740
  </body>
741
  </html>