RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix document progress not set to fail when embedding model error (#16381)
Wang Qi985e3c1db50a
diff --git a/api/db/services/task_service.py b/api/db/services/task_service.pyindex fb765a9741..8dc03ec8fc 100644--- a/api/db/services/task_service.py+++ b/api/db/services/task_service.py@@ -28,7 +28,7 @@ from api.db.db_models import Task, Document, Knowledgebase, Tenantfrom api.db.services.common_service import CommonServicefrom api.db.services.document_service import DocumentServicefrom common.misc_utils import get_uuid-from common.time_utils import current_timestamp+from common.time_utils import current_timestamp, get_format_timefrom common.constants import StatusEnum, TaskStatus, MAXIMUM_PAGE_NUMBER, MAXIMUM_TASK_PAGE_NUMBERfrom deepdoc.parser.excel_parser import RAGFlowExcelParserfrom rag.utils.redis_conn import REDIS_CONN@@ -138,6 +138,7 @@ class TaskService(CommonService):).where(cls.model.id == docs[0]["id"]).execute()if docs[0]["retry_count"] >= 3:+ DocumentService.update_by_id(docs[0]["doc_id"], {"progress": -1, "run": TaskStatus.FAIL.value, "update_time": current_timestamp(), "update_date": get_format_time()})return Nonereturn docs[0]@@ -347,6 +348,11 @@ class TaskService(CommonService):if begin_at is not None:process_duration = (datetime.now() - begin_at).total_seconds()cls.model.update(process_duration=process_duration).where(cls.model.id == id).execute()+ if info.get("progress") == -1:+ doc_info = {"progress": -1, "run": TaskStatus.FAIL.value, "update_time": current_timestamp(), "update_date": get_format_time()}+ if info.get("progress_msg"):+ doc_info["progress_msg"] = trim_header_by_lines((task.progress_msg or "") + "\n" + info["progress_msg"], TASK_MAX_LOG_LENGTH)+ DocumentService.update_by_id(task.doc_id, doc_info)@classmethod@DB.connection_context()