Skip to content

Commit 734e3a3

Browse files
committed
no message
1 parent 822de54 commit 734e3a3

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

astrbot/dashboard/routes/subagent.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,23 @@ async def update_config(self):
9292
return jsonify(Response().error("配置必须为 JSON 对象").__dict__)
9393

9494
cfg = self.core_lifecycle.astrbot_config
95-
cfg["subagent_orchestrator"] = data
95+
96+
if "subagent_orchestrator" in data:
97+
orch_data = data["subagent_orchestrator"]
98+
cfg["subagent_orchestrator"] = orch_data
99+
100+
# Reload dynamic handoff tools if orchestrator exists
101+
orch = getattr(self.core_lifecycle, "subagent_orchestrator", None)
102+
if orch is not None:
103+
await orch.reload_from_config(orch_data)
104+
else:
105+
return jsonify(
106+
Response().error("缺少 subagent_orchestrator 字段").__dict__
107+
)
96108

97109
# Persist to cmd_config.json
98-
# AstrBotConfigManager does not expose a `save()` method; persist via AstrBotConfig.
99110
cfg.save_config()
100111

101-
# Reload dynamic handoff tools if orchestrator exists
102-
orch = getattr(self.core_lifecycle, "subagent_orchestrator", None)
103-
if orch is not None:
104-
await orch.reload_from_config(data)
105-
106112
return jsonify(Response().ok(message="保存成功").__dict__)
107113
except Exception as e:
108114
logger.error(traceback.format_exc())

0 commit comments

Comments
 (0)