Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Allow more task logs for #14617 (#14624)

Wang Qi1d114f034bf8
diff --git a/api/db/services/task_service.py b/api/db/services/task_service.py
index cb9967f08a..640c8fbd25 100644
--- a/api/db/services/task_service.py
+++ b/api/db/services/task_service.py
@@ -37,6 +37,7 @@ from rag.nlp import search
CANVAS_DEBUG_DOC_ID = "dataflow_x"
GRAPH_RAPTOR_FAKE_DOC_ID = "graph_raptor_x"
+TASK_MAX_LOG_LENGTH = int(os.environ.get("TASK_MAX_LOG_LENGTH", 3000)) # TEXT MAX is 64 KiB bytes!
def trim_header_by_lines(text: str, max_length) -> str:
# Trim header text to maximum length while preserving line breaks
@@ -320,7 +321,7 @@ class TaskService(CommonService):
if os.environ.get("MACOS"):
if info["progress_msg"]:
- progress_msg = trim_header_by_lines(task.progress_msg + "\n" + info["progress_msg"], 3000)
+ progress_msg = trim_header_by_lines(task.progress_msg + "\n" + info["progress_msg"], TASK_MAX_LOG_LENGTH)
cls.model.update(progress_msg=progress_msg).where(cls.model.id == id).execute()
if "progress" in info:
prog = info["progress"]
@@ -332,7 +333,7 @@ class TaskService(CommonService):
else:
with DB.lock("update_progress", -1):
if info["progress_msg"]:
- progress_msg = trim_header_by_lines(task.progress_msg + "\n" + info["progress_msg"], 3000)
+ progress_msg = trim_header_by_lines(task.progress_msg + "\n" + info["progress_msg"], TASK_MAX_LOG_LENGTH)
cls.model.update(progress_msg=progress_msg).where(cls.model.id == id).execute()
if "progress" in info:
prog = info["progress"]