瀏覽代碼

fix(batch add model list): fix the issue of fetching model list failure in batch add channel

mango 1 年之前
父節點
當前提交
2ec4d284b6
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      controller/channel.go

+ 5 - 1
controller/channel.go

@@ -539,7 +539,11 @@ func FetchModels(c *gin.Context) {
 		return
 	}
 
-	request.Header.Set("Authorization", "Bearer "+req.Key)
+	// remove line breaks and extra spaces.
+	key := strings.TrimSpace(req.Key)
+	// If the key contains a line break, only take the first part.
+	key = strings.Split(key, "\n")[0]
+	request.Header.Set("Authorization", "Bearer "+key)
 
 	response, err := client.Do(request)
 	if err != nil {