diff --git a/backend/ai-core/internal/background/thinker.go b/backend/ai-core/internal/background/thinker.go index 2ce7955..7f2f57b 100644 --- a/backend/ai-core/internal/background/thinker.go +++ b/backend/ai-core/internal/background/thinker.go @@ -524,11 +524,14 @@ func (t *Thinker) restoreContext() { latest = m.CreatedAt } } - if !latest.IsZero() { + // Only use if reasonably recent (within 24h). Old memories don't represent user activity. + if !latest.IsZero() && time.Since(latest) < 24*time.Hour { t.mu.Lock() t.lastUserMessage = latest t.mu.Unlock() log.Printf("[后台思考] 上下文已恢复: 最近活动 %v 前", time.Since(latest).Round(time.Second)) + } else if !latest.IsZero() { + log.Printf("[后台思考] 上下文恢复跳过: 最近记忆 %v 前(>24h),使用默认值", time.Since(latest).Round(time.Second)) } }