feat(api): 添加 graphrag 权限规则和优化知识图谱缓存失效
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (java-kotlin) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled

- 在权限规则匹配器中添加 /api/graphrag/** 的读写权限控制
- 修改图关系服务中的删除操作以精确失效相关实体缓存
- 更新图同步服务确保 BELONGS_TO 关系在增量同步时正确重建
- 重构图同步步骤服务中的组织归属关系构建逻辑
- 修复前端图_canvas 组件中的元素点击事件处理逻辑
- 实现 Python GraphRAG 缓存的启用/禁用功能
- 为 GraphRAG 缓存统计和清除接口添加调用方日志记录
This commit is contained in:
2026-02-24 09:25:31 +08:00
parent ca37bc5a3b
commit 75f9b95093
8 changed files with 107 additions and 27 deletions

View File

@@ -260,9 +260,10 @@ async def query_stream(
summary="缓存统计",
description="返回 GraphRAG 检索缓存的命中率和容量统计。",
)
async def cache_stats():
async def cache_stats(caller: Annotated[str, Depends(_require_caller_id)]):
from app.module.kg_graphrag.cache import get_cache
logger.info("GraphRAG cache stats requested by caller=%s", caller)
return StandardResponse(code=200, message="success", data=get_cache().stats())
@@ -272,8 +273,9 @@ async def cache_stats():
summary="清空缓存",
description="清空所有 GraphRAG 检索缓存。",
)
async def cache_clear():
async def cache_clear(caller: Annotated[str, Depends(_require_caller_id)]):
from app.module.kg_graphrag.cache import get_cache
logger.info("GraphRAG cache clear requested by caller=%s", caller)
get_cache().clear()
return StandardResponse(code=200, message="success", data={"cleared": True})