cuikunyu
commited on
Commit
·
5979959
1
Parent(s):
3757a93
Optimize: Use python-docx for better parsing.
Browse files
lightrag/api/routers/document_routes.py
CHANGED
|
@@ -499,7 +499,10 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool:
|
|
| 499 |
content = result.document.export_to_markdown()
|
| 500 |
else:
|
| 501 |
if not pm.is_installed("python-docx"): # type: ignore
|
| 502 |
-
|
|
|
|
|
|
|
|
|
|
| 503 |
from docx import Document # type: ignore
|
| 504 |
from io import BytesIO
|
| 505 |
|
|
|
|
| 499 |
content = result.document.export_to_markdown()
|
| 500 |
else:
|
| 501 |
if not pm.is_installed("python-docx"): # type: ignore
|
| 502 |
+
try:
|
| 503 |
+
pm.install("python-docx")
|
| 504 |
+
except Exception:
|
| 505 |
+
pm.install("docx")
|
| 506 |
from docx import Document # type: ignore
|
| 507 |
from io import BytesIO
|
| 508 |
|