This commit is contained in:
parent
6820275b40
commit
bd60b2a11a
|
|
@ -189,28 +189,6 @@ def build_user_index(user_id: str):
|
|||
# 确认存储是否加载成功,检查索引数据
|
||||
logger.info("已成功加载存储上下文。")
|
||||
|
||||
# 禁用 LLM 并确保从存储加载时不涉及 OpenAI 模型
|
||||
# 使用本地模型或 Mock 模型(不涉及 OpenAI)
|
||||
service_context = ServiceContext.from_defaults(
|
||||
embed_model='local', # 使用本地嵌入模型
|
||||
llm=None # 确保禁用 LLM
|
||||
)
|
||||
|
||||
# 使用 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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue