diff --git a/flowsettings.py b/flowsettings.py index 4e6b14a..cae5c68 100644 --- a/flowsettings.py +++ b/flowsettings.py @@ -222,7 +222,7 @@ KH_INDICES = [ "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, }, @@ -233,7 +233,7 @@ KH_INDICES = [ "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, }, diff --git a/libs/kotaemon/kotaemon/indices/ingests/files.py b/libs/kotaemon/kotaemon/indices/ingests/files.py index 7da3713..0176ca8 100644 --- a/libs/kotaemon/kotaemon/indices/ingests/files.py +++ b/libs/kotaemon/kotaemon/indices/ingests/files.py @@ -18,6 +18,7 @@ from kotaemon.loaders import ( OCRReader, PandasExcelReader, PDFThumbnailReader, + TxtReader, UnstructuredReader, ) @@ -47,6 +48,8 @@ KH_DEFAULT_FILE_EXTRACTORS: dict[str, BaseReader] = { ".tiff": unstructured, ".tif": unstructured, ".pdf": PDFThumbnailReader(), + ".txt": TxtReader(), + ".md": TxtReader(), } diff --git a/libs/ktem/ktem/index/file/ui.py b/libs/ktem/ktem/index/file/ui.py index a639c43..3315a22 100644 --- a/libs/ktem/ktem/index/file/ui.py +++ b/libs/ktem/ktem/index/file/ui.py @@ -353,6 +353,9 @@ class FileIndexPage(BasePage): 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))