This commit is contained in:
amb
2026-09-01 20:51:46 +08:00
parent 70ece67910
commit b80161972a
18 changed files with 1878 additions and 359 deletions
+4 -1
View File
@@ -21,17 +21,20 @@ class DocumentRepository:
self,
kb_id: str,
*,
category_id: str | None = None,
page: int = 1,
page_size: int = 50,
status: str | None = None,
) -> tuple[list[Document], int]:
"""分页获取知识库的文档列表。"""
"""分页获取知识库的文档列表。支持按分类过滤。"""
conditions = [
Document.knowledge_base_id == kb_id,
Document.status != "DELETED",
]
if status:
conditions.append(Document.status == status)
if category_id:
conditions.append(Document.category_id == category_id)
count_stmt = select(func.count()).select_from(Document).where(*conditions)
total = self._session.scalar(count_stmt) or 0