This commit is contained in:
parent
55678fece8
commit
9e6ed151b3
|
|
@ -177,6 +177,8 @@ def build_user_index(user_id: str):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
# 持久化存储之后,加载已保存的存储上下文信息
|
||||
logger.info(f"开始加载持久化存储的数据...")
|
||||
|
||||
|
|
@ -196,14 +198,20 @@ def build_user_index(user_id: str):
|
|||
# 确认存储是否加载成功,检查索引数据
|
||||
logger.info("已成功加载存储上下文。")
|
||||
|
||||
# 创建 ServiceContext,显式禁用 LLM
|
||||
service_context = ServiceContext.from_defaults(llm=None)
|
||||
# 禁用 LLM 并确保从存储加载时不涉及 OpenAI 模型
|
||||
service_context = ServiceContext.from_defaults(llm=None) # 确保 LLM 被禁用
|
||||
|
||||
# 使用 load_index_from_storage 加载索引
|
||||
# 使用 load_index_from_storage 加载索引,确保不触发 OpenAI 加载
|
||||
try:
|
||||
loaded_index = load_index_from_storage(storage_context)
|
||||
|
||||
# 检查加载后的索引
|
||||
logger.info(f"加载的索引数量: {len(loaded_index.get_documents())}")
|
||||
except Exception as e:
|
||||
logger.error(f"加载索引时发生错误: {e}")
|
||||
raise HTTPException(status_code=500, detail="索引加载失败")
|
||||
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"索引构建失败: {e}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue