feat: 知识库树形视图(按来源分组),左侧树导航+右侧列表联动

This commit is contained in:
simonkoson
2026-05-27 09:35:36 +08:00
parent 7999fd14c8
commit 74a0508755
7 changed files with 477 additions and 55 deletions
+15 -1
View File
@@ -89,4 +89,18 @@ def list_distinct_sources(
"""
svc = KnowledgeService()
sources = svc.get_distinct_sources()
return [{"source": s} for s in sources]
return [{"source": s} for s in sources]
@router.get("/grouped")
def get_grouped_knowledge_items(
session: Session = Depends(get_session),
current_user: User = Depends(require_role(UserRole.zhipianren, UserRole.zebian, UserRole.biandao)),
):
"""
返回按 source_type → source_detail 两层聚合的树形结构,
含「全部」根节点,供知识库树形导航使用。
三角色均可读。
"""
svc = KnowledgeService()
return svc.get_grouped_items()