Upload index.html
Browse files- static/index.html +33 -19
static/index.html
CHANGED
|
@@ -370,7 +370,10 @@
|
|
| 370 |
<div class="container">
|
| 371 |
<header>
|
| 372 |
<h1>WHEC - Chatbot</h1>
|
| 373 |
-
<p class="subtitle">
|
|
|
|
|
|
|
|
|
|
| 374 |
</header>
|
| 375 |
|
| 376 |
<div class="search-container">
|
|
@@ -490,25 +493,36 @@
|
|
| 490 |
|
| 491 |
// 2. Display Images
|
| 492 |
if (data.images && data.images.length > 0) {
|
| 493 |
-
|
| 494 |
-
data.images.
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
</div>
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
}
|
| 512 |
}
|
| 513 |
|
| 514 |
// 3. Display Texts
|
|
|
|
| 370 |
<div class="container">
|
| 371 |
<header>
|
| 372 |
<h1>WHEC - Chatbot</h1>
|
| 373 |
+
<p class="subtitle">Based on documents at WHEC (Warrior Heat- and Exertion-Related Events Collaborative)
|
| 374 |
+
page: <a
|
| 375 |
+
href="https://www.hprc-online.org/resources-partners/whec">https://www.hprc-online.org/resources-partners/whec</a>
|
| 376 |
+
</p>
|
| 377 |
</header>
|
| 378 |
|
| 379 |
<div class="search-container">
|
|
|
|
| 493 |
|
| 494 |
// 2. Display Images
|
| 495 |
if (data.images && data.images.length > 0) {
|
| 496 |
+
// Sort by score descending just to be safe
|
| 497 |
+
data.images.sort((a, b) => b.score - a.score);
|
| 498 |
+
|
| 499 |
+
let imagesToShow = data.images.filter(img => img.score >= 0.3);
|
| 500 |
+
|
| 501 |
+
// Fallback: if no images match threshold, show the top 1 most relevant
|
| 502 |
+
if (imagesToShow.length === 0) {
|
| 503 |
+
imagesToShow = [data.images[0]];
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
if (imagesToShow.length > 0) {
|
| 507 |
+
imagesSection.style.display = 'block';
|
| 508 |
+
imagesToShow.forEach(img => {
|
| 509 |
+
const div = document.createElement('div');
|
| 510 |
+
div.className = 'image-card';
|
| 511 |
+
div.innerHTML = `
|
| 512 |
+
<a href="${img.path}" target="_blank">
|
| 513 |
+
<img src="${img.path}" alt="${img.filename}" loading="lazy">
|
| 514 |
+
</a>
|
| 515 |
+
<div class="image-meta">
|
| 516 |
+
<div class="image-filename" title="${img.filename}">${img.filename}</div>
|
| 517 |
+
<div class="image-stats">
|
| 518 |
+
<span>Page ${img.page || '?'}</span>
|
| 519 |
+
<span>${(img.score * 100).toFixed(0)}% Match</span>
|
| 520 |
+
</div>
|
| 521 |
</div>
|
| 522 |
+
`;
|
| 523 |
+
imagesGrid.appendChild(div);
|
| 524 |
+
});
|
| 525 |
+
}
|
| 526 |
}
|
| 527 |
|
| 528 |
// 3. Display Texts
|