From c2dda202162b588c629dde5cd823e001ac5c6200 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Fri, 3 May 2024 12:42:20 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20fix:=20allow=20JSON=20U?= =?UTF-8?q?pload=20(#30)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🗃️f fix: allow JSON Upload * add file ext --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index 8b93a2c7..a5de6577 100644 --- a/main.py +++ b/main.py @@ -275,6 +275,8 @@ def get_loader(filename: str, file_content_type: str, filepath: str): "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ] or file_ext in ["xls", "xlsx"]: loader = UnstructuredExcelLoader(filepath) + elif file_content_type == "application/json" or file_ext == "json": + loader = TextLoader(filepath, autodetect_encoding=True) elif file_ext in known_source_ext or ( file_content_type and file_content_type.find("text/") >= 0 ):