From f6b9fe0395153a6e205e66274f67922bb307cd78 Mon Sep 17 00:00:00 2001 From: phact Date: Tue, 16 Dec 2025 23:03:53 -0500 Subject: [PATCH] txt to md --- sdks/python/tests/test_integration.py | 25 ++++++++++++++----------- src/models/processors.py | 10 +++++++++- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/sdks/python/tests/test_integration.py b/sdks/python/tests/test_integration.py index 62981520..25a79f77 100644 --- a/sdks/python/tests/test_integration.py +++ b/sdks/python/tests/test_integration.py @@ -54,8 +54,9 @@ def test_file(tmp_path) -> Path: import uuid file_path = tmp_path / f"sdk_test_doc_{uuid.uuid4().hex[:8]}.txt" file_path.write_text( - f"SDK Integration Test Document {uuid.uuid4()}\n\n" - "This document tests the OpenRAG Python SDK.\n" + f"SDK Integration Test Document\n\n" + f"ID: {uuid.uuid4()}\n\n" + "This document tests the OpenRAG Python SDK.\n\n" "It contains unique content about purple elephants dancing.\n" ) return file_path @@ -76,15 +77,6 @@ class TestSettings: class TestDocuments: """Test document operations.""" - @pytest.mark.asyncio - async def test_ingest_document(self, client, test_file: Path): - """Test document ingestion.""" - # wait=True (default) polls until completion - result = await client.documents.ingest(file_path=str(test_file)) - - assert result.status == "completed" - assert result.successful_files >= 1 - @pytest.mark.asyncio async def test_ingest_document_no_wait(self, client, test_file: Path): """Test document ingestion without waiting.""" @@ -96,6 +88,17 @@ class TestDocuments: # Can poll manually final_status = await client.documents.wait_for_task(result.task_id) assert final_status.status == "completed" + assert final_status.successful_files >= 1 + + @pytest.mark.asyncio + async def test_ingest_document(self, client, test_file: Path): + """Test document ingestion.""" + # wait=True (default) polls until completion + result = await client.documents.ingest(file_path=str(test_file)) + + assert result.status == "completed" + assert result.successful_files >= 1 + @pytest.mark.asyncio async def test_delete_document(self, client, test_file: Path): diff --git a/src/models/processors.py b/src/models/processors.py index 8f84c3dc..d8de30c5 100644 --- a/src/models/processors.py +++ b/src/models/processors.py @@ -730,7 +730,15 @@ class LangflowFileProcessor(TaskProcessor): if not content_type: content_type = 'application/octet-stream' - file_tuple = (original_filename, content, content_type) + # Rename .txt to .md for Langflow compatibility + # Langflow has issues processing text/plain files + langflow_filename = original_filename + if original_filename.lower().endswith('.txt'): + langflow_filename = original_filename[:-4] + '.md' + content_type = 'text/markdown' + logger.debug(f"Renamed {original_filename} to {langflow_filename} for Langflow") + + file_tuple = (langflow_filename, content, content_type) # Get JWT token using same logic as DocumentFileProcessor # This will handle anonymous JWT creation if needed