From 157fb4d3c1763c47fdda88aa4133b37439bbc54a Mon Sep 17 00:00:00 2001 From: Victor Maznyuk Date: Sat, 26 Sep 2026 09:03:59 +0200 Subject: [PATCH] fix(frontend): label host-sandbox skill secret cards like the sandbox cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sandbox cards on the environment-variable settings page already pass the localized host label to configLabel, so the host config shows as "This computer". The skill secret cards call configLabel without it and show the raw backend name of the host config instead (本机), in every locale. skillSecretCards now takes the same optional hostLabel and forwards it; EnvVarSettings passes t('settings.skills.hostTarget') as it does for the sandbox cards. Without a label the behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) --- frontend/src/views/settings/EnvVarSettings.vue | 2 +- frontend/src/views/settings/envVarState.test.ts | 8 ++++++++ frontend/src/views/settings/envVarState.ts | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/settings/EnvVarSettings.vue b/frontend/src/views/settings/EnvVarSettings.vue index 9c72272c..f9070fbb 100644 --- a/frontend/src/views/settings/EnvVarSettings.vue +++ b/frontend/src/views/settings/EnvVarSettings.vue @@ -437,7 +437,7 @@ const loading = ref(true) const loadError = ref('') const groups = ref([]) -const skillCards = computed(() => skillSecretCards(groups.value)) +const skillCards = computed(() => skillSecretCards(groups.value, t('settings.skills.hostTarget'))) const sandboxCards = computed(() => sandboxGroupsWithVars(groups.value)) const multipleSandboxes = computed(() => groups.value.length > 1) const sandboxOptions = computed(() => diff --git a/frontend/src/views/settings/envVarState.test.ts b/frontend/src/views/settings/envVarState.test.ts index c95f59ac..2ca140f0 100644 --- a/frontend/src/views/settings/envVarState.test.ts +++ b/frontend/src/views/settings/envVarState.test.ts @@ -279,3 +279,11 @@ test('skillSecretCards lifts declared skills out of config groups and skips empt assert.equal(cards[0].skill.skill_id, 'weknora') assert.equal(cards[0].sandbox_config_name, 'Docker-Test') }) + +test('skillSecretCards labels the host sandbox like the sandbox cards do', () => { + const hostSkill = skill('weknora', 'weknora', [envVar({ name: 'WEKNORA_API_KEY' })]) + const groups = [config('host', '本机', [], [hostSkill])] + + assert.equal(skillSecretCards(groups, 'This computer')[0].sandbox_config_name, 'This computer') + assert.equal(skillSecretCards(groups)[0].sandbox_config_name, '本机') +}) diff --git a/frontend/src/views/settings/envVarState.ts b/frontend/src/views/settings/envVarState.ts index 37c75fc4..c147e2e7 100644 --- a/frontend/src/views/settings/envVarState.ts +++ b/frontend/src/views/settings/envVarState.ts @@ -193,14 +193,14 @@ export interface SkillSecretCard { skill: SkillEnvGroup } -export function skillSecretCards(groups: ConfigEnvGroup[]): SkillSecretCard[] { +export function skillSecretCards(groups: ConfigEnvGroup[], hostLabel = ''): SkillSecretCard[] { const cards: SkillSecretCard[] = [] for (const group of groups) { for (const skill of group.skills || []) { if (!skill.vars?.length) continue cards.push({ sandbox_config_id: group.sandbox_config_id, - sandbox_config_name: configLabel(group), + sandbox_config_name: configLabel(group, hostLabel), skill, }) }