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:
@@ -220,3 +220,12 @@ func (r *knowledgeRepository) UpdateKnowledgeColumn(ctx context.Context, id stri
|
||||
err := r.db.WithContext(ctx).Model(&types.Knowledge{}).Where("id = ?", id).Update(column, value).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// CountKnowledgeByKnowledgeBaseID counts the number of knowledge items in a knowledge base
|
||||
func (r *knowledgeRepository) CountKnowledgeByKnowledgeBaseID(ctx context.Context, tenantID uint, kbID string) (int64, error) {
|
||||
var count int64
|
||||
err := r.db.WithContext(ctx).Model(&types.Knowledge{}).
|
||||
Where("tenant_id = ? AND knowledge_base_id = ?", tenantID, kbID).
|
||||
Count(&count).Error
|
||||
return count, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user