浏览代码

fix: init metadata as empty (#348)

Taranjeet Singh 2 年之前
父节点
当前提交
9687ec2c1a
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      embedchain/embedchain.py

+ 3 - 0
embedchain/embedchain.py

@@ -118,6 +118,9 @@ class EmbedChain:
         if self.config.id is not None:
             metadatas = [{**m, "app_id": self.config.id} for m in metadatas]
 
+        # FIXME: Fix the error handling logic when metadatas or metadata is None
+        metadatas = metadatas if metadatas else []
+        metadata = metadata if metadata else {}
         chunks_before_addition = self.count()
 
         # Add metadata to each document