Skip to content

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

Refactor: remove useless initialize logic in list_doc (#8523)

Stephen Hu7dbe06f7d8d6
diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.py
index e0f77c985e..c744b07ab4 100644
--- a/api/apps/sdk/doc.py
+++ b/api/apps/sdk/doc.py
@@ -519,20 +519,20 @@ def list_docs(dataset_id, tenant_id):
# rename key's name
renamed_doc_list = []
+ key_mapping = {
+ "chunk_num": "chunk_count",
+ "kb_id": "dataset_id",
+ "token_num": "token_count",
+ "parser_id": "chunk_method",
+ }
+ run_mapping = {
+ "0": "UNSTART",
+ "1": "RUNNING",
+ "2": "CANCEL",
+ "3": "DONE",
+ "4": "FAIL",
+ }
for doc in docs:
- key_mapping = {
- "chunk_num": "chunk_count",
- "kb_id": "dataset_id",
- "token_num": "token_count",
- "parser_id": "chunk_method",
- }
- run_mapping = {
- "0": "UNSTART",
- "1": "RUNNING",
- "2": "CANCEL",
- "3": "DONE",
- "4": "FAIL",
- }
renamed_doc = {}
for key, value in doc.items():
if key == "run":