yangdx
commited on
Commit
·
c61b420
1
Parent(s):
db9c501
Moved update status logic to document routes.
Browse files- Removed update status from health check endpoint
- Added update_status field to PipelineStatusResponse
lightrag/api/lightrag_server.py
CHANGED
@@ -423,9 +423,6 @@ def create_app(args):
|
|
423 |
@app.get("/health", dependencies=[Depends(optional_api_key_dependency)])
|
424 |
async def get_status():
|
425 |
"""Get current system status"""
|
426 |
-
# Get update flags status for all namespaces
|
427 |
-
update_status = await get_all_update_flags_status()
|
428 |
-
|
429 |
username = os.getenv("AUTH_USERNAME")
|
430 |
password = os.getenv("AUTH_PASSWORD")
|
431 |
if not (username and password):
|
@@ -453,11 +450,10 @@ def create_app(args):
|
|
453 |
"vector_storage": args.vector_storage,
|
454 |
"enable_llm_cache_for_extract": args.enable_llm_cache_for_extract,
|
455 |
},
|
456 |
-
"update_status": update_status,
|
457 |
"core_version": core_version,
|
458 |
"api_version": __api_version__,
|
459 |
"auth_mode": auth_mode,
|
460 |
-
|
461 |
|
462 |
# Custom StaticFiles class to prevent caching of HTML files
|
463 |
class NoCacheStaticFiles(StaticFiles):
|
|
|
423 |
@app.get("/health", dependencies=[Depends(optional_api_key_dependency)])
|
424 |
async def get_status():
|
425 |
"""Get current system status"""
|
|
|
|
|
|
|
426 |
username = os.getenv("AUTH_USERNAME")
|
427 |
password = os.getenv("AUTH_PASSWORD")
|
428 |
if not (username and password):
|
|
|
450 |
"vector_storage": args.vector_storage,
|
451 |
"enable_llm_cache_for_extract": args.enable_llm_cache_for_extract,
|
452 |
},
|
|
|
453 |
"core_version": core_version,
|
454 |
"api_version": __api_version__,
|
455 |
"auth_mode": auth_mode,
|
456 |
+
}
|
457 |
|
458 |
# Custom StaticFiles class to prevent caching of HTML files
|
459 |
class NoCacheStaticFiles(StaticFiles):
|
lightrag/api/routers/document_routes.py
CHANGED
@@ -111,6 +111,7 @@ class PipelineStatusResponse(BaseModel):
|
|
111 |
request_pending: Flag for pending request for processing
|
112 |
latest_message: Latest message from pipeline processing
|
113 |
history_messages: List of history messages
|
|
|
114 |
"""
|
115 |
|
116 |
autoscanned: bool = False
|
@@ -123,6 +124,7 @@ class PipelineStatusResponse(BaseModel):
|
|
123 |
request_pending: bool = False
|
124 |
latest_message: str = ""
|
125 |
history_messages: Optional[List[str]] = None
|
|
|
126 |
|
127 |
class Config:
|
128 |
extra = "allow" # Allow additional fields from the pipeline status
|
@@ -796,12 +798,18 @@ def create_document_routes(
|
|
796 |
HTTPException: If an error occurs while retrieving pipeline status (500)
|
797 |
"""
|
798 |
try:
|
799 |
-
from lightrag.kg.shared_storage import get_namespace_data
|
800 |
|
801 |
pipeline_status = await get_namespace_data("pipeline_status")
|
|
|
|
|
|
|
802 |
|
803 |
# Convert to regular dict if it's a Manager.dict
|
804 |
status_dict = dict(pipeline_status)
|
|
|
|
|
|
|
805 |
|
806 |
# Convert history_messages to a regular list if it's a Manager.list
|
807 |
if "history_messages" in status_dict:
|
|
|
111 |
request_pending: Flag for pending request for processing
|
112 |
latest_message: Latest message from pipeline processing
|
113 |
history_messages: List of history messages
|
114 |
+
update_status: Status of update flags for all namespaces
|
115 |
"""
|
116 |
|
117 |
autoscanned: bool = False
|
|
|
124 |
request_pending: bool = False
|
125 |
latest_message: str = ""
|
126 |
history_messages: Optional[List[str]] = None
|
127 |
+
update_status: Optional[dict] = None
|
128 |
|
129 |
class Config:
|
130 |
extra = "allow" # Allow additional fields from the pipeline status
|
|
|
798 |
HTTPException: If an error occurs while retrieving pipeline status (500)
|
799 |
"""
|
800 |
try:
|
801 |
+
from lightrag.kg.shared_storage import get_namespace_data, get_all_update_flags_status
|
802 |
|
803 |
pipeline_status = await get_namespace_data("pipeline_status")
|
804 |
+
|
805 |
+
# Get update flags status for all namespaces
|
806 |
+
update_status = await get_all_update_flags_status()
|
807 |
|
808 |
# Convert to regular dict if it's a Manager.dict
|
809 |
status_dict = dict(pipeline_status)
|
810 |
+
|
811 |
+
# Add update_status to the status dictionary
|
812 |
+
status_dict["update_status"] = update_status
|
813 |
|
814 |
# Convert history_messages to a regular list if it's a Manager.list
|
815 |
if "history_messages" in status_dict:
|