diff --git a/lightrag/api/routers/document_routes.py b/lightrag/api/routers/document_routes.py index 822b797b..9cd421bf 100644 --- a/lightrag/api/routers/document_routes.py +++ b/lightrag/api/routers/document_routes.py @@ -369,7 +369,7 @@ class DocStatusResponse(BaseModel): chunks_count: Optional[int] = Field( default=None, description="Number of chunks the document was split into" ) - error: Optional[str] = Field( + error_msg: Optional[str] = Field( default=None, description="Error message if processing failed" ) metadata: Optional[dict[str, Any]] = Field( @@ -1570,7 +1570,7 @@ def create_document_routes( updated_at=format_datetime(doc_status.updated_at), track_id=doc_status.track_id, chunks_count=doc_status.chunks_count, - error=doc_status.error, + error_msg=doc_status.error_msg, metadata=doc_status.metadata, file_path=doc_status.file_path, ) @@ -1844,7 +1844,7 @@ def create_document_routes( updated_at=format_datetime(doc_status.updated_at), track_id=doc_status.track_id, chunks_count=doc_status.chunks_count, - error=doc_status.error, + error_msg=doc_status.error_msg, metadata=doc_status.metadata, file_path=doc_status.file_path, ) diff --git a/lightrag/base.py b/lightrag/base.py index ed50c324..f98c11d4 100644 --- a/lightrag/base.py +++ b/lightrag/base.py @@ -647,7 +647,7 @@ class DocProcessingStatus: """Number of chunks after splitting, used for processing""" chunks_list: list[str] | None = field(default_factory=list) """List of chunk IDs associated with this document, used for deletion""" - error: str | None = None + error_msg: str | None = None """Error message if failed""" metadata: dict[str, Any] = field(default_factory=dict) """Additional metadata""" diff --git a/lightrag_webui/src/api/lightrag.ts b/lightrag_webui/src/api/lightrag.ts index e3b2d1cb..a0fdc86e 100644 --- a/lightrag_webui/src/api/lightrag.ts +++ b/lightrag_webui/src/api/lightrag.ts @@ -143,6 +143,7 @@ export type QueryResponse = { export type DocActionResponse = { status: 'success' | 'partial_success' | 'failure' | 'duplicated' message: string + track_id?: string } export type DeleteDocResponse = { @@ -160,8 +161,9 @@ export type DocStatusResponse = { status: DocStatus created_at: string updated_at: string + track_id?: string chunks_count?: number - error?: string + error_msg?: string metadata?: Record file_path: string } @@ -170,6 +172,13 @@ export type DocsStatusesResponse = { statuses: Record } +export type TrackStatusResponse = { + track_id: string + documents: DocStatusResponse[] + total_count: number + status_summary: Record +} + export type AuthStatusResponse = { auth_configured: boolean access_token?: string @@ -689,3 +698,13 @@ export const checkEntityNameExists = async (entityName: string): Promise => { + const response = await axiosInstance.get(`/documents/track_status/${encodeURIComponent(trackId)}`) + return response.data +} diff --git a/lightrag_webui/src/features/DocumentManager.tsx b/lightrag_webui/src/features/DocumentManager.tsx index a4149962..61b4b5a4 100644 --- a/lightrag_webui/src/features/DocumentManager.tsx +++ b/lightrag_webui/src/features/DocumentManager.tsx @@ -749,8 +749,8 @@ export default function DocumentManager() { {doc.status === 'failed' && ( {t('documentPanel.documentManager.status.failed')} )} - {doc.error && ( - + {doc.error_msg && ( + ⚠️ )}