diff --git a/apps/application/workflow/nodes/ai_chat_node/ai_chat_node.py b/apps/application/workflow/nodes/ai_chat_node/ai_chat_node.py index e476e3926c0..8f1638da6bb 100644 --- a/apps/application/workflow/nodes/ai_chat_node/ai_chat_node.py +++ b/apps/application/workflow/nodes/ai_chat_node/ai_chat_node.py @@ -437,6 +437,7 @@ def execute(self): question.content, reasoning_content_id, text_content_id, + is_result=is_result, ) ) else: @@ -467,7 +468,7 @@ def _generate_prompt_question(self, question_str, model, vision, image_list, vid return HumanMessage(content=[*videos, *images, {"type": "text", "text": question_str}]) async def _stream_response( - self, response, chat_model, message_list, question, reasoning_content_id, text_content_id + self, response, chat_model, message_list, question, reasoning_content_id, text_content_id, is_result=None ): reasoning_setting = {"reasoning_end": False, "is_reasoning": False} @@ -503,11 +504,12 @@ async def _stream_response( reasoning_content_id, "", Status.SUCCESS, node_info, Position(self.get_node_id()) ) ) - self.write( - TextContent( - text_content_id, content_chunk, Status.RUNNING, node_info, Position(self.get_node_id()) + if is_result: + self.write( + TextContent( + text_content_id, content_chunk, Status.RUNNING, node_info, Position(self.get_node_id()) + ) ) - ) if reasoning_content_chunk and model_setting.get("reasoning_content_enable", False): reasoning_setting["is_reasoning"] = True self.write(