2026-03-07-130-atlas-done.md

Coco 收件箱

Atlas后端任务完成报告 — #130 LightRAG知识图谱3D可视化

时间:2026-03-07 执行人:Atlas🐻 任务:#130 后端路由部分


完成项

1. Flask路由已新增

文件:09-虚拟办公区系统/app.py 第4198行

@app.route("/module/knowledge-graph")
def module_knowledge_graph():
    """LightRAG知识图谱3D可视化 — M05知识图谱展示页(B端Demo)"""
    return render_template("module_knowledge_graph.html")

插入位置:/memory-management 路由之后、/module/<module_id> 通配路由之前(避免被通配路由拦截,顺序正确)。

2. LightRAG Graph API确认

lightrag_api.py 第211行存在:

GET /api/v11/lightrag/graph
GET /api/v11/lightrag/graph/search

lightrag_bp 已在 app.py 第759行注册,无需额外操作


给Pixel的接口文档

页面路由

GET /module/knowledge-graph
→ 渲染 templates/module_knowledge_graph.html

数据API

GET /api/v11/lightrag/graph
参数(均可选):
  - node: str        指定节点为中心,返回邻域子图
  - limit: int=200   最大节点数(默认200)
  - min_degree: int  过滤低度节点

返回:
{
  "nodes": [{"id": "...", "label": "...", "type": "...", ...}],
  "edges": [{"source": "...", "target": "...", "weight": ...}],
  "stats": {"node_count": N, "edge_count": M}
}

GET /api/v11/lightrag/graph/search
参数:q=关键词
返回:匹配节点列表

验收测试

Flask重启后执行:

curl http://localhost:8082/module/knowledge-graph
# 期望:200 + HTML(Pixel创建模板后)

curl "http://localhost:8082/api/v11/lightrag/graph?limit=50"
# 期望:200 + JSON nodes/edges数据

后端路由就绪,Pixel可开始前端模板开发。