Add support for jupyter notebooks.

This commit is contained in:
Murtaza 2023-05-22 00:42:41 +05:30
parent 70a70d0c17
commit 514f3b352a
2 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,7 @@ from parsers.txt import process_txt
from parsers.csv import process_csv from parsers.csv import process_csv
from parsers.docx import process_docx from parsers.docx import process_docx
from parsers.pdf import process_pdf from parsers.pdf import process_pdf
from parsers.notebook import process_ipnyb
from parsers.markdown import process_markdown from parsers.markdown import process_markdown
from parsers.powerpoint import process_powerpoint from parsers.powerpoint import process_powerpoint
from parsers.html import process_html from parsers.html import process_html
@ -91,6 +92,7 @@ file_processors = {
".pptx": process_powerpoint, ".pptx": process_powerpoint,
".docx": process_docx, ".docx": process_docx,
".epub": process_epub, ".epub": process_epub,
".ipynb": process_ipnyb,
} }
async def filter_file(file: UploadFile, supabase, vector_store, stats_db): async def filter_file(file: UploadFile, supabase, vector_store, stats_db):

View File

@ -0,0 +1,7 @@
from .common import process_file
from langchain.document_loaders import NotebookLoader
from fastapi import UploadFile
def process_ipnyb(vector_store, file: UploadFile, stats_db):
return process_file(vector_store, file, NotebookLoader, "ipynb", stats_db=stats_db)