feat: semantic (embedding-based) response cache

- cache.rs: cosine-similarity store (threshold, TTL, ring buffer), partitioned by
  routing signature; tracks hit rate and model cost saved
- pipeline: embed routing text, look up before the model call (route_source=cache on
  hit), insert successful responses; stats record cache hits
- config [cache] + admin settings card; dashboard shows hit-rate and savings
- embedding model resolved from the pool (or first kind="embedding")
This commit is contained in:
infosave2007
2026-06-30 17:04:53 +03:00
parent bf8534f13d
commit 5759de153b
17 changed files with 492 additions and 5 deletions
+11
View File
@@ -254,4 +254,15 @@ export default {
"toast.deleted": "已删除",
"toast.probing": "探测中…",
"toast.imported": "配置已导入",
"dash.cache": "语义缓存",
"dash.cache.hitRate": "命中率",
"dash.cache.hits": "命中",
"dash.cache.saved": "已节省",
"dash.cache.disabled": "语义缓存已禁用 — 在设置中启用。",
"settings.cache": "语义缓存",
"settings.cache.enabled": "启用语义缓存",
"settings.cache.threshold": "相似度阈值",
"settings.cache.ttl": "条目 TTL",
"settings.cache.embed": "嵌入模型",
"settings.cache.note": "缓存设置将在重启后生效。",
};