Skip to content

Commit

Permalink
fix: ignore data if not have proper prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Jul 30, 2023
1 parent ec88c0c commit 8cbbeb7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controller/relay-openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func openaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*O
if len(data) < 6 { // ignore blank line or wrong format
continue
}
if data[:6] != "data: " && data[:6] != "[DONE]" {
continue
}
dataChan <- data
data = data[6:]
if !strings.HasPrefix(data, "[DONE]") {
Expand Down

0 comments on commit 8cbbeb7

Please sign in to comment.