kobe6258 1 月之前
父節點
當前提交
ff9f4bf408
共有 2 個文件被更改,包括 3 次插入4 次删除
  1. 1 1
      services/ws_service.go
  2. 2 3
      utils/llm/eta_llm/eta_llm_client.go

+ 1 - 1
services/ws_service.go

@@ -19,7 +19,7 @@ func WsAuthenticate() web.FilterFunc {
 	return func(ctx *context.Context) {
 		method := ctx.Input.Method()
 		uri := ctx.Input.URI()
-		if method == "POST" || method == "GET" {
+		if method == "GET" {
 			authorization := ctx.Input.Header("authorization")
 			if authorization == "" {
 				authorization = ctx.Input.Header("Authorization")

+ 2 - 3
utils/llm/eta_llm/eta_llm_client.go

@@ -151,9 +151,7 @@ func parseResponse(response *http.Response) (baseResp eta_llm_http.BaseResponse,
 func ParseStreamResponse(response *http.Response) (contentChan chan string, errChan chan error, closeChan chan struct{}) {
 	defer func() {
 		_ = response.Body.Close()
-		defer close(contentChan)
-		defer close(errChan)
-		defer close(closeChan)
+
 	}()
 	contentChan = make(chan string, 10)
 	errChan = make(chan error, 10)
@@ -161,6 +159,7 @@ func ParseStreamResponse(response *http.Response) (contentChan chan string, errC
 	go func() {
 		defer close(contentChan)
 		defer close(errChan)
+		defer close(closeChan)
 		scanner := bufio.NewScanner(response.Body)
 		scanner.Split(bufio.ScanLines)
 		for scanner.Scan() {