fix(memory): handle non-string timestamp and missing role in raw_archive

This commit is contained in:
santhreal authored and Xubin Ren committed 2026-08-01 20:14:28 +08:00
1 parent e152e7bc0b
commit 4c387f6633
2 files changed
+22 -5

No files matched your search

+4 -5
View File
@@ -713,11 +713,10 @@ class MemoryStore:
if tools_used
else ""
)
timestamp = cast(str, message.get("timestamp", "?"))
role = cast(str, message["role"])
lines.append(
f"[{timestamp[:16]}] {role.upper()}{tools}: {content}"
)
raw_timestamp = message.get("timestamp")
timestamp = str(raw_timestamp) if raw_timestamp is not None else "?"
role = str(message.get("role") or "unknown")
lines.append(f"[{timestamp[:16]}] {role.upper()}{tools}: {content}")
return "\n".join(lines)
def raw_archive(