Merge pull request #4 from syui/claude/ai-memory-system-011CUps6H1mBNe6zxKdkcyUj

Fix compilation errors in Layer 4 caching
This commit is contained in:
syui
2025-11-06 19:04:05 +09:00
committed by GitHub
3 changed files with 6 additions and 3 deletions

View File

@@ -19,6 +19,9 @@ pub enum MemoryError {
#[error("Configuration error: {0}")] #[error("Configuration error: {0}")]
Config(String), Config(String),
#[error("Parse error: {0}")]
Parse(String),
} }
pub type Result<T> = std::result::Result<T, MemoryError>; pub type Result<T> = std::result::Result<T, MemoryError>;

View File

@@ -530,7 +530,7 @@ impl MemoryStore {
.map_err(|e| MemoryError::Parse(e.to_string()))? .map_err(|e| MemoryError::Parse(e.to_string()))?
.with_timezone(&Utc); .with_timezone(&Utc);
let age_minutes = (Utc::now() - cached_at).num_minutes(); let age_minutes = (Utc::now() - cached_at).num_seconds() / 60;
if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES { if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES {
let relationship: super::relationship::RelationshipInference = let relationship: super::relationship::RelationshipInference =
@@ -582,7 +582,7 @@ impl MemoryStore {
.map_err(|e| MemoryError::Parse(e.to_string()))? .map_err(|e| MemoryError::Parse(e.to_string()))?
.with_timezone(&Utc); .with_timezone(&Utc);
let age_minutes = (Utc::now() - cached_at).num_minutes(); let age_minutes = (Utc::now() - cached_at).num_seconds() / 60;
if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES { if age_minutes < Self::RELATIONSHIP_CACHE_DURATION_MINUTES {
let relationships: Vec<super::relationship::RelationshipInference> = let relationships: Vec<super::relationship::RelationshipInference> =

View File

@@ -2,7 +2,7 @@ use anyhow::Result;
use serde_json::{json, Value}; use serde_json::{json, Value};
use std::io::{self, BufRead, Write}; use std::io::{self, BufRead, Write};
use crate::core::{Memory, MemoryStore, UserAnalysis, RelationshipInference, infer_all_relationships, get_relationship}; use crate::core::{Memory, MemoryStore, UserAnalysis, infer_all_relationships, get_relationship};
pub struct BaseMCPServer { pub struct BaseMCPServer {
store: MemoryStore, store: MemoryStore,