From 2ec4d284b6c82132c009a27f911dc45e2216b8ca Mon Sep 17 00:00:00 2001 From: mango Date: Tue, 7 Jan 2025 12:42:37 +0800 Subject: [PATCH] fix(batch add model list): fix the issue of fetching model list failure in batch add channel --- controller/channel.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/channel.go b/controller/channel.go index 62f5bc69..f3ec6b3a 100644 --- a/controller/channel.go +++ b/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 {