feat: 2.2 主动话题发起 — 轻量思考扩展【话题发起】输出
- 轻量思考 prompt 新增话题发起指引 - 检测【话题发起】标记 → 提取内容 → 通过 messagePusher 推送 - 遵循 ProactiveGuard 频率控制 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -828,7 +828,9 @@ func (t *Thinker) performLightThink() {
|
|||||||
|
|
||||||
请用一句话在心里判断:
|
请用一句话在心里判断:
|
||||||
1. 开拓者有什么需要立即关注的事情吗?(提醒、设备状态、情绪变化)
|
1. 开拓者有什么需要立即关注的事情吗?(提醒、设备状态、情绪变化)
|
||||||
2. 如果有紧急事项,输出【需要深思】标记;如果一切正常,输出一个字的感受即可。
|
2. 如果想起之前聊过的某件事可以追问(如"上周说的面试怎么样了"),输出【话题发起】+ 你要说的话
|
||||||
|
3. 如果有紧急事项,输出【需要深思】标记
|
||||||
|
4. 如果一切正常,输出一个字的感受即可。
|
||||||
|
|
||||||
注意:只需要极简判断,不要长篇反思。`, now.Format("15:04"))
|
注意:只需要极简判断,不要长篇反思。`, now.Format("15:04"))
|
||||||
|
|
||||||
@@ -864,6 +866,25 @@ func (t *Thinker) performLightThink() {
|
|||||||
log.Println("[轻量思考] 距上次深度思考太近,跳过唤醒")
|
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 周期性自主思考循环
|
// periodicThinkLoop 周期性自主思考循环
|
||||||
|
|||||||
Reference in New Issue
Block a user