增加语音合成功能

This commit is contained in:
RockYang
2025-04-01 17:03:51 +08:00
parent afb9193985
commit ff69cb231a
20 changed files with 216 additions and 88 deletions

View File

@@ -30,14 +30,17 @@ func NewChatModelHandler(app *core.AppServer, db *gorm.DB) *ChatModelHandler {
func (h *ChatModelHandler) List(c *gin.Context) {
var items []model.ChatModel
var chatModels = make([]vo.ChatModel, 0)
session := h.DB.Session(&gorm.Session{}).Where("type", "chat").Where("enabled", true)
session := h.DB.Session(&gorm.Session{}).Where("enabled", true)
t := c.Query("type")
logger.Info("type: ", t)
if t != "" {
session = session.Where("type", t)
} else {
session = session.Where("type", "chat")
}
session = session.Where("open", true)
if h.IsLogin(c) {
if h.IsLogin(c) && t == "chat" {
user, _ := h.GetLoginUser(c)
var models []int
err := utils.JsonDecode(user.ChatModels, &models)
@@ -48,7 +51,7 @@ func (h *ChatModelHandler) List(c *gin.Context) {
}
res := session.Order("sort_num ASC").Find(&items)
res := session.Debug().Order("sort_num ASC").Find(&items)
if res.Error == nil {
for _, item := range items {
var cm vo.ChatModel