fix: close connection when response ended

This commit is contained in:
JustSong 2023-07-29 23:52:18 +08:00 committed by ckt1031
parent 1190c4b98c
commit fdddf3caf6

View File

@ -205,6 +205,10 @@ func xunfeiStreamHandler(c *gin.Context, textRequest GeneralOpenAIRequest, appId
} }
dataChan <- response dataChan <- response
if response.Payload.Choices.Status == 2 { if response.Payload.Choices.Status == 2 {
err := conn.Close()
if err != nil {
common.SysError("error closing websocket connection: " + err.Error())
}
break break
} }
} }