Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f895d045a7 | ||
|
|
eb2e292e8e | ||
|
|
8f378e7fc9 | ||
|
|
497e17ec62 | ||
|
|
0a421dbb9d | ||
|
|
be15d42d93 | ||
|
|
450857dee8 | ||
|
|
0c2010c348 | ||
|
|
f796e7b3a8 | ||
|
|
f5cc7953f4 | ||
|
|
710aa53562 | ||
|
|
c1cb14b938 | ||
|
|
a94c6e37a0 |
@@ -13,6 +13,7 @@ type Friend struct {
|
||||
Pinyin string `json:"pinyin"` // 昵称拼音大写首字母
|
||||
PinyinAll string `json:"pinyinAll"` // 昵称全拼
|
||||
EnableAi bool `json:"enableAI" gorm:"type:tinyint(1) default 0 not null"` // 是否使用AI
|
||||
AiModel string `json:"aiModel"` // AI模型
|
||||
EnableChatRank bool `json:"enableChatRank" gorm:"type:tinyint(1) default 0 not null"` // 是否使用聊天排行
|
||||
EnableWelcome bool `json:"enableWelcome" gorm:"type:tinyint(1) default 0 not null"` // 是否启用迎新
|
||||
IsOk bool `json:"isOk" gorm:"type:tinyint(1) default 0 not null"` // 是否正常
|
||||
|
||||
@@ -28,9 +28,13 @@ 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
|
||||
}
|
||||
// 判断有没有启用AI
|
||||
if !friendInfo.EnableAi {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -93,7 +97,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
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ type FriendItem struct {
|
||||
PinyinAll string // 昵称全拼
|
||||
Wxid string // 微信原始Id
|
||||
EnableAi bool // 是否使用AI
|
||||
AiModel string // AI模型
|
||||
EnableChatRank bool // 是否使用聊天排行
|
||||
EnableWelcome bool // 是否使用迎新
|
||||
EnableCommand bool // 是否启用指令
|
||||
|
||||
Reference in New Issue
Block a user