refactor(perceive): return Instant in showLastInteract

This commit is contained in:
2026-03-19 23:16:02 +08:00
parent ccb7041093
commit 3cc6e8df99
3 changed files with 6 additions and 4 deletions

View File

@@ -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();
}

View File

@@ -37,8 +37,8 @@ public class PerceiveCore extends PartnerCore<PerceiveCore> {
}
@CapabilityMethod
public long showLastInteract() {
return lastInteractTime.toEpochMilli();
public Instant showLastInteract() {
return lastInteractTime;
}
@Override

View File

@@ -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] 记忆更新: 自动触发");
}