Skip to content

Commit 34ba613

Browse files
author
mobiusy
committed
fix(http_request_stream): 修复事件流数据处理中的空格问题
移除对data字段的多余strip操作,保持原始数据格式。修复错误事件处理时可能因多余空格导致的问题。
1 parent 44e9702 commit 34ba613

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

http_request_stream/tools/http_request_stream.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,13 @@ def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessag
106106
if raw_line is None:
107107
continue
108108
line = raw_line.decode("utf-8") if isinstance(raw_line, bytes) else raw_line
109-
line = line.strip()
110109
if not line:
111110
continue
112111
if line.startswith("event:"):
113112
current_event = line[6:].strip()
114113
continue
115-
if line.startswith("data:"):
116-
line = line[5:].strip()
114+
if line.startswith("data: "):
115+
line = line[6:]
117116
if current_event == "error" and line:
118117
err_msg = line
119118
yield self.create_variable_message("error", err_msg)

0 commit comments

Comments
 (0)