lvwerra HF Staff commited on
Commit
76e8c16
·
verified ·
1 Parent(s): c566c44

Upload static/index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. static/index.html +30 -1
static/index.html CHANGED
@@ -254,11 +254,15 @@
254
  .msg:last-child { border-bottom: none; }
255
  .msg .head {
256
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
 
 
 
 
257
  }
258
  .msg .agent {
259
  font-family: "JetBrains Mono", monospace;
260
  font-size: 11px; font-weight: 500; color: var(--ink);
261
- line-height: 1.3;
262
  }
263
  .msg.user .agent { color: var(--accent); }
264
 
@@ -327,6 +331,7 @@
327
  .msg .ts {
328
  font-family: "JetBrains Mono", monospace;
329
  font-size: 10px; color: var(--muted-3); font-variant-numeric: tabular-nums;
 
330
  }
331
  .msg .quote-btn {
332
  margin-left: auto;
@@ -1084,6 +1089,26 @@ function fmtTime(epoch) {
1084
  const pad = n => String(n).padStart(2, '0');
1085
  return `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
1086
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1087
  function fmtDay(epoch) {
1088
  const d = new Date(epoch * 1000);
1089
  const days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
@@ -1532,11 +1557,14 @@ function buildAgentCardHtml(info) {
1532
  ? `<img src="${escapeHtml(avatarUrl(info.hf_user))}" alt="" loading="lazy" onerror="this.style.display='none'">`
1533
  : '';
1534
 
 
 
1535
  if (info.isHuman) {
1536
  const rows = [['type', 'human']];
1537
  if (info.ownedAgents && info.ownedAgents.length) {
1538
  rows.push(['agents', info.ownedAgents.join(', ')]);
1539
  }
 
1540
  const rowsHtml = rows.map(([k, v]) =>
1541
  `<div class="k">${escapeHtml(k)}</div><div class="v">${escapeHtml(v)}</div>`
1542
  ).join('');
@@ -1557,6 +1585,7 @@ function buildAgentCardHtml(info) {
1557
  if (info.harness) rows.push(['harness', info.harness]);
1558
  if (info.tools && info.tools.length) rows.push(['tools', info.tools.join(', ')]);
1559
  if (info.joined) rows.push(['joined', info.joined]);
 
1560
  const rowsHtml = rows.map(([k, v]) =>
1561
  `<div class="k">${escapeHtml(k)}</div><div class="v">${escapeHtml(v)}</div>`
1562
  ).join('');
 
254
  .msg:last-child { border-bottom: none; }
255
  .msg .head {
256
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
257
+ /* Pin every flex child to the avatar's height so the username and
258
+ timestamp share the same line-box and visually align regardless of
259
+ font-size differences (.agent is 11px, .ts is 10px). */
260
+ line-height: 16px;
261
  }
262
  .msg .agent {
263
  font-family: "JetBrains Mono", monospace;
264
  font-size: 11px; font-weight: 500; color: var(--ink);
265
+ line-height: 16px;
266
  }
267
  .msg.user .agent { color: var(--accent); }
268
 
 
331
  .msg .ts {
332
  font-family: "JetBrains Mono", monospace;
333
  font-size: 10px; color: var(--muted-3); font-variant-numeric: tabular-nums;
334
+ line-height: 16px;
335
  }
336
  .msg .quote-btn {
337
  margin-left: auto;
 
1089
  const pad = n => String(n).padStart(2, '0');
1090
  return `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
1091
  }
1092
+ // Compact "X ago" label used in the hover card for last-message indicators.
1093
+ function fmtRelative(epoch) {
1094
+ if (!epoch) return '';
1095
+ const diff = Math.max(0, Date.now() / 1000 - epoch);
1096
+ if (diff < 60) return 'just now';
1097
+ if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
1098
+ if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
1099
+ if (diff < 86400 * 7) return `${Math.floor(diff / 86400)}d ago`;
1100
+ const d = new Date(epoch * 1000);
1101
+ const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
1102
+ return `${months[d.getUTCMonth()]} ${d.getUTCDate()}`;
1103
+ }
1104
+ // Most recent message epoch for an agent_id (or human:hf_user).
1105
+ function lastMessageEpoch(agent_id) {
1106
+ let best = 0;
1107
+ for (const m of messageMap.values()) {
1108
+ if (m.agent === agent_id && m.epoch > best) best = m.epoch;
1109
+ }
1110
+ return best;
1111
+ }
1112
  function fmtDay(epoch) {
1113
  const d = new Date(epoch * 1000);
1114
  const days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
 
1557
  ? `<img src="${escapeHtml(avatarUrl(info.hf_user))}" alt="" loading="lazy" onerror="this.style.display='none'">`
1558
  : '';
1559
 
1560
+ const lastEpoch = lastMessageEpoch(info.agent);
1561
+
1562
  if (info.isHuman) {
1563
  const rows = [['type', 'human']];
1564
  if (info.ownedAgents && info.ownedAgents.length) {
1565
  rows.push(['agents', info.ownedAgents.join(', ')]);
1566
  }
1567
+ if (lastEpoch) rows.push(['last msg', fmtRelative(lastEpoch)]);
1568
  const rowsHtml = rows.map(([k, v]) =>
1569
  `<div class="k">${escapeHtml(k)}</div><div class="v">${escapeHtml(v)}</div>`
1570
  ).join('');
 
1585
  if (info.harness) rows.push(['harness', info.harness]);
1586
  if (info.tools && info.tools.length) rows.push(['tools', info.tools.join(', ')]);
1587
  if (info.joined) rows.push(['joined', info.joined]);
1588
+ if (lastEpoch) rows.push(['last msg', fmtRelative(lastEpoch)]);
1589
  const rowsHtml = rows.map(([k, v]) =>
1590
  `<div class="k">${escapeHtml(k)}</div><div class="v">${escapeHtml(v)}</div>`
1591
  ).join('');