@wendongfly/myhi 1.0.86 → 1.0.88

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/dist/chat.html CHANGED
@@ -344,36 +344,35 @@
344
344
  const H = 'style="font-size:0.9rem;font-weight:700;margin-bottom:0.5rem;color:#e6edf3"';
345
345
  const T = 'style="font-size:0.82rem;color:#b1bac4;line-height:1.6"';
346
346
  let html = '<div style="padding:1.5rem">';
347
- html += '<h3 style="margin:0 0 1.2rem;font-size:1.1rem;color:#fff;text-align:center">Claude 用量统计</h3>';
347
+ html += '<h3 style="margin:0 0 1.2rem;font-size:1.1rem;color:#fff;text-align:center">Claude 用量</h3>';
348
348
  if (data.rateLimit) {
349
349
  const rl = data.rateLimit;
350
- const remaining = Math.max(0, Math.ceil((new Date(rl.resetsAt * 1000) - Date.now()) / 60000));
350
+ const resetTime = new Date(rl.resetsAt * 1000);
351
+ const remaining = Math.max(0, Math.ceil((resetTime - Date.now()) / 60000));
352
+ const hours = Math.floor(remaining / 60);
353
+ const mins = remaining % 60;
354
+ const timeStr = hours > 0 ? `${hours}小时${mins}分钟` : `${mins}分钟`;
351
355
  const statusColor = rl.status === 'allowed' ? '#3fb950' : '#f85149';
352
- html += `<div ${C}><div ${H}>5小时窗口</div>`;
353
- html += `<div ${T}><span style="color:${statusColor};font-weight:600">${rl.status === 'allowed' ? '● 正常' : '● 受限'}</span> 重置: ${remaining} 分钟后</div></div>`;
356
+ const statusText = rl.status === 'allowed' ? '正常可用' : '已达上限';
357
+ html += `<div ${C}>`;
358
+ html += `<div ${H}>5 小时配额窗口</div>`;
359
+ html += `<div ${T}><span style="color:${statusColor};font-weight:700;font-size:0.95rem">${rl.status === 'allowed' ? '●' : '●'} ${statusText}</span></div>`;
360
+ html += `<div ${T}>窗口重置: <b style="color:#e6edf3">${timeStr}后</b>(${resetTime.toLocaleTimeString('zh-CN', {hour:'2-digit',minute:'2-digit'})})</div>`;
361
+ html += '</div>';
354
362
  } else {
355
- html += `<div ${C}><div ${H}>5小时窗口</div><div ${T}>发送 Agent 消息后可查看</div></div>`;
356
- }
357
- if (data.sevenDay) {
358
- const s = data.sevenDay;
359
- html += `<div ${C}><div ${H}>近 7 天</div>`;
360
- html += `<div ${T}>消息 <b style="color:#e6edf3">${s.messageCount.toLocaleString()}</b> 会话 <b style="color:#e6edf3">${s.sessionCount}</b> 工具调用 <b style="color:#e6edf3">${s.toolCallCount.toLocaleString()}</b></div></div>`;
363
+ html += `<div ${C}><div ${H}>5 小时配额窗口</div><div ${T}>发送一条 Agent 消息后可查看</div></div>`;
361
364
  }
362
365
  if (data.activeSessions?.length) {
363
- html += `<div ${C}><div ${H}>当前活跃会话</div>`;
366
+ html += `<div ${C}><div ${H}>当前会话</div>`;
364
367
  for (const s of data.activeSessions) {
365
368
  if (!s.usage) continue;
366
- html += `<div ${T}>${s.title} <b style="color:#e6edf3">${s.usage.queryCount}</b> 次查询 <b style="color:#e6edf3">$${s.usage.totalCostUSD.toFixed(4)}</b></div>`;
369
+ const u = s.usage;
370
+ html += `<div ${T}><b style="color:#e6edf3">${s.title}</b> (${s.owner || '管理员'})</div>`;
371
+ html += `<div style="font-size:0.78rem;color:#8b949e;margin:0.2rem 0 0.3rem;line-height:1.5">查询 <b style="color:#b1bac4">${u.queryCount}</b>次 输入 <b style="color:#b1bac4">${((u.totalInputTokens+u.totalCacheReadTokens)/1000).toFixed(0)}K</b> 输出 <b style="color:#b1bac4">${(u.totalOutputTokens/1000).toFixed(0)}K</b> 费用 <b style="color:#b1bac4">$${u.totalCostUSD.toFixed(4)}</b></div>`;
372
+ if (u.modelUsage) { for (const [m, mu] of Object.entries(u.modelUsage)) { html += `<div style="font-size:0.72rem;color:#6e7681;line-height:1.4"> ${m.replace(/claude-/,'').replace(/-\d{8}$/,'').replace(/\[.*\]/,'')} ${(mu.inputTokens/1000).toFixed(0)}K/${(mu.outputTokens/1000).toFixed(0)}K $${mu.costUSD.toFixed(4)}</div>`; } }
367
373
  }
368
374
  html += '</div>';
369
375
  }
370
- if (data.totalStats) {
371
- const t = data.totalStats;
372
- html += `<div ${C}><div ${H}>累计(截至 ${t.lastComputedDate || '未知'})</div>`;
373
- html += `<div ${T}>总会话 <b style="color:#e6edf3">${t.totalSessions}</b> 总消息 <b style="color:#e6edf3">${t.totalMessages?.toLocaleString()}</b></div>`;
374
- if (t.modelUsage) { for (const [m, u] of Object.entries(t.modelUsage)) { if (u.outputTokens > 0) html += `<div style="font-size:0.75rem;color:#8b949e;margin-top:0.3rem">${m.replace(/claude-/,'').replace(/-\d{8}$/,'')} 输入 ${(u.inputTokens/1000).toFixed(0)}K 输出 ${(u.outputTokens/1000).toFixed(0)}K</div>`; } }
375
- html += '</div>';
376
- }
377
376
  html += '<button onclick="this.closest(\'[data-usage-overlay]\').remove()" style="margin-top:0.8rem;width:100%;padding:0.7rem;background:#7c3aed;color:#fff;border:none;border-radius:10px;cursor:pointer;font-size:0.9rem;font-weight:600">关闭</button></div>';
378
377
  const overlay = document.createElement('div');
379
378
  overlay.setAttribute('data-usage-overlay', '');
package/dist/index.html CHANGED
@@ -540,36 +540,35 @@
540
540
  const H = 'style="font-size:0.9rem;font-weight:700;margin-bottom:0.5rem;color:#e6edf3"';
541
541
  const T = 'style="font-size:0.82rem;color:#b1bac4;line-height:1.6"';
542
542
  let html = '<div style="padding:1.5rem">';
543
- html += '<h3 style="margin:0 0 1.2rem;font-size:1.1rem;color:#fff;text-align:center">Claude 用量统计</h3>';
543
+ html += '<h3 style="margin:0 0 1.2rem;font-size:1.1rem;color:#fff;text-align:center">Claude 用量</h3>';
544
544
  if (data.rateLimit) {
545
545
  const rl = data.rateLimit;
546
- const remaining = Math.max(0, Math.ceil((new Date(rl.resetsAt * 1000) - Date.now()) / 60000));
546
+ const resetTime = new Date(rl.resetsAt * 1000);
547
+ const remaining = Math.max(0, Math.ceil((resetTime - Date.now()) / 60000));
548
+ const hours = Math.floor(remaining / 60);
549
+ const mins = remaining % 60;
550
+ const timeStr = hours > 0 ? `${hours}小时${mins}分钟` : `${mins}分钟`;
547
551
  const statusColor = rl.status === 'allowed' ? '#3fb950' : '#f85149';
548
- html += `<div ${C}><div ${H}>5小时窗口</div>`;
549
- html += `<div ${T}><span style="color:${statusColor};font-weight:600">${rl.status === 'allowed' ? '● 正常' : '● 受限'}</span> 重置: ${remaining} 分钟后</div></div>`;
552
+ const statusText = rl.status === 'allowed' ? '正常可用' : '已达上限';
553
+ html += `<div ${C}>`;
554
+ html += `<div ${H}>5 小时配额窗口</div>`;
555
+ html += `<div ${T}><span style="color:${statusColor};font-weight:700;font-size:0.95rem">● ${statusText}</span></div>`;
556
+ html += `<div ${T}>窗口重置: <b style="color:#e6edf3">${timeStr}后</b>(${resetTime.toLocaleTimeString('zh-CN', {hour:'2-digit',minute:'2-digit'})})</div>`;
557
+ html += '</div>';
550
558
  } else {
551
- html += `<div ${C}><div ${H}>5小时窗口</div><div ${T}>发送 Agent 消息后可查看</div></div>`;
552
- }
553
- if (data.sevenDay) {
554
- const s = data.sevenDay;
555
- html += `<div ${C}><div ${H}>近 7 天</div>`;
556
- html += `<div ${T}>消息 <b style="color:#e6edf3">${s.messageCount.toLocaleString()}</b> 会话 <b style="color:#e6edf3">${s.sessionCount}</b> 工具调用 <b style="color:#e6edf3">${s.toolCallCount.toLocaleString()}</b></div></div>`;
559
+ html += `<div ${C}><div ${H}>5 小时配额窗口</div><div ${T}>发送一条 Agent 消息后可查看</div></div>`;
557
560
  }
558
561
  if (data.activeSessions?.length) {
559
- html += `<div ${C}><div ${H}>当前活跃会话</div>`;
562
+ html += `<div ${C}><div ${H}>当前会话</div>`;
560
563
  for (const s of data.activeSessions) {
561
564
  if (!s.usage) continue;
562
- html += `<div ${T}>${s.title} <b style="color:#e6edf3">${s.usage.queryCount}</b> 次查询 <b style="color:#e6edf3">$${s.usage.totalCostUSD.toFixed(4)}</b></div>`;
565
+ const u = s.usage;
566
+ html += `<div ${T}><b style="color:#e6edf3">${s.title}</b> (${s.owner || '管理员'})</div>`;
567
+ html += `<div style="font-size:0.78rem;color:#8b949e;margin:0.2rem 0 0.3rem;line-height:1.5">查询 <b style="color:#b1bac4">${u.queryCount}</b>次 输入 <b style="color:#b1bac4">${((u.totalInputTokens+u.totalCacheReadTokens)/1000).toFixed(0)}K</b> 输出 <b style="color:#b1bac4">${(u.totalOutputTokens/1000).toFixed(0)}K</b> 费用 <b style="color:#b1bac4">$${u.totalCostUSD.toFixed(4)}</b></div>`;
568
+ if (u.modelUsage) { for (const [m, mu] of Object.entries(u.modelUsage)) { html += `<div style="font-size:0.72rem;color:#6e7681;line-height:1.4"> ${m.replace(/claude-/,'').replace(/-\d{8}$/,'').replace(/\[.*\]/,'')} ${(mu.inputTokens/1000).toFixed(0)}K/${(mu.outputTokens/1000).toFixed(0)}K $${mu.costUSD.toFixed(4)}</div>`; } }
563
569
  }
564
570
  html += '</div>';
565
571
  }
566
- if (data.totalStats) {
567
- const t = data.totalStats;
568
- html += `<div ${C}><div ${H}>累计(截至 ${t.lastComputedDate || '未知'})</div>`;
569
- html += `<div ${T}>总会话 <b style="color:#e6edf3">${t.totalSessions}</b> 总消息 <b style="color:#e6edf3">${t.totalMessages?.toLocaleString()}</b></div>`;
570
- if (t.modelUsage) { for (const [m, u] of Object.entries(t.modelUsage)) { if (u.outputTokens > 0) html += `<div style="font-size:0.75rem;color:#8b949e;margin-top:0.3rem">${m.replace(/claude-/,'').replace(/-\d{8}$/,'')} 输入 ${(u.inputTokens/1000).toFixed(0)}K 输出 ${(u.outputTokens/1000).toFixed(0)}K</div>`; } }
571
- html += '</div>';
572
- }
573
572
  html += '<button onclick="this.closest(\'[data-usage-overlay]\').remove()" style="margin-top:0.8rem;width:100%;padding:0.7rem;background:#7c3aed;color:#fff;border:none;border-radius:10px;cursor:pointer;font-size:0.9rem;font-weight:600">关闭</button></div>';
574
573
  const overlay = document.createElement('div');
575
574
  overlay.setAttribute('data-usage-overlay', '');