Spaces:
Running
Running
added text to the banner
Browse files
app/src/content/assets/data/banner_visualisation_data.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:98eba5e5db19f482da8a3b26498c2fa633afa458f5b75e23d2dca24e24cc7596
|
3 |
+
size 844651
|
app/src/content/embeds/banner.html
CHANGED
@@ -258,12 +258,25 @@
|
|
258 |
.attr('stroke', isDark ? 'rgba(255,255,255,0.85)' : 'rgba(0,0,0,0.85)')
|
259 |
.attr('stroke-width', 1.2);
|
260 |
const imgSrc = `${thumbBase}${d.original_id}.jpg`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
tipInner.innerHTML =
|
262 |
`<div style="display:flex; gap:10px; align-items:flex-start;">` +
|
263 |
`<img src="${imgSrc}" alt="thumb ${d.original_id}" style="width:120px;height:120px;object-fit:cover;flex:0 0 auto;border-radius:6px;border:1px solid var(--border-color);" />` +
|
264 |
`<div style="min-width:140px;">` +
|
265 |
`<div><strong>${d.category || 'Unknown'}</strong></div>` +
|
266 |
-
`<div><strong>
|
|
|
267 |
`<div><strong>Subset</strong> ${d.subset ?? '—'}</div>` +
|
268 |
`</div>` +
|
269 |
`</div>`;
|
|
|
258 |
.attr('stroke', isDark ? 'rgba(255,255,255,0.85)' : 'rgba(0,0,0,0.85)')
|
259 |
.attr('stroke-width', 1.2);
|
260 |
const imgSrc = `${thumbBase}${d.original_id}.jpg`;
|
261 |
+
|
262 |
+
// Function to truncate text to max 25 words
|
263 |
+
const truncateText = (text, maxWords = 25) => {
|
264 |
+
if (!text || typeof text !== 'string') return '—';
|
265 |
+
const words = text.trim().split(/\s+/);
|
266 |
+
if (words.length <= maxWords) return text;
|
267 |
+
return words.slice(0, maxWords).join(' ') + '...';
|
268 |
+
};
|
269 |
+
|
270 |
+
const userText = truncateText(d.user);
|
271 |
+
const assistantText = truncateText(d.assistant);
|
272 |
+
|
273 |
tipInner.innerHTML =
|
274 |
`<div style="display:flex; gap:10px; align-items:flex-start;">` +
|
275 |
`<img src="${imgSrc}" alt="thumb ${d.original_id}" style="width:120px;height:120px;object-fit:cover;flex:0 0 auto;border-radius:6px;border:1px solid var(--border-color);" />` +
|
276 |
`<div style="min-width:140px;">` +
|
277 |
`<div><strong>${d.category || 'Unknown'}</strong></div>` +
|
278 |
+
`<div><strong>Q:</strong> ${userText}</div>` +
|
279 |
+
`<div><strong>A:</strong> ${assistantText}</div>` +
|
280 |
`<div><strong>Subset</strong> ${d.subset ?? '—'}</div>` +
|
281 |
`</div>` +
|
282 |
`</div>`;
|