Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions dashboard/src/i18n/locales/en-US/features/subagent.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
"refresh": "Refresh",
"save": "Save",
"add": "Add SubAgent",
"delete": "Delete"
"delete": "Delete",
"close": "Close"
},
"switches": {
"enable": "Enable SubAgent orchestration",
"dedupe": "Deduplicate main LLM tools (hide tools duplicated by SubAgents)"
"enableHint": "Enable sub-agent functionality",
"dedupe": "Deduplicate main LLM tools (hide tools duplicated by SubAgents)",
"dedupeHint": "Remove duplicate tools from main agent"
},
"description": {
"disabled": "When off: SubAgent is disabled; the main LLM mounts tools via persona rules (all by default) and calls them directly.",
Expand All @@ -29,7 +32,8 @@
"transferPrefix": "transfer_to_{name}",
"switchLabel": "Enable",
"previewTitle": "Preview: handoff tool shown to the main LLM",
"personaChip": "Persona: {id}"
"personaChip": "Persona: {id}",
"personaPreview": "PERSONA PREVIEW"
},
"form": {
"nameLabel": "Agent name (used for transfer_to_{name})",
Expand All @@ -49,6 +53,13 @@
"nameDuplicate": "Duplicate SubAgent name: {name}",
"personaMissing": "SubAgent {name} has no persona selected",
"saveSuccess": "Saved successfully",
"saveFailed": "Failed to save"
"saveFailed": "Failed to save",
"nameRequired": "Name is required",
"namePattern": "Lowercase letters, numbers, underscore only"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To provide a more accurate validation error message to the user (as mentioned in my comment on SubAgentPage.vue), this string should be updated to include all constraints: starting with a letter, allowed characters, and max length.

Suggested change
"namePattern": "Lowercase letters, numbers, underscore only"
"namePattern": "Must start with a letter, contain only lowercase letters, numbers, or underscores, and be at most 64 characters long."

},
"empty": {
"title": "No Agents Configured",
"subtitle": "Add a new sub-agent to get started",
"action": "Create First Agent"
}
}
17 changes: 14 additions & 3 deletions dashboard/src/i18n/locales/zh-CN/features/subagent.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
"refresh": "刷新",
"save": "保存",
"add": "新增 SubAgent",
"delete": "删除"
"delete": "删除",
"close": "关闭"
},
"switches": {
"enable": "启用 SubAgent 编排",
"dedupe": "主 LLM 去重重复工具(与 SubAgent 重叠的工具将被隐藏)"
"enableHint": "启用子代理功能",
"dedupe": "主 LLM 去重重复工具(与 SubAgent 重叠的工具将被隐藏)",
"dedupeHint": "从主代理中移除重复工具"
},
"description": {
"disabled": "不启动:SubAgent 关闭;主 LLM 按 persona 规则挂载工具(默认全部),并直接调用。",
Expand All @@ -39,6 +42,7 @@
"providerHint": "留空表示跟随全局默认 provider。",
"personaLabel": "选择人格设定",
"personaHint": "SubAgent 将直接继承所选 Persona 的系统设定与工具。在人格设定页管理和新建人格。",
"personaPreview": "人格预览",
"descriptionLabel": "对主 LLM 的描述(用于决定是否 handoff)",
"descriptionHint": "这段会作为 transfer_to_* 工具的描述给主 LLM 看,建议简短明确。"
},
Expand All @@ -50,6 +54,13 @@
"nameDuplicate": "SubAgent 名称重复:{name}",
"personaMissing": "SubAgent {name} 未选择 Persona",
"saveSuccess": "保存成功",
"saveFailed": "保存失败"
"saveFailed": "保存失败",
"nameRequired": "名称必填",
"namePattern": "仅支持小写字母、数字和下划线"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To provide a more accurate validation error message to the user (as mentioned in my comment on SubAgentPage.vue), this string should be updated to include all constraints: starting with a letter, allowed characters, and max length.

Suggested change
"namePattern": "仅支持小写字母、数字和下划线"
"namePattern": "必须以小写字母开头,只能包含小写字母、数字或下划线,且长度不超过64个字符"

},
"empty": {
"title": "未配置 SubAgent",
"subtitle": "添加一个新的子代理以开始",
"action": "创建第一个 Agent"
}
}
16 changes: 8 additions & 8 deletions dashboard/src/views/SubAgentPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<template #label>
<div class="d-flex flex-column">
<span class="text-body-2 font-weight-medium">{{ tm('switches.enable') }}</span>
<span class="text-caption text-medium-emphasis">Enable sub-agent functionality</span>
<span class="text-caption text-medium-emphasis">{{ tm('switches.enableHint') }}</span>
</div>
</template>
</v-switch>
Expand All @@ -80,7 +80,7 @@
<template #label>
<div class="d-flex flex-column">
<span class="text-body-2 font-weight-medium">{{ tm('switches.dedupe') }}</span>
<span class="text-caption text-medium-emphasis">Remove duplicate tools from main agent</span>
<span class="text-caption text-medium-emphasis">{{ tm('switches.dedupeHint') }}</span>
</div>
</template>
</v-switch>
Expand Down Expand Up @@ -166,7 +166,7 @@
<v-text-field
v-model="agent.name"
:label="tm('form.nameLabel')"
:rules="[v => !!v || 'Name is required', v => /^[a-z][a-z0-9_]*$/.test(v) || 'Lowercase letters, numbers, underscore only']"
:rules="[v => !!v || tm('messages.nameRequired'), v => /^[a-z][a-z0-9_]*$/.test(v) || tm('messages.namePattern')]"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The validation regex here is inconsistent with the one used in validateBeforeSave (line 356), which also checks for length (/^[a-z][a-z0-9_]{0,63}$/). To provide immediate and consistent feedback to the user, the regex in the template should also enforce the length constraint.

Additionally, the error message from tm('messages.namePattern') is incomplete. I've left suggestions on the locale files to improve it.

                  :rules="[v => !!v || tm('messages.nameRequired'), v => /^[a-z][a-z0-9_]{0,63}$/.test(v) || tm('messages.namePattern')]"

variant="outlined"
density="comfortable"
hide-details="auto"
Expand Down Expand Up @@ -215,7 +215,7 @@
<v-col cols="12" md="6">
<div class="h-100">
<div class="text-caption font-weight-bold text-medium-emphasis mb-2 ml-1">
PERSONA PREVIEW
{{ tm('cards.personaPreview') }}
</div>
<PersonaQuickPreview
:model-value="agent.persona_id"
Expand All @@ -231,17 +231,17 @@
<!-- Empty State -->
<div v-if="cfg.agents.length === 0" class="d-flex flex-column align-center justify-center py-12 text-medium-emphasis">
<v-icon icon="mdi-robot-off" size="64" class="mb-4 opacity-50" />
<div class="text-h6">No Agents Configured</div>
<div class="text-body-2 mb-4">Add a new sub-agent to get started</div>
<div class="text-h6">{{ tm('empty.title') }}</div>
<div class="text-body-2 mb-4">{{ tm('empty.subtitle') }}</div>
<v-btn color="primary" variant="tonal" @click="addAgent">
Create First Agent
{{ tm('empty.action') }}
</v-btn>
</div>

<v-snackbar v-model="snackbar.show" :color="snackbar.color" timeout="3000" location="top">
{{ snackbar.message }}
<template #actions>
<v-btn variant="text" @click="snackbar.show = false">Close</v-btn>
<v-btn variant="text" @click="snackbar.show = false">{{ tm('actions.close') }}</v-btn>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fallback 'Close' in tm('actions.close') || 'Close' will never be used. The tm function returns a placeholder string like [MISSING: ...] for missing keys, which is a truthy value in JavaScript. This means the || operator will not evaluate the right-hand side.

Since the actions.close key is added in this PR, the fallback is not strictly needed. It's better to remove it to avoid confusion and rely on the i18n system to handle missing keys during development.

        <v-btn variant="text" @click="snackbar.show = false">{{ tm('actions.close') }}</v-btn>

</template>
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
</v-snackbar>
</div>
Expand Down