fix(memory): stop autosaving assistant summaries and filter legacy entries

This commit is contained in:
Chummy 2026-02-20 00:35:48 +08:00
parent 6d745e9cb3
commit d714d3984e
8 changed files with 173 additions and 34 deletions

View file

@ -293,6 +293,10 @@ fn compact_sender_history(ctx: &ChannelRuntimeContext, sender_key: &str) -> bool
}
fn should_skip_memory_context_entry(key: &str, content: &str) -> bool {
if memory::is_assistant_autosave_key(key) {
return true;
}
if key.trim().to_ascii_lowercase().ends_with("_history") {
return true;
}
@ -2167,6 +2171,10 @@ mod tests {
"telegram_123_history",
r#"[{"role":"user"}]"#
));
assert!(should_skip_memory_context_entry(
"assistant_resp_legacy",
"fabricated memory"
));
assert!(!should_skip_memory_context_entry("telegram_123_45", "hi"));
}