Skip to content

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

Fix: typo process_duration (#8696)

Yongteng Lei4d7bfd2ba302
diff --git a/api/apps/document_app.py b/api/apps/document_app.py
index 90d62b0b38..5273c2bcfe 100644
--- a/api/apps/document_app.py
+++ b/api/apps/document_app.py
@@ -490,7 +490,7 @@ def change_parser():
if "parser_config" in req:
DocumentService.update_parser_config(doc.id, req["parser_config"])
if doc.token_num > 0:
- e = DocumentService.increment_chunk_num(doc.id, doc.kb_id, doc.token_num * -1, doc.chunk_num * -1, doc.process_duation * -1)
+ e = DocumentService.increment_chunk_num(doc.id, doc.kb_id, doc.token_num * -1, doc.chunk_num * -1, doc.process_duration * -1)
if not e:
return get_data_error_result(message="Document not found!")
tenant_id = DocumentService.get_tenant_id(req["doc_id"])
diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py
index c744b07ab4..c3bce0bc53 100644
--- a/api/apps/sdk/doc.py
+++ b/api/apps/sdk/doc.py
@@ -300,7 +300,7 @@ def update_doc(tenant_id, dataset_id, document_id):
doc.kb_id,
doc.token_num * -1,
doc.chunk_num * -1,
- doc.process_duation * -1,
+ doc.process_duration * -1,
)
if not e:
return get_error_data_result(message="Document not found!")
@@ -526,11 +526,11 @@ def list_docs(dataset_id, tenant_id):
"parser_id": "chunk_method",
}
run_mapping = {
- "0": "UNSTART",
- "1": "RUNNING",
- "2": "CANCEL",
- "3": "DONE",
- "4": "FAIL",
+ "0": "UNSTART",
+ "1": "RUNNING",
+ "2": "CANCEL",
+ "3": "DONE",
+ "4": "FAIL",
}
for doc in docs:
renamed_doc = {}
diff --git a/api/db/db_models.py b/api/db/db_models.py
index 5eba272d98..b174d562aa 100644
--- a/api/db/db_models.py
+++ b/api/db/db_models.py
@@ -632,7 +632,7 @@ class Document(DataBaseModel):
progress = FloatField(default=0, index=True)
progress_msg = TextField(null=True, help_text="process message", default="")
process_begin_at = DateTimeField(null=True, index=True)
- process_duation = FloatField(default=0)
+ process_duration = FloatField(default=0)
meta_fields = JSONField(null=True, default={})
run = CharField(max_length=1, null=True, help_text="start to run processing or cancel.(1: run it; 2: cancel)", default="0", index=True)
@@ -675,7 +675,7 @@ class Task(DataBaseModel):
priority = IntegerField(default=0)
begin_at = DateTimeField(null=True, index=True)
- process_duation = FloatField(default=0)
+ process_duration = FloatField(default=0)
progress = FloatField(default=0, index=True)
progress_msg = TextField(null=True, help_text="process message", default="")
@@ -952,3 +952,11 @@ def migrate_db():
migrate(migrator.add_column("mcp_server", "variables", JSONField(null=True, help_text="MCP Server variables", default=dict)))
except Exception:
pass
+ try:
+ migrate(migrator.rename_column("task", "process_duation", "process_duration"))
+ except Exception:
+ pass
+ try:
+ migrate(migrator.rename_column("document", "process_duation", "process_duration"))
+ except Exception:
+ pass
diff --git a/api/db/services/document_service.py b/api/db/services/document_service.py
index c69f75acae..f6d7e0def8 100644
--- a/api/db/services/document_service.py
+++ b/api/db/services/document_service.py
@@ -228,10 +228,10 @@ class DocumentService(CommonService):
@classmethod
@DB.connection_context()
- def increment_chunk_num(cls, doc_id, kb_id, token_num, chunk_num, duation):
+ def increment_chunk_num(cls, doc_id, kb_id, token_num, chunk_num, duration):
num = cls.model.update(token_num=cls.model.token_num + token_num,
chunk_num=cls.model.chunk_num + chunk_num,
- process_duation=cls.model.process_duation + duation).where(
+ process_duration=cls.model.process_duration + duration).where(
cls.model.id == doc_id).execute()
if num == 0:
raise LookupError(
@@ -246,10 +246,10 @@ class DocumentService(CommonService):
@classmethod
@DB.connection_context()
- def decrement_chunk_num(cls, doc_id, kb_id, token_num, chunk_num, duation):
+ def decrement_chunk_num(cls, doc_id, kb_id, token_num, chunk_num, duration):
num = cls.model.update(token_num=cls.model.token_num - token_num,
chunk_num=cls.model.chunk_num - chunk_num,
- process_duation=cls.model.process_duation + duation).where(
+ process_duration=cls.model.process_duration + duration).where(
cls.model.id == doc_id).execute()
if num == 0:
raise LookupError(
@@ -525,7 +525,7 @@ class DocumentService(CommonService):
msg = "\n".join(sorted(msg))
info = {
- "process_duation": datetime.timestamp(
+ "process_duration": datetime.timestamp(
datetime.now()) -
d["process_begin_at"].timestamp(),
"run": status}
diff --git a/docs/references/http_api_reference.md b/docs/references/http_api_reference.md
index 1cca27c0e3..d3f87b00a1 100644
--- a/docs/references/http_api_reference.md
+++ b/docs/references/http_api_reference.md
@@ -1058,7 +1058,7 @@ Success:
},
"chunk_method": "naive",
"process_begin_at": null,
- "process_duation": 0.0,
+ "process_duration": 0.0,
"progress": 0.0,
"progress_msg": "",
"run": "0",
@@ -1417,7 +1417,7 @@ Success:
}
},
"process_begin_at": "Thu, 24 Oct 2024 09:56:44 GMT",
- "process_duation": 0.54213,
+ "process_duration": 0.54213,
"progress": 0.0,
"progress_msg": "Task dispatched...",
"run": "2",
diff --git a/docs/references/python_api_reference.md b/docs/references/python_api_reference.md
index 9c8437ac4a..bb50e1e997 100644
--- a/docs/references/python_api_reference.md
+++ b/docs/references/python_api_reference.md
@@ -552,7 +552,7 @@ A `Document` object contains the following attributes:
- `progress`: `float` The current processing progress as a percentage. Defaults to `0.0`.
- `progress_msg`: `str` A message indicating the current progress status. Defaults to `""`.
- `process_begin_at`: `datetime` The start time of document processing. Defaults to `None`.
-- `process_duation`: `float` Duration of the processing in seconds. Defaults to `0.0`.
+- `process_duration`: `float` Duration of the processing in seconds. Defaults to `0.0`.
- `run`: `str` The document's processing status:
- `"UNSTART"` (default)
- `"RUNNING"`
diff --git a/sdk/python/ragflow_sdk/modules/document.py b/sdk/python/ragflow_sdk/modules/document.py
index cec8de161f..6cb0e3b5e3 100644
--- a/sdk/python/ragflow_sdk/modules/document.py
+++ b/sdk/python/ragflow_sdk/modules/document.py
@@ -41,7 +41,7 @@ class Document(Base):
self.progress = 0.0
self.progress_msg = ""
self.process_begin_at = None
- self.process_duation = 0.0
+ self.process_duration = 0.0
self.run = "0"
self.status = "1"
for k in list(res_dict.keys()):
diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py
index 9c1c7302ce..0689f71727 100644
--- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py
+++ b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_parse_documents.py
@@ -46,7 +46,7 @@ def validate_document_details(auth, dataset_id, document_ids):
doc = res["data"]["docs"][0]
assert doc["run"] == "DONE"
assert len(doc["process_begin_at"]) > 0
- assert doc["process_duation"] > 0
+ assert doc["process_duration"] > 0
assert doc["progress"] > 0
assert "Task done" in doc["progress_msg"]
diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py
index 7f05302b56..6f0927930f 100644
--- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py
+++ b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py
@@ -28,7 +28,7 @@ def validate_document_parse_done(auth, dataset_id, document_ids):
doc = res["data"]["docs"][0]
assert doc["run"] == "DONE"
assert len(doc["process_begin_at"]) > 0
- assert doc["process_duation"] > 0
+ assert doc["process_duration"] > 0
assert doc["progress"] > 0
assert "Task done" in doc["progress_msg"]
diff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py
index 5bf6f0410a..29dbc55bef 100644
--- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py
+++ b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_update_document.py
@@ -228,7 +228,7 @@ class TestDocumentsUpdated:
marks=pytest.mark.skip(reason="issues/6104"),
),
pytest.param(
- {"process_duation": 1.0},
+ {"process_duration": 1.0},
102,
"The input parameters are invalid.",
marks=pytest.mark.skip(reason="issues/6104"),
diff --git a/test/testcases/test_http_api/test_file_management_within_dataset/test_parse_documents.py b/test/testcases/test_http_api/test_file_management_within_dataset/test_parse_documents.py
index e8ffa914ed..04aa8cac21 100644
--- a/test/testcases/test_http_api/test_file_management_within_dataset/test_parse_documents.py
+++ b/test/testcases/test_http_api/test_file_management_within_dataset/test_parse_documents.py
@@ -47,7 +47,7 @@ def validate_document_details(auth, dataset_id, document_ids):
doc = res["data"]["docs"][0]
assert doc["run"] == "DONE"
assert len(doc["process_begin_at"]) > 0
- assert doc["process_duation"] > 0
+ assert doc["process_duration"] > 0
assert doc["progress"] > 0
assert "Task done" in doc["progress_msg"]
diff --git a/test/testcases/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py b/test/testcases/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py
index 4c32448789..67d89c8153 100644
--- a/test/testcases/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py
+++ b/test/testcases/test_http_api/test_file_management_within_dataset/test_stop_parse_documents.py
@@ -29,7 +29,7 @@ def validate_document_parse_done(auth, dataset_id, document_ids):
doc = res["data"]["docs"][0]
assert doc["run"] == "DONE"
assert len(doc["process_begin_at"]) > 0
- assert doc["process_duation"] > 0
+ assert doc["process_duration"] > 0
assert doc["progress"] > 0
assert "Task done" in doc["progress_msg"]
diff --git a/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py b/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py
index ca7bbe5c74..e2ab5d031d 100644
--- a/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py
+++ b/test/testcases/test_http_api/test_file_management_within_dataset/test_update_document.py
@@ -229,7 +229,7 @@ class TestDocumentsUpdated:
marks=pytest.mark.skip(reason="issues/6104"),
),
pytest.param(
- {"process_duation": 1.0},
+ {"process_duration": 1.0},
102,
"The input parameters are invalid.",
marks=pytest.mark.skip(reason="issues/6104"),
diff --git a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_parse_documents.py b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_parse_documents.py
index 9b76bf6d1d..2afc9928f0 100644
--- a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_parse_documents.py
+++ b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_parse_documents.py
@@ -45,7 +45,7 @@ def validate_document_details(dataset, document_ids):
if document.id in document_ids:
assert document.run == "DONE"
assert len(document.process_begin_at) > 0
- assert document.process_duation > 0
+ assert document.process_duration > 0
assert document.progress > 0
assert "Task done" in document.progress_msg
diff --git a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_stop_parse_documents.py b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_stop_parse_documents.py
index 9b561881ef..8454ed9471 100644
--- a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_stop_parse_documents.py
+++ b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_stop_parse_documents.py
@@ -23,7 +23,7 @@ def validate_document_parse_done(dataset, document_ids):
if document.id in document_ids:
assert document.run == "DONE"
assert len(document.process_begin_at) > 0
- assert document.process_duation > 0
+ assert document.process_duration > 0
assert document.progress > 0
assert "Task done" in document.progress_msg
diff --git a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.py b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.py
index f1d3dadb8d..1f738bea20 100644
--- a/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.py
+++ b/test/testcases/test_sdk_api/test_file_management_within_dataset/test_update_document.py
@@ -141,7 +141,7 @@ class TestDocumentsUpdated:
marks=pytest.mark.skip(reason="issues/6104"),
),
pytest.param(
- {"process_duation": 1.0},
+ {"process_duration": 1.0},
"The input parameters are invalid",
marks=pytest.mark.skip(reason="issues/6104"),
),
diff --git a/test/testcases/test_web_api/test_document_app/test_paser_documents.py b/test/testcases/test_web_api/test_document_app/test_paser_documents.py
index 34e8855718..55946b7f5a 100644
--- a/test/testcases/test_web_api/test_document_app/test_paser_documents.py
+++ b/test/testcases/test_web_api/test_document_app/test_paser_documents.py
@@ -48,7 +48,7 @@ def validate_document_parse_done(auth, _kb_id, _document_ids):
continue
assert doc["run"] == "3"
assert len(doc["process_begin_at"]) > 0
- assert doc["process_duation"] > 0
+ assert doc["process_duration"] > 0
assert doc["progress"] > 0
assert "Task done" in doc["progress_msg"]
diff --git a/web/src/interfaces/database/document.ts b/web/src/interfaces/database/document.ts
index 59bc5d0213..5ccbc44a28 100644
--- a/web/src/interfaces/database/document.ts
+++ b/web/src/interfaces/database/document.ts
@@ -12,7 +12,7 @@ export interface IDocumentInfo {
parser_config: IParserConfig;
parser_id: string;
process_begin_at?: string;
- process_duation: number;
+ process_duration: number;
progress: number;
progress_msg: string;
run: RunningStatus;
diff --git a/web/src/interfaces/database/knowledge.ts b/web/src/interfaces/database/knowledge.ts
index 4b357ee88a..011f8a9eb7 100644
--- a/web/src/interfaces/database/knowledge.ts
+++ b/web/src/interfaces/database/knowledge.ts
@@ -69,7 +69,7 @@ export interface IKnowledgeFile {
name: string;
parser_id: string;
process_begin_at?: any;
- process_duation: number;
+ process_duration: number;
progress: number; // parsing process
progress_msg: string; // parsing log
run: RunningStatus; // parsing status
diff --git a/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx b/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx
index bd77431ea8..bb052a6698 100644
--- a/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx
+++ b/web/src/pages/add-knowledge/components/knowledge-file/parsing-status-cell/index.tsx
@@ -61,9 +61,9 @@ const PopoverContent = ({ record }: IProps) => {
children: record.process_begin_at,
},
{
- key: 'process_duation',
+ key: 'process_duration',
label: t('processDuration'),
- children: `${record.process_duation.toFixed(2)} s`,
+ children: `${record.process_duration.toFixed(2)} s`,
},
{
key: 'progress_msg',
diff --git a/web/src/pages/dataset/dataset/parsing-card.tsx b/web/src/pages/dataset/dataset/parsing-card.tsx
index 31c750f0b7..b5511dae8a 100644
--- a/web/src/pages/dataset/dataset/parsing-card.tsx
+++ b/web/src/pages/dataset/dataset/parsing-card.tsx
@@ -53,9 +53,9 @@ export const PopoverContent = ({ record }: IProps) => {
children: record.process_begin_at,
},
{
- key: 'knowledgeDetails.process_duation',
+ key: 'knowledgeDetails.process_duration',
label: t('processDuration'),
- children: `${record.process_duation.toFixed(2)} s`,
+ children: `${record.process_duration.toFixed(2)} s`,
},
{
key: 'progress_msg',