Skip to content

Commit 2a6bbc8

Browse files
committed
fix: update system message handling in base image and video understand nodes
1 parent 72713a2 commit 2a6bbc8

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def execute(self, model_id, system, prompt, dialogue_number, dialogue_type, hist
164164
self.context['history_message'] = history_message
165165
question = self.generate_prompt_question(prompt)
166166
self.context['question'] = question.content
167+
system = self.workflow_manage.generate_prompt(system)
168+
self.context['system'] = system
167169
# 生成消息列表, 真实的history_message
168170
message_list = self.generate_message_list(image_model, system, prompt,
169171
self.get_history_message(history_chat_record, dialogue_number), image)
@@ -296,7 +298,7 @@ def generate_message_list(self, image_model, system: str, prompt: str, history_m
296298

297299
if system is not None and len(system) > 0:
298300
return [
299-
SystemMessage(self.workflow_manage.generate_prompt(system)),
301+
SystemMessage(system),
300302
*history_message,
301303
*messages
302304
]
@@ -320,7 +322,7 @@ def get_details(self, index: int, **kwargs):
320322
'name': self.node.properties.get('stepName'),
321323
"index": index,
322324
'run_time': self.context.get('run_time'),
323-
'system': self.node_params.get('system'),
325+
'system': self.context.get('system'),
324326
'history_message': [{'content': message.content, 'role': message.type} for message in
325327
(self.context.get('history_message') if self.context.get(
326328
'history_message') is not None else [])],

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ def execute(self, model_id, system, prompt, dialogue_number, dialogue_type, hist
163163
# 执行详情中的历史消息不需要图片内容
164164
history_message = self.get_history_message_for_details(history_chat_record, dialogue_number)
165165
self.context['history_message'] = history_message
166+
system = self.workflow_manage.generate_prompt(system)
167+
self.context['system'] = system
166168
question = self.generate_prompt_question(prompt)
167169
self.context['question'] = question.content
168170
# 生成消息列表, 真实的history_message
@@ -291,7 +293,7 @@ def generate_message_list(self, video_model, system: str, prompt: str, history_m
291293

292294
if system is not None and len(system) > 0:
293295
return [
294-
SystemMessage(self.workflow_manage.generate_prompt(system)),
296+
SystemMessage(system),
295297
*history_message,
296298
*messages
297299
]
@@ -315,7 +317,7 @@ def get_details(self, index: int, **kwargs):
315317
'name': self.node.properties.get('stepName'),
316318
"index": index,
317319
'run_time': self.context.get('run_time'),
318-
'system': self.node_params.get('system'),
320+
'system': self.context.get('system'),
319321
'history_message': [{'content': message.content, 'role': message.type} for message in
320322
(self.context.get('history_message') if self.context.get(
321323
'history_message') is not None else [])],

0 commit comments

Comments
 (0)