Explorar o código

fix: close connection when response ended

JustSong %!s(int64=2) %!d(string=hai) anos
pai
achega
065147b440
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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
 			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
 			}
 			}
 		}
 		}