Fix: prevent auto-incrementing memory name suffix when only permissions change (#16750)

This commit is contained in:
euvre
2026-07-08 20:12:45 +08:00
committed by GitHub
parent a41fef49d0
commit 74d3508a37
2 changed files with 17 additions and 13 deletions

View File

@@ -154,7 +154,9 @@ class MemoryService(CommonService):
update_dict["memory_type"] = calculate_memory_type(update_dict["memory_type"])
if "name" in update_dict:
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"]:
if existing and existing.name == update_dict["name"]:
update_dict.pop("name", None)
else:
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()})