### Type of change #2485 - [x] Performance Improvementtags/v0.12.0
| "content_with_weight": "content", | "content_with_weight": "content", | ||||
| "doc_id": "document_id", | "doc_id": "document_id", | ||||
| "important_kwd": "important_keywords", | "important_kwd": "important_keywords", | ||||
| "img_id":"image_id", | |||||
| } | } | ||||
| renamed_chunk = {} | renamed_chunk = {} | ||||
| for key, value in chunk.items(): | for key, value in chunk.items(): | ||||
| "content_with_weight": "content", | "content_with_weight": "content", | ||||
| "doc_id": "document_id", | "doc_id": "document_id", | ||||
| "important_kwd": "important_keywords", | "important_kwd": "important_keywords", | ||||
| "kb_id":"knowledge_base_id", | |||||
| "kb_id":"dataset_id", | |||||
| "create_timestamp_flt":"create_timestamp", | |||||
| "create_time": "create_time", | |||||
| "document_keyword":"document", | |||||
| } | } | ||||
| renamed_chunk = {} | renamed_chunk = {} | ||||
| for key, value in d.items(): | for key, value in d.items(): | ||||
| new_key = key_mapping.get(key, key) | |||||
| renamed_chunk[new_key] = value | |||||
| if key in key_mapping: | |||||
| new_key = key_mapping.get(key, key) | |||||
| renamed_chunk[new_key] = value | |||||
| return get_json_result(data={"chunk": renamed_chunk}) | return get_json_result(data={"chunk": renamed_chunk}) | ||||
| # return get_json_result(data={"chunk_id": chunk_id}) | # return get_json_result(data={"chunk_id": chunk_id}) |
| self.content = "" | self.content = "" | ||||
| self.important_keywords = [] | self.important_keywords = [] | ||||
| self.create_time = "" | self.create_time = "" | ||||
| self.create_timestamp_float = 0.0 | |||||
| self.create_timestamp = 0.0 | |||||
| self.knowledgebase_id = None | self.knowledgebase_id = None | ||||
| self.document_name = "" | self.document_name = "" | ||||
| self.document_id = "" | self.document_id = "" | ||||
| "name": self.document_name, | "name": self.document_name, | ||||
| "content": self.content, | "content": self.content, | ||||
| "important_keywords": self.important_keywords, | "important_keywords": self.important_keywords, | ||||
| "create_time": self.create_time, | |||||
| "create_timestamp_flt": self.create_timestamp_float, | |||||
| "document_id": self.document_id, | "document_id": self.document_id, | ||||
| "status": self.status, | "status": self.status, | ||||
| }) | }) |
| res = self.post('/doc/save', | res = self.post('/doc/save', | ||||
| {"id": self.id, "name": self.name, "thumbnail": self.thumbnail, "knowledgebase_id": self.knowledgebase_id, | {"id": self.id, "name": self.name, "thumbnail": self.thumbnail, "knowledgebase_id": self.knowledgebase_id, | ||||
| "parser_method": self.parser_method, "parser_config": self.parser_config.to_json(), | "parser_method": self.parser_method, "parser_config": self.parser_config.to_json(), | ||||
| "source_type": self.source_type, "type": self.type, "created_by": self.created_by, | |||||
| "size": self.size, "token_count": self.token_count, "chunk_count": self.chunk_count, | |||||
| "progress": self.progress, "progress_msg": self.progress_msg, | |||||
| "process_begin_at": self.process_begin_at, "process_duation": self.process_duration | |||||
| }) | }) | ||||
| res = res.json() | res = res.json() | ||||
| if res.get("retmsg") == "success": | if res.get("retmsg") == "success": |