Skip to content

Commit 238ee93

Browse files
committed
no message
1 parent 734e3a3 commit 238ee93

2 files changed

Lines changed: 29 additions & 37 deletions

File tree

astrbot/dashboard/routes/subagent.py

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

9494
cfg = self.core_lifecycle.astrbot_config
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-
)
95+
cfg["subagent_orchestrator"] = data
10896

10997
# Persist to cmd_config.json
98+
# AstrBotConfigManager does not expose a `save()` method; persist via AstrBotConfig.
11099
cfg.save_config()
111100

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+
112106
return jsonify(Response().ok(message="保存成功").__dict__)
113107
except Exception as e:
114108
logger.error(traceback.format_exc())

dashboard/src/views/SubAgentPage.vue

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -868,30 +868,28 @@ async function save() {
868868
saving.value = true
869869
try {
870870
const payload = {
871-
subagent_orchestrator: {
872-
main_enable: cfg.value.main_enable,
873-
remove_main_duplicate_tools: cfg.value.remove_main_duplicate_tools,
874-
router_system_prompt: cfg.value.router_system_prompt,
875-
agents: cfg.value.agents.map((agent) => ({
876-
name: agent.name,
877-
persona_id: agent.persona_id,
878-
public_description: agent.public_description,
879-
enabled: agent.enabled,
880-
provider_id: agent.provider_id
881-
})),
882-
dynamic_agents: {
883-
enabled: dynamicCfg.value.enabled,
884-
max_dynamic_subagent_count: dynamicCfg.value.max_dynamic_subagent_count,
885-
auto_cleanup_per_turn: dynamicCfg.value.auto_cleanup_per_turn,
886-
tools_blacklist: dynamicCfg.value.tools_blacklist,
887-
tools_inherent: dynamicCfg.value.tools_inherent
888-
},
889-
history_enabled: rootCfg.value.history_enabled,
890-
shared_context_enabled: rootCfg.value.shared_context_enabled,
891-
shared_context_maxlen: rootCfg.value.shared_context_maxlen,
892-
subagent_history_maxlen: rootCfg.value.subagent_history_maxlen,
893-
execution_timeout: rootCfg.value.execution_timeout
894-
}
871+
main_enable: cfg.value.main_enable,
872+
remove_main_duplicate_tools: cfg.value.remove_main_duplicate_tools,
873+
router_system_prompt: cfg.value.router_system_prompt,
874+
agents: cfg.value.agents.map((agent) => ({
875+
name: agent.name,
876+
persona_id: agent.persona_id,
877+
public_description: agent.public_description,
878+
enabled: agent.enabled,
879+
provider_id: agent.provider_id
880+
})),
881+
dynamic_agents: {
882+
enabled: dynamicCfg.value.enabled,
883+
max_dynamic_subagent_count: dynamicCfg.value.max_dynamic_subagent_count,
884+
auto_cleanup_per_turn: dynamicCfg.value.auto_cleanup_per_turn,
885+
tools_blacklist: dynamicCfg.value.tools_blacklist,
886+
tools_inherent: dynamicCfg.value.tools_inherent
887+
},
888+
history_enabled: rootCfg.value.history_enabled,
889+
shared_context_enabled: rootCfg.value.shared_context_enabled,
890+
shared_context_maxlen: rootCfg.value.shared_context_maxlen,
891+
subagent_history_maxlen: rootCfg.value.subagent_history_maxlen,
892+
execution_timeout: rootCfg.value.execution_timeout
895893
}
896894
897895
const res = await axios.post('/api/subagent/config', payload)

0 commit comments

Comments
 (0)