Skip to content

Commit d869f54

Browse files
committed
fix: handle None and empty lists for image and video data in history message generation
1 parent 8cdacdb commit d869f54

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def generate_history_ai_message(self, chat_record):
207207
def generate_history_human_message_for_details(self, chat_record):
208208
for data in chat_record.details.values():
209209
if self.node.id == data['node_id'] and 'image_list' in data:
210-
image_list = data['image_list']
210+
image_list = data['image_list'] or []
211211
if len(image_list) == 0 or data['dialogue_type'] == 'WORKFLOW':
212212
return HumanMessage(content=chat_record.problem_text)
213213

@@ -238,7 +238,7 @@ def generate_history_human_message(self, chat_record):
238238

239239
for data in chat_record.details.values():
240240
if self.node.id == data['node_id'] and 'image_list' in data:
241-
image_list = data['image_list']
241+
image_list = data['image_list'] or []
242242
if len(image_list) == 0 or data['dialogue_type'] == 'WORKFLOW':
243243
return HumanMessage(content=chat_record.problem_text)
244244
file_id_list = []

apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def generate_history_ai_message(self, chat_record):
209209
def generate_history_human_message_for_details(self, chat_record):
210210
for data in chat_record.details.values():
211211
if self.node.id == data['node_id'] and 'video_list' in data:
212-
video_list = data['video_list']
212+
video_list = data['video_list'] or []
213213
# 增加对 None 和空列表的检查
214214
if not video_list or len(video_list) == 0 or data['dialogue_type'] == 'WORKFLOW':
215215
return HumanMessage(content=chat_record.problem_text)
@@ -240,7 +240,7 @@ def generate_history_human_message(self, chat_record, video_model):
240240

241241
for data in chat_record.details.values():
242242
if self.node.id == data['node_id'] and 'video_list' in data:
243-
video_list = data['video_list']
243+
video_list = data['video_list'] or []
244244
if video_list is None or len(video_list) == 0 or data['dialogue_type'] == 'WORKFLOW':
245245
return HumanMessage(content=chat_record.problem_text)
246246
file_id_list = []

0 commit comments

Comments
 (0)