fix: prevent memory name from auto-appending (1) on description update (#16714)

This commit is contained in:
euvre
2026-07-07 19:34:51 +08:00
committed by GitHub
parent 28a41ed070
commit 41801ad2b8

View File

@@ -150,7 +150,9 @@ class MemoryService(CommonService):
if "memory_type" in update_dict and isinstance(update_dict["memory_type"], list):
update_dict["memory_type"] = calculate_memory_type(update_dict["memory_type"])
if "name" in update_dict:
update_dict["name"] = duplicate_name(cls.query, name=update_dict["name"], tenant_id=tenant_id)
existing = cls.model.select().where((cls.model.id == memory_id) & (cls.model.tenant_id == tenant_id)).first()
if not existing or existing.name != update_dict["name"]:
update_dict["name"] = duplicate_name(cls.query, name=update_dict["name"], tenant_id=tenant_id)
update_dict.update({"update_time": current_timestamp(), "update_date": get_format_time()})
return cls.model.update(update_dict).where(cls.model.id == memory_id).execute()