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}) + } } }() }