update MyFAISS.py and cli_demo.py
This commit is contained in:
parent
00cb7bf598
commit
2eb35291b2
|
|
@ -129,12 +129,12 @@ class MyFAISS(FAISS, VectorStore):
|
|||
if len(ids) == 0:
|
||||
return f"docs delete fail"
|
||||
else:
|
||||
# 从 self.index 中删除对应id
|
||||
self.index.remove_ids(np.array(ids, dtype=np.int64))
|
||||
for id in ids:
|
||||
index = list(self.index_to_docstore_id.keys())[list(self.index_to_docstore_id.values()).index(id)]
|
||||
self.index_to_docstore_id.pop(index)
|
||||
self.docstore._dict.pop(id)
|
||||
# TODO: 从 self.index 中删除对应id
|
||||
# self.index.reset()
|
||||
self.save_local(vs_path)
|
||||
return f"docs delete success"
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Reference in New Issue