Pārlūkot izejas kodu

fix: close connection when response ended

JustSong 2 gadi atpakaļ
vecāks
revīzija
065147b440
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      controller/relay-xunfei.go

+ 4 - 0
controller/relay-xunfei.go

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