Merge pull request '🐛 Fix a bug.' (#60) from hotfix into main
All checks were successful
BuildImage / build-image (push) Successful in 1m20s
All checks were successful
BuildImage / build-image (push) Successful in 1m20s
Reviewed-on: #60
This commit is contained in:
commit
44b8e4a162
@ -48,8 +48,23 @@ func AI(m *plugin.MessageContext) {
|
|||||||
|
|
||||||
// 处理预设角色,默认是配置文件里的,如果数据库配置不为空,则使用数据库配置
|
// 处理预设角色,默认是配置文件里的,如果数据库配置不为空,则使用数据库配置
|
||||||
prompt := config.Conf.Ai.Personality
|
prompt := config.Conf.Ai.Personality
|
||||||
|
var dbPrompt entity.AiAssistant
|
||||||
if friendInfo.Prompt != "" {
|
if friendInfo.Prompt != "" {
|
||||||
prompt = friendInfo.Prompt
|
// 取出配置的角色
|
||||||
|
client.MySQL.First(&dbPrompt, "id = ?", friendInfo.Prompt)
|
||||||
|
if dbPrompt.Id != "" {
|
||||||
|
prompt = dbPrompt.Personality
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 配置模型
|
||||||
|
chatModel := openai.GPT3Dot5Turbo0613
|
||||||
|
if friendInfo.AiModel != "" {
|
||||||
|
chatModel = friendInfo.AiModel
|
||||||
|
} else if dbPrompt.Model != "" {
|
||||||
|
chatModel = dbPrompt.Model
|
||||||
|
} else if config.Conf.Ai.Model != "" {
|
||||||
|
chatModel = config.Conf.Ai.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组装消息体
|
// 组装消息体
|
||||||
@ -101,14 +116,6 @@ func AI(m *plugin.MessageContext) {
|
|||||||
Content: m.Content,
|
Content: m.Content,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 配置模型
|
|
||||||
chatModel := openai.GPT3Dot5Turbo0613
|
|
||||||
if friendInfo.AiModel != "" {
|
|
||||||
chatModel = friendInfo.AiModel
|
|
||||||
} else if config.Conf.Ai.Model != "" {
|
|
||||||
chatModel = config.Conf.Ai.Model
|
|
||||||
}
|
|
||||||
|
|
||||||
// 默认使用AI回复
|
// 默认使用AI回复
|
||||||
conf := openai.DefaultConfig(config.Conf.Ai.ApiKey)
|
conf := openai.DefaultConfig(config.Conf.Ai.ApiKey)
|
||||||
if config.Conf.Ai.BaseUrl != "" {
|
if config.Conf.Ai.BaseUrl != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user