Loyal-Young opened a new issue, #5184:
URL: https://github.com/apache/rocketmq-dashboard/issues/5184

   ### Bug
   
   The AI run-stream parser recognizes event boundaries only when both line 
endings use the same style (`CRLF+CRLF`, `LF+LF`, or `CR+CR`). The SSE wire 
format permits each line to end in CRLF, LF, or CR independently. An event 
terminated by `LF+CRLF` is therefore a valid event, but the parser concatenates 
it with the next event. For a JSON `agent` frame followed by `done`, it raises 
`llm.stream.malformed_event` instead of delivering the agent frame.
   
   ### Reproduction
   
   Return `event: agent\ndata: {"type":"text_delta","content":"hello"}\n\r\n` 
followed by a normal `done` frame. The focused test on current `master` fails 
because the first JSON payload is joined with the `done` payload.
   
   ### Expected behavior
   
   Detect a blank line made from any two valid SSE line endings and dispatch 
the first frame separately. A single CRLF is only one line ending and must not 
be mistaken for a blank line.
   
   ### Reference
   
   The WHATWG [HTML Standard, parsing an event 
stream](https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation)
 defines CRLF, LF, and CR as valid line endings.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to