update
This commit is contained in:
parent
1719bd5463
commit
ffab2ccdcd
@ -42,8 +42,11 @@ class KBESService:
|
||||
if not question:
|
||||
return [], KBRetrievalMetrics(0.0, 0.0, 0.0, 0, 0.0, False)
|
||||
|
||||
# 仅对 KB_PROVIDER=es_bm25:禁用 KBES 检索缓存(避免 curl/API 不一致与历史命中)
|
||||
enable_retrieval_cache = KBConfig.KB_PROVIDER != 'es_bm25'
|
||||
|
||||
cache_hit = False
|
||||
if redis and KBConfig.KB_CACHE_TTL > 0:
|
||||
if enable_retrieval_cache and redis and KBConfig.KB_CACHE_TTL > 0:
|
||||
key = cls._cache_key(question)
|
||||
cached = await redis.get(key)
|
||||
if cached:
|
||||
@ -91,7 +94,7 @@ class KBESService:
|
||||
cache_hit=cache_hit,
|
||||
)
|
||||
|
||||
if redis and KBConfig.KB_CACHE_TTL > 0:
|
||||
if enable_retrieval_cache and redis and KBConfig.KB_CACHE_TTL > 0:
|
||||
try:
|
||||
key = cls._cache_key(question)
|
||||
await redis.set(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user