Skip to content

Commit

Permalink
fix no finish_reason
Browse files Browse the repository at this point in the history
  • Loading branch information
xqdoo00o committed May 28, 2024
1 parent ff409b6 commit abdd3b1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/chatgpt/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ func Handler(c *gin.Context, response *http.Response, secret *tokens.Secret, pro
continue
}
}
if original_response.Message.EndTurn != nil {
if original_response.Message.EndTurn != nil && !original_response.Message.EndTurn.(bool) {
msgId = ""
}
if len(original_response.Message.Metadata.Citations) != 0 {
Expand Down Expand Up @@ -734,11 +734,10 @@ func Handler(c *gin.Context, response *http.Response, secret *tokens.Secret, pro
if response_string == "" {
response_string = chatgpt_response_converter.ConvertToString(&original_response, &previous_text, isRole)
}
if response_string == "" {
continue
if isRole && response_string != "" {
isRole = false
}
isRole = false
if stream {
if stream && response_string != "" {
_, err = c.Writer.WriteString(response_string)
if err != nil {
return "", nil
Expand Down

0 comments on commit abdd3b1

Please sign in to comment.