Skip to content

Commit

Permalink
fix: bug of last reply in characterAi module
Browse files Browse the repository at this point in the history
  • Loading branch information
PICOF committed Jan 2, 2023
1 parent 9b4f2c8 commit f89cb97
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aiTalk/msgDistribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ func EstablishCoversation(ws *websocket.Conn, botNum int, uid int64, groupId int
} else {
chat = BotMap[strconv.FormatInt(uid, 10)+botId].(*AiChat)
chat.Renew()
myUtil.SendGroupMessage(ws, groupId, "请继续说吧,我们上次聊到哪里了?\n("+chat.LastReply.Replies[chat.LastReply.Index].Text+")")
len := len(chat.LastReply.Replies)
if len != 0 {
myUtil.SendGroupMessage(ws, groupId, "请继续说吧,我们上次聊到哪里了?\n("+chat.LastReply.Replies[chat.LastReply.Index%len].Text+")")
} else {
BotMap[strconv.FormatInt(uid, 10)+botId] = nil
myUtil.SendGroupMessage(ws, groupId, "会话连接出现了意外问题!请尝试重新连接")
}

}
for {
select {
Expand Down

0 comments on commit f89cb97

Please sign in to comment.