feat: performThink 10s休闲检查 + IsUserRecentlyActive — 后台让步前台
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user