From 29bf7ac2c4fe01ae83874d6fee073e60a18d88ea Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 1 Sep 2026 10:45:01 +0800 Subject: [PATCH] fix(frontend): clarify agent skill picker and open install progress in-place Available vs uninstalled skills were easy to mix up, and installing rows lost their action. Group the list, keep a progress control, and open the install drawer without leaving the agent editor. --- frontend/src/i18n/locales/en-US.ts | 17 +- frontend/src/i18n/locales/ko-KR.ts | 17 +- frontend/src/i18n/locales/ru-RU.ts | 17 +- frontend/src/i18n/locales/zh-CN.ts | 17 +- .../src/views/agent/AgentEditorModal.test.mjs | 14 +- frontend/src/views/agent/AgentEditorModal.vue | 329 ++++++++++++++---- 6 files changed, 307 insertions(+), 104 deletions(-) diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 44a23c24..93df1879 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -1016,24 +1016,25 @@ export default { fallbackPrompt: 'Fallback Prompt', fallbackPromptPlaceholder: 'Leave empty to use default prompt', skillsConfig: 'Skills', - skillsConfigDesc: 'Choose the sandbox that runs skill scripts, then pick from the workspace catalog. Skills not installed on that sandbox are visible but cannot be enabled until they are installed.', - skillsSelection: 'Available skills', - skillsSelectionDesc: 'The list comes from the workspace skill catalog. Only skills that are ready on the selected sandbox can be enabled.', + skillsConfigDesc: 'Select a running sandbox, then pick skills below. Skills not on that sandbox show Install and can only be checked after they are installed.', + skillsSelection: 'Skill list', + skillsSelectionDesc: 'All workspace skills are listed here. Installed ones can be used now; others need Install first.', skillsAll: 'All', skillsSelected: 'Selected', skillsNone: 'Disabled', selectSkills: 'Select skills', - selectSkillsDesc: 'Choose which skills to enable. Uninstalled or not-ready skills cannot be checked.', - skillsAllListHint: 'Ready skills on this sandbox will be enabled. Uninstalled ones are not included until you install them.', - skillsListSummary: '{ready} ready, {pending} not ready on this sandbox', - skillsListSummaryReadyOnly: '{ready} ready', + selectSkillsDesc: 'Check the skills this agent should use. Uninstalled skills cannot be checked — click Install on the right first.', + skillsAllListHint: 'All only includes skills already installed on this sandbox. Uninstalled skills are not added until you install them.', + skillsGroupAvailable: 'Available', + skillsGroupUnavailable: 'Unavailable', noSkillsAvailable: 'The workspace catalog has no skills yet.', skillsNeedSandbox: 'Select a sandbox first.', goSandboxSettings: 'Manage sandboxes', goSkillSettings: 'Manage skills', installToThisSandbox: 'Install onto this sandbox', installShort: 'Install', - skillNotInstalled: 'Not installed on this sandbox', + viewInstallProgress: 'View progress', + skillNotInstalled: 'Not installed', skillNotReady: 'Not ready yet', skillDisabledOnSandbox: 'Disabled on this sandbox', sandboxBackend: 'Sandbox', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 5d195c52..a2a5e0ac 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -5749,24 +5749,25 @@ export default { fallbackPrompt: '폴백 프롬프트', fallbackPromptPlaceholder: '시스템 기본 프롬프트를 사용하려면 비워 두세요.', skillsConfig: '스킬', - skillsConfigDesc: '스킬 스크립트가 실행될 샌드박스를 고른 뒤, 워크스페이스 카탈로그에서 선택합니다. 해당 샌드박스에 설치되지 않은 스킬은 보이지만 설치 전에는 선택할 수 없습니다.', - skillsSelection: '사용 가능한 스킬', - skillsSelectionDesc: '목록은 워크스페이스 스킬 카탈로그에서 가져옵니다. 선택한 샌드박스에서 준비된 스킬만 사용할 수 있습니다.', + skillsConfigDesc: '먼저 실행 샌드박스를 선택한 뒤 아래 목록에서 스킬을 고르세요. 해당 샌드박스에 없는 스킬은 「설치」가 보이며, 설치한 뒤에만 선택할 수 있습니다.', + skillsSelection: '스킬 목록', + skillsSelectionDesc: '워크스페이스 카탈로그의 스킬이 모두 표시됩니다. 이 샌드박스에 설치된 것은 바로 쓸 수 있고, 나머지는 먼저 「설치」해야 합니다.', skillsAll: '전체', skillsSelected: '지정', skillsNone: '비활성화', selectSkills: '스킬 선택', - selectSkillsDesc: '사용할 스킬을 선택하세요. 설치되지 않았거나 아직 준비되지 않은 스킬은 선택할 수 없습니다.', - skillsAllListHint: '이 샌드박스에서 준비된 스킬이 사용됩니다. 설치되지 않은 스킬은 설치해야 「전체」에 포함됩니다.', - skillsListSummary: '준비됨 {ready}개, 이 샌드박스에서 아직 사용 불가 {pending}개', - skillsListSummaryReadyOnly: '준비됨 {ready}개', + selectSkillsDesc: '이 에이전트에서 쓸 스킬을 선택하세요. 설치되지 않은 스킬은 선택할 수 없으며, 오른쪽 「설치」를 먼저 누르세요.', + skillsAllListHint: '「전체」에는 이 샌드박스에 이미 설치된 스킬만 포함됩니다. 설치되지 않은 스킬은 「설치」한 뒤에야 포함됩니다.', + skillsGroupAvailable: '사용 가능', + skillsGroupUnavailable: '사용 불가', noSkillsAvailable: '워크스페이스 카탈로그에 스킬이 없습니다.', skillsNeedSandbox: '먼저 실행 샌드박스를 선택하세요.', goSandboxSettings: '샌드박스 관리', goSkillSettings: '스킬 관리', installToThisSandbox: '이 샌드박스에 설치', installShort: '설치', - skillNotInstalled: '현재 샌드박스에 설치되지 않음', + viewInstallProgress: '진행 상황', + skillNotInstalled: '미설치', skillNotReady: '아직 준비되지 않음', skillDisabledOnSandbox: '이 샌드박스에서 비활성화됨', sandboxBackend: '실행 샌드박스', diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 46fd611d..50d4aeb3 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -5749,24 +5749,25 @@ export default { fallbackPrompt: 'Fallback Prompt', fallbackPromptPlaceholder: 'Leave empty to use default prompt', skillsConfig: 'Навыки', - skillsConfigDesc: 'Выберите песочницу для скриптов, затем выберите навыки из каталога пространства. Навыки, не установленные в эту песочницу, видны, но их нельзя включить до установки.', - skillsSelection: 'Доступные навыки', - skillsSelectionDesc: 'Список берётся из каталога навыков пространства. Включить можно только навыки, готовые в выбранной песочнице.', + skillsConfigDesc: 'Сначала выберите песочницу, затем навыки из списка ниже. Неустановленные навыки показывают «Установить» и их нельзя отметить до установки.', + skillsSelection: 'Список навыков', + skillsSelectionDesc: 'Здесь все навыки каталога пространства. Установленные в эту песочницу можно использовать сразу; остальные сначала нужно установить.', skillsAll: 'Все', skillsSelected: 'Выбранные', skillsNone: 'Отключено', selectSkills: 'Выбрать навыки', - selectSkillsDesc: 'Отметьте навыки, которые нужно включить. Неустановленные или неготовые навыки выбрать нельзя.', - skillsAllListHint: 'Будут включены готовые навыки в этой песочнице. Неустановленные не попадут в «Все», пока их не установить.', - skillsListSummary: '{ready} готовы, {pending} ещё нельзя включить в этой песочнице', - skillsListSummaryReadyOnly: '{ready} готовы', + selectSkillsDesc: 'Отметьте навыки для этого агента. Неустановленные выбрать нельзя — сначала нажмите «Установить» справа.', + skillsAllListHint: '«Все» включает только навыки, уже установленные в этой песочнице. Неустановленные не попадут в список, пока вы их не установите.', + skillsGroupAvailable: 'Доступны', + skillsGroupUnavailable: 'Недоступны', noSkillsAvailable: 'В каталоге пространства ещё нет навыков.', skillsNeedSandbox: 'Сначала выберите песочницу.', goSandboxSettings: 'Управление песочницами', goSkillSettings: 'Управление навыками', installToThisSandbox: 'Установить в эту песочницу', installShort: 'Установить', - skillNotInstalled: 'Не установлен в текущую песочницу', + viewInstallProgress: 'Смотреть ход', + skillNotInstalled: 'Не установлен', skillNotReady: 'Ещё не готов', skillDisabledOnSandbox: 'Отключён в этой песочнице', sandboxBackend: 'Песочница', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index a6cbdb8c..44963edd 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -5751,24 +5751,25 @@ export default { fallbackPrompt: '兜底提示词', fallbackPromptPlaceholder: '留空使用系统默认提示词', skillsConfig: '技能', - skillsConfigDesc: '先选择运行沙箱,再从空间目录中选用。未装到该沙箱的技能可以看见,但要先安装才能勾选。', - skillsSelection: '可用技能', - skillsSelectionDesc: '列表来自空间技能目录。只能启用当前沙箱上已就绪的技能。', + skillsConfigDesc: '先选择运行沙箱,再从下面列表选用技能。没装到该沙箱的会显示「安装」,装好后才能勾选。', + skillsSelection: '技能列表', + skillsSelectionDesc: '这里列出空间目录中的技能。已装到当前沙箱的可以直接用;没装的请先点「安装」。', skillsAll: '全部', skillsSelected: '指定', skillsNone: '禁用', selectSkills: '选择技能', - selectSkillsDesc: '勾选要启用的技能。未安装或未就绪的不能勾选。', - skillsAllListHint: '将启用此沙箱上已就绪的技能。未安装的不会自动带上,装好后才会纳入「全部」。', - skillsListSummary: '{ready} 个已就绪,{pending} 个尚未可在此沙箱启用', - skillsListSummaryReadyOnly: '{ready} 个已就绪', + selectSkillsDesc: '勾选要给这个智能体用的技能。没装到当前沙箱的不能勾选,请先点右侧「安装」。', + skillsAllListHint: '「全部」只包含已装到此沙箱的技能。没装的不会自动带上,点「安装」装好后才会算进去。', + skillsGroupAvailable: '可用', + skillsGroupUnavailable: '不可用', noSkillsAvailable: '空间目录里还没有技能。', skillsNeedSandbox: '请先选择运行沙箱。', goSandboxSettings: '管理沙箱', goSkillSettings: '管理技能', installToThisSandbox: '安装到此沙箱', installShort: '安装', - skillNotInstalled: '未安装到当前沙箱', + viewInstallProgress: '查看进度', + skillNotInstalled: '未安装', skillNotReady: '尚未就绪', skillDisabledOnSandbox: '已在沙箱中停用', sandboxBackend: '运行沙箱', diff --git a/frontend/src/views/agent/AgentEditorModal.test.mjs b/frontend/src/views/agent/AgentEditorModal.test.mjs index fa4b03b4..91dd7ac9 100644 --- a/frontend/src/views/agent/AgentEditorModal.test.mjs +++ b/frontend/src/views/agent/AgentEditorModal.test.mjs @@ -135,15 +135,23 @@ test('agent skill picker uses the catalog and only enables ready installs', () = assert.match(source, /showCatalogSkillList/) assert.match(source, /skillsSelectionMode\.value !== 'none'/) assert.match(source, /:disabled="!skill\.selectable"/) - assert.match(source, /catalogPendingCount/) + assert.match(source, /catalogSkillGroups/) assert.match(source, /installPartial/) assert.match(source, /installCatalogToCurrent/) assert.match(source, /agent\.editor\.installToThisSandbox/) assert.match(source, /skill-pick-list/) - assert.match(source, /skill-ready-stat/) - assert.match(source, /skillsListSummaryReadyOnly/) + assert.match(source, /skill-pick-group/) + assert.match(source, /skill-pick__badge/) + assert.match(source, /skillStatusIcon/) + assert.match(source, /isSkillBusy/) + assert.match(source, /viewInstallProgress/) + assert.match(source, /openSkillInstallProgress/) + assert.match(source, /SandboxSkillsPanel/) + assert.match(source, /focus-skill-id/) + assert.match(source, /skillsGroupUnavailable/) assert.match(source, /selectedSandboxSummary/) assert.match(source, /line-clamp: 2/) assert.doesNotMatch(source, /skillsSelectionMode === 'selected' && catalogSkillRows/) assert.doesNotMatch(source, /skill-list-summary/) + assert.doesNotMatch(source, /skill-ready-stat/) }) diff --git a/frontend/src/views/agent/AgentEditorModal.vue b/frontend/src/views/agent/AgentEditorModal.vue index c261d46a..7cee3807 100644 --- a/frontend/src/views/agent/AgentEditorModal.vue +++ b/frontend/src/views/agent/AgentEditorModal.vue @@ -1342,7 +1342,6 @@ {{ $t('agent.editor.skillsSelected') }} {{ $t('agent.editor.skillsNone') }} -

{{ skillListSummary }}

{{ $t('agent.editor.skillsNeedSandbox') }}

@@ -1366,47 +1365,77 @@ v-model="formData.config.selected_skills" class="skill-pick-list" > -
- -
-
- {{ skill.name }} - {{ skillStatusHint(skill) }} -
-

{{ skill.description }}

-
- + + {{ group.label }} + {{ group.skills.length }} + +
- {{ $t('agent.editor.installShort') }} - -
+ + +
+
+ {{ skill.name }} + + + {{ skillStatusHint(skill) }} + +
+

{{ skill.description }}

+
+ + {{ $t('agent.editor.installShort') }} + + + {{ $t('agent.editor.viewInstallProgress') }} + +
+ @@ -1760,6 +1789,28 @@ + + + + @@ -1805,6 +1856,8 @@ import { useEditorResourcesStore } from '@/stores/editorResources'; import AgentAvatar from '@/components/AgentAvatar.vue'; import PromptTemplateSelector from '@/components/PromptTemplateSelector.vue'; import ModelSelector from '@/components/ModelSelector.vue'; +import SandboxSkillsPanel from '@/components/SandboxSkillsPanel.vue'; +import SettingDrawer from '@/components/settings/SettingDrawer.vue'; import KBParserSettings, { type ParserEngineRule } from '@/views/knowledge/settings/KBParserSettings.vue'; import AgentShareSettings from '@/components/AgentShareSettings.vue'; import { SKILL_ICON } from '@/types/mention'; @@ -2050,19 +2103,25 @@ const skillsSelectionHint = computed(() => { return t('agent.editor.skillsSelectionDesc') }) -const catalogReadyCount = computed(() => - catalogSkillRows.value.filter((skill) => skill.selectable).length, -) - -const catalogPendingCount = computed(() => - catalogSkillRows.value.filter((skill) => !skill.selectable).length, -) - -const skillListSummary = computed(() => { - const ready = catalogReadyCount.value - const pending = catalogPendingCount.value - if (pending > 0) return t('agent.editor.skillsListSummary', { ready, pending }) - return t('agent.editor.skillsListSummaryReadyOnly', { ready }) +const catalogSkillGroups = computed(() => { + const ready = catalogSkillRows.value.filter((skill) => skill.selectable) + const pending = catalogSkillRows.value.filter((skill) => !skill.selectable) + const groups: { key: 'ready' | 'pending'; label: string; skills: CatalogSkillRow[] }[] = [] + if (ready.length) { + groups.push({ + key: 'ready', + label: t('agent.editor.skillsGroupAvailable'), + skills: ready, + }) + } + if (pending.length) { + groups.push({ + key: 'pending', + label: t('agent.editor.skillsGroupUnavailable'), + skills: pending, + }) + } + return groups }) function skillStatusHint(skill: CatalogSkillRow): string { @@ -2076,6 +2135,17 @@ function skillStatusHint(skill: CatalogSkillRow): string { return t('agent.editor.skillNotReady') } +function skillStatusIcon(skill: CatalogSkillRow): string { + if (!skill.installed || skill.installStatus === 'failed') return 'download' + if (skill.installStatus === 'installing' || skill.installStatus === 'removing') return 'refresh' + if (skill.installStatus === 'ready' && !skill.installEnabled) return 'close-circle' + return 'time' +} + +function isSkillBusy(skill: CatalogSkillRow): boolean { + return skill.installStatus === 'installing' || skill.installStatus === 'removing' +} + function canInstallSkillRow(skill: CatalogSkillRow): boolean { if (!canInstallSkills.value || !hasSandboxSelected.value) return false return !skill.installed || skill.installStatus === 'failed' @@ -2099,6 +2169,55 @@ function openSkillSettings() { uiStore.openSettings('skills', configId || undefined) } +const showSkillProgress = ref(false) +const skillProgressRecord = ref(null) +const skillProgressId = ref('') +const skillProgressTitle = ref('') +const skillProgressDesc = computed(() => { + const record = skillProgressRecord.value + if (!record) return '' + return t('settings.skills.manageDrawerDesc', { name: record.name }) +}) + +function sandboxRecordById(configId: string): SandboxConfigRecord | undefined { + return chatResources.sandboxConfigs.find((cfg) => cfg.id === configId) +} + +function installOnCurrentSandbox(skill: CatalogSkillRow, configId: string) { + return (skill.installations || []).find((row) => row.sandbox_config_id === configId) +} + +async function openSkillInstallProgress(skill: CatalogSkillRow) { + const configId = formData.value.config.sandbox_config_id || '' + const record = sandboxRecordById(configId) + if (!record) { + openSkillSettings() + return + } + let inst = installOnCurrentSandbox(skill, configId) + if (!inst?.skill_id) { + await syncInstalledSkills(true) + const latest = catalogSkillRows.value.find((row) => row.id === skill.id) + inst = latest ? installOnCurrentSandbox(latest, configId) : undefined + } + if (!inst?.skill_id) { + openSkillSettings() + return + } + skillProgressRecord.value = record + skillProgressId.value = inst.skill_id + skillProgressTitle.value = skill.name + showSkillProgress.value = true +} + +function onSkillProgressUpdated() { + void syncInstalledSkills(true) +} + +function onSkillProgressChanged() { + void syncInstalledSkills(true) +} + function pruneSelectedSkills() { if (!catalogReady.value) return const names = new Set(catalogSkillRows.value.filter((skill) => skill.selectable).map((skill) => skill.name)) @@ -3391,6 +3510,9 @@ watch(() => props.visible, async (val) => { clearFieldHighlight(); agentIMChannelCount.value = 0; agentEmbedChannelCount.value = 0; + showSkillProgress.value = false; + skillProgressRecord.value = null; + skillProgressId.value = ''; } }); @@ -5298,15 +5420,6 @@ const handleSave = async () => { align-items: flex-end; } -.skill-ready-stat { - margin: 6px 0 0; - max-width: 280px; - font-size: 12px; - color: var(--td-text-color-secondary); - line-height: 1.45; - text-align: right; -} - .sandbox-config-select { width: 280px; } @@ -5970,15 +6083,51 @@ const handleSave = async () => { .skill-pick-list { display: flex; flex-direction: column; - gap: 8px; + gap: 16px; width: 100%; +} - :deep(.t-checkbox-group) { - display: flex; - flex-direction: column; - gap: 8px; - width: 100%; - } +.skill-pick-group { + display: flex; + flex-direction: column; + gap: 8px; +} + +.skill-pick-group__header { + display: flex; + align-items: center; + gap: 8px; + padding-bottom: 2px; +} + +.skill-pick-group__bar { + display: inline-block; + width: 3px; + height: 14px; + border-radius: 2px; + background: var(--td-brand-color); +} + +.skill-pick-group--pending .skill-pick-group__bar { + background: var(--td-text-color-placeholder); +} + +.skill-pick-group__title { + font-size: 13px; + font-weight: 600; + color: var(--td-text-color-primary); + letter-spacing: 0.2px; +} + +.skill-pick-group__count { + min-width: 20px; + padding: 0 6px; + font-size: 11px; + color: var(--td-text-color-secondary); + background: var(--td-bg-color-secondarycontainer); + border-radius: 999px; + text-align: center; + line-height: 18px; } .skill-pick { @@ -6000,6 +6149,28 @@ const handleSave = async () => { flex-shrink: 0; } +.skill-pick__badge { + flex-shrink: 0; + width: 28px; + height: 28px; + border-radius: 7px; + display: flex; + align-items: center; + justify-content: center; + background: var(--td-bg-color-secondarycontainer); + color: var(--td-text-color-secondary); +} + +.skill-pick--ready .skill-pick__badge { + background: color-mix(in srgb, var(--td-brand-color) 12%, transparent); + color: var(--td-brand-color); +} + +.skill-pick--pending .skill-pick__badge { + background: var(--td-bg-color-container); + color: var(--td-text-color-placeholder); +} + .skill-pick__body { flex: 1; min-width: 0; @@ -6023,9 +6194,29 @@ const handleSave = async () => { } .skill-pick__hint { + display: inline-flex; + align-items: center; + gap: 4px; flex-shrink: 0; font-size: 12px; color: var(--td-text-color-placeholder); + + .t-icon { + flex-shrink: 0; + } +} + +.skill-pick__hint--busy { + color: var(--td-brand-color); + + .t-icon { + animation: skill-pick-spin 1s linear infinite; + } +} + +@keyframes skill-pick-spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } } .skill-desc {