[Vector Store] Fix function add_texts in TencentVectorDB (#24469)

Regardless of whether `embedding_func` is set or not, the 'text'
attribute of document should be assigned, otherwise the `page_content`
in the document of the final search result will be lost
This commit is contained in:
ZhangShenao
2024-07-22 21:50:22 +08:00
committed by GitHub
parent 7ab82eb8cc
commit 0f6737cbfe
2 changed files with 25 additions and 2 deletions

View File

@@ -375,8 +375,7 @@ class TencentVectorDB(VectorStore):
}
if embeddings:
doc_attrs["vector"] = embeddings[id]
else:
doc_attrs["text"] = texts[id]
doc_attrs["text"] = texts[id]
doc_attrs.update(metadata)
doc = self.document.Document(**doc_attrs)
docs.append(doc)