diff --git a/lightrag/api/routers/document_routes.py b/lightrag/api/routers/document_routes.py index c25f7241..4f22947c 100644 --- a/lightrag/api/routers/document_routes.py +++ b/lightrag/api/routers/document_routes.py @@ -714,6 +714,10 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool: # Insert into the RAG queue if content: + # Check if content contains only whitespace characters + if not content.strip(): + logger.warning(f"File contains only whitespace characters. file_paths={file_path.name}") + await rag.apipeline_enqueue_documents(content, file_paths=file_path.name) logger.info(f"Successfully fetched and enqueued file: {file_path.name}") return True diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 2ab9f89a..47e484f0 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -965,6 +965,9 @@ class LightRAG: ) } + if not chunks: + logger.warning("No document chunks to process") + # Process document in two stages # Stage 1: Process text chunks and docs (parallel execution) doc_status_task = asyncio.create_task( diff --git a/pyproject.toml b/pyproject.toml index b87df3bc..2bb1f288 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ description = "LightRAG: Simple and Fast Retrieval-Augmented Generation" readme = "README.md" license = {text = "MIT"} -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", @@ -91,3 +91,6 @@ version = {attr = "lightrag.__version__"} [tool.setuptools.package-data] lightrag = ["api/webui/**/*"] + +[tool.ruff] +target-version = "py310"