Browse Source

remove html type and add js/css

Marclass 1 year ago
parent
commit
cf6b3fa48a
1 changed files with 5 additions and 2 deletions
  1. 5 2
      backend/apps/rag/main.py

+ 5 - 2
backend/apps/rag/main.py

@@ -149,16 +149,17 @@ def store_doc(
         "text/plain",
         "text/plain",
         "text/csv",
         "text/csv",
         "text/xml",
         "text/xml",
-        "text/html",
         "text/x-python",
         "text/x-python",
+        "text/css",
         "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
         "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
         "application/octet-stream",
         "application/octet-stream",
+        "application/x-javascript",
     ]:
     ]:
         raise HTTPException(
         raise HTTPException(
             status_code=status.HTTP_400_BAD_REQUEST,
             status_code=status.HTTP_400_BAD_REQUEST,
             detail=ERROR_MESSAGES.FILE_NOT_SUPPORTED,
             detail=ERROR_MESSAGES.FILE_NOT_SUPPORTED,
         )
         )
-    text_xml=["text/html", "text/xml"]
+    text_xml=["text/xml"]
     octet_markdown=["md"]
     octet_markdown=["md"]
     octet_plain=[
     octet_plain=[
         "go", "py", "java", "sh", "bat", "ps1", "cmd", "js", 
         "go", "py", "java", "sh", "bat", "ps1", "cmd", "js", 
@@ -206,6 +207,8 @@ def store_doc(
                 loader = UnstructuredMarkdownLoader(file_path)
                 loader = UnstructuredMarkdownLoader(file_path)
             if file_ext in octet_plain:
             if file_ext in octet_plain:
                 loader = TextLoader(file_path)
                 loader = TextLoader(file_path)
+        elif file.content_type == "application/x-javascript":
+            loader = TextLoader(file_path)
 
 
         data = loader.load()
         data = loader.load()
         result = store_data_in_vector_db(data, collection_name)
         result = store_data_in_vector_db(data, collection_name)