feat: different AI model consuming different amounts of use_calls

This commit is contained in:
RockYang
2023-10-26 14:38:06 +08:00
parent 7ccb4c5f06
commit 7677ae254f
9 changed files with 27 additions and 16 deletions

View File

@@ -167,9 +167,7 @@ func (h *ChatHandler) sendXunFeiMessage(
// 消息发送成功
if len(contents) > 0 {
// 更新用户的对话次数
if userVo.ChatConfig.ApiKeys[session.Model.Platform] == "" {
h.db.Model(&model.User{}).Where("id = ?", userVo.Id).UpdateColumn("calls", gorm.Expr("calls - ?", 1))
}
h.subUserCalls(userVo, session)
if message.Role == "" {
message.Role = "assistant"