chore: use StringContent() to convert response to text

This commit is contained in:
JustSong 2024-04-27 15:41:02 +08:00
parent ef88497f25
commit 04b49aa0ec

View File

@ -274,7 +274,7 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusC
if response == nil { if response == nil {
return true return true
} }
responseText += fmt.Sprintf("%v", response.Choices[0].Delta.Content) responseText += response.Choices[0].Delta.StringContent()
jsonResponse, err := json.Marshal(response) jsonResponse, err := json.Marshal(response)
if err != nil { if err != nil {
logger.SysError("error marshalling stream response: " + err.Error()) logger.SysError("error marshalling stream response: " + err.Error())