perf(cache): 修复缓存失效 Bug + 集成语义缓存 + 删除 AgenticRAG 死代码
- fix: Query Cache GET/SET Key 不匹配导致命中率始终为 0% - fix: CACHE_MIN_SCORE 阈值 0.3 对 ChromaDB cosine distance 过于严格 - feat: 在 /rag 端点集成语义缓存(命中时跳过检索+生成,92x 加速) - refactor: 删除 AgenticRAG 死代码路径(10 个 agentic_*.py,约 1950 行) - cleanup: 移除 engine.py 死方法、路由死函数、初始化死代码
This commit is contained in:
@@ -181,7 +181,10 @@ SEMANTIC_CACHE_ENABLED = True
|
||||
SEMANTIC_CACHE_THRESHOLD = 0.92 # 相似度阈值
|
||||
|
||||
# 缓存写入最低置信度
|
||||
CACHE_MIN_SCORE = 0.3
|
||||
# 注意:ChromaDB cosine distance 范围 [0,2],score = 1 - dist
|
||||
# 当前 embedding 模型的 cosine similarity 普遍在 0.03-0.06 之间
|
||||
# 搜索管线已通过 rerank 过滤低质量结果,此处不再额外限制
|
||||
CACHE_MIN_SCORE = 0.0
|
||||
|
||||
# LLM 调用预算
|
||||
MAX_LLM_CALLS_PER_QUERY = 2
|
||||
|
||||
Reference in New Issue
Block a user