diff --git a/surfsense_backend/app/routes/documents_routes.py b/surfsense_backend/app/routes/documents_routes.py index 5b82dd7..9ca59c0 100644 --- a/surfsense_backend/app/routes/documents_routes.py +++ b/surfsense_backend/app/routes/documents_routes.py @@ -138,8 +138,8 @@ async def process_file_in_background( session: AsyncSession ): try: - # Check if the file is a markdown file - if filename.lower().endswith(('.md', '.markdown')): + # Check if the file is a markdown or text file + if filename.lower().endswith(('.md', '.markdown', '.txt')): # For markdown files, read the content directly with open(file_path, 'r', encoding='utf-8') as f: markdown_content = f.read() diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx index 87d6b4e..5f9f76f 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx @@ -48,6 +48,8 @@ export default function FileUploader() { 'audio/mp4': ['.mp4', '.m4a'], 'audio/wav': ['.wav'], 'audio/webm': ['.webm'], + 'text/markdown': ['.md', '.markdown'], + 'text/plain': ['.txt'], }; // Conditionally set accepted file types based on ETL service @@ -82,7 +84,6 @@ export default function FileUploader() { 'application/vnd.oasis.opendocument.graphics': ['.odg'], 'application/vnd.oasis.opendocument.spreadsheet': ['.ods'], 'application/vnd.oasis.opendocument.formula': ['.fods'], - 'text/plain': ['.txt'], 'text/csv': ['.csv'], 'text/tab-separated-values': ['.tsv'], 'text/html': ['.html', '.htm', '.web'], @@ -112,7 +113,6 @@ export default function FileUploader() { 'text/html': ['.html'], 'image/jpeg': ['.jpeg', '.jpg'], 'image/png': ['.png'], - 'text/markdown': ['.md', '.markdown'], 'application/vnd.ms-outlook': ['.msg'], 'application/vnd.oasis.opendocument.text': ['.odt'], 'text/x-org': ['.org'], @@ -123,7 +123,6 @@ export default function FileUploader() { 'text/x-rst': ['.rst'], 'application/rtf': ['.rtf'], 'image/tiff': ['.tiff'], - 'text/plain': ['.txt'], 'text/tab-separated-values': ['.tsv'], 'application/vnd.ms-excel': ['.xls'], 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],