fix(frontend): label host-sandbox skill secret cards like the sandbox cards
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) <noreply@anthropic.com>
main
parent
9cab226853
commit
157fb4d3c1
|
|
@ -437,7 +437,7 @@ const loading = ref(true)
|
|||
const loadError = ref('')
|
||||
const groups = ref<ConfigEnvGroup[]>([])
|
||||
|
||||
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(() =>
|
||||
|
|
|
|||
|
|
@ -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, '本机')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue