Skip to content

Commit

Permalink
Merge pull request #1 from byte911/return_usage
Browse files Browse the repository at this point in the history
Return the usage info
  • Loading branch information
byte911 committed Sep 6, 2024
2 parents f977469 + 18031ae commit dfbbbab
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 dfbbbab

Please sign in to comment.