MCPcopy Create free account
hub / github.com/astercloud/aster / detectOutdated

Method detectOutdated

pkg/memory/quality_analyzer.go:174–200  ·  view source on GitHub ↗

detectOutdated 检测过时信息

(memories []MemoryWithScore)

Source from the content-addressed store, hash-verified

172
173// detectOutdated 检测过时信息
174func (qa *QualityAnalyzer) detectOutdated(memories []MemoryWithScore) []Inconsistency {
175 inconsistencies := []Inconsistency{}
176
177 for _, mem := range memories {
178 if mem.Provenance == nil {
179 continue
180 }
181
182 age := time.Since(mem.Provenance.CreatedAt)
183
184 // 超过 180 天认为可能过时
185 if age > 180*24*time.Hour {
186 severity := math.Min(age.Hours()/(365*24), 1.0) // 1年=100%严重
187
188 inconsistencies = append(inconsistencies, Inconsistency{
189 Type: InconsistencyOutdated,
190 MemoryID1: mem.DocID,
191 Description: fmt.Sprintf("记忆可能过时(%d天前):'%s'",
192 int(age.Hours()/24), truncate(mem.Text, 50)),
193 Severity: severity,
194 DetectedAt: time.Now(),
195 })
196 }
197 }
198
199 return inconsistencies
200}
201
202// detectLowConfidence 检测低置信度记忆
203func (qa *QualityAnalyzer) detectLowConfidence(memories []MemoryWithScore) []Inconsistency {

Callers 2

TestDetectOutdatedFunction · 0.95
DetectInconsistenciesMethod · 0.95

Calls 1

truncateFunction · 0.70

Tested by 1

TestDetectOutdatedFunction · 0.76