feat(frontend): 完成智能体页面汉化

This commit is contained in:
2026-08-30 11:04:13 +08:00
parent 0bb78e004b
commit bec308b5d1
9 changed files with 199 additions and 30 deletions
+4 -3
View File
@@ -2,13 +2,14 @@
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useAgentStore } from '@/stores/agent'
import { runStatusLabel } from './labels'
const agentStore = useAgentStore()
const router = useRouter()
const error = ref('')
onMounted(async () => {
try { await agentStore.loadRuns() } catch (reason) { error.value = reason instanceof Error ? reason.message : 'Run 列表加载失败' }
try { await agentStore.loadRuns() } catch (reason) { error.value = reason instanceof Error ? reason.message : '运行记录加载失败' }
})
function selectRun(runId: string) { void router.push({ name: 'agent', params: { runId } }) }
@@ -16,12 +17,12 @@ function selectRun(runId: string) { void router.push({ name: 'agent', params: {
<template>
<div class="sidebar-panel">
<button class="button-primary new-button" @click="router.push({ name: 'agent' })"> 新建 Run</button>
<button class="button-primary new-button" @click="router.push({ name: 'agent' })"> 新建运行</button>
<p v-if="error" class="subtle error-text">{{ error }}</p>
<div class="sidebar-list">
<button v-for="run in agentStore.sortedRuns" :key="run.run_id" class="sidebar-list-item run-item"
:class="{ active: agentStore.activeRunId === run.run_id }" @click="selectRun(run.run_id)">
<span class="badge" :class="{ success: run.status === 'completed', error: run.status === 'failed', warning: run.status === 'waiting_permission' }">{{ run.status }}</span>
<span class="badge" :class="{ success: run.status === 'completed', error: run.status === 'failed', warning: run.status === 'waiting_permission' }">{{ runStatusLabel(run.status) }}</span>
<strong>{{ run.run_id.slice(0, 12) }}</strong><small>{{ run.started_at ? new Date(run.started_at).toLocaleString() : '等待开始' }}</small>
</button>
</div>