myagent-ai 1.15.17 → 1.15.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web/api_server.py +12 -2
package/package.json
CHANGED
package/web/api_server.py
CHANGED
|
@@ -2086,6 +2086,8 @@ class ApiServer:
|
|
|
2086
2086
|
"execution_mode", "enabled", "sandbox_image", "sandbox_network", "sandbox_memory",
|
|
2087
2087
|
"platform", "platform_token", "platform_app_id", "platform_app_secret",
|
|
2088
2088
|
"model_id", "backup_model_ids", "work_dir", "department")
|
|
2089
|
+
# [v1.15.17] 在修改 cfg 之前保存旧部门,修复部门同步 bug
|
|
2090
|
+
old_dept = cfg.get("department", "")
|
|
2089
2091
|
# 更新允许的字段
|
|
2090
2092
|
updated = False
|
|
2091
2093
|
for k in allowed_fields:
|
|
@@ -2101,8 +2103,7 @@ class ApiServer:
|
|
|
2101
2103
|
# 自动更新 updated_at
|
|
2102
2104
|
cfg["updated_at"] = datetime.datetime.now().isoformat()
|
|
2103
2105
|
(ad / "config.json").write_text(json.dumps(cfg, indent=2, ensure_ascii=False), encoding="utf-8")
|
|
2104
|
-
#
|
|
2105
|
-
old_dept = cfg.get("department", "")
|
|
2106
|
+
# 部门变更时同步部门成员列表(old_dept 已在 cfg 修改前保存)
|
|
2106
2107
|
new_dept = data.get("department", old_dept)
|
|
2107
2108
|
if old_dept != new_dept and (old_dept or new_dept):
|
|
2108
2109
|
try:
|
|
@@ -2173,6 +2174,15 @@ class ApiServer:
|
|
|
2173
2174
|
logger.info(f" 已清理 Agent '{path}' 的 {len(rows)} 个会话记忆")
|
|
2174
2175
|
except Exception as e:
|
|
2175
2176
|
logger.warning(f"清理会话记忆失败: {e}")
|
|
2177
|
+
# [v1.15.17] 从部门成员列表中移除已删除的 Agent
|
|
2178
|
+
dept = cfg.get("department", "") if cfg else ""
|
|
2179
|
+
if dept:
|
|
2180
|
+
try:
|
|
2181
|
+
dm = self._get_dept_manager()
|
|
2182
|
+
dm.assign_agent(dept, agents=[path], action="remove")
|
|
2183
|
+
logger.info(f"已从部门 '{dept}' 移除已删除的 Agent '{path}'")
|
|
2184
|
+
except Exception as e:
|
|
2185
|
+
logger.warning(f"从部门移除 Agent '{path}' 失败: {e}")
|
|
2176
2186
|
shutil.rmtree(ad)
|
|
2177
2187
|
logger.info(f"删除 Agent: {path}")
|
|
2178
2188
|
return web.json_response({"ok": True})
|