From f3e2f6e429b1b97e48f3e8980dfca598a6cce63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Mon, 19 Aug 2024 11:49:16 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20AI=E5=AF=B9=E8=AF=9D=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=95=B0=E9=87=8F=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?20=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/plugins/ai.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/plugins/ai.go b/plugin/plugins/ai.go index 814a307..7d7410e 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 }