Skip to content

Commit 98a0629

Browse files
fix: Fix the keyword for raise exception
1 parent 739b7ab commit 98a0629

8 files changed

Lines changed: 14 additions & 16 deletions

File tree

apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def handle_variables(self, tool_params):
364364
tool_params[k] = self.workflow_manage.generate_prompt(tool_params[k])
365365
elif type(v) == dict:
366366
self.handle_variables(v)
367-
elif (type(v) == list) and len(v) > 0 and type(v[0]) == str:
367+
elif type(v) == list and len(v) > 0 and type(v[0]) == str:
368368
tool_params[k] = self.get_reference_content(v)
369369
return tool_params
370370

apps/application/flow/step_node/mcp_node/impl/base_mcp_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def handle_variables(self, tool_params):
5151
for k, v in tool_params.items():
5252
if type(v) == str:
5353
tool_params[k] = self.workflow_manage.generate_prompt(tool_params[k])
54-
if type(v) == dict:
54+
elif type(v) == dict:
5555
self.handle_variables(v)
56-
if (type(v) == list) and (type(v[0]) == str):
56+
elif (type(v) == list) and len(v) > 0 and (type(v[0]) == str):
5757
tool_params[k] = self.get_reference_content(v)
5858
return tool_params
5959

apps/chat/serializers/chat_record.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ def vote(self, instance: Dict, with_valid=True):
7575
chat_record_details_model.vote_status = VoteChoices.STAR
7676
chat_record_details_model.vote_reason = vote_reason
7777
chat_record_details_model.vote_other_content = vote_other_content
78-
79-
if vote_status == VoteChoices.TRAMPLE:
78+
elif vote_status == VoteChoices.TRAMPLE:
8079
# 点踩
8180
chat_record_details_model.vote_status = VoteChoices.TRAMPLE
8281
chat_record_details_model.vote_reason = vote_reason

apps/common/handle/base_parse_qa_handle.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_title_row_index_dict(title_row_list):
2222
title_row_index_dict = {}
2323
if len(title_row_list) == 1:
2424
title_row_index_dict['content'] = 0
25-
elif len(title_row_list) == 1:
25+
elif len(title_row_list) == 2:
2626
title_row_index_dict['title'] = 0
2727
title_row_index_dict['content'] = 1
2828
else:
@@ -33,11 +33,11 @@ def get_title_row_index_dict(title_row_list):
3333
title_row = title_row_list[index]
3434
if title_row is None:
3535
title_row = ''
36-
if title_row.startswith('分段标题'):
36+
elif title_row.startswith('分段标题'):
3737
title_row_index_dict['title'] = index
38-
if title_row.startswith('分段内容'):
38+
elif title_row.startswith('分段内容'):
3939
title_row_index_dict['content'] = index
40-
if title_row.startswith('问题'):
40+
elif title_row.startswith('问题'):
4141
title_row_index_dict['problem_list'] = index
4242
return title_row_index_dict
4343

apps/common/handle/impl/qa/csv_parse_qa_handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def read_csv_standard(file_path):
2020
data = []
21-
with open(file_path, 'r') as file:
21+
with open(file_path, 'r', encoding='utf-8') as file:
2222
reader = csv.reader(file)
2323
for row in reader:
2424
data.append(row)

apps/oss/serializers/file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ def _is_unsafe_ip(self, ip: str) -> bool:
219219
def get_url_content(url, application_id: str):
220220
application = Application.objects.filter(id=application_id).first()
221221
if application is None:
222-
return AppApiException(500, _('Application does not exist'))
222+
raise AppApiException(500, _('Application does not exist'))
223223
if not application.file_upload_enable:
224-
return AppApiException(500, _('File upload is not enabled'))
224+
raise AppApiException(500, _('File upload is not enabled'))
225225
file_limit = 50 * 1024 * 1024
226226
if application.file_upload_setting and application.file_upload_setting.get('fileLimit'):
227227
file_limit = application.file_upload_setting.get('fileLimit') * 1024 * 1024

ui/src/locales/lang/en-US/workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export default {
188188
result: 'Search Results',
189189
searchParam: 'Search Parameters',
190190
select_variable: 'Select Variable',
191-
valueMessage: `Value or name `,
191+
valueMessage: 'Value or name',
192192

193193
searchQuestion: {
194194
label: 'Search Question',

ui/src/workflow/nodes/intent-classify-node/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,11 @@ class IntentModel extends AppNodeModel {
4747
})
4848

4949
if (branch_condition_list) {
50-
5150
const FORM_ITEMS_HEIGHT = 397 // 上方表单占用高度
52-
51+
5352
for (let index = 0; index < branch_condition_list.length; index++) {
5453
const element = branch_condition_list[index]
55-
54+
5655
anchors.push({
5756
x: x + width / 2 - 10,
5857
y: showNode

0 commit comments

Comments
 (0)