Skip to content

Commit

Permalink
feat: add markdown file support (#202)
Browse files Browse the repository at this point in the history
* feat: add support for .md

* fix: disable download all on private collection
  • Loading branch information
taprosoft authored Sep 3, 2024
1 parent 4f07857 commit 607867d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flowsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"config": {
"supported_file_types": (
".png, .jpeg, .jpg, .tiff, .tif, .pdf, .xls, .xlsx, .doc, .docx, "
".pptx, .csv, .html, .mhtml, .txt, .zip"
".pptx, .csv, .html, .mhtml, .txt, .md, .zip"
),
"private": False,
},
Expand All @@ -233,7 +233,7 @@
"config": {
"supported_file_types": (
".png, .jpeg, .jpg, .tiff, .tif, .pdf, .xls, .xlsx, .doc, .docx, "
".pptx, .csv, .html, .mhtml, .txt, .zip"
".pptx, .csv, .html, .mhtml, .txt, .md, .zip"
),
"private": False,
},
Expand Down
3 changes: 3 additions & 0 deletions libs/kotaemon/kotaemon/indices/ingests/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
OCRReader,
PandasExcelReader,
PDFThumbnailReader,
TxtReader,
UnstructuredReader,
)

Expand Down Expand Up @@ -47,6 +48,8 @@
".tiff": unstructured,
".tif": unstructured,
".pdf": PDFThumbnailReader(),
".txt": TxtReader(),
".md": TxtReader(),
}


Expand Down
3 changes: 3 additions & 0 deletions libs/ktem/ktem/index/file/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ def download_single_file(self, is_zipped_state, file_id):
return not is_zipped_state, new_button

def download_all_files(self):
if self._index.config.get("private", False):
raise gr.Error("This feature is not available for private collection.")

zip_files = []
for file_name in os.listdir(flowsettings.KH_CHUNKS_OUTPUT_DIR):
zip_files.append(os.path.join(flowsettings.KH_CHUNKS_OUTPUT_DIR, file_name))
Expand Down

0 comments on commit 607867d

Please sign in to comment.