tmp #99

Merged
李寻欢 merged 51 commits from tmp into hotfix 2024-08-20 16:45:07 +08:00
Showing only changes of commit c7f1bf8f23 - Show all commits

View File

@ -10,6 +10,7 @@ import (
"go-wechat/utils" "go-wechat/utils"
"log" "log"
"strings" "strings"
"time"
) )
// AiSummary // AiSummary
@ -22,6 +23,9 @@ func AiSummary() {
} }
for _, group := range groups { for _, group := range groups {
// 记录开始时间
var start = time.Now()
// 获取对话记录 // 获取对话记录
var records []vo.TextMessageItem var records []vo.TextMessageItem
if records, err = service.GetTextMessagesById(group.Wxid); err != nil { if records, err = service.GetTextMessagesById(group.Wxid); err != nil {
@ -86,5 +90,10 @@ func AiSummary() {
replyMsg := fmt.Sprintf("#昨日消息总结\n又是一天过去了让我们一起来看看昨儿群友们都聊了什么有趣的话题吧~\n\n%s", resp.Choices[0].Message.Content) replyMsg := fmt.Sprintf("#昨日消息总结\n又是一天过去了让我们一起来看看昨儿群友们都聊了什么有趣的话题吧~\n\n%s", resp.Choices[0].Message.Content)
//log.Printf("群[%s]对话记录总结成功,总结内容: %s", group.Wxid, replyMsg) //log.Printf("群[%s]对话记录总结成功,总结内容: %s", group.Wxid, replyMsg)
utils.SendMessage(group.Wxid, "", replyMsg, 0) utils.SendMessage(group.Wxid, "", replyMsg, 0)
// 判断耗时是否达到15秒不足就等待
if used := time.Now().Sub(start); used < 15*time.Second {
time.Sleep(15*time.Second - used)
}
} }
} }