Browse Source

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

### What problem does this PR solve?

Remove useless logic in a loop for list_doc

### Type of change

- [x] Refactoring
- [x] Performance Improvement
tags/v0.20.0
Stephen Hu 4 months ago
parent
commit
7dbe06f7d8
No account linked to committer's email address
1 changed files with 13 additions and 13 deletions
  1. 13
    13
      api/apps/sdk/doc.py

+ 13
- 13
api/apps/sdk/doc.py View File

@@ -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":

Loading…
Cancel
Save