fix: stream with empty line

This commit is contained in:
Yeuoly 2024-09-24 16:02:01 +08:00
parent 947bfdc807
commit fb3a701c86
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61
2 changed files with 4 additions and 3 deletions

View File

@ -56,7 +56,8 @@ class BasePluginManager:
line = line.decode("utf-8").strip()
if line.startswith("data:"):
line = line[5:].strip()
yield line
if line:
yield line
def _stream_request_with_model(
self,

View File

@ -212,8 +212,8 @@ class ToolNode(BaseNode):
chunk_content=message.message.text, from_variable_selector=[self.node_id, "text"]
)
elif message.type == ToolInvokeMessage.MessageType.JSON:
assert isinstance(message, ToolInvokeMessage.JsonMessage)
json.append(message.json_object)
assert isinstance(message.message, ToolInvokeMessage.JsonMessage)
json.append(message.message.json_object)
elif message.type == ToolInvokeMessage.MessageType.LINK:
assert isinstance(message.message, ToolInvokeMessage.TextMessage)
stream_text = f"Link: {message.message.text}\n"