ui(agent): merge skills and sandbox into one editor tab (#2806)

* ui(agent): merge skills and sandbox into one editor tab

Skills and the sandbox they run in belong together, so the agent editor now shows one Skills section with sandbox selection driving the available list.

* fix(frontend): type selected skill names when pruning

vue-tsc could not infer the selected_skills filter callback after JSON-cloned form state.
main
lyingbug 2026-08-25 21:20:47 +08:00 committed by GitHub
parent 5e117afea0
commit a753a15354
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 176 additions and 136 deletions

View File

@ -1009,26 +1009,24 @@ export default {
fallbackPrompt: 'Fallback Prompt',
fallbackPromptPlaceholder: 'Leave empty to use default prompt',
skillsConfig: 'Skills',
skillsConfigDesc: 'Configure preloaded Skills available to the Agent for specialized domain knowledge and workflows',
skillsConfigDesc: 'Choose the sandbox that runs skill scripts, then pick which Skills from that sandbox the Agent can use. The Skill list follows the selected sandbox.',
skillsSelection: 'Skills Selection',
skillsSelectionDesc: 'Select the scope of Skills available to the Agent',
skillsSelectionDesc: 'Choose which Skills the Agent can use. The list comes from the sandbox selected above.',
skillsAll: 'All',
skillsSelected: 'Selected',
skillsNone: 'Disabled',
selectSkills: 'Select Skills',
selectSkillsDesc: 'Choose which Skills to enable',
noSkillsAvailable: 'No preloaded Skills available',
sandboxConfig: 'Skill sandbox',
sandboxConfigDesc: 'Choose which sandbox this agent\'s skill scripts run in.',
noSkillsAvailable: 'This sandbox has no preloaded Skills. Install them in Skill Sandbox settings.',
skillsNeedSandbox: 'Select a sandbox first. Available Skills come from the skills installed in that sandbox.',
goSandboxSettings: 'Configure in Skill Sandbox settings',
sandboxBackend: 'Sandbox config',
sandboxBackendDefault: 'Disable sandbox',
sandboxBackendHint: 'Only applies while skill execution is enabled. If the selected config is deleted, this agent\'s skill execution will fail.',
sandboxBackendHint: 'Skill scripts run in the selected sandbox. They stay disabled until a config is chosen; if that config is deleted, skill execution will fail.',
sandboxBackendMissing: 'Config deleted',
sandboxNoConfigs: 'This workspace has no sandbox yet, so skill scripts will not run. Add one under Settings - Skill Sandbox.',
sandboxInfoTitle: 'Why pick a config?',
sandboxInfoContent: 'Configs differ in account, region and quota. Once a session\'s sandbox exists, its attachments, artifacts and teardown stay pinned to the config it was created on — changing this only affects sandboxes created afterwards.',
skillsInfoTitle: 'What are Skills?',
skillsInfoContent: 'Skills are preloaded professional knowledge modules that provide domain-specific instructions, workflows, and tool support for the Agent. When enabled, the Agent will automatically load relevant knowledge when needed.'
sandboxNoConfigs: 'This workspace has no sandbox yet, so skill scripts will not run.',
skillsInfoTitle: 'How Skills and the sandbox work together',
skillsInfoContent: 'Skills are preloaded knowledge modules whose scripts run in the selected sandbox. The list comes from skills installed there. Once a session sandbox exists, its attachments, artifacts, and teardown stay pinned to the config it was created on — changing the sandbox only affects later sessions.'
},
selector: {
title: 'Select Agent',

View File

@ -5569,26 +5569,24 @@ export default {
fallbackPrompt: '폴백 프롬프트',
fallbackPromptPlaceholder: '시스템 기본 프롬프트를 사용하려면 비워 두세요.',
skillsConfig: '스킬 Skills',
skillsConfigDesc: 'Agent가 사용할 수 있는 사전 설치된 Skills를 구성하여 전문 영역 지식과 워크플로를 제공합니다',
skillsConfigDesc: '스킬 스크립트가 실행될 샌드박스를 선택한 뒤, 해당 샌드박스에서 Agent가 사용할 Skills를 구성합니다. 사용 가능한 Skills는 선택한 샌드박스에 따라 달라집니다.',
skillsSelection: 'Skills 선택',
skillsSelectionDesc: 'Agent가 사용할 수 있는 Skills 범위 선택',
skillsSelectionDesc: 'Agent가 사용할 수 있는 Skills 범위를 선택하세요. 목록은 위에서 선택한 샌드박스에 설치된 스킬에서 가져옵니다.',
skillsAll: '전체',
skillsSelected: '지정',
skillsNone: '비활성화',
selectSkills: 'Skills 선택',
selectSkillsDesc: '활성화할 Skills 선택',
noSkillsAvailable: '사전 설치된 Skills가 없습니다',
sandboxConfig: '스킬 샌드박스',
sandboxConfigDesc: '이 에이전트의 스킬 스크립트가 실행될 샌드박스를 선택하세요.',
noSkillsAvailable: '이 샌드박스에 사전 설치된 Skills가 없습니다. 스킬 샌드박스 설정에서 설치할 수 있습니다.',
skillsNeedSandbox: '먼저 샌드박스 설정을 선택하세요. 사용 가능한 Skills는 해당 샌드박스에 설치된 스킬에서 가져옵니다.',
goSandboxSettings: '스킬 샌드박스 설정에서 구성',
sandboxBackend: '샌드박스 설정',
sandboxBackendDefault: '샌드박스 사용 안 함',
sandboxBackendHint: '스킬 실행이 켜져 있을 때만 적용됩니다. 선택한 설정이 삭제되면 이 에이전트의 스킬 실행이 실패합니다.',
sandboxBackendHint: '스킬 스크립트는 선택한 샌드박스에서 실행됩니다. 선택하지 않으면 실행되지 않으며, 선택한 설정이 삭제되면 스킬 실행이 실패합니다.',
sandboxBackendMissing: '설정이 삭제됨',
sandboxNoConfigs: '이 워크스페이스에 샌드박스가 없어 스킬 스크립트가 실행되지 않습니다. 설정 - 스킬 샌드박스에서 추가하세요.',
sandboxInfoTitle: '왜 설정을 고르나요?',
sandboxInfoContent: '설정마다 계정, 리전, 할당량이 다릅니다. 세션의 샌드박스가 한 번 만들어지면 첨부 파일, 산출물, 회수는 그 설정에 고정됩니다. 여기서 바꾸면 이후에 새로 만들어지는 샌드박스에만 영향을 줍니다.',
skillsInfoTitle: 'Skills란 무엇인가요?',
skillsInfoContent: 'Skills는 Agent에 특정 도메인의 지침, 워크플로 및 도구 지원을 제공하는 사전 설치된 전문 지식 모듈입니다. 활성화되면 Agent는 필요할 때 자동으로 관련 지식을 로드합니다.'
sandboxNoConfigs: '이 워크스페이스에 샌드박스가 없어 스킬 스크립트가 실행되지 않습니다.',
skillsInfoTitle: 'Skills와 샌드박스는 어떻게 연동되나요?',
skillsInfoContent: 'Skills는 사전 설치된 전문 지식 모듈이며, 스크립트는 선택한 샌드박스에서 격리 실행됩니다. 목록은 해당 샌드박스에 설치된 스킬에서 가져옵니다. 세션 샌드박스가 한 번 만들어지면 첨부 파일, 산출물, 회수는 그 설정에 고정되며, 여기서 바꾸면 이후에 새로 만들어지는 세션에만 영향을 줍니다.'
},
messages: {
created: '에이전트가 성공적으로 생성되었습니다.',

View File

@ -5569,26 +5569,24 @@ export default {
fallbackPrompt: 'Fallback Prompt',
fallbackPromptPlaceholder: 'Leave empty to use default prompt',
skillsConfig: 'Skills',
skillsConfigDesc: 'Настройка предустановленных Skills для агента, предоставляющих специализированные знания и рабочие процессы',
skillsConfigDesc: 'Выберите песочницу для скриптов навыков и настройте Skills, доступные агенту в этой песочнице. Список Skills зависит от выбранной песочницы.',
skillsSelection: 'Выбор Skills',
skillsSelectionDesc: 'Выберите диапазон Skills, доступных агенту',
skillsSelectionDesc: 'Выберите диапазон Skills, доступных агенту. Список берётся из навыков, установленных в выбранной выше песочнице.',
skillsAll: 'Все',
skillsSelected: 'Выбранные',
skillsNone: 'Отключено',
selectSkills: 'Выбрать Skills',
selectSkillsDesc: 'Выберите Skills для активации',
noSkillsAvailable: 'Нет доступных предустановленных Skills',
sandboxConfig: 'Песочница навыков',
sandboxConfigDesc: 'Выберите песочницу, в которой будут выполняться скрипты навыков этого агента.',
noSkillsAvailable: 'В этой песочнице нет предустановленных Skills. Их можно установить в настройках песочницы навыков.',
skillsNeedSandbox: 'Сначала выберите конфигурацию песочницы. Доступные Skills берутся из навыков, установленных в этой песочнице.',
goSandboxSettings: 'Настроить в параметрах песочницы навыков',
sandboxBackend: 'Конфигурация песочницы',
sandboxBackendDefault: 'Не использовать песочницу',
sandboxBackendHint: 'Действует только при включённом выполнении навыков. Если выбранная конфигурация будет удалена, выполнение навыков этого агента завершится ошибкой.',
sandboxBackendHint: 'Скрипты навыков выполняются в выбранной песочнице. Без выбора они не запускаются; если конфигурация удалена, выполнение навыков завершится ошибкой.',
sandboxBackendMissing: 'Конфигурация удалена',
sandboxNoConfigs: 'В этом пространстве ещё нет песочницы, поэтому скрипты навыков не будут выполняться. Добавьте её в «Настройки — Песочница навыков».',
sandboxInfoTitle: 'Зачем выбирать конфигурацию?',
sandboxInfoContent: 'Конфигурации отличаются аккаунтом, регионом и квотой. Когда песочница сессии уже создана, вложения, артефакты и удаление остаются привязаны к той конфигурации. Изменение здесь влияет только на песочницы, созданные позже.',
skillsInfoTitle: 'Что такое Skills?',
skillsInfoContent: 'Skills — это предустановленные модули профессиональных знаний, которые предоставляют агенту инструкции, рабочие процессы и инструменты для конкретных областей. При активации агент автоматически загружает соответствующие знания по мере необходимости.'
sandboxNoConfigs: 'В этом пространстве ещё нет песочницы, поэтому скрипты навыков не выполняются.',
skillsInfoTitle: 'Как связаны Skills и песочница?',
skillsInfoContent: 'Skills — это предустановленные модули знаний, скрипты которых выполняются в выбранной песочнице. Список берётся из установленных там навыков. После создания песочницы сессии вложения, артефакты и удаление остаются привязаны к той конфигурации — изменение песочницы влияет только на последующие сессии.'
},
messages: {
created: 'Agent created successfully',

View File

@ -5571,26 +5571,24 @@ export default {
fallbackPrompt: '兜底提示词',
fallbackPromptPlaceholder: '留空使用系统默认提示词',
skillsConfig: '技能 Skills',
skillsConfigDesc: '配置 Agent 可以使用的预装 Skills,提供专业领域知识和工作流程',
skillsConfigDesc: '选择技能脚本运行的沙箱,并配置该沙箱中可供 Agent 使用的 Skills。可用 Skills 会随所选沙箱变化。',
skillsSelection: 'Skills 选择',
skillsSelectionDesc: '选择 Agent 可以使用的 Skills 范围',
skillsSelectionDesc: '选择 Agent 可以使用的 Skills 范围。列表来自上方所选沙箱中已安装的技能。',
skillsAll: '全部',
skillsSelected: '指定',
skillsNone: '禁用',
selectSkills: '选择 Skills',
selectSkillsDesc: '选择要启用的 Skills',
noSkillsAvailable: '暂无预装 Skills',
sandboxConfig: '技能沙箱',
sandboxConfigDesc: '选择该智能体的技能脚本在哪个沙箱中执行。',
noSkillsAvailable: '该沙箱暂无预装 Skills,可在技能沙箱设置中安装。',
skillsNeedSandbox: '请先选择沙箱配置。可用 Skills 来自该沙箱已安装的技能。',
goSandboxSettings: '去技能沙箱设置中配置',
sandboxBackend: '沙箱配置',
sandboxBackendDefault: '不启用沙箱',
sandboxBackendHint: '仅在启用技能执行时生效。所选配置被删除后,该智能体的技能执行会失败。',
sandboxBackendHint: '技能脚本在所选沙箱中执行。未选择时不会执行技能脚本;所选配置被删除后,技能执行会失败。',
sandboxBackendMissing: '配置已删除',
sandboxNoConfigs: '当前空间还没有沙箱配置,技能脚本不会执行。可在「设置 - 技能沙箱」中添加。',
sandboxInfoTitle: '为什么要选配置?',
sandboxInfoContent: '不同配置对应不同的账号、区域与配额。同一会话的沙箱一旦创建,后续的附件、产物与销毁都会锁定在创建时那份配置上,改这里只影响之后新建的沙箱。',
skillsInfoTitle: '什么是 Skills?',
skillsInfoContent: 'Skills 是预装的专业知识模块,可以为 Agent 提供特定领域的指令、工作流程和工具支持。启用 Skills 后,Agent 会在需要时自动加载相关知识。'
sandboxNoConfigs: '当前空间还没有沙箱配置,技能脚本不会执行。',
skillsInfoTitle: 'Skills 与沙箱如何联动?',
skillsInfoContent: 'Skills 是预装的专业知识模块,脚本在所选沙箱中隔离执行。可用列表来自该沙箱已安装的技能;同一会话的沙箱一旦创建,后续附件、产物与销毁都会锁定在创建时那份配置上,改沙箱只影响之后新建的会话。'
},
messages: {
created: '智能体创建成功',

View File

@ -108,3 +108,21 @@ test('retrieval retention is offered to agents that actually have a knowledge ba
const guard = settingRowGuard('agent.editor.retainRetrievalHistory')
assert.match(guard, /isAgentMode && hasKnowledgeBase/)
})
test('skills and sandbox share one editor section', () => {
const navItems = source.match(/const navItems = computed\(\(\) => \{([\s\S]*?)^\}\);/m)?.[1]
assert.ok(navItems, 'expected to find the nav items computed')
assert.match(navItems, /key: 'skills'/)
assert.doesNotMatch(navItems, /key: 'sandbox'/)
const capabilityGroup = source.match(/pickItems\(\['multimodal', 'tools', 'mcp', 'skills'\]\)/)
assert.ok(capabilityGroup, 'expected the capability group to list skills without a separate sandbox tab')
assert.match(source, /v-show="currentSection === 'skills' && isAgentMode"/)
assert.doesNotMatch(source, /currentSection === 'sandbox' && isAgentMode/)
assert.match(source, /sandbox: 'skills'/)
assert.match(source, /formData\.config\.sandbox_config_id/)
assert.match(source, /:disabled="!hasSandboxSelected"/)
assert.match(source, /name="help-circle"/)
assert.doesNotMatch(source, /skill-info-box/)
})

View File

@ -1260,15 +1260,55 @@
</div>
</div>
<!-- Skills 配置(仅 Agent 模式) -->
<!-- Skills + 技能沙箱(仅 Agent 模式):可用 Skills 取决于所选沙箱 -->
<div v-show="currentSection === 'skills' && isAgentMode" class="section">
<div class="section-header">
<h2>{{ $t('agent.editor.skillsConfig') }}</h2>
<div class="section-header-title">
<h2>{{ $t('agent.editor.skillsConfig') }}</h2>
<t-popup placement="bottom-start" trigger="hover" :overlay-inner-style="{ maxWidth: '380px' }">
<button type="button" class="hint-trigger"
:aria-label="$t('agent.editor.skillsInfoTitle')">
<t-icon name="help-circle" size="16px" />
</button>
<template #content>
<div class="hint-popover">
<p class="hint-popover__title">{{ $t('agent.editor.skillsInfoTitle') }}</p>
<p class="hint-popover__text">{{ $t('agent.editor.skillsInfoContent') }}</p>
</div>
</template>
</t-popup>
</div>
<p class="section-description">{{ $t('agent.editor.skillsConfigDesc') }}</p>
</div>
<div class="settings-group">
<!-- Skills 选择模式 -->
<!-- 沙箱配置:技能脚本运行环境,同时决定下方 Skills 列表 -->
<div class="setting-row">
<div class="setting-info">
<label>{{ $t('agent.editor.sandboxBackend') }}</label>
<p class="desc">{{ $t('agent.editor.sandboxBackendHint') }}</p>
</div>
<div class="setting-control" style="flex-direction: column; align-items: flex-end;">
<t-select v-model="formData.config.sandbox_config_id"
:placeholder="$t('agent.editor.sandboxBackendDefault')" style="width: 280px">
<t-option value="" :label="$t('agent.editor.sandboxBackendDefault')" />
<t-option v-for="cfg in sandboxConfigOptions" :key="cfg.id" :value="cfg.id"
:label="`${cfg.name} (${backendLabel(cfg.sandbox_type)})`" />
</t-select>
<a href="javascript:void(0)" class="go-settings-link"
@click.prevent="uiStore.openSettings('sandbox')">
{{ $t('agent.editor.goSandboxSettings') }}
</a>
</div>
</div>
<div v-if="sandboxConfigOptions.length === 0" class="setting-row">
<div class="setting-info">
<p class="desc empty-hint">{{ $t('agent.editor.sandboxNoConfigs') }}</p>
</div>
</div>
<!-- Skills 选择模式:未选沙箱时只能保持禁用,列表来自所选沙箱 -->
<div class="setting-row">
<div class="setting-info">
<label>{{ $t('agent.editor.skillsSelection') }}</label>
@ -1276,8 +1316,8 @@
</div>
<div class="setting-control">
<t-radio-group v-model="skillsSelectionMode">
<t-radio-button value="all">{{ $t('agent.editor.skillsAll') }}</t-radio-button>
<t-radio-button value="selected">{{ $t('agent.editor.skillsSelected') }}</t-radio-button>
<t-radio-button value="all" :disabled="!hasSandboxSelected">{{ $t('agent.editor.skillsAll') }}</t-radio-button>
<t-radio-button value="selected" :disabled="!hasSandboxSelected">{{ $t('agent.editor.skillsSelected') }}</t-radio-button>
<t-radio-button value="none">{{ $t('agent.editor.skillsNone') }}</t-radio-button>
</t-radio-group>
</div>
@ -1303,61 +1343,16 @@
</div>
</div>
<!-- 无可用 Skills 提示 -->
<div v-if="skillOptions.length === 0" class="setting-row">
<div v-if="!hasSandboxSelected && sandboxConfigOptions.length > 0" class="setting-row">
<div class="setting-info">
<p class="desc empty-hint">{{ $t('agent.editor.skillsNeedSandbox') }}</p>
</div>
</div>
<div v-else-if="hasSandboxSelected && skillOptions.length === 0" class="setting-row">
<div class="setting-info">
<p class="desc empty-hint">{{ $t('agent.editor.noSkillsAvailable') }}</p>
</div>
</div>
<!-- Skills 说明 -->
<div class="skill-info-box">
<t-icon name="lightbulb" class="info-icon" />
<div class="info-content">
<p><strong>{{ $t('agent.editor.skillsInfoTitle') }}</strong></p>
<p>{{ $t('agent.editor.skillsInfoContent') }}</p>
</div>
</div>
</div>
</div>
<!-- 技能沙箱(仅 Agent 模式):技能脚本的运行环境 -->
<div v-show="currentSection === 'sandbox' && isAgentMode" class="section">
<div class="section-header">
<h2>{{ $t('agent.editor.sandboxConfig') }}</h2>
<p class="section-description">{{ $t('agent.editor.sandboxConfigDesc') }}</p>
</div>
<div class="settings-group">
<div class="setting-row">
<div class="setting-info">
<label>{{ $t('agent.editor.sandboxBackend') }}</label>
<p class="desc">{{ $t('agent.editor.sandboxBackendHint') }}</p>
</div>
<div class="setting-control">
<t-select v-model="formData.config.sandbox_config_id"
:placeholder="$t('agent.editor.sandboxBackendDefault')" style="width: 280px">
<t-option value="" :label="$t('agent.editor.sandboxBackendDefault')" />
<t-option v-for="cfg in sandboxConfigOptions" :key="cfg.id" :value="cfg.id"
:label="`${cfg.name} (${backendLabel(cfg.sandbox_type)})`" />
</t-select>
</div>
</div>
<!-- 未建具名配置时说明「默认」到底是什么,避免下拉只有一项时显得像坏了 -->
<div v-if="sandboxConfigOptions.length === 0" class="setting-row">
<div class="setting-info">
<p class="desc empty-hint">{{ $t('agent.editor.sandboxNoConfigs') }}</p>
</div>
</div>
<div class="skill-info-box">
<t-icon name="code" class="info-icon" />
<div class="info-content">
<p><strong>{{ $t('agent.editor.sandboxInfoTitle') }}</strong></p>
<p>{{ $t('agent.editor.sandboxInfoContent') }}</p>
</div>
</div>
</div>
</div>
@ -1815,7 +1810,17 @@ const copyAgentId = async () => {
await copyWithToast(editorAgent.value?.id, 'common.copied');
};
const currentSection = ref(props.initialSection || 'basic');
// 旧入口把技能沙箱拆成独立 tab;合并后仍接受 section=sandbox。
const AGENT_EDITOR_SECTION_ALIASES: Record<string, string> = {
sandbox: 'skills',
};
function resolveEditorSection(section?: string | null): string {
const key = section || 'basic';
return AGENT_EDITOR_SECTION_ALIASES[key] || key;
}
const currentSection = ref(resolveEditorSection(props.initialSection));
const suggestionTab = ref<'starters' | 'followUps'>('starters');
const contentWrapperRef = ref<HTMLElement | null>(null);
const highlightedField = ref<AgentNotReadyReasonKey | null>(null);
@ -1882,8 +1887,10 @@ const applyInitialFieldHighlight = async (field: string) => {
const onAgentEditorFocusSection = (event: Event) => {
const section = (event as CustomEvent<{ section?: string }>).detail?.section
if (section && navItems.value.some((item) => item.key === section)) {
currentSection.value = section
if (!section) return
const resolved = resolveEditorSection(section)
if (navItems.value.some((item) => item.key === resolved)) {
currentSection.value = resolved
}
}
@ -1945,12 +1952,27 @@ const webSearchProviderList = ref<WebSearchProviderEntity[]>([]);
const skillOptions = ref<{ name: string; description: string }[]>([]);
// 是否允许启用 Skills(当前沙盒配置上有可执行技能时为 true;未选配置前为 false)
const skillsAvailable = ref(false);
const hasSandboxSelected = computed(() => !!formData.value.config.sandbox_config_id);
async function syncInstalledSkills() {
function pruneSelectedSkills() {
const configId = formData.value.config.sandbox_config_id || ''
await editorResources.ensureSkills(configId)
if (!configId) return
// 拉取失败时不要把用户已选项清掉
if (!skillsAvailable.value && skillOptions.value.length === 0) return
const names = new Set(skillOptions.value.map((skill) => skill.name))
const selected: string[] = formData.value.config.selected_skills || []
const kept = selected.filter((name: string) => names.has(name))
if (kept.length !== selected.length) {
formData.value.config.selected_skills = kept
}
}
async function syncInstalledSkills(force = false) {
const configId = formData.value.config.sandbox_config_id || ''
await editorResources.ensureSkills(configId, force)
skillsAvailable.value = editorResources.skillsAvailable
skillOptions.value = [...editorResources.skills]
pruneSelectedSkills()
}
// 空间内的具名沙箱后端配置。始终包含当前已选中的那份,即使它已被删除——
// 否则下拉会静默显示为“不启用沙箱”,看不出该智能体其实指着一份不存在的配置。
@ -2324,7 +2346,6 @@ const navItems = computed(() => {
items.push({ key: 'tools', icon: 'tools', label: t('agent.editor.toolsConfig') });
items.push({ key: 'mcp', icon: 'server', label: t('agentEditor.mcp.label') });
items.push({ key: 'skills', icon: 'lightbulb', label: t('agent.editor.skillsConfig') });
items.push({ key: 'sandbox', icon: 'code', label: t('agent.editor.sandboxConfig') });
}
// 发布(仅编辑模式)
if (editorMode.value === 'edit' && editorAgent.value?.id && !editorAgent.value?.is_builtin && !authStore.isLiteMode) {
@ -2352,7 +2373,7 @@ const navGroups = computed(() => {
{
key: 'capability',
label: t('agentEditor.navGroups.capability'),
items: pickItems(['multimodal', 'tools', 'mcp', 'skills', 'sandbox']),
items: pickItems(['multimodal', 'tools', 'mcp', 'skills']),
},
{
key: 'integration',
@ -3005,7 +3026,7 @@ const needsRerankModel = computed(() => {
watch(() => props.visible, async (val) => {
if (val) {
savedAgent.value = null;
currentSection.value = props.initialSection || 'basic';
currentSection.value = resolveEditorSection(props.initialSection);
// 先加载依赖数据(包括默认配置)
await loadDependencies();
@ -3367,6 +3388,9 @@ watch(isAgentMode, (isAgent) => {
if (isAgent && currentSection.value === 'advanced') {
currentSection.value = 'basic';
}
if (!isAgent && (currentSection.value === 'skills' || currentSection.value === 'sandbox')) {
currentSection.value = 'basic';
}
});
// 监听设置弹窗关闭,刷新模型列表
@ -3376,6 +3400,7 @@ watch(() => uiStore.showSettingsModal, async (visible, prevVisible) => {
await Promise.all([
chatResources.ensureModels(true),
editorResources.ensureStorageEngine(true),
chatResources.ensureSandboxConfigs(true),
]);
if (chatResources.allModels.length > 0) {
allModels.value = chatResources.allModels;
@ -3383,6 +3408,7 @@ watch(() => uiStore.showSettingsModal, async (visible, prevVisible) => {
if (editorResources.storageStatus.length > 0) {
storageEngineStatus.value = editorResources.storageStatus;
}
await syncInstalledSkills(true);
} catch (e) {
console.warn('Failed to refresh data after settings closed', e);
}
@ -5643,40 +5669,44 @@ const handleSave = async () => {
line-height: 1.5;
}
.skill-info-box {
display: flex;
gap: 12px;
padding: 16px;
background: var(--td-brand-color-light);
border-radius: 8px;
border: 1px solid var(--td-brand-color-focus);
margin-top: 16px;
.hint-trigger {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px;
border: none;
border-radius: 4px;
background: transparent;
color: var(--td-text-color-placeholder);
cursor: help;
line-height: 1;
.info-icon {
font-size: 20px;
&:hover,
&:focus-visible {
color: var(--td-brand-color);
flex-shrink: 0;
margin-top: 2px;
outline: none;
}
}
.info-content {
flex: 1;
.hint-popover {
display: flex;
flex-direction: column;
gap: 4px;
max-width: 340px;
}
p {
margin: 0;
font-size: 13px;
color: var(--td-text-color-secondary);
line-height: 1.6;
.hint-popover__title {
margin: 0;
color: var(--td-text-color-primary);
font-size: 13px;
font-weight: 600;
}
&:first-child {
margin-bottom: 4px;
}
strong {
color: var(--td-brand-color);
}
}
}
.hint-popover__text {
margin: 0;
color: var(--td-text-color-secondary);
font-size: 12px;
line-height: 1.55;
}
.empty-hint {