Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit adeafd0

Browse files
author
玄浩
committedMar 4, 2025·
fix: ci error report
1 parent ffb0c0e commit adeafd0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎stream_reader.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ var (
1515
errorPrefix = []byte(`{"error":`)
1616
)
1717

18+
const (
19+
splitParts = 2
20+
)
21+
1822
type streamable interface {
1923
ChatCompletionStreamResponse | CompletionResponse
2024
}
@@ -74,9 +78,9 @@ func (stream *streamReader[T]) processLines() ([]byte, error) {
7478

7579
var value []byte
7680

77-
split := bytes.SplitN(noSpaceLine, []byte(":"), 2)
81+
split := bytes.SplitN(noSpaceLine, []byte(":"), splitParts)
7882

79-
if len(split) != 2 || !bytes.Equal(split[0], dataField) {
83+
if len(split) != splitParts || !bytes.Equal(split[0], dataField) {
8084
dataFieldNotFound = true
8185
} else {
8286
value = split[1]

0 commit comments

Comments
 (0)
Please sign in to comment.