Skip to content

Commit 5776fa7

Browse files
authored
refactor: improve memory service date time consistency (#12144)
### What problem does this PR solve? improve memory service date time consistency ### Type of change - [x] Refactoring
1 parent fc6af19 commit 5776fa7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

api/db/services/memory_service.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def create_memory(cls, tenant_id: str, name: str, memory_type: List[str], embd_i
117117
if len(memory_name) > MEMORY_NAME_LIMIT:
118118
return False, f"Memory name {memory_name} exceeds limit of {MEMORY_NAME_LIMIT}."
119119

120+
timestamp = current_timestamp()
121+
format_time = get_format_time()
120122
# build create dict
121123
memory_info = {
122124
"id": get_uuid(),
@@ -126,10 +128,10 @@ def create_memory(cls, tenant_id: str, name: str, memory_type: List[str], embd_i
126128
"embd_id": embd_id,
127129
"llm_id": llm_id,
128130
"system_prompt": PromptAssembler.assemble_system_prompt({"memory_type": memory_type}),
129-
"create_time": current_timestamp(),
130-
"create_date": get_format_time(),
131-
"update_time": current_timestamp(),
132-
"update_date": get_format_time(),
131+
"create_time": timestamp,
132+
"create_date": format_time,
133+
"update_time": timestamp,
134+
"update_date": format_time,
133135
}
134136
obj = cls.model(**memory_info).save(force_insert=True)
135137

0 commit comments

Comments
 (0)