From baae7dd80605dc0b146494b32ab80f7886b81cb6 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 26 May 2026 10:08:30 +0800 Subject: [PATCH] fix(frontend): update KBInfoPopover to correctly display FAQ and document counts Refactor the logic in KBInfoPopover.vue to differentiate between FAQ and document knowledge bases. The component now uses `chunk_count` for FAQ KBs and retains `knowledge_count` for document KBs, ensuring accurate representation of entry totals. This change aligns the display logic with the intended user-facing metrics for each KB type. --- frontend/src/components/KBInfoPopover.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/KBInfoPopover.vue b/frontend/src/components/KBInfoPopover.vue index c87a5e65..66c6cff2 100644 --- a/frontend/src/components/KBInfoPopover.vue +++ b/frontend/src/components/KBInfoPopover.vue @@ -346,12 +346,23 @@ const statRows = computed = [] - if (typeof kb.knowledge_count === 'number') { + // FAQ KBs store every Q/A pair as a chunk, so chunk_count is the + // user-facing entry total. Document KBs use knowledge_count for the + // file-level total (chunk_count there counts internal splits and is + // not meaningful to surface here). Mirrors the same branching used + // by the list card. + if (kb.type === 'faq') { + if (typeof kb.chunk_count === 'number') { + items.push({ + key: 'faq', + label: t('knowledgeBase.infoCard.faqCount'), + value: kb.chunk_count, + }) + } + } else if (typeof kb.knowledge_count === 'number') { items.push({ key: 'knowledge', - label: kb.type === 'faq' - ? t('knowledgeBase.infoCard.faqCount') - : t('knowledgeBase.infoCard.documentCount'), + label: t('knowledgeBase.infoCard.documentCount'), value: kb.knowledge_count, }) }