diff --git a/backend/ai-core/internal/background/thinker.go b/backend/ai-core/internal/background/thinker.go index d242232..1e31b65 100644 --- a/backend/ai-core/internal/background/thinker.go +++ b/backend/ai-core/internal/background/thinker.go @@ -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 后台思考配置 type ThinkerConfig struct { Enabled bool