From 9767abae89653c091881f1495742d304583217e7 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 12:46:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=202.2=20=E4=B8=BB=E5=8A=A8=E8=AF=9D?= =?UTF-8?q?=E9=A2=98=E5=8F=91=E8=B5=B7=20=E2=80=94=20=E8=BD=BB=E9=87=8F?= =?UTF-8?q?=E6=80=9D=E8=80=83=E6=89=A9=E5=B1=95=E3=80=90=E8=AF=9D=E9=A2=98?= =?UTF-8?q?=E5=8F=91=E8=B5=B7=E3=80=91=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 轻量思考 prompt 新增话题发起指引 - 检测【话题发起】标记 → 提取内容 → 通过 messagePusher 推送 - 遵循 ProactiveGuard 频率控制 Co-Authored-By: Claude --- .../ai-core/internal/background/thinker.go | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 周期性自主思考循环