From 2244526a974fb1cde069b25420488c350af450ae Mon Sep 17 00:00:00 2001 From: Ghostz <137054651+ye4293@users.noreply.github.com> Date: Sun, 17 Mar 2024 02:37:33 +0800 Subject: [PATCH 1/2] Update model-ratio.go --- common/model-ratio.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/model-ratio.go b/common/model-ratio.go index 5e7d5729..e2e1a2fd 100644 --- a/common/model-ratio.go +++ b/common/model-ratio.go @@ -133,9 +133,9 @@ var ModelRatio = map[string]float64{ "mixtral-8x7b-32768": 0.27 / 1000 * USD, "gemma-7b-it": 0.1 / 1000 * USD, // https://platform.lingyiwanwu.com/docs#-计费单元 - "yi-34b-chat-0205": 2.5 / 1000000 * RMB, - "yi-34b-chat-200k": 12.0 / 1000000 * RMB, - "yi-vl-plus": 6.0 / 1000000 * RMB, + "yi-34b-chat-0205": 2.5 / 1000 * RMB, + "yi-34b-chat-200k": 12.0 / 1000 * RMB, + "yi-vl-plus": 6.0 / 1000 * RMB, } var CompletionRatio = map[string]float64{} From c0cbfa898e7be846cba71dffae9579d22bbc8bfa Mon Sep 17 00:00:00 2001 From: Ghostz <137054651+ye4293@users.noreply.github.com> Date: Tue, 2 Apr 2024 01:03:28 +0800 Subject: [PATCH 2/2] Update misc.go --- controller/misc.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/controller/misc.go b/controller/misc.go index f27fdb12..544fd6b7 100644 --- a/controller/misc.go +++ b/controller/misc.go @@ -83,17 +83,27 @@ func SendEmailVerification(c *gin.Context) { return } if config.EmailDomainRestrictionEnabled { + parts := strings.Split(email, "@") + localPart := parts[0] + domainPart := parts[1] + + containsSpecialSymbols := strings.Contains(localPart, "+") || strings.Count(localPart, ".") > 1 allowed := false for _, domain := range config.EmailDomainWhitelist { - if strings.HasSuffix(email, "@"+domain) { + if domainPart == domain { allowed = true break } } - if !allowed { + if allowed && !containsSpecialSymbols { + c.JSON(http.StatusOK, gin.H{ + "success": true, + "message": "Your email address is allowed.", + }) + } else { c.JSON(http.StatusOK, gin.H{ "success": false, - "message": "管理员启用了邮箱域名白名单,您的邮箱地址的域名不在白名单中", + "message": "The administrator has enabled the email domain name whitelist, and your email address is not allowed due to special symbols or it's not in the whitelist.", }) return }