Show total chunks/embeddings in the indexed-documents popup
Browse filesAdds a summary line above the per-document list (e.g. "2 documents —
9 chunks / 9 embeddings"), recomputed on every open and after each
remove so it always reflects what's actually indexed right now.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- index.html +9 -1
index.html
CHANGED
|
@@ -332,7 +332,8 @@
|
|
| 332 |
<div class="modal-box" style="max-width:420px;text-align:left;">
|
| 333 |
<button type="button" class="sidebar-close-btn" id="ragDocsModalClose" aria-label="Close" style="position:absolute;top:14px;right:14px;">✕</button>
|
| 334 |
<div class="modal-title" style="text-align:center;">Indexed documents</div>
|
| 335 |
-
<div class="modal-sub" id="ragDocsModalSub" style="margin-bottom:
|
|
|
|
| 336 |
<div id="ragDocsList" style="display:flex;flex-direction:column;gap:8px;max-height:300px;overflow-y:auto;"></div>
|
| 337 |
</div>
|
| 338 |
</div>
|
|
@@ -729,6 +730,7 @@ const ragDocsModalOverlay = document.getElementById('ragDocsModalOverlay');
|
|
| 729 |
const ragDocsModalClose = document.getElementById('ragDocsModalClose');
|
| 730 |
const ragDocsModalSub = document.getElementById('ragDocsModalSub');
|
| 731 |
const ragDocsListEl = document.getElementById('ragDocsList');
|
|
|
|
| 732 |
const ragTopKDownBtn = document.getElementById('ragTopKDown');
|
| 733 |
const ragTopKUpBtn = document.getElementById('ragTopKUp');
|
| 734 |
const ragTopKValueEl = document.getElementById('ragTopKValue');
|
|
@@ -2133,11 +2135,17 @@ async function removeRagDocByName(name) {
|
|
| 2133 |
|
| 2134 |
async function renderRagDocsList() {
|
| 2135 |
ragDocsListEl.innerHTML = '<div style="text-align:center;color:var(--muted);font-size:13px;padding:12px 0;">Loading…</div>';
|
|
|
|
| 2136 |
const documents = await fetchRagDocsList();
|
| 2137 |
if (!documents.length) {
|
| 2138 |
ragDocsListEl.innerHTML = '<div style="text-align:center;color:var(--muted);font-size:13px;padding:12px 0;">No documents indexed in this conversation yet.</div>';
|
| 2139 |
return;
|
| 2140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2141 |
ragDocsListEl.innerHTML = '';
|
| 2142 |
documents.forEach((doc) => {
|
| 2143 |
const row = document.createElement('div');
|
|
|
|
| 332 |
<div class="modal-box" style="max-width:420px;text-align:left;">
|
| 333 |
<button type="button" class="sidebar-close-btn" id="ragDocsModalClose" aria-label="Close" style="position:absolute;top:14px;right:14px;">✕</button>
|
| 334 |
<div class="modal-title" style="text-align:center;">Indexed documents</div>
|
| 335 |
+
<div class="modal-sub" id="ragDocsModalSub" style="margin-bottom:4px;text-align:center;">For this conversation</div>
|
| 336 |
+
<div id="ragDocsSummary" style="margin-bottom:14px;text-align:center;font-size:12px;color:var(--muted);"></div>
|
| 337 |
<div id="ragDocsList" style="display:flex;flex-direction:column;gap:8px;max-height:300px;overflow-y:auto;"></div>
|
| 338 |
</div>
|
| 339 |
</div>
|
|
|
|
| 730 |
const ragDocsModalClose = document.getElementById('ragDocsModalClose');
|
| 731 |
const ragDocsModalSub = document.getElementById('ragDocsModalSub');
|
| 732 |
const ragDocsListEl = document.getElementById('ragDocsList');
|
| 733 |
+
const ragDocsSummaryEl = document.getElementById('ragDocsSummary');
|
| 734 |
const ragTopKDownBtn = document.getElementById('ragTopKDown');
|
| 735 |
const ragTopKUpBtn = document.getElementById('ragTopKUp');
|
| 736 |
const ragTopKValueEl = document.getElementById('ragTopKValue');
|
|
|
|
| 2135 |
|
| 2136 |
async function renderRagDocsList() {
|
| 2137 |
ragDocsListEl.innerHTML = '<div style="text-align:center;color:var(--muted);font-size:13px;padding:12px 0;">Loading…</div>';
|
| 2138 |
+
ragDocsSummaryEl.textContent = '';
|
| 2139 |
const documents = await fetchRagDocsList();
|
| 2140 |
if (!documents.length) {
|
| 2141 |
ragDocsListEl.innerHTML = '<div style="text-align:center;color:var(--muted);font-size:13px;padding:12px 0;">No documents indexed in this conversation yet.</div>';
|
| 2142 |
return;
|
| 2143 |
}
|
| 2144 |
+
// One embedding vector per chunk, always — there's no separate
|
| 2145 |
+
// per-document embedding count to report, so this is really one
|
| 2146 |
+
// number shown two ways for anyone expecting them to differ.
|
| 2147 |
+
const totalChunks = documents.reduce((sum, doc) => sum + (doc.chunks || 0), 0);
|
| 2148 |
+
ragDocsSummaryEl.textContent = `${documents.length} document${documents.length === 1 ? '' : 's'} — ${totalChunks} chunk${totalChunks === 1 ? '' : 's'} / ${totalChunks} embedding${totalChunks === 1 ? '' : 's'}`;
|
| 2149 |
ragDocsListEl.innerHTML = '';
|
| 2150 |
documents.forEach((doc) => {
|
| 2151 |
const row = document.createElement('div');
|