feat: Add statistics localization and enhance knowledge base functionality

- Introduced new localization strings for document count, FAQ entries, and chunk count in English, Russian, and Chinese.
- Updated the KnowledgeBase and KnowledgeBaseList components to display knowledge and chunk counts.
- Implemented backend functions to count knowledge items and chunks associated with each knowledge base, improving data management and user insights.
This commit is contained in:
wizardchen
2025-11-21 01:39:43 +08:00
parent c678094724
commit 9e98848d69
12 changed files with 72 additions and 4 deletions
@@ -678,7 +678,7 @@ const knowledgeDropdownOptions = computed(() =>
knowledgeList.value.map((item) => ({
content: item.name,
value: item.id,
prefixIcon: () => h(TIcon, { name: item.type === 'faq' ? 'help-circle' : 'folder', size: '16px' }),
prefixIcon: () => h(TIcon, { name: item.type === 'faq' ? 'chat-bubble-help' : 'folder', size: '16px' }),
}))
);
@@ -74,7 +74,10 @@
<div class="bottom-left">
<div class="type-badge" :class="{ 'document': (kb.type || 'document') === 'document', 'faq': kb.type === 'faq' }">
<t-icon :name="kb.type === 'faq' ? 'chat-bubble-help' : 'folder'" size="14px" />
<span>{{ kb.type === 'faq' ? $t('knowledgeEditor.basic.typeFAQ') : $t('knowledgeEditor.basic.typeDocument') }}</span>
<span>
{{ kb.type === 'faq' ? $t('knowledgeEditor.basic.typeFAQ') : $t('knowledgeEditor.basic.typeDocument') }}
({{ kb.type === 'faq' ? (kb.chunk_count || 0) : (kb.knowledge_count || 0) }})
</span>
</div>
<div class="feature-badges">
<t-tooltip v-if="kb.extract_config?.enabled" :content="$t('knowledgeList.features.knowledgeGraph')" placement="top">
@@ -167,6 +170,8 @@ interface KB {
vlm_config?: { enabled?: boolean; model_id?: string };
extract_config?: { enabled?: boolean };
cos_config?: { provider?: string; bucket_name?: string };
knowledge_count?: number;
chunk_count?: number;
}
const kbs = ref<KB[]>([])
@@ -1097,11 +1097,10 @@ const kbInfo = ref<any>(null)
const knowledgeList = ref<Array<{ id: string; name: string; type?: string }>>([])
const knowledgeDropdownOptions = computed(() =>
knowledgeList.value
.filter((item) => !item.type || item.type === 'document')
.map((item) => ({
content: item.name,
value: item.id,
prefixIcon: () => h(TIcon, { name: 'file', size: '16px' }),
prefixIcon: () => h(TIcon, { name: item.type === 'document' ? 'folder' : 'chat-bubble-help', size: '16px' }),
})),
)