fix(stream): use io.EOF instead of errors.New("EOF") in SSEReader

errors.New("EOF") creates a distinct error instance that doesn't match
io.EOF, causing processRawHTTPStream to silently ignore normal stream
termination without sending a done response.

- SSEReader: return io.EOF instead of errors.New("EOF")
- processRawHTTPStream: handle io.EOF as normal completion, send done
  response with usage/toolCalls (aligned with processStream behavior)

Fixes #860
This commit is contained in:
nullkey
2026-04-02 17:03:13 +08:00
committed by lyingbug
parent cb36570cde
commit d68c94a11a
2 changed files with 15 additions and 3 deletions
+1 -2
View File
@@ -2,7 +2,6 @@ package chat
import (
"bufio"
"errors"
"io"
"strings"
)
@@ -55,5 +54,5 @@ func (r *SSEReader) ReadEvent() (*SSEEvent, error) {
return nil, err
}
return nil, errors.New("EOF")
return nil, io.EOF
}