Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(frontend): label host-sandbox skill secret cards like the sandbox cards

Victor Maznyuk157fb4d3c176
diff --git a/frontend/src/views/settings/EnvVarSettings.vue b/frontend/src/views/settings/EnvVarSettings.vue
index 9c72272ce..f9070fbb4 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<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(() =>
diff --git a/frontend/src/views/settings/envVarState.test.ts b/frontend/src/views/settings/envVarState.test.ts
index c95f59ac4..2ca140f0e 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 37c75fc43..c147e2e7d 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,
})
}