From bec308b5d14da412ba05cc589e99a65d40814249 Mon Sep 17 00:00:00 2001 From: KiriAky 107 Date: Sun, 30 Aug 2026 11:04:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E5=AE=8C=E6=88=90=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E4=BD=93=E9=A1=B5=E9=9D=A2=E6=B1=89=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/CommandPalette.vue | 2 +- .../src/components/common/PrimarySidebar.vue | 2 +- .../components/common/SecondarySidebar.vue | 2 +- frontend/src/components/common/StatusBar.vue | 2 +- frontend/src/components/common/TitleBar.vue | 2 +- frontend/src/features/agent/AgentView.vue | 51 ++++--- frontend/src/features/agent/RunListPanel.vue | 7 +- frontend/src/features/agent/labels.spec.ts | 35 +++++ frontend/src/features/agent/labels.ts | 126 ++++++++++++++++++ 9 files changed, 199 insertions(+), 30 deletions(-) create mode 100644 frontend/src/features/agent/labels.spec.ts create mode 100644 frontend/src/features/agent/labels.ts diff --git a/frontend/src/components/common/CommandPalette.vue b/frontend/src/components/common/CommandPalette.vue index a661469..33e238d 100644 --- a/frontend/src/components/common/CommandPalette.vue +++ b/frontend/src/components/common/CommandPalette.vue @@ -20,7 +20,7 @@ const commands = computed(() => [ { id: 'workspace', label: '打开工作区', hint: '导航', run: () => router.push('/workspace') }, { id: 'search', label: '全局搜索', hint: '导航', run: () => router.push('/search') }, { id: 'chat', label: '打开 AI 对话', hint: '导航', run: () => router.push('/chat') }, - { id: 'agent', label: '创建 Agent Run', hint: '导航', run: () => router.push('/agent/runs') }, + { id: 'agent', label: '创建智能体运行', hint: '导航', run: () => router.push('/agent/runs') }, { id: 'settings', label: '打开设置', hint: '导航', run: () => router.push('/settings') }, { id: 'mode', label: `切换为${editorStore.mode === 'source' ? '写作' : '源码'}模式`, hint: '编辑器', run: () => editorStore.toggleMode() }, { id: 'save', label: '保存当前笔记', hint: '编辑器', run: () => editorStore.save() }, diff --git a/frontend/src/components/common/PrimarySidebar.vue b/frontend/src/components/common/PrimarySidebar.vue index 2d861b1..5ac01c4 100644 --- a/frontend/src/components/common/PrimarySidebar.vue +++ b/frontend/src/components/common/PrimarySidebar.vue @@ -12,7 +12,7 @@ const navItems = [ { name: 'workspace', icon: FolderOpened, label: '工作区' }, { name: 'search', icon: Search, label: '搜索' }, { name: 'chat', icon: ChatDotRound, label: 'AI 对话' }, - { name: 'agent', icon: Cpu, label: 'Agent' }, + { name: 'agent', icon: Cpu, label: '智能体' }, { name: 'tasks', icon: CircleCheck, label: '任务' }, { name: 'skills', icon: Lightning, label: 'Skill' }, { name: 'plugins', icon: Connection, label: 'Plugin' }, diff --git a/frontend/src/components/common/SecondarySidebar.vue b/frontend/src/components/common/SecondarySidebar.vue index 1c51e1f..4cd09c3 100644 --- a/frontend/src/components/common/SecondarySidebar.vue +++ b/frontend/src/components/common/SecondarySidebar.vue @@ -19,7 +19,7 @@ const sidebarTitle = computed(() => { const titles: Record = { 'file-tree': '文件', 'conversation-list': '对话', - 'run-list': 'Agent Run', + 'run-list': '智能体运行', 'search-filters': '搜索筛选', 'task-filters': '任务筛选', 'extension-list': '扩展', diff --git a/frontend/src/components/common/StatusBar.vue b/frontend/src/components/common/StatusBar.vue index 41089d7..cb897c2 100644 --- a/frontend/src/components/common/StatusBar.vue +++ b/frontend/src/components/common/StatusBar.vue @@ -84,7 +84,7 @@ const showEditorInfo = computed(() => route.name === 'workspace') - Agent 运行中 + 智能体运行中
diff --git a/frontend/src/components/common/TitleBar.vue b/frontend/src/components/common/TitleBar.vue index 9b2e5be..bfd5043 100644 --- a/frontend/src/components/common/TitleBar.vue +++ b/frontend/src/components/common/TitleBar.vue @@ -18,7 +18,7 @@ const pageTitle = computed(() => { workspace: '工作区', search: '搜索', chat: 'AI 对话', - agent: 'Agent Trace', + agent: '智能体执行轨迹', tasks: '任务', skills: 'Skill 管理', plugins: 'Plugin 管理', diff --git a/frontend/src/features/agent/AgentView.vue b/frontend/src/features/agent/AgentView.vue index 135d166..06b5aa3 100644 --- a/frontend/src/features/agent/AgentView.vue +++ b/frontend/src/features/agent/AgentView.vue @@ -4,6 +4,8 @@ import { useRoute, useRouter } from 'vue-router' import { useAgentStore } from '@/stores/agent' import { useProviderStore } from '@/stores/provider' import { useSkillStore } from '@/stores/skill' +import type { AgentEvent } from '@/contracts' +import { eventLabel, localizeDetails, permissionLabel, runStatusLabel, toolDescription, toolLabel } from './labels' const route = useRoute() const router = useRouter() @@ -24,12 +26,12 @@ onMounted(async () => { try { await Promise.all([providerStore.loadProviders(), skillStore.loadSkills(), agentStore.loadTools()]) await providerStore.loadModels(form.provider_id) - } catch (error) { pageError.value = error instanceof Error ? error.message : 'Agent 配置加载失败' } + } catch (error) { pageError.value = error instanceof Error ? error.message : '智能体配置加载失败' } }) watch(() => route.params.runId, async (runId) => { if (typeof runId !== 'string') return - try { await agentStore.loadRun(runId) } catch (error) { pageError.value = error instanceof Error ? error.message : 'Run 加载失败' } + try { await agentStore.loadRun(runId) } catch (error) { pageError.value = error instanceof Error ? error.message : '运行记录加载失败' } }, { immediate: true }) watch(() => form.provider_id, async (providerId) => { @@ -53,50 +55,54 @@ async function createRun() { allow_network: form.allow_network, max_concurrent_tools: form.max_concurrent_tools, }) await router.replace({ name: 'agent', params: { runId: run.run_id } }) - } catch (error) { pageError.value = error instanceof Error ? error.message : 'Run 创建失败' } + } catch (error) { pageError.value = error instanceof Error ? error.message : '运行创建失败' } } -function eventText(data: Record) { - return String(data.text ?? data.message ?? data.code ?? '') +function eventText(event: AgentEvent) { + if (event.event === 'RunCompleted') return '任务已成功完成。' + if (event.event === 'RunCancelled') return '任务已取消。' + const text = event.data.text ?? event.data.message ?? event.data.code + if (text) return String(text) + return '' }