From 0ab5328babe5073fac44780d138549468b103818 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Sat, 22 Mar 2025 17:30:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ai=E5=AF=B9=E8=AF=9D=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/imService.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/service/imService.go b/service/imService.go index 3033f6a..607a62c 100644 --- a/service/imService.go +++ b/service/imService.go @@ -92,7 +92,10 @@ func WSReceiveMessageService(userID, sessionID int, channel string, msg proto.WS log.Println("get ollama client error:", err) } prompt := msg.Msg - actx, _ := actxMap[sessionID] + actx, ok := actxMap[sessionID] + if ok { + log.Println("actx has get will use:", len(actx)) + } req := &api.GenerateRequest{ Model: "qwen2.5:0.5b", Context: actx, @@ -112,6 +115,7 @@ func WSReceiveMessageService(userID, sessionID int, channel string, msg proto.WS actxMap = make(map[int][]int) } actxMap[sessionID] = actx + log.Println("actx has save:", len(actxMap[sessionID])) //创建消息 err2, msgID := CreateMessage(2, sessionID, 2, userID, robotMsg, 1) //机器人id为2,消息类型为2,状态为1 if err2 != nil {