增加多语言翻译

This commit is contained in:
sophie committed 2026-04-10 09:34:33 +08:00
1 parent 45ed2ed72a
commit 3d22e050f3
2 files changed
+94 -26

No files matched your search

+22 -22
View File
@@ -1115,7 +1115,7 @@ const runAgentTest = async (agent?: AgentRow) => {
success: !!data.success,
request_url: data.request_url || '',
output_info: data.output_info || '',
analysis: data.analysis || (res.ok ? '测试已完成。' : '测试失败。'),
analysis: data.analysis || (res.ok ? t('admin.agent.testDone') : t('admin.agent.testFailed')),
http_status: data.http_status,
tested_at: data.tested_at
};
@@ -1136,8 +1136,8 @@ const runAgentTest = async (agent?: AgentRow) => {
agentTestResult.value = {
success: false,
request_url: '',
output_info: e?.message || 'Network error',
analysis: '测试失败:请求过程出现异常。',
output_info: e?.message || t('admin.agent.networkError'),
analysis: t('admin.agent.testFailedRequestException'),
http_status: 0
};
} finally {
@@ -2557,10 +2557,10 @@ const handlePermissionImport = async (event: Event) => {
</td>
<td class="px-8 py-5 font-mono text-xs text-gray-500 max-w-xs truncate">
<span v-if="agent.type === 'api'" class="flex items-center gap-1">
<span class="text-gray-400">ID:</span> {{ agent.dify_app_id }}
<span class="text-gray-400">{{ t('admin.agent.idLabel') }}:</span> {{ agent.dify_app_id }}
</span>
<span v-else class="flex items-center gap-1" :title="agent.extra_config?.iframe_url">
<span class="text-gray-400">URL:</span> {{ agent.extra_config?.iframe_url }}
<span class="text-gray-400">{{ t('admin.agent.urlLabel') }}:</span> {{ agent.extra_config?.iframe_url }}
</span>
</td>
<td class="px-8 py-5">
@@ -2576,21 +2576,21 @@ const handlePermissionImport = async (event: Event) => {
<button
@click.stop="openAgentTestModal(agent)"
class="p-2 text-emerald-600 bg-emerald-50 hover:bg-emerald-100 rounded-lg transition-all"
title="测试应用"
:title="t('admin.agent.test')"
>
测试
{{ t('admin.agent.test') }}
</button>
<button
@click.stop="openAgentPermissionModal(agent)"
class="p-2 text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-lg transition-all"
title="Manage Access"
:title="t('admin.agent.manageAccess')"
>
<Users class="w-5 h-5" />
</button>
<button
@click.stop="deleteAgent(agent.id)"
class="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all"
title="Delete Agent"
:title="t('admin.agent.delete')"
>
<Trash2 class="w-5 h-5" />
</button>
@@ -2914,20 +2914,20 @@ const handlePermissionImport = async (event: Event) => {
<div class="bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden">
<div class="px-5 py-4 border-b border-gray-100 flex flex-col md:flex-row md:items-center md:justify-between gap-3">
<h3 class="font-semibold text-gray-900">{{ t('admin.wecom.auditTitle') }}</h3>
<div class="flex flex-wrap items-center gap-2">
<select v-model="wecomAuditSourceFilter" class="px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white">
<div class="flex w-full md:w-auto flex-wrap md:flex-nowrap items-center justify-start md:justify-end gap-2">
<select v-model="wecomAuditSourceFilter" class="h-11 min-w-[112px] px-3 border border-gray-200 rounded-lg text-sm bg-white shrink-0">
<option value="all">{{ t('admin.wecom.filters.allSources') }}</option>
<option value="wecom">{{ t('admin.wecom.sources.wecom') }}</option>
<option value="password">{{ t('admin.wecom.sources.password') }}</option>
</select>
<select v-model="wecomAuditStatusFilter" class="px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white">
<select v-model="wecomAuditStatusFilter" class="h-11 min-w-[112px] px-3 border border-gray-200 rounded-lg text-sm bg-white shrink-0">
<option value="all">{{ t('admin.wecom.filters.allStatus') }}</option>
<option value="success">{{ t('admin.wecom.auditStatus.success') }}</option>
<option value="failed">{{ t('admin.wecom.auditStatus.failed') }}</option>
</select>
<button
@click="exportWecomAudits"
class="inline-flex items-center gap-2 px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-700 bg-white hover:bg-gray-50"
class="inline-flex h-11 items-center gap-2 px-3 border border-gray-200 rounded-lg text-sm text-gray-700 bg-white hover:bg-gray-50 shrink-0"
>
<Download class="w-4 h-4" />
{{ t('admin.wecom.exportAudit') }}
@@ -3202,7 +3202,7 @@ const handlePermissionImport = async (event: Event) => {
@dragover.prevent
@drop="onColumnDrop(String(key))"
>
<div class="flex flex-col gap-2 min-w-[120px]">
<div class="flex flex-col gap-2 min-w-0">
<button
@click="onReportHeaderClick(String(key))"
class="text-left hover:text-blue-700 transition-colors"
@@ -3460,8 +3460,8 @@ const handlePermissionImport = async (event: Event) => {
<div class="bg-white rounded-2xl shadow-xl w-full max-w-3xl max-h-[90vh] flex flex-col animate-fade-in-up">
<div class="px-8 py-6 border-b border-gray-100 flex justify-between items-start">
<div>
<h3 class="text-lg font-bold text-gray-900">应用测试</h3>
<p class="text-sm text-gray-500 mt-1">应用:<span class="font-medium text-blue-600">{{ testingAgent.name }}</span></p>
<h3 class="text-lg font-bold text-gray-900">{{ t('admin.agent.testModalTitle') }}</h3>
<p class="text-sm text-gray-500 mt-1">{{ t('admin.agent.testModalAgent') }}:<span class="font-medium text-blue-600">{{ testingAgent.name }}</span></p>
</div>
<button @click="showAgentTestModal = false" class="p-2 hover:bg-gray-100 rounded-full text-gray-400 hover:text-gray-600 transition-colors">✕</button>
</div>
@@ -3469,32 +3469,32 @@ const handlePermissionImport = async (event: Event) => {
<div class="flex-1 overflow-y-auto p-8 space-y-5">
<div class="flex items-center justify-between">
<div class="text-sm text-gray-600">
<span v-if="agentTestResult?.tested_at">测试时间:{{ agentTestResult.tested_at }}</span>
<span v-if="agentTestResult?.tested_at">{{ t('admin.agent.testedAt') }}:{{ agentTestResult.tested_at }}</span>
</div>
<button
@click="runAgentTest()"
:disabled="isTestingAgent"
class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700 disabled:opacity-50"
>
{{ isTestingAgent ? '测试中...' : '重新测试' }}
{{ isTestingAgent ? t('admin.agent.testing') : t('admin.agent.retest') }}
</button>
</div>
<div v-if="isTestingAgent" class="text-sm text-gray-500">正在执行测试,请稍候...</div>
<div v-if="isTestingAgent" class="text-sm text-gray-500">{{ t('admin.agent.testingInProgress') }}</div>
<template v-if="agentTestResult">
<div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">请求地址</div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">{{ t('admin.agent.requestUrl') }}</div>
<div class="p-3 rounded-lg bg-gray-50 border border-gray-200 text-sm font-mono break-all">{{ agentTestResult.request_url || '-' }}</div>
</div>
<div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">输出信息</div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">{{ t('admin.agent.outputInfo') }}</div>
<pre class="p-3 rounded-lg bg-gray-50 border border-gray-200 text-sm whitespace-pre-wrap break-all max-h-64 overflow-y-auto">{{ agentTestResult.output_info || '-' }}</pre>
</div>
<div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">最终结果分析</div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">{{ t('admin.agent.analysis') }}</div>
<div
class="p-3 rounded-lg border text-sm"
:class="agentTestResult.success ? 'bg-green-50 border-green-200 text-green-800' : 'bg-red-50 border-red-200 text-red-800'"