From cf6b3fa48aa11142f5df2ee0dda28391f326514b Mon Sep 17 00:00:00 2001 From: Marclass Date: Wed, 17 Jan 2024 00:34:22 -0700 Subject: [PATCH] remove html type and add js/css --- backend/apps/rag/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/apps/rag/main.py b/backend/apps/rag/main.py index 11bbbbe8..820ec195 100644 --- a/backend/apps/rag/main.py +++ b/backend/apps/rag/main.py @@ -149,16 +149,17 @@ def store_doc( "text/plain", "text/csv", "text/xml", - "text/html", "text/x-python", + "text/css", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/octet-stream", + "application/x-javascript", ]: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.FILE_NOT_SUPPORTED, ) - text_xml=["text/html", "text/xml"] + text_xml=["text/xml"] octet_markdown=["md"] octet_plain=[ "go", "py", "java", "sh", "bat", "ps1", "cmd", "js", @@ -206,6 +207,8 @@ def store_doc( loader = UnstructuredMarkdownLoader(file_path) if file_ext in octet_plain: loader = TextLoader(file_path) + elif file.content_type == "application/x-javascript": + loader = TextLoader(file_path) data = loader.load() result = store_data_in_vector_db(data, collection_name)