From 45e3da82e1721384dd412323cf11fd4517862070 Mon Sep 17 00:00:00 2001 From: xiaopeng <1509442308@qq.com> Date: Wed, 27 May 2026 09:47:04 +0800 Subject: [PATCH] fix: count all documents for homepage stats, not just knowledge_base type Co-Authored-By: Claude Opus 4.7 --- backend/src/api/analytics.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/api/analytics.py b/backend/src/api/analytics.py index 2b9563f..23fdf19 100644 --- a/backend/src/api/analytics.py +++ b/backend/src/api/analytics.py @@ -243,10 +243,8 @@ async def get_platform_stats( total_users = db.query(func.count(User.id)).scalar() or 0 active_users = max(users_with_sessions, users_with_documents, total_users) - # 知识文档数(知识库中的文档) - knowledge_documents = db.query(func.count(Document.id)).filter( - Document.source_type == "knowledge_base" - ).scalar() or 0 + # 知识文档数(所有文档) + knowledge_documents = db.query(func.count(Document.id)).scalar() or 0 # 问答对话数(所有用户消息) qa_dialogues = db.query(func.count(ChatMessage.id)).filter(