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
@@ -143,7 +143,9 @@ class PostgresUpsert_VectorStores implements INode {
const flattenDocs = docs && docs.length ? flatten(docs) : []
const finalDocs = []
for (let i = 0; i < flattenDocs.length; i += 1) {
finalDocs.push(new Document(flattenDocs[i]))
if (flattenDocs[i] && flattenDocs[i].pageContent) {
finalDocs.push(new Document(flattenDocs[i]))
}
}
const vectorStore = await TypeORMVectorStore.fromDocuments(finalDocs, embeddings, args)