yangdx commited on
Commit
0d7fa15
·
1 Parent(s): 5d737ce

Fix linting

Browse files
lightrag/api/routers/document_routes.py CHANGED
@@ -101,7 +101,7 @@ class DocsStatusesResponse(BaseModel):
101
 
102
  class PipelineStatusResponse(BaseModel):
103
  """Response model for pipeline status
104
-
105
  Attributes:
106
  autoscanned: Whether auto-scan has started
107
  busy: Whether the pipeline is currently busy
@@ -114,6 +114,7 @@ class PipelineStatusResponse(BaseModel):
114
  latest_message: Latest message from pipeline processing
115
  history_messages: List of history messages
116
  """
 
117
  autoscanned: bool = False
118
  busy: bool = False
119
  job_name: str = "Default Job"
@@ -277,7 +278,7 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool:
277
  if global_args["main_args"].document_loading_engine == "DOCLING":
278
  if not pm.is_installed("docling"): # type: ignore
279
  pm.install("docling")
280
- from docling.document_converter import DocumentConverter # type: ignore
281
 
282
  converter = DocumentConverter()
283
  result = converter.convert(file_path)
@@ -296,7 +297,7 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool:
296
  if global_args["main_args"].document_loading_engine == "DOCLING":
297
  if not pm.is_installed("docling"): # type: ignore
298
  pm.install("docling")
299
- from docling.document_converter import DocumentConverter # type: ignore
300
 
301
  converter = DocumentConverter()
302
  result = converter.convert(file_path)
@@ -316,7 +317,7 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool:
316
  if global_args["main_args"].document_loading_engine == "DOCLING":
317
  if not pm.is_installed("docling"): # type: ignore
318
  pm.install("docling")
319
- from docling.document_converter import DocumentConverter # type: ignore
320
 
321
  converter = DocumentConverter()
322
  result = converter.convert(file_path)
@@ -337,7 +338,7 @@ async def pipeline_enqueue_file(rag: LightRAG, file_path: Path) -> bool:
337
  if global_args["main_args"].document_loading_engine == "DOCLING":
338
  if not pm.is_installed("docling"): # type: ignore
339
  pm.install("docling")
340
- from docling.document_converter import DocumentConverter # type: ignore
341
 
342
  converter = DocumentConverter()
343
  result = converter.convert(file_path)
@@ -748,7 +749,11 @@ def create_document_routes(
748
  logger.error(traceback.format_exc())
749
  raise HTTPException(status_code=500, detail=str(e))
750
 
751
- @router.get("/pipeline_status", dependencies=[Depends(optional_api_key)], response_model=PipelineStatusResponse)
 
 
 
 
752
  async def get_pipeline_status() -> PipelineStatusResponse:
753
  """
754
  Get the current status of the document indexing pipeline.
 
101
 
102
  class PipelineStatusResponse(BaseModel):
103
  """Response model for pipeline status
104
+
105
  Attributes:
106
  autoscanned: Whether auto-scan has started
107
  busy: Whether the pipeline is currently busy
 
114
  latest_message: Latest message from pipeline processing
115
  history_messages: List of history messages
116
  """
117
+
118
  autoscanned: bool = False
119
  busy: bool = False
120
  job_name: str = "Default Job"
 
278
  if global_args["main_args"].document_loading_engine == "DOCLING":
279
  if not pm.is_installed("docling"): # type: ignore
280
  pm.install("docling")
281
+ from docling.document_converter import DocumentConverter # type: ignore
282
 
283
  converter = DocumentConverter()
284
  result = converter.convert(file_path)
 
297
  if global_args["main_args"].document_loading_engine == "DOCLING":
298
  if not pm.is_installed("docling"): # type: ignore
299
  pm.install("docling")
300
+ from docling.document_converter import DocumentConverter # type: ignore
301
 
302
  converter = DocumentConverter()
303
  result = converter.convert(file_path)
 
317
  if global_args["main_args"].document_loading_engine == "DOCLING":
318
  if not pm.is_installed("docling"): # type: ignore
319
  pm.install("docling")
320
+ from docling.document_converter import DocumentConverter # type: ignore
321
 
322
  converter = DocumentConverter()
323
  result = converter.convert(file_path)
 
338
  if global_args["main_args"].document_loading_engine == "DOCLING":
339
  if not pm.is_installed("docling"): # type: ignore
340
  pm.install("docling")
341
+ from docling.document_converter import DocumentConverter # type: ignore
342
 
343
  converter = DocumentConverter()
344
  result = converter.convert(file_path)
 
749
  logger.error(traceback.format_exc())
750
  raise HTTPException(status_code=500, detail=str(e))
751
 
752
+ @router.get(
753
+ "/pipeline_status",
754
+ dependencies=[Depends(optional_api_key)],
755
+ response_model=PipelineStatusResponse,
756
+ )
757
  async def get_pipeline_status() -> PipelineStatusResponse:
758
  """
759
  Get the current status of the document indexing pipeline.