mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-31 19:33:26 +08:00
update MyFAISS with method mentioned in https://github.com/imClumsyPanda/langchain-ChatGLM/issues/613#issuecomment-1590460465
This commit is contained in:
parent
a55aab498f
commit
58d6a9a098
Binary file not shown.
|
Before Width: | Height: | Size: 291 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 265 KiB |
@ -5,6 +5,7 @@ from typing import Any, Callable, List, Tuple, Dict
|
|||||||
from langchain.docstore.base import Docstore
|
from langchain.docstore.base import Docstore
|
||||||
from langchain.docstore.document import Document
|
from langchain.docstore.document import Document
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import copy
|
||||||
|
|
||||||
|
|
||||||
class MyFAISS(FAISS, VectorStore):
|
class MyFAISS(FAISS, VectorStore):
|
||||||
@ -95,7 +96,8 @@ class MyFAISS(FAISS, VectorStore):
|
|||||||
for id in id_seq:
|
for id in id_seq:
|
||||||
if id == id_seq[0]:
|
if id == id_seq[0]:
|
||||||
_id = self.index_to_docstore_id[id]
|
_id = self.index_to_docstore_id[id]
|
||||||
doc = self.docstore.search(_id)
|
# doc = self.docstore.search(_id)
|
||||||
|
doc = copy.deepcopy(self.docstore.search(_id))
|
||||||
else:
|
else:
|
||||||
_id0 = self.index_to_docstore_id[id]
|
_id0 = self.index_to_docstore_id[id]
|
||||||
doc0 = self.docstore.search(_id0)
|
doc0 = self.docstore.search(_id0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user