Skip to content

Commit 00465ee

Browse files
committed
更新dashborad
1 parent 09da25c commit 00465ee

4 files changed

Lines changed: 710 additions & 195 deletions

File tree

astrbot/dashboard/routes/subagent.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,21 @@ async def get_config(self):
5959
if isinstance(a, dict):
6060
a.setdefault("provider_id", None)
6161
a.setdefault("persona_id", None)
62-
return jsonify(Response().ok(data=data).__dict__)
62+
63+
# 获取 enhanced_subagent 配置
64+
enhanced_data = cfg.get("enhanced_subagent", {})
65+
66+
# 合并返回
67+
return jsonify(
68+
Response()
69+
.ok(
70+
data={
71+
"subagent_orchestrator": data,
72+
"enhanced_subagent": enhanced_data,
73+
}
74+
)
75+
.__dict__
76+
)
6377
except Exception as e:
6478
logger.error(traceback.format_exc())
6579
return jsonify(Response().error(f"获取 subagent 配置失败: {e!s}").__dict__)
@@ -71,17 +85,23 @@ async def update_config(self):
7185
return jsonify(Response().error("配置必须为 JSON 对象").__dict__)
7286

7387
cfg = self.core_lifecycle.astrbot_config
74-
cfg["subagent_orchestrator"] = data
88+
89+
# 分别处理两个配置
90+
if "subagent_orchestrator" in data:
91+
orch_data = data["subagent_orchestrator"]
92+
cfg["subagent_orchestrator"] = orch_data
93+
94+
# Reload dynamic handoff tools if orchestrator exists
95+
orch = getattr(self.core_lifecycle, "subagent_orchestrator", None)
96+
if orch is not None:
97+
await orch.reload_from_config(orch_data)
98+
99+
if "enhanced_subagent" in data:
100+
cfg["enhanced_subagent"] = data["enhanced_subagent"]
75101

76102
# Persist to cmd_config.json
77-
# AstrBotConfigManager does not expose a `save()` method; persist via AstrBotConfig.
78103
cfg.save_config()
79104

80-
# Reload dynamic handoff tools if orchestrator exists
81-
orch = getattr(self.core_lifecycle, "subagent_orchestrator", None)
82-
if orch is not None:
83-
await orch.reload_from_config(data)
84-
85105
return jsonify(Response().ok(message="保存成功").__dict__)
86106
except Exception as e:
87107
logger.error(traceback.format_exc())
Lines changed: 83 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,129 @@
11
{
22
"header": {
3-
"eyebrow": "Orchestration"
3+
"eyebrow": "Subagent Orchestration"
44
},
55
"page": {
6-
"title": "SubAgent Orchestration",
6+
"title": "Subagent Orchestration",
77
"beta": "Experimental",
8-
"subtitle": "The main LLM can use its own tools directly and delegate tasks to SubAgents via handoff."
8+
"subtitle": "The main agent can use its own tools directly, or delegate tasks to subagents to complete more complex tasks and avoid excessive context length."
99
},
1010
"actions": {
1111
"refresh": "Refresh",
1212
"save": "Save",
13-
"add": "Add SubAgent",
13+
"add": "Add Subagent",
1414
"expand": "Expand",
1515
"collapse": "Collapse",
1616
"delete": "Delete",
1717
"close": "Close"
1818
},
1919
"overview": {
20-
"totalAgents": "Total SubAgents",
21-
"totalAgentsNote": "Configured delegate agents",
20+
"totalAgents": "Total Subagents",
21+
"totalAgentsNote": "Number of configured subagents",
2222
"enabledAgents": "Enabled Agents",
23-
"enabledAgentsNote": "Agents available for handoff",
24-
"mainOrchestration": "Main Orchestration",
23+
"enabledAgentsNote": "Subagents participating in handoff orchestration",
24+
"mainOrchestration": "Main Orchestration Status",
2525
"boundPersonas": "Bound Personas",
26-
"boundPersonasNote": "Agents with an attached persona"
26+
"boundPersonasNote": "Subagents with persona bindings"
2727
},
2828
"switches": {
29-
"enable": "Enable SubAgent orchestration",
30-
"enableHint": "Enable sub-agent functionality",
31-
"dedupe": "Deduplicate main LLM tools (hide tools duplicated by SubAgents)",
32-
"dedupeHint": "Remove duplicate tools from main agent"
29+
"enable": "Enable Subagent Orchestration",
30+
"enableHint": "Enable subagent functionality",
31+
"dedupe": "Deduplicate tools for main LLM",
32+
"dedupeHint": "Remove duplicate tools from the main agent that overlap with subagents"
3333
},
3434
"description": {
35-
"disabled": "When off: SubAgent is disabled; the main LLM mounts tools via persona rules (all by default) and calls them directly.",
36-
"enabled": "When on: the main LLM keeps its own tools and mounts transfer_to_* delegate tools. With deduplication, tools overlapping with SubAgents are removed from the main tool set."
35+
"disabled": "Subagent orchestration is not enabled.",
36+
"enabled": "Subagents will be placed in the main agent's tool set as tools, and the main agent will call subagents at appropriate times to complete tasks."
3737
},
3838
"section": {
39-
"title": "SubAgents",
40-
"subtitle": "Configure delegate agents, personas, and descriptions for the main LLM",
39+
"title": "Subagent Configuration",
40+
"subtitle": "Configure delegatable subagents, personas, and descriptions for the main agent",
4141
"globalSettings": "Global Settings",
42-
"agentSetup": "Agent Setup"
42+
"agentSetup": "Agent Setup",
43+
"orchestratorTitle": "Subagent Orchestration",
44+
"orchestratorSubtitle": "Configure basic orchestration features including subagent list and router system prompt",
45+
"enhancedSettings": "Enhanced Subagent Settings",
46+
"enhancedSettingsHint": "Configure runtime parameters, resource limits, and tool strategies for dynamic subagents"
4347
},
4448
"cards": {
4549
"statusEnabled": "Enabled",
4650
"statusDisabled": "Disabled",
47-
"unnamed": "Untitled SubAgent",
51+
"unnamed": "Unnamed Subagent",
4852
"transferPrefix": "transfer_to_{name}",
4953
"switchLabel": "Enable",
50-
"previewTitle": "Preview: handoff tool shown to the main LLM",
54+
"previewTitle": "Preview: handoff tools seen by main LLM",
5155
"personaChip": "Persona: {id}",
56+
"noDescription": "No description",
5257
"personaPreview": "Persona Preview",
53-
"noDescription": "No description yet",
54-
"previewHint": "Review the currently selected persona to verify the handoff target."
58+
"previewHint": "Shows a preview of the currently selected Persona for easy confirmation of handoff targets."
5559
},
5660
"form": {
57-
"nameLabel": "Agent name (used for transfer_to_{name})",
58-
"nameHint": "Use lowercase letters + underscores; must be globally unique.",
61+
"nameLabel": "Agent Name (used for transfer_to_{name})",
62+
"nameHint": "Use lowercase letters and underscores, globally unique",
5963
"providerLabel": "Chat Provider (optional)",
60-
"providerHint": "Leave empty to follow the global default provider.",
61-
"personaLabel": "Choose Persona",
62-
"personaHint": "The SubAgent inherits the selected Persona's system settings and tools.",
63-
"descriptionLabel": "Description for the main LLM (used to decide handoff)",
64-
"descriptionHint": "Shown to the main LLM as the transfer_to_* tool description—keep it short and clear."
64+
"providerHint": "Leave empty to use global default provider.",
65+
"personaLabel": "Select Persona",
66+
"personaHint": "The subagent will directly inherit the selected Persona's system settings and tools. Manage and create personas on the Persona settings page.",
67+
"personaPreview": "Persona Preview",
68+
"descriptionLabel": "Description for Main LLM (used to decide handoff)",
69+
"descriptionHint": "This will be used as the description for transfer_to_* tools shown to the main LLM. Keep it concise and clear."
6570
},
6671
"messages": {
67-
"loadConfigFailed": "Failed to load config",
72+
"loadConfigFailed": "Failed to load configuration",
6873
"loadPersonaFailed": "Failed to load persona list",
69-
"unsavedChangesNotice": "You have unsaved changes on this page. Save before leaving.",
70-
"unsavedChangesLeaveConfirm": "You have unsaved changes. Leaving will discard them. Continue?",
71-
"unsavedChangesReloadConfirm": "You have unsaved changes. Reloading will discard them. Continue?",
72-
"nameMissing": "A SubAgent is missing a name",
73-
"nameInvalid": "Invalid SubAgent name: only lowercase letters/numbers/underscores, starting with a letter",
74-
"nameDuplicate": "Duplicate SubAgent name: {name}",
75-
"personaMissing": "SubAgent {name} has no persona selected",
74+
"unsavedChangesNotice": "There are unsaved changes on this page. Please save before leaving.",
75+
"unsavedChangesLeaveConfirm": "There are unsaved changes. Leaving will discard these changes. Continue?",
76+
"unsavedChangesReloadConfirm": "There are unsaved changes. Refreshing will discard these changes. Continue?",
77+
"nameMissing": "A subagent is missing a name",
78+
"nameInvalid": "Invalid subagent name: only lowercase letters, numbers, and underscores are allowed, must start with a letter",
79+
"nameDuplicate": "Duplicate subagent name: {name}",
80+
"personaMissing": "Subagent {name} has no selected Persona",
7681
"saveSuccess": "Saved successfully",
7782
"saveFailed": "Failed to save",
7883
"nameRequired": "Name is required",
79-
"namePattern": "Lowercase letters, numbers, underscore only"
84+
"namePattern": "Only lowercase letters, numbers, and underscores allowed"
8085
},
8186
"empty": {
82-
"title": "No Agents Configured",
83-
"subtitle": "Add a new sub-agent to get started",
87+
"title": "No Subagents Configured",
88+
"subtitle": "Add a new subagent to get started",
8489
"action": "Create First Agent"
90+
},
91+
"enhancedSwitches": {
92+
"enable": "Enable Enhanced Subagents",
93+
"enableHint": "Enable dynamic subagent creation and management. When enabled, tools like create_dynamic_subagent can be used.",
94+
"autoCleanup": "Auto Cleanup Per Turn",
95+
"autoCleanupHint": "Automatically clean up inactive subagents after each turn",
96+
"sharedContext": "Shared Context",
97+
"sharedContextHint": "Share partial context between subagents"
98+
},
99+
"enhancedFields": {
100+
"maxSubagentCount": "Max Subagent Count",
101+
"maxSubagentCountHint": "Maximum number of concurrent subagents",
102+
"sharedContextMaxlen": "Shared Context Max Length",
103+
"sharedContextMaxlenHint": "Maximum token count for shared context",
104+
"maxSubagentHistory": "Max History Messages",
105+
"maxSubagentHistoryHint": "Maximum history messages per subagent",
106+
"executionTimeout": "Execution Timeout (seconds)",
107+
"executionTimeoutHint": "Maximum execution timeout for subagent tasks"
108+
},
109+
"enhancedSection": {
110+
"runtimeParams": "Runtime Parameters",
111+
"runtimeParamsHint": "Control subagent count, history, and execution timeout",
112+
"sharedContext": "Shared Context",
113+
"sharedContextHint": "Context sharing strategy between subagents",
114+
"toolStrategy": "Tool Strategy",
115+
"toolStrategyHint": "Control which tools subagents can use"
116+
},
117+
"enhancedTools": {
118+
"blacklist": "Tools Blacklist",
119+
"blacklistHint": "Tools that subagents cannot use. Blacklisted tools will not be assigned to subagents.",
120+
"inherent": "Inherent Tools List",
121+
"inherentHint": "Tools inherent to subagents. Tools in this list are guaranteed to be assigned to subagents.",
122+
"selectTool": "Select Tool",
123+
"addTool": "Add Tool",
124+
"selectBlacklistTool": "Add Tool to Blacklist",
125+
"selectInherentTool": "Add Tool to Inherent List",
126+
"emptyBlacklist": "No blacklisted tools",
127+
"emptyInherent": "No inherent tools"
85128
}
86129
}

dashboard/src/i18n/locales/zh-CN/features/subagent.json

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
"title": "子代理配置",
4040
"subtitle": "为主代理配置可委派的子代理、人格与描述信息",
4141
"globalSettings": "全局设置",
42-
"agentSetup": "Agent 设置"
42+
"agentSetup": "Agent 设置",
43+
"orchestratorTitle": "子代理编排",
44+
"orchestratorSubtitle": "配置子代理列表、主代理路由提示词等基础编排功能",
45+
"enhancedSettings": "增强子代理设置",
46+
"enhancedSettingsHint": "配置动态子代理的运行参数、资源限制和工具策略"
4347
},
4448
"cards": {
4549
"statusEnabled": "启用",
@@ -83,5 +87,43 @@
8387
"title": "未配置子代理",
8488
"subtitle": "添加一个新的子代理以开始",
8589
"action": "创建第一个 Agent"
90+
},
91+
"enhancedSwitches": {
92+
"enable": "启用增强子代理",
93+
"enableHint": "启用动态子代理创建和管理能力。开启后可使用 create_dynamic_subagent 等工具。",
94+
"autoCleanup": "每轮自动清理",
95+
"autoCleanupHint": "每轮对话结束后自动清理不活跃的子代理",
96+
"sharedContext": "共享上下文",
97+
"sharedContextHint": "子代理之间共享部分上下文信息"
98+
},
99+
"enhancedFields": {
100+
"maxSubagentCount": "最大子代理数量",
101+
"maxSubagentCountHint": "同时存在的最大子代理数量",
102+
"sharedContextMaxlen": "共享上下文最大长度",
103+
"sharedContextMaxlenHint": "共享上下文的最大 token 数量",
104+
"maxSubagentHistory": "最大历史消息数",
105+
"maxSubagentHistoryHint": "每个子代理保留的最大历史消息数量",
106+
"executionTimeout": "执行超时时间(秒)",
107+
"executionTimeoutHint": "子代理执行任务的最大超时时间"
108+
},
109+
"enhancedSection": {
110+
"runtimeParams": "运行参数",
111+
"runtimeParamsHint": "控制子代理的数量、历史和执行超时",
112+
"sharedContext": "共享上下文",
113+
"sharedContextHint": "子代理之间的上下文共享策略",
114+
"toolStrategy": "工具策略",
115+
"toolStrategyHint": "控制子代理可使用哪些工具"
116+
},
117+
"enhancedTools": {
118+
"blacklist": "工具黑名单",
119+
"blacklistHint": "子代理不可使用的工具列表。被加入黑名单的工具将不会分配给子代理。",
120+
"inherent": "固有工具名单",
121+
"inherentHint": "子代理固有的工具名单,在该名单内的工具会确保分配给子代理。",
122+
"selectTool": "选择工具",
123+
"addTool": "添加工具",
124+
"selectBlacklistTool": "添加工具到黑名单",
125+
"selectInherentTool": "添加工具到固有名单",
126+
"emptyBlacklist": "暂无黑名单工具",
127+
"emptyInherent": "暂无固有工具"
86128
}
87129
}

0 commit comments

Comments
 (0)