Fix Unnecessary Newline Characters in Extracted Tool Response Text (#4646)

Co-authored-by: kronus <kronus@istarshine.com>
This commit is contained in:
kronus-ho 2024-05-25 15:24:59 +08:00 committed by GitHub
parent f804adbff3
commit f56b984d97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,11 +173,12 @@ class ToolNode(BaseNode):
"""
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]]: