Skip to content

fix(model): preserve SSE data alongside comments and ignored fields #397

Closed

Description

@WH-2099

_handle_generate_stream_response drops an entire SSE event when its first line is a comment:

: heartbeat
data: {"choices":[{"delta":{"content":"Answer"},"finish_reason":"stop"}]}

This should produce Answer with finish reason stop.
Unknown fields before data and standalone id: events are also rejected.
Still present in the #396 merge (a91e6b4a).
#396 closed this issue on merge; a separate fix is still required.

  • Ignore comments line by line, unknown fields and events without data, following the SSE rules.
  • Preserve data around comments, usage, [DONE] and response cleanup across fragmented input.
  • Cover existing raw JSON, custom delimiters, encodings and EOF behavior when changing the parser.

Update the existing regression tests on main to expect the corrected output.
From #394 and the review in #396.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions