This commit is contained in:
parent
9e6ed151b3
commit
13a4c91c7d
|
|
@ -179,8 +179,6 @@ def build_user_index(user_id: str):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 持久化存储之后,加载已保存的存储上下文信息
|
|
||||||
logger.info(f"开始加载持久化存储的数据...")
|
|
||||||
|
|
||||||
# 加载 Faiss 索引
|
# 加载 Faiss 索引
|
||||||
faiss_index_file = os.path.join(persist_dir, "index.faiss")
|
faiss_index_file = os.path.join(persist_dir, "index.faiss")
|
||||||
|
|
@ -199,7 +197,11 @@ def build_user_index(user_id: str):
|
||||||
logger.info("已成功加载存储上下文。")
|
logger.info("已成功加载存储上下文。")
|
||||||
|
|
||||||
# 禁用 LLM 并确保从存储加载时不涉及 OpenAI 模型
|
# 禁用 LLM 并确保从存储加载时不涉及 OpenAI 模型
|
||||||
service_context = ServiceContext.from_defaults(llm=None) # 确保 LLM 被禁用
|
# 使用本地模型或 Mock 模型(不涉及 OpenAI)
|
||||||
|
service_context = ServiceContext.from_defaults(
|
||||||
|
embed_model='local', # 使用本地嵌入模型
|
||||||
|
llm=None # 确保禁用 LLM
|
||||||
|
)
|
||||||
|
|
||||||
# 使用 load_index_from_storage 加载索引,确保不触发 OpenAI 加载
|
# 使用 load_index_from_storage 加载索引,确保不触发 OpenAI 加载
|
||||||
try:
|
try:
|
||||||
|
|
@ -211,8 +213,6 @@ def build_user_index(user_id: str):
|
||||||
logger.error(f"加载索引时发生错误: {e}")
|
logger.error(f"加载索引时发生错误: {e}")
|
||||||
raise HTTPException(status_code=500, detail="索引加载失败")
|
raise HTTPException(status_code=500, detail="索引加载失败")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"索引构建失败: {e}")
|
logger.error(f"索引构建失败: {e}")
|
||||||
raise HTTPException(status_code=500, detail="索引构建失败")
|
raise HTTPException(status_code=500, detail="索引构建失败")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue