Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 修正错误的 source_type,最后一个else后为 TOOL 类型
  2. 调整source_id的变量顺序,与source_type的判断顺序保持一致,使代码更加清晰。

meta=meta
)
if not QuerySet(File).filter(id=new_file.id).exists():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion apps/application/flow/workflow_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/application/serializers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down
2 changes: 1 addition & 1 deletion apps/common/handle/impl/text/doc_split_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': []
Expand Down
2 changes: 1 addition & 1 deletion apps/common/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 是post_len,不是pre_len
  2. post_len已经是int型的,不需要再转换

content = "***************"
return pre_str + content + end_str

Expand Down
5 changes: 2 additions & 3 deletions apps/common/utils/split_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion apps/knowledge/serializers/knowledge_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading