feat: performThink 10s休闲检查 + IsUserRecentlyActive — 后台让步前台

This commit is contained in:
2026-06-23 21:52:02 +08:00
parent e83bd6febb
commit fab934fb12
@@ -408,6 +408,15 @@ func (t *Thinker) PushPlatformMessage(target ProactiveTarget, message string) {
} }
} }
// IsUserRecentlyActive returns true if the user has been active within the given duration.
func (t *Thinker) IsUserRecentlyActive(d time.Duration) bool {
t.mu.Lock()
defer t.mu.Unlock()
return time.Since(t.lastUserMessage) < d
}
// ThinkerConfig 后台思考配置 // ThinkerConfig 后台思考配置
type ThinkerConfig struct { type ThinkerConfig struct {
Enabled bool Enabled bool