mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
feat(memory): use timestamp-prefixed document IDs for chronological sorting (#381)
Replace random UUID document IDs with `{unix_seconds}_{8char_hex}` format
so memory documents sort chronologically by filename and ID.
This commit is contained in:
@@ -27,7 +27,11 @@ impl UnifiedMemory {
|
||||
let document_id = input
|
||||
.document_id
|
||||
.or(existing_document_id)
|
||||
.unwrap_or_else(|| Uuid::new_v4().to_string());
|
||||
.unwrap_or_else(|| {
|
||||
let ts = Self::now_ts() as u64;
|
||||
let short = &Uuid::new_v4().to_string()[..8];
|
||||
format!("{ts}_{short}")
|
||||
});
|
||||
let now = Self::now_ts();
|
||||
let created_at = {
|
||||
let conn = self.conn.lock();
|
||||
|
||||
Reference in New Issue
Block a user