diff --git a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py index 68eeadfe055..7bd910c31f3 100644 --- a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py +++ b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py @@ -55,8 +55,8 @@ def save_image(image_list): id=meta['file_id'], file_name=image.file_name, file_size=len(file_bytes), - source_type=FileSourceType.APPLICATION.value if application_id else FileSourceType.KNOWLEDGE.value if knowledge_id else FileSourceType.APPLICATION.value, - source_id=application_id or tool_id or knowledge_id, + source_type=FileSourceType.APPLICATION.value if application_id else FileSourceType.KNOWLEDGE.value if knowledge_id else FileSourceType.TOOL.value, + source_id=application_id or knowledge_id or tool_id, meta=meta ) if not QuerySet(File).filter(id=new_file.id).exists(): diff --git a/apps/application/flow/step_node/tool_workflow_lib_node/impl/base_tool_workflow_lib_node.py b/apps/application/flow/step_node/tool_workflow_lib_node/impl/base_tool_workflow_lib_node.py index ac625bf79ba..d158878454e 100644 --- a/apps/application/flow/step_node/tool_workflow_lib_node/impl/base_tool_workflow_lib_node.py +++ b/apps/application/flow/step_node/tool_workflow_lib_node/impl/base_tool_workflow_lib_node.py @@ -162,7 +162,7 @@ def save_context(self, details, workflow_manage): self.context['child_answer_data'] = details.get('child_answer_data') self.context['details'] = details.get('details') self.extra['input_field_list'] = details.get('input_field_list') - self.extra['output_field_list'] = details.get('input_field_list') + self.extra['output_field_list'] = details.get('output_field_list') self.extra['input'] = details.get('input') self.extra['output'] = details.get('output') self.context['result'] = details.get('result') diff --git a/apps/application/flow/workflow_manage.py b/apps/application/flow/workflow_manage.py index a020d7a2dec..bf882eac084 100644 --- a/apps/application/flow/workflow_manage.py +++ b/apps/application/flow/workflow_manage.py @@ -497,7 +497,7 @@ def hand_event_node_result(self, current_node, node_result_future): return None if not enableException: chunk = self.base_to_response.to_stream_chunk_response(self.params.get('chat_id'), - self.params.get('chat_id'), + self.params.get('chat_record_id'), current_node.id, current_node.up_node_id_list, 'Exception:' + str(e), False, 0, 0, diff --git a/apps/application/serializers/common.py b/apps/application/serializers/common.py index 33f08f1a67a..b41ce79e470 100644 --- a/apps/application/serializers/common.py +++ b/apps/application/serializers/common.py @@ -301,7 +301,7 @@ def get_chat_variable(self): def append_chat_record(self, chat_record: ChatRecord): chat_record.problem_text = chat_record.problem_text[0:10240] if chat_record.problem_text is not None else "" - chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.problem_text is not None else "" + chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.answer_text is not None else "" is_save = True # 存入缓存中 for index in range(len(self.chat_record_list)): diff --git a/apps/common/handle/impl/text/doc_split_handle.py b/apps/common/handle/impl/text/doc_split_handle.py index 8648e204060..86b96318a6e 100644 --- a/apps/common/handle/impl/text/doc_split_handle.py +++ b/apps/common/handle/impl/text/doc_split_handle.py @@ -214,7 +214,7 @@ def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_bu else: split_model = SplitModel(default_pattern_list, with_filter=with_filter, limit=limit) except BaseException as e: - maxkb_logger.error(f"Error processing XLSX file {file.name}: {e}, {traceback.format_exc()}") + maxkb_logger.error(f"Error processing DOC file {file.name}: {e}, {traceback.format_exc()}") return { 'name': file_name, 'content': [] diff --git a/apps/common/utils/common.py b/apps/common/utils/common.py index f234ebeaf8c..ad840262a67 100644 --- a/apps/common/utils/common.py +++ b/apps/common/utils/common.py @@ -85,7 +85,7 @@ def encryption(message: str): range(0, max_pre_len if pre_len > max_pre_len else 1 if pre_len <= 0 else int(pre_len))]) end_str = "".join( [message[index] for index in - range(message_len - (int(post_len) if pre_len < max_post_len else max_post_len), message_len)]) + range(message_len - (post_len if post_len < max_post_len else max_post_len), message_len)]) content = "***************" return pre_str + content + end_str diff --git a/apps/common/utils/split_model.py b/apps/common/utils/split_model.py index 95217b9f512..d9c85a96a81 100644 --- a/apps/common/utils/split_model.py +++ b/apps/common/utils/split_model.py @@ -485,9 +485,8 @@ def get_split_model(filename: str, with_filter: bool = False, limit: int = 10000 """ if filename.endswith(".md"): pattern_list = default_split_pattern.get('md') - return SplitModel(pattern_list, with_filter=with_filter, limit=limit) - - pattern_list = default_split_pattern.get('md') + else: + pattern_list = default_split_pattern.get('default') return SplitModel(pattern_list, with_filter=with_filter, limit=limit) diff --git a/apps/knowledge/serializers/knowledge_workflow.py b/apps/knowledge/serializers/knowledge_workflow.py index 7f131b8f488..11e4d7823c9 100644 --- a/apps/knowledge/serializers/knowledge_workflow.py +++ b/apps/knowledge/serializers/knowledge_workflow.py @@ -385,7 +385,7 @@ def to_knowledge_workflow(knowledge_workflow, update_tool_map): work_flow = knowledge_workflow.get("work_flow") for node in work_flow.get('nodes', []): hand_node(node, update_tool_map) - if node.get('type') == 'loop_node': + if node.get('type') == 'loop-node': for n in node.get('properties', {}).get('node_data', {}).get('loop_body', {}).get('nodes', []): hand_node(n, update_tool_map) return work_flow