mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 09:32:22 +03:00
feat(backend): adds python code parsing (#1003)
Adds a python code parser and invokes it in processors.py
This commit is contained in:
parent
e328ab81b3
commit
a626b84b96
14
backend/parsers/code_python.py
Normal file
14
backend/parsers/code_python.py
Normal file
@ -0,0 +1,14 @@
|
||||
from langchain.document_loaders import PythonLoader
|
||||
from models import File
|
||||
|
||||
from .common import process_file
|
||||
|
||||
|
||||
async def process_python(file: File, enable_summarization, brain_id, user_openai_api_key):
|
||||
return await process_file(
|
||||
file=file,
|
||||
loader_class=PythonLoader,
|
||||
enable_summarization=enable_summarization,
|
||||
brain_id=brain_id,
|
||||
user_openai_api_key=user_openai_api_key,
|
||||
)
|
@ -12,6 +12,7 @@ from parsers.pdf import process_pdf
|
||||
from parsers.powerpoint import process_powerpoint
|
||||
from parsers.txt import process_txt
|
||||
from parsers.xlsx import process_xlsx
|
||||
from parsers.code_python import process_python
|
||||
|
||||
file_processors = {
|
||||
".txt": process_txt,
|
||||
@ -34,6 +35,7 @@ file_processors = {
|
||||
".xls": process_xlsx,
|
||||
".epub": process_epub,
|
||||
".ipynb": process_ipnyb,
|
||||
".py": process_python,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user