diff --git a/api/core/workflow/nodes/tool/tool_node.py b/api/core/workflow/nodes/tool/tool_node.py index a08e25db9e9eb5..edfff593dcd764 100644 --- a/api/core/workflow/nodes/tool/tool_node.py +++ b/api/core/workflow/nodes/tool/tool_node.py @@ -173,11 +173,12 @@ def _extract_tool_response_text(self, tool_response: list[ToolInvokeMessage]) -> """ Extract tool response text """ - return ''.join([ - f'{message.message}\n' if message.type == ToolInvokeMessage.MessageType.TEXT else - f'Link: {message.message}\n' if message.type == ToolInvokeMessage.MessageType.LINK else '' + return '\n'.join([ + f'{message.message}' if message.type == ToolInvokeMessage.MessageType.TEXT else + f'Link: {message.message}' if message.type == ToolInvokeMessage.MessageType.LINK else '' for message in tool_response ]) + @classmethod def _extract_variable_selector_to_variable_mapping(cls, node_data: ToolNodeData) -> dict[str, list[str]]: