From 0216b1dfadc938efef909f30069d8dbe0019cc9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Mon, 27 Apr 2026 18:02:51 +0800 Subject: [PATCH 1/6] fix: Fix some code reading incorrect attribute names --- .../impl/base_tool_workflow_lib_node.py | 2 +- apps/application/flow/workflow_manage.py | 2 +- apps/application/serializers/common.py | 2 +- apps/common/utils/common.py | 2 +- apps/common/utils/split_model.py | 5 ++--- 5 files changed, 6 insertions(+), 7 deletions(-) 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/utils/common.py b/apps/common/utils/common.py index f234ebeaf8c..04fe576ec12 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 - (int(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) From 8bdf4fca5d11ea9a9a16aeef3e81476c9d956f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Mon, 27 Apr 2026 18:51:47 +0800 Subject: [PATCH 2/6] fix wrong FileSourceType --- .../document_extract_node/impl/base_document_extract_node.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(): From 221ccd010fe48b21d198127e63bf8c0305a8cd3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Tue, 28 Apr 2026 10:23:16 +0800 Subject: [PATCH 3/6] fix --- apps/common/handle/impl/text/doc_split_handle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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': [] From dfcfee72226f76d0f4f58e16c3e07b0c9bcc7af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Tue, 28 Apr 2026 12:21:53 +0800 Subject: [PATCH 4/6] fix 2 --- .../speech_to_text_step_node/impl/base_speech_to_text_node.py | 2 +- apps/knowledge/serializers/knowledge_workflow.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py b/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py index 1df3f85cdeb..64e24180cf4 100644 --- a/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py +++ b/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py @@ -16,7 +16,7 @@ class BaseSpeechToTextNode(ISpeechToTextNode): def save_context(self, details, workflow_manage): self.context['answer'] = details.get('answer') - self.context['result'] = details.get('answer') + self.context['result'] = details.get('result') if self.node_params.get('is_result', False): self.answer_text = details.get('answer') self.context['exception_message'] = details.get('err_message') 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 From d40ddc8296d7489b817b9baa0bb175c263256f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Wed, 29 Apr 2026 19:21:33 +0800 Subject: [PATCH 5/6] revert --- .../speech_to_text_step_node/impl/base_speech_to_text_node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py b/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py index 64e24180cf4..1df3f85cdeb 100644 --- a/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py +++ b/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py @@ -16,7 +16,7 @@ class BaseSpeechToTextNode(ISpeechToTextNode): def save_context(self, details, workflow_manage): self.context['answer'] = details.get('answer') - self.context['result'] = details.get('result') + self.context['result'] = details.get('answer') if self.node_params.get('is_result', False): self.answer_text = details.get('answer') self.context['exception_message'] = details.get('err_message') From 03af688d48965719fd1cc4b5f020dfc7ebd94a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Wed, 29 Apr 2026 19:23:42 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/utils/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/utils/common.py b/apps/common/utils/common.py index 04fe576ec12..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 post_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