Havoc412 ea102eef60 🆕 🐛 feat(rag): 添加释放 GLM 客户端接口并优化连接池管理
- 新增 Release 方法,用于释放 GLM 客户端连接
- 优化 GlmClientHub 结构,改用 Idle 和 Active 字段
- 更新相关路由和验证器注册
- 调整初始化逻辑,确保正确设置 Idle 和 Active 数量
2024-11-20 08:50:22 +08:00

28 lines
690 B
Go

package rag
import (
"catface/app/global/consts"
"catface/app/http/controller/web"
"catface/app/http/validator/core/data_transfer"
"catface/app/utils/response"
"github.com/gin-gonic/gin"
)
type Release struct {
Token string `form:"token" json:"token"`
}
func (r Release) CheckParams(context *gin.Context) {
if err := context.ShouldBind(&r); err != nil {
response.ValidatorError(context, err)
return
}
extraAddBindDataContext := data_transfer.DataAddContext(r, consts.ValidatorPrefix, context)
if extraAddBindDataContext == nil {
response.ErrorSystem(context, "RAG RELEASE 表单验证器json化失败", "")
} else {
(&web.Rag{}).Release(extraAddBindDataContext)
}
}