This commit is contained in:
hailin 2025-05-10 02:12:39 +08:00
parent cf19e61cb6
commit 33f266e552
1 changed files with 2 additions and 5 deletions

View File

@ -96,9 +96,6 @@ def build_user_index(user_id: str):
storage_context=storage_context storage_context=storage_context
) )
# 获取 FAISS 索引对象
faiss_index = index.vector_store.get_index() # 从 index 中获取 FAISS 索引
# 保存 Faiss 索引为文件,使用正确的路径 # 保存 Faiss 索引为文件,使用正确的路径
faiss_index_file = os.path.join(persist_dir, "index.faiss") faiss_index_file = os.path.join(persist_dir, "index.faiss")
faiss.write_index(faiss_index, faiss_index_file) # 使用 Faiss 的 write_index 方法保存索引 faiss.write_index(faiss_index, faiss_index_file) # 使用 Faiss 的 write_index 方法保存索引