Skip to content

Commit

Permalink
fix: return the usage info if not null (#1792)
Browse files Browse the repository at this point in the history
Usage is missing.
  • Loading branch information
byte911 authored and songquanpeng committed Sep 22, 2024
1 parent a216810 commit 88acc5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions relay/adaptor/openai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func StreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*model.E
render.StringData(c, data) // if error happened, pass the data to client
continue // just ignore the error
}
if len(streamResponse.Choices) == 0 {
// but for empty choice, we should not pass it to client, this is for azure
if len(streamResponse.Choices) == 0 && streamResponse.Usage == nil {
// but for empty choice and no usage, we should not pass it to client, this is for azure
continue // just ignore empty choice
}
render.StringData(c, data)
Expand Down

0 comments on commit 88acc5a

Please sign in to comment.