fix: restore main runtime sources and cache consistency

This commit is contained in:
User
2026-07-14 14:19:36 +08:00
parent e40989eeab
commit f951bc6598
15 changed files with 1664 additions and 29 deletions

View File

@@ -664,6 +664,17 @@ class KnowledgeSyncService:
except Exception as e:
logger.warning(f"递增缓存版本号失败: {e}")
# 语义缓存没有知识库版本字段,文档增删改后必须清空;否则回答缓存
# 可能继续返回已过时的来源、引用或图片路径。
try:
from core.semantic_cache import get_semantic_cache
semantic_cache = get_semantic_cache()
if semantic_cache:
semantic_cache.clear()
logger.debug(f"已清空语义缓存(文档变更触发): {kb_name}")
except Exception as e:
logger.warning(f"清空语义缓存失败: {e}")
return True
except Exception as e: