mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 09:15:29 -04:00
fix(memory): return complete memory lists (#3885)
This commit is contained in:
@@ -93,16 +93,15 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
|
||||
if category_filter:
|
||||
msg += f" in category '{category_filter}'"
|
||||
return [TextContent(type="text", text=msg + ".")]
|
||||
|
||||
lines = [f"Found {len(memories)} memory entries:\n"]
|
||||
for m in memories[:100]:
|
||||
for m in memories:
|
||||
cat = m.get("category", "fact")
|
||||
mid = m.get("id", "?")[:8]
|
||||
text = m.get("text", "")
|
||||
if len(text) > 150:
|
||||
text = text[:150] + "..."
|
||||
lines.append(f"- [{cat}] `{mid}` — {text}")
|
||||
if len(memories) > 100:
|
||||
lines.append(f"... and {len(memories) - 100} more")
|
||||
return [TextContent(type="text", text="\n".join(lines))]
|
||||
|
||||
elif action == "add":
|
||||
|
||||
@@ -972,16 +972,15 @@ async def do_manage_memory(content: str, session_id: Optional[str] = None, owner
|
||||
memories = [m for m in memories if m.get("category", "").lower() == category_filter]
|
||||
if not memories:
|
||||
return {"results": "No memories found" + (f" in category '{category_filter}'" if category_filter else "") + "."}
|
||||
|
||||
result_lines = [f"Found {len(memories)} memory entries:\n"]
|
||||
for m in memories[:100]:
|
||||
for m in memories:
|
||||
cat = m.get("category", "fact")
|
||||
mid = m.get("id", "?")[:8]
|
||||
text = m.get("text", "")
|
||||
if len(text) > 150:
|
||||
text = text[:150] + "..."
|
||||
result_lines.append(f"- [{cat}] `{mid}` — {text}")
|
||||
if len(memories) > 100:
|
||||
result_lines.append(f"... and {len(memories) - 100} more")
|
||||
return {"results": "\n".join(result_lines)}
|
||||
|
||||
elif action == "add":
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_memory_list_implementations_do_not_truncate_results():
|
||||
for path in ("mcp_servers/memory_server.py", "src/ai_interaction.py"):
|
||||
source = Path(path).read_text()
|
||||
assert "memories[:100]" not in source
|
||||
Reference in New Issue
Block a user