Update buffalo_rag/frontend/static/js/app.js
Browse files
buffalo_rag/frontend/static/js/app.js
CHANGED
|
@@ -63,33 +63,36 @@
|
|
| 63 |
// Update sources panel
|
| 64 |
function updateSources(sources) {
|
| 65 |
sourcesContainer.innerHTML = '';
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
| 68 |
sourcesContainer.appendChild(noSources);
|
| 69 |
return;
|
| 70 |
}
|
| 71 |
-
|
| 72 |
-
|
| 73 |
const card = document.createElement('div');
|
| 74 |
card.className = 'source-card';
|
| 75 |
-
|
| 76 |
const title = document.createElement('h4');
|
| 77 |
title.textContent = source.title;
|
| 78 |
-
|
| 79 |
const link = document.createElement('a');
|
| 80 |
link.className = 'link';
|
| 81 |
link.href = source.url;
|
| 82 |
link.target = '_blank';
|
| 83 |
link.innerHTML = `View source <i class="fas fa-external-link-alt"></i>`;
|
| 84 |
-
|
| 85 |
const score = document.createElement('div');
|
| 86 |
score.className = 'score';
|
| 87 |
score.textContent = `Relevance: ${source.score.toFixed(2)}`;
|
| 88 |
-
|
| 89 |
card.appendChild(title);
|
| 90 |
card.appendChild(link);
|
| 91 |
card.appendChild(score);
|
| 92 |
-
|
| 93 |
sourcesContainer.appendChild(card);
|
| 94 |
});
|
| 95 |
}
|
|
|
|
| 63 |
// Update sources panel
|
| 64 |
function updateSources(sources) {
|
| 65 |
sourcesContainer.innerHTML = '';
|
| 66 |
+
|
| 67 |
+
// Filter sources with score > -8
|
| 68 |
+
const filteredSources = sources.filter(source => source.score > -8);
|
| 69 |
+
|
| 70 |
+
if (filteredSources.length === 0) {
|
| 71 |
sourcesContainer.appendChild(noSources);
|
| 72 |
return;
|
| 73 |
}
|
| 74 |
+
|
| 75 |
+
filteredSources.forEach(source => {
|
| 76 |
const card = document.createElement('div');
|
| 77 |
card.className = 'source-card';
|
| 78 |
+
|
| 79 |
const title = document.createElement('h4');
|
| 80 |
title.textContent = source.title;
|
| 81 |
+
|
| 82 |
const link = document.createElement('a');
|
| 83 |
link.className = 'link';
|
| 84 |
link.href = source.url;
|
| 85 |
link.target = '_blank';
|
| 86 |
link.innerHTML = `View source <i class="fas fa-external-link-alt"></i>`;
|
| 87 |
+
|
| 88 |
const score = document.createElement('div');
|
| 89 |
score.className = 'score';
|
| 90 |
score.textContent = `Relevance: ${source.score.toFixed(2)}`;
|
| 91 |
+
|
| 92 |
card.appendChild(title);
|
| 93 |
card.appendChild(link);
|
| 94 |
card.appendChild(score);
|
| 95 |
+
|
| 96 |
sourcesContainer.appendChild(card);
|
| 97 |
});
|
| 98 |
}
|