🔧 新增数据库配置模型

This commit is contained in:
李寻欢
2024-01-22 08:31:38 +08:00
parent 0a421dbb9d
commit 497e17ec62
3 changed files with 8 additions and 4 deletions

View File

@@ -28,9 +28,9 @@ func AI(m *plugin.MessageContext) {
}
// 取出所有启用了AI的好友或群组
var count int64
client.MySQL.Model(&entity.Friend{}).Where("enable_ai IS TRUE").Where("wxid = ?", m.FromUser).Count(&count)
if count < 1 {
var friendInfo entity.Friend
client.MySQL.Where("wxid = ?", m.FromUser).First(&friendInfo)
if friendInfo.Wxid == "" {
return
}
@@ -93,7 +93,9 @@ func AI(m *plugin.MessageContext) {
// 配置模型
chatModel := openai.GPT3Dot5Turbo0613
if config.Conf.Ai.Model != "" {
if friendInfo.AiModel != "" {
chatModel = friendInfo.AiModel
} else if config.Conf.Ai.Model != "" {
chatModel = config.Conf.Ai.Model
}