mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(perceive): return Instant in showLastInteract
This commit is contained in:
@@ -2,9 +2,11 @@ package work.slhaf.partner.core.perceive;
|
||||
|
||||
import work.slhaf.partner.api.agent.factory.capability.annotation.Capability;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Capability(value = "perceive")
|
||||
public interface PerceiveCapability {
|
||||
String refreshInteract();
|
||||
|
||||
long showLastInteract();
|
||||
Instant showLastInteract();
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public class PerceiveCore extends PartnerCore<PerceiveCore> {
|
||||
}
|
||||
|
||||
@CapabilityMethod
|
||||
public long showLastInteract() {
|
||||
return lastInteractTime.toEpochMilli();
|
||||
public Instant showLastInteract() {
|
||||
return lastInteractTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -95,7 +95,7 @@ public class MemoryUpdater extends AbstractAgentModule.Running<PartnerRunningFlo
|
||||
private void tryAutoUpdate() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
int chatCount = cognationCapability.snapshotChatMessages().size();
|
||||
if (currentTime - perceiveCapability.showLastInteract() > UPDATE_TRIGGER_INTERVAL && chatCount > 1) {
|
||||
if (currentTime - perceiveCapability.showLastInteract().toEpochMilli() > UPDATE_TRIGGER_INTERVAL && chatCount > 1) {
|
||||
triggerMemoryUpdate(true);
|
||||
log.info("[MemoryUpdater] 记忆更新: 自动触发");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user