diff --git a/plugin/plugins/ai.go b/plugin/plugins/ai.go index 814a3074..7d7410e1 100644 --- a/plugin/plugins/ai.go +++ b/plugin/plugins/ai.go @@ -19,8 +19,12 @@ import ( "time" ) +// 已经通知过的群组或者好友map var notifyMap = make(map[string]bool) +// 拉取最近消息条数 +const fetchMessageCount = 20 + // AI // @description: AI消息 // @param m @@ -198,7 +202,7 @@ func getGroupUserMessages(msgId int64, groupId, groupUserId string) (records []e Where("create_at >= DATE_SUB(NOW(),INTERVAL 30 MINUTE)"). Where(subQuery). Order("create_at desc"). - Limit(4).Find(&records) + Limit(fetchMessageCount).Find(&records) return } @@ -214,6 +218,6 @@ func getUserPrivateMessages(userId string) (records []entity.Message) { Where("create_at >= DATE_SUB(NOW(),INTERVAL 30 MINUTE)"). Where(subQuery). Order("create_at desc"). - Limit(4).Find(&records) + Limit(fetchMessageCount).Find(&records) return }