mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-12 04:03:42 +08:00
实现 API Key 负载均衡,修复 WebSocket session 失效问题
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"openai/types"
|
||||
"openai/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -91,7 +92,9 @@ func (s *Server) ConfigSetHandle(c *gin.Context) {
|
||||
}
|
||||
|
||||
if token, ok := data["token"]; ok {
|
||||
s.Config.Tokens = append(s.Config.Tokens, token)
|
||||
if !utils.ContainsItem(s.Config.Tokens, token) {
|
||||
s.Config.Tokens = append(s.Config.Tokens, token)
|
||||
}
|
||||
}
|
||||
|
||||
// 保存配置文件
|
||||
|
||||
Reference in New Issue
Block a user