diff --git a/backend/ai-core/internal/background/thinker.go b/backend/ai-core/internal/background/thinker.go index 4ec72e6..cdcb302 100644 --- a/backend/ai-core/internal/background/thinker.go +++ b/backend/ai-core/internal/background/thinker.go @@ -828,7 +828,9 @@ func (t *Thinker) performLightThink() { 请用一句话在心里判断: 1. 开拓者有什么需要立即关注的事情吗?(提醒、设备状态、情绪变化) -2. 如果有紧急事项,输出【需要深思】标记;如果一切正常,输出一个字的感受即可。 +2. 如果想起之前聊过的某件事可以追问(如"上周说的面试怎么样了"),输出【话题发起】+ 你要说的话 +3. 如果有紧急事项,输出【需要深思】标记 +4. 如果一切正常,输出一个字的感受即可。 注意:只需要极简判断,不要长篇反思。`, now.Format("15:04")) @@ -864,6 +866,25 @@ func (t *Thinker) performLightThink() { log.Println("[轻量思考] 距上次深度思考太近,跳过唤醒") } } + + // Check if a topic should be initiated (proactive conversation starter). + if idx := strings.Index(content, "【话题发起】"); idx >= 0 { + topic := strings.TrimSpace(content[idx+len("【话题发起】"):]) + if topic != "" { + log.Printf("[轻量思考] 话题发起: %s", topic) + t.mu.Lock() + pusher := t.messagePusher + sessionID := t.activeSessionID + if sessionID == "" { + sessionID = t.adminSessionID + } + canPush := time.Since(t.lastProactiveMsgTime) >= t.proactiveMsgMinGap + t.mu.Unlock() + if pusher != nil && canPush { + go pusher(t.adminUserID, sessionID, topic) + } + } + } } // periodicThinkLoop 周期性自主思考循环