Skip to content

Commit 9a58608

Browse files
fix: Fix null pointer exception
1 parent adc87e3 commit 9a58608

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ def handle_variables(self, tool_params):
362362
for k, v in tool_params.items():
363363
if type(v) == str:
364364
tool_params[k] = self.workflow_manage.generate_prompt(tool_params[k])
365-
if type(v) == dict:
365+
elif type(v) == dict:
366366
self.handle_variables(v)
367-
if (type(v) == list) 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/tool_lib_node/impl/base_tool_lib_node.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def execute(self, tool_lib_id, input_field_list, **kwargs) -> NodeResult:
251251
def tool_exec_record(self, tool_lib, all_params):
252252
task_record_id = uuid.uuid7()
253253
start_time = time.time()
254+
filtered_args = all_params
254255
try:
255256
# 过滤掉 tool_init_params 中的参数
256257
tool_init_params = json.loads(rsa_long_decrypt(tool_lib.init_params)) if tool_lib.init_params else {}
@@ -259,8 +260,6 @@ def tool_exec_record(self, tool_lib, all_params):
259260
k: v for k, v in all_params.items()
260261
if k not in tool_init_params
261262
}
262-
else:
263-
filtered_args = all_params
264263
if [WorkflowMode.KNOWLEDGE, WorkflowMode.KNOWLEDGE_LOOP].__contains__(
265264
self.workflow_manage.flow.workflow_mode):
266265
source_id = self.workflow_manage.params.get('knowledge_id')

apps/application/flow/step_node/variable_splitting_node/impl/base_variable_splitting_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
jsonpath_expr_cache = MemCache('parse_path', {
1717
'TIMEOUT': 3600, # 缓存有效期为 1 小时
1818
'OPTIONS': {
19-
'MAX_ENTRIES': 1000, # 最多缓存 500 个条目
19+
'MAX_ENTRIES': 1000, # 最多缓存 1000 个条目
2020
'CULL_FREQUENCY': 10, # 达到上限时,删除约 1/10 的缓存
2121
},
2222
})

apps/chat/serializers/chat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ def get_chat_record(chat_info, chat_record_id):
382382
str(chat_record.id) == str(chat_record_id)]
383383
if chat_record_list is not None and len(chat_record_list):
384384
return chat_record_list[-1]
385-
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id, chat_id=chat_info.chat_id).first()
386-
if chat_record is None:
387-
if not is_valid_uuid(chat_record_id):
388-
raise ChatException(500, _("Conversation record does not exist"))
385+
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id, chat_id=chat_info.chat_id).first()
386+
if chat_record is None:
387+
if not is_valid_uuid(chat_record_id):
388+
raise ChatException(500, _("Conversation record does not exist"))
389389
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id).first()
390390
return chat_record
391391

apps/models_provider/impl/ollama_model_provider/ollama_model_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def convert_to_down_model_chunk(row_str: str, chunk_index: int):
224224
if row.get('status').__contains__("pulling"):
225225
progress = 0
226226
status = DownModelChunkStatus.pulling
227-
if 'total' in row and 'completed' in row:
227+
if 'total' in row and 'completed' in row and row.get('total'):
228228
progress = (row.get('completed') / row.get('total') * 100)
229229
elif 'error' in row:
230230
status = DownModelChunkStatus.error

apps/trigger/handler/impl/trigger/event_trigger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def execute(trigger, request=None, **kwargs):
119119
trigger_setting = trigger.get('trigger_setting')
120120
if trigger_setting.get('token'):
121121
token = request.META.get('HTTP_AUTHORIZATION')
122-
if trigger_setting.get('token') != token.replace('Bearer ', ''):
122+
if not token or trigger_setting.get('token') != token.replace('Bearer ', ''):
123123
raise AppAuthenticationFailed(1002, _('Authentication information is incorrect'))
124124
is_active = trigger.get('is_active')
125125
if not is_active:

0 commit comments

Comments
 (0)