mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-09 00:12:21 +02:00
Squash Odysseus development history
This commit is contained in:
@@ -118,6 +118,32 @@ def test_pinned_memory_injection_is_capped_at_five():
|
||||
assert len(processor._last_used_memories) == 5
|
||||
|
||||
|
||||
def test_pinned_identity_auto_injection_uses_first_five_not_newest():
|
||||
rows = [
|
||||
{
|
||||
"id": f"identity-{idx}",
|
||||
"text": f"User identity fact {idx} email marker.",
|
||||
"category": "identity",
|
||||
"pinned": True,
|
||||
"timestamp": idx,
|
||||
}
|
||||
for idx in range(10)
|
||||
]
|
||||
|
||||
processor = _processor(rows)
|
||||
processor.build_context_preface(
|
||||
message="Who is the user?",
|
||||
session=SimpleNamespace(),
|
||||
use_rag=False,
|
||||
use_memory=True,
|
||||
)
|
||||
|
||||
assert [m["text"] for m in processor._last_used_memories] == [
|
||||
f"User identity fact {idx} email marker."
|
||||
for idx in range(5)
|
||||
]
|
||||
|
||||
|
||||
def test_total_memory_injection_is_capped_at_five_across_pinned_and_recalled():
|
||||
rows = [
|
||||
{
|
||||
@@ -150,3 +176,30 @@ def test_total_memory_injection_is_capped_at_five_across_pinned_and_recalled():
|
||||
|
||||
assert len(processor._last_used_memories) <= 5
|
||||
assert sum(1 for m in processor._last_used_memories if m["type"] == "pinned") == 4
|
||||
|
||||
|
||||
def test_explicit_memory_management_skips_recall_injection():
|
||||
rows = [{
|
||||
"id": "identity",
|
||||
"text": "User's name is Felix.",
|
||||
"category": "identity",
|
||||
"pinned": True,
|
||||
"timestamp": 1,
|
||||
}]
|
||||
|
||||
processor = _processor(rows)
|
||||
preface, _, _ = processor.build_context_preface(
|
||||
message="list my saved memories",
|
||||
session=SimpleNamespace(),
|
||||
use_rag=False,
|
||||
use_memory=True,
|
||||
)
|
||||
|
||||
assert "User's name is Felix." not in _context_text(preface)
|
||||
assert processor._last_used_memories == []
|
||||
|
||||
|
||||
def test_memory_management_detection_does_not_disable_normal_recall():
|
||||
assert ChatProcessor._is_memory_management_request("find my saved memories")
|
||||
assert ChatProcessor._is_memory_management_request("what do you remember about my nationality?")
|
||||
assert not ChatProcessor._is_memory_management_request("Explain how memory allocation works")
|
||||
|
||||
Reference in New Issue
Block a user