JobSmithManipulation
commited on
Commit
·
246879d
1
Parent(s):
42023af
update document sdk (#2485)
Browse files### Type of change
#2485
- [x] Performance Improvement
api/apps/sdk/doc.py
CHANGED
@@ -499,6 +499,7 @@ def list_chunk(tenant_id):
|
|
499 |
"content_with_weight": "content",
|
500 |
"doc_id": "document_id",
|
501 |
"important_kwd": "important_keywords",
|
|
|
502 |
}
|
503 |
renamed_chunk = {}
|
504 |
for key, value in chunk.items():
|
@@ -560,12 +561,16 @@ def create(tenant_id):
|
|
560 |
"content_with_weight": "content",
|
561 |
"doc_id": "document_id",
|
562 |
"important_kwd": "important_keywords",
|
563 |
-
"kb_id":"
|
|
|
|
|
|
|
564 |
}
|
565 |
renamed_chunk = {}
|
566 |
for key, value in d.items():
|
567 |
-
|
568 |
-
|
|
|
569 |
|
570 |
return get_json_result(data={"chunk": renamed_chunk})
|
571 |
# return get_json_result(data={"chunk_id": chunk_id})
|
|
|
499 |
"content_with_weight": "content",
|
500 |
"doc_id": "document_id",
|
501 |
"important_kwd": "important_keywords",
|
502 |
+
"img_id":"image_id",
|
503 |
}
|
504 |
renamed_chunk = {}
|
505 |
for key, value in chunk.items():
|
|
|
561 |
"content_with_weight": "content",
|
562 |
"doc_id": "document_id",
|
563 |
"important_kwd": "important_keywords",
|
564 |
+
"kb_id":"dataset_id",
|
565 |
+
"create_timestamp_flt":"create_timestamp",
|
566 |
+
"create_time": "create_time",
|
567 |
+
"document_keyword":"document",
|
568 |
}
|
569 |
renamed_chunk = {}
|
570 |
for key, value in d.items():
|
571 |
+
if key in key_mapping:
|
572 |
+
new_key = key_mapping.get(key, key)
|
573 |
+
renamed_chunk[new_key] = value
|
574 |
|
575 |
return get_json_result(data={"chunk": renamed_chunk})
|
576 |
# return get_json_result(data={"chunk_id": chunk_id})
|
sdk/python/ragflow/modules/chunk.py
CHANGED
@@ -7,7 +7,7 @@ class Chunk(Base):
|
|
7 |
self.content = ""
|
8 |
self.important_keywords = []
|
9 |
self.create_time = ""
|
10 |
-
self.
|
11 |
self.knowledgebase_id = None
|
12 |
self.document_name = ""
|
13 |
self.document_id = ""
|
@@ -38,8 +38,6 @@ class Chunk(Base):
|
|
38 |
"name": self.document_name,
|
39 |
"content": self.content,
|
40 |
"important_keywords": self.important_keywords,
|
41 |
-
"create_time": self.create_time,
|
42 |
-
"create_timestamp_flt": self.create_timestamp_float,
|
43 |
"document_id": self.document_id,
|
44 |
"status": self.status,
|
45 |
})
|
|
|
7 |
self.content = ""
|
8 |
self.important_keywords = []
|
9 |
self.create_time = ""
|
10 |
+
self.create_timestamp = 0.0
|
11 |
self.knowledgebase_id = None
|
12 |
self.document_name = ""
|
13 |
self.document_id = ""
|
|
|
38 |
"name": self.document_name,
|
39 |
"content": self.content,
|
40 |
"important_keywords": self.important_keywords,
|
|
|
|
|
41 |
"document_id": self.document_id,
|
42 |
"status": self.status,
|
43 |
})
|
sdk/python/ragflow/modules/document.py
CHANGED
@@ -36,10 +36,6 @@ class Document(Base):
|
|
36 |
res = self.post('/doc/save',
|
37 |
{"id": self.id, "name": self.name, "thumbnail": self.thumbnail, "knowledgebase_id": self.knowledgebase_id,
|
38 |
"parser_method": self.parser_method, "parser_config": self.parser_config.to_json(),
|
39 |
-
"source_type": self.source_type, "type": self.type, "created_by": self.created_by,
|
40 |
-
"size": self.size, "token_count": self.token_count, "chunk_count": self.chunk_count,
|
41 |
-
"progress": self.progress, "progress_msg": self.progress_msg,
|
42 |
-
"process_begin_at": self.process_begin_at, "process_duation": self.process_duration
|
43 |
})
|
44 |
res = res.json()
|
45 |
if res.get("retmsg") == "success":
|
|
|
36 |
res = self.post('/doc/save',
|
37 |
{"id": self.id, "name": self.name, "thumbnail": self.thumbnail, "knowledgebase_id": self.knowledgebase_id,
|
38 |
"parser_method": self.parser_method, "parser_config": self.parser_config.to_json(),
|
|
|
|
|
|
|
|
|
39 |
})
|
40 |
res = res.json()
|
41 |
if res.get("retmsg") == "success":
|