add check before adding new document

This commit is contained in:
Henry
2023-11-01 16:20:13 +00:00
parent 43c8ae59cf
commit 6cc0811085
15 changed files with 45 additions and 17 deletions
@@ -71,7 +71,7 @@ class InMemoryVectorStore_VectorStores implements INode {
const flattenDocs = docs && docs.length ? flatten(docs) : []
const finalDocs = []
for (let i = 0; i < flattenDocs.length; i += 1) {
if (flattenDocs[i] !== undefined && flattenDocs[i].pageContent !== undefined) {
if (flattenDocs[i] && flattenDocs[i].pageContent) {
finalDocs.push(new Document(flattenDocs[i]))
}
}