From fab934fb12b6d4f8e6db119435f6f6972e5ce522 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 21:52:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20performThink=2010s=E4=BC=91=E9=97=B2?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=20+=20IsUserRecentlyActive=20=E2=80=94=20?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E8=AE=A9=E6=AD=A5=E5=89=8D=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/ai-core/internal/background/thinker.go | 9 +++++++++ 1 file changed, 9 insertions(+) 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