From a2078b6662fbc5ab345f8820b8e427070c49768d Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 20:01:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BB=E5=8A=A8=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=86=99=E5=9B=9E=E5=AF=B9=E8=AF=9D=E5=8E=86=E5=8F=B2=20?= =?UTF-8?q?=E2=80=94=20=E9=98=B2=E6=AD=A2=E7=9F=AD=E6=9C=9F=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=8F=90=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - storeThought 推送主动消息后写入 convStore - 轻量思考话题发起后也写入 - 配合提示词规则: 两小时内不重复问同类话题 Co-Authored-By: Claude --- backend/ai-core/internal/background/thinker.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/ai-core/internal/background/thinker.go b/backend/ai-core/internal/background/thinker.go index 7f2f57b..9f22a0f 100644 --- a/backend/ai-core/internal/background/thinker.go +++ b/backend/ai-core/internal/background/thinker.go @@ -929,6 +929,9 @@ func (t *Thinker) performLightThink() { t.mu.Unlock() if pusher != nil && canPush { go pusher(t.adminUserID, sessionID, topic) + if t.convStore != nil && sessionID != "" { + t.convStore.AddMessage(sessionID, model.LLMMessage{Role: model.RoleAssistant, Content: topic}) + } } } } @@ -1873,9 +1876,15 @@ func (t *Thinker) storeThought(content string, toolCallsJSON string, toolCallCou log.Printf("[后台思考] 推送平台主动消息: target=%s/%s user=%s group=%s msg=%s", targetCopy.Platform, targetCopy.ChatType, targetCopy.UserID, targetCopy.GroupID, proactiveMsg) platformPusher(*targetCopy, proactiveMsg) + if t.convStore != nil && pushSessionID != "" { + t.convStore.AddMessage(pushSessionID, model.LLMMessage{Role: model.RoleAssistant, Content: proactiveMsg}) + } } else { - log.Printf("[后台思考] 推送主动消息: %s", proactiveMsg) + log.Printf("[后台思考] 推送主动消息: %%s", proactiveMsg) pusher(t.adminUserID, pushSessionID, proactiveMsg) + if t.convStore != nil && pushSessionID != "" { + t.convStore.AddMessage(pushSessionID, model.LLMMessage{Role: model.RoleAssistant, Content: proactiveMsg}) + } } }() }