Skip to content

Commit a9140ba

Browse files
wangliang181230liuruibin
authored andcommitted
fix: Fix some code reading incorrect attribute names
1 parent 4de2a89 commit a9140ba

10 files changed

Lines changed: 12 additions & 13 deletions

File tree

apps/application/chat_pipeline/I_base_chat_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, _id: str, document_id: str, knowledge_id: str, content: str,
2626
self.knowledge_id = knowledge_id
2727
self.content = content
2828
self.title = title
29-
self.status = status,
29+
self.status = status
3030
self.is_active = is_active
3131
self.comprehensive_score = comprehensive_score
3232
self.similarity = similarity

apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def save_image(image_list):
5555
id=meta['file_id'],
5656
file_name=image.file_name,
5757
file_size=len(file_bytes),
58-
source_type=FileSourceType.APPLICATION.value if application_id else FileSourceType.KNOWLEDGE.value if knowledge_id else FileSourceType.APPLICATION.value,
59-
source_id=application_id or tool_id or knowledge_id,
58+
source_type=FileSourceType.APPLICATION.value if application_id else FileSourceType.KNOWLEDGE.value if knowledge_id else FileSourceType.TOOL.value,
59+
source_id=application_id or knowledge_id or tool_id,
6060
meta=meta
6161
)
6262
if not QuerySet(File).filter(id=new_file.id).exists():

apps/application/flow/step_node/loop_node/impl/base_loop_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def workflow_manage_new_instance(loop_data, global_data, start_node_id=None,
303303
_is_interrupt=_is_interrupt_exec)
304304

305305
def get_loop_context_data(self):
306-
fields = self.node.properties.get('config', []).get('fields', []) or []
306+
fields = self.node.properties.get('config', {}).get('fields', []) or []
307307
return {f.get('value'): self.context.get(f.get('value')) for f in fields if
308308
self.context.get(f.get('value')) is not None}
309309

apps/application/flow/step_node/tool_workflow_lib_node/impl/base_tool_workflow_lib_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def save_context(self, details, workflow_manage):
162162
self.context['child_answer_data'] = details.get('child_answer_data')
163163
self.context['details'] = details.get('details')
164164
self.extra['input_field_list'] = details.get('input_field_list')
165-
self.extra['output_field_list'] = details.get('input_field_list')
165+
self.extra['output_field_list'] = details.get('output_field_list')
166166
self.extra['input'] = details.get('input')
167167
self.extra['output'] = details.get('output')
168168
self.context['result'] = details.get('result')

apps/application/flow/workflow_manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def hand_event_node_result(self, current_node, node_result_future):
503503
return None
504504
if not enableException:
505505
chunk = self.base_to_response.to_stream_chunk_response(self.params.get('chat_id'),
506-
self.params.get('chat_id'),
506+
self.params.get('chat_record_id'),
507507
current_node.id,
508508
current_node.up_node_id_list,
509509
'Exception:' + str(e), False, 0, 0,

apps/application/serializers/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def get_chat_variable(self):
301301

302302
def append_chat_record(self, chat_record: ChatRecord):
303303
chat_record.problem_text = chat_record.problem_text[0:10240] if chat_record.problem_text is not None else ""
304-
chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.problem_text is not None else ""
304+
chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.answer_text is not None else ""
305305
is_save = True
306306
# 存入缓存中
307307
for index in range(len(self.chat_record_list)):

apps/common/handle/impl/text/doc_split_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_bu
214214
else:
215215
split_model = SplitModel(default_pattern_list, with_filter=with_filter, limit=limit)
216216
except BaseException as e:
217-
maxkb_logger.error(f"Error processing XLSX file {file.name}: {e}, {traceback.format_exc()}")
217+
maxkb_logger.error(f"Error processing DOC file {file.name}: {e}, {traceback.format_exc()}")
218218
return {
219219
'name': file_name,
220220
'content': []

apps/common/utils/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def encryption(message: str):
135135
range(0, max_pre_len if pre_len > max_pre_len else 1 if pre_len <= 0 else int(pre_len))])
136136
end_str = "".join(
137137
[message[index] for index in
138-
range(message_len - (int(post_len) if pre_len < max_post_len else max_post_len), message_len)])
138+
range(message_len - (post_len if post_len < max_post_len else max_post_len), message_len)])
139139
content = "***************"
140140
return pre_str + content + end_str
141141

apps/common/utils/split_model.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,8 @@ def get_split_model(filename: str, with_filter: bool = False, limit: int = 10000
485485
"""
486486
if filename.endswith(".md"):
487487
pattern_list = default_split_pattern.get('md')
488-
return SplitModel(pattern_list, with_filter=with_filter, limit=limit)
489-
490-
pattern_list = default_split_pattern.get('md')
488+
else:
489+
pattern_list = default_split_pattern.get('default')
491490
return SplitModel(pattern_list, with_filter=with_filter, limit=limit)
492491

493492

apps/knowledge/serializers/knowledge_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def to_knowledge_workflow(knowledge_workflow, update_tool_map):
467467
work_flow = knowledge_workflow.get("work_flow")
468468
for node in work_flow.get("nodes", []):
469469
hand_node(node, update_tool_map)
470-
if node.get("type") == "loop_node":
470+
if node.get("type") == "loop-node":
471471
for n in node.get("properties", {}).get("node_data", {}).get("loop_body", {}).get("nodes", []):
472472
hand_node(n, update_tool_map)
473473
return work_flow

0 commit comments

Comments
 (0)