From 53cc1a5e636eb0c3983f10e42ec78a1fdd655b5b Mon Sep 17 00:00:00 2001 From: gongzhiyong Date: Thu, 28 May 2026 18:51:43 +0800 Subject: [PATCH] fix: localize agnet role and resource labels --- heicode/VERSION | 2 +- .../create-agnet-deployment-sheet.tsx | 59 ++++++++++++++++--- heicode/web/default/src/i18n/locales/zh.json | 17 +++++- 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/heicode/VERSION b/heicode/VERSION index 323afbcd..8a3b8ac2 100644 --- a/heicode/VERSION +++ b/heicode/VERSION @@ -1 +1 @@ -1.4.14 +1.4.15 diff --git a/heicode/web/default/src/features/agnet-console/create-agnet-deployment-sheet.tsx b/heicode/web/default/src/features/agnet-console/create-agnet-deployment-sheet.tsx index 359b7231..b35f2fa2 100644 --- a/heicode/web/default/src/features/agnet-console/create-agnet-deployment-sheet.tsx +++ b/heicode/web/default/src/features/agnet-console/create-agnet-deployment-sheet.tsx @@ -245,6 +245,46 @@ function formatSubMode(value: AgnetSubMode, t: (key: string) => string) { return t('Waterfall') } +function formatRoleLabel(value: string, t: (key: string) => string) { + const role = value.trim().toLowerCase() + const labels: Record = { + product: t('Product role'), + frontend: t('Frontend role'), + backend: t('Backend role'), + reviewer: t('Reviewer role'), + ops: t('Ops role'), + builder: t('Builder role'), + } + return labels[role] || value +} + +function formatRoleDisplayName(value: string, t: (key: string) => string) { + const name = value.trim().toLowerCase() + const labels: Record = { + 'product agnet': t('Product Agnet'), + 'frontend agnet': t('Frontend Agnet'), + 'backend agnet': t('Backend Agnet'), + 'reviewer agnet': t('Reviewer Agnet'), + 'ops agnet': t('Ops Agnet'), + } + return labels[name] || value +} + +function formatResourceType( + value: ResourceType | string, + t: (key: string) => string +) { + const type = String(value).trim().toLowerCase() + const labels: Record = { + git: t('Git repository'), + sk: t('SK skill pack'), + project_doc: t('Project docs'), + cloud_account: t('Cloud account'), + cloud_resource: t('Cloud resource'), + } + return labels[type] || String(value) +} + function buildAgent( row: AgentFormRow, index: number, @@ -936,7 +976,9 @@ export function CreateAgnetDeploymentSheet({
#{index + 1} - {agent.role_template || t('Agent')} + {agent.role_template + ? formatRoleLabel(agent.role_template, t) + : t('Agent')}
{agents.length > 1 ? ( @@ -976,9 +1018,9 @@ export function CreateAgnetDeploymentSheet({ {roleTemplates.map((tpl) => ( - {tpl.key} + {formatRoleLabel(tpl.key, t)} - · {tpl.display_name} + · {formatRoleDisplayName(tpl.display_name, t)} ))} @@ -1052,7 +1094,7 @@ export function CreateAgnetDeploymentSheet({ {RESOURCE_TYPES.map((type) => ( - {type} + {formatResourceType(type, t)} ))} @@ -1276,7 +1318,7 @@ export function CreateAgnetDeploymentSheet({ key={a.role} className='text-primary inline-flex items-center gap-1 rounded-md bg-[color-mix(in_oklch,var(--primary)_12%,transparent)] px-1.5 py-0.5 font-mono text-[10px]' > - {a.role} + {formatRoleLabel(a.role, t)} · {a.model_ref} @@ -1309,8 +1351,11 @@ export function CreateAgnetDeploymentSheet({ className='flex items-center gap-2' > - {(g as { resource_type?: string }) - .resource_type || '?'} + {formatResourceType( + (g as { resource_type?: string }) + .resource_type || '?', + t + )} {(g as { resource_id?: string }).resource_id || diff --git a/heicode/web/default/src/i18n/locales/zh.json b/heicode/web/default/src/i18n/locales/zh.json index 466abab2..b880a985 100644 --- a/heicode/web/default/src/i18n/locales/zh.json +++ b/heicode/web/default/src/i18n/locales/zh.json @@ -94,7 +94,7 @@ "Add a new model to the system by providing the necessary information.": "通过提供必要信息向系统添加新模型。", "Add a new user by providing necessary info.": "通过提供必要信息来添加新用户。", "Add a new vendor to the system": "向系统添加新供应商", - "Add agent": "添加 Agent", + "Add agent": "添加智能体", "Add an extra layer of security to your account": "为您的账户添加额外的安全层", "Add and submit": "添加后提交", "Add Announcement": "添加公告", @@ -4107,6 +4107,21 @@ "Waterfall": "瀑布", "Sub mode": "子模式", "Agent": "智能体", + "Product role": "产品", + "Frontend role": "前端", + "Backend role": "后端", + "Reviewer role": "评审", + "Ops role": "运维", + "Builder role": "构建", + "Product Agnet": "产品智能体", + "Frontend Agnet": "前端智能体", + "Backend Agnet": "后端智能体", + "Reviewer Agnet": "评审智能体", + "Ops Agnet": "运维智能体", + "Git repository": "Git 仓库", + "SK skill pack": "SK 技能包", + "Cloud account": "云账号", + "Cloud resource": "云资源", "Handoff": "交接", "Event": "事件", "Snapshot": "快照",