Fix linting

This commit is contained in:
yangdx
2025-02-21 12:16:04 +08:00
parent 043dbad683
commit 1749678384

View File

@@ -190,9 +190,7 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool:
docx_file = BytesIO(file) docx_file = BytesIO(file)
doc = Document(docx_file) doc = Document(docx_file)
content = "\n".join( content = "\n".join([paragraph.text for paragraph in doc.paragraphs])
[paragraph.text for paragraph in doc.paragraphs]
)
case ".pptx": case ".pptx":
if not pm.is_installed("pptx"): if not pm.is_installed("pptx"):
pm.install("pptx") pm.install("pptx")
@@ -232,19 +230,13 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool:
# Insert into the RAG queue # Insert into the RAG queue
if content: if content:
await rag.apipeline_enqueue_documents(content) await rag.apipeline_enqueue_documents(content)
logging.info( logging.info(f"Successfully fetched and enqueued file: {file_path.name}")
f"Successfully fetched and enqueued file: {file_path.name}"
)
return True return True
else: else:
logging.error( logging.error(f"No content could be extracted from file: {file_path.name}")
f"No content could be extracted from file: {file_path.name}"
)
except Exception as e: except Exception as e:
logging.error( logging.error(f"Error processing or enqueueing file {file_path.name}: {str(e)}")
f"Error processing or enqueueing file {file_path.name}: {str(e)}"
)
logging.error(traceback.format_exc()) logging.error(traceback.format_exc())
finally: finally:
if file_path.name.startswith(temp_prefix): if file_path.name.startswith(temp_prefix):