From 4fbfdf2be8ae2cd002e364821b3dcba5ee22475c Mon Sep 17 00:00:00 2001 From: YokiiroBW Date: Sun, 5 Jul 2026 12:56:49 +0800 Subject: [PATCH] refactor: normalize standalone workbench labels --- frontend/standalone-web/src/App.vue | 263 +++++++++++++++++----------- web/assets/index-BTWVDt8L.css | 1 - web/assets/index-ChLO5vLw.js | 17 ++ web/assets/index-DL1DDRDZ.css | 1 + web/assets/index-QsMDq_Mp.js | 17 -- web/index.html | 4 +- 6 files changed, 185 insertions(+), 118 deletions(-) delete mode 100644 web/assets/index-BTWVDt8L.css create mode 100644 web/assets/index-ChLO5vLw.js create mode 100644 web/assets/index-DL1DDRDZ.css delete mode 100644 web/assets/index-QsMDq_Mp.js diff --git a/frontend/standalone-web/src/App.vue b/frontend/standalone-web/src/App.vue index 2c14650..505c083 100644 --- a/frontend/standalone-web/src/App.vue +++ b/frontend/standalone-web/src/App.vue @@ -20,6 +20,79 @@ import type { WardrobeItem, WardrobeMatchResult } from "../../shared/types/wardr type ViewKey = "dashboard" | "profiles" | "materials" | "wardrobe" | "jobs" | "discovery" | "logs" | "settings" +const text = { + waiting: "\u7b49\u5f85\u64cd\u4f5c", + loading: "\u52a0\u8f7d\u4e2d...", + loadFailed: "\u52a0\u8f7d\u5931\u8d25", + refresh: "\u5237\u65b0", + complete: "\u5b8c\u6210", + failed: "\u5931\u8d25", + noProfile: "\u672a\u9009\u62e9\u89d2\u8272", + noTags: "\u65e0\u6807\u7b7e", + noImage: "\u672a\u7ed1\u5b9a\u56fe\u7247", + dashboard: "\u8fd0\u884c\u6982\u89c8", + profiles: "\u89d2\u8272", + materials: "\u7d20\u6750\u5e93", + wardrobe: "\u89d2\u8272\u8863\u6a71", + jobs: "\u4efb\u52a1\u961f\u5217", + discovery: "\u80fd\u529b\u63a2\u6d4b", + logs: "\u65e5\u5fd7\u5ba1\u8ba1", + settings: "\u8bbe\u7f6e", + profileList: "\u89d2\u8272\u5217\u8868", + emptyProfiles: "\u6682\u65e0\u89d2\u8272", + categories: "\u7d20\u6750\u5206\u7c7b", + materialItems: "\u7d20\u6750\u6761\u76ee", + emptyCategories: "\u6682\u65e0\u5206\u7c7b", + emptyMaterials: "\u6682\u65e0\u7d20\u6750", + pendingConfirm: "\u5f85\u786e\u8ba4", + signFirstImage: "\u7b7e\u540d\u9996\u56fe", + noSignableMaterial: "\u6ca1\u6709\u53ef\u7b7e\u540d\u7684\u7d20\u6750\u56fe\u7247", + signMaterial: "\u7b7e\u540d\u7d20\u6750", + match: "\u5339\u914d", + matchWardrobe: "\u8863\u6a71\u5339\u914d", + emptyWardrobe: "\u6682\u65e0\u8863\u6a71\u6761\u76ee", + moveFailed: "\u5931\u8d25\u8f6c\u6b7b\u4fe1", + retryDead: "\u91cd\u8bd5\u6b7b\u4fe1", + retry: "\u91cd\u8bd5", + cancel: "\u53d6\u6d88", + emptyJobs: "\u6682\u65e0\u4efb\u52a1", + dialects: "\u534f\u8bae\u65b9\u8a00", + safeProbe: "\u5b89\u5168\u63a2\u6d4b", + capabilityProfiles: "\u80fd\u529b\u6863\u6848", + support: "\u652f\u6301", + unsupported: "\u4e0d\u652f\u6301", + unconfirmed: "\u5f85\u786e\u8ba4", + emptyCapabilities: "\u6682\u65e0\u80fd\u529b\u6863\u6848", + generationLogs: "\u751f\u6210\u65e5\u5fd7", + errorLogs: "\u9519\u8bef", + workflowLogs: "\u5de5\u4f5c\u6d41", + integrationLogs: "\u96c6\u6210", + auditLogs: "\u5ba1\u8ba1", + emptyGenerationLogs: "\u6682\u65e0\u751f\u6210\u65e5\u5fd7", + emptyErrors: "\u6682\u65e0\u9519\u8bef", + emptyWorkflowLogs: "\u6682\u65e0\u5de5\u4f5c\u6d41\u65e5\u5fd7", + emptyIntegrationLogs: "\u6682\u65e0\u96c6\u6210\u65e5\u5fd7", + emptyAuditLogs: "\u6682\u65e0\u5ba1\u8ba1\u65e5\u5fd7", + noErrorDetail: "\u65e0\u9519\u8bef\u8be6\u60c5", + reload: "\u91cd\u8f7d", + exportRedacted: "\u5bfc\u51fa\u8131\u654f\u914d\u7f6e", + exportSettings: "\u5bfc\u51fa\u8bbe\u7f6e", + exportDone: "\u5bfc\u51fa\u8bbe\u7f6e\u5b8c\u6210\uff0c\u914d\u7f6e\u5df2\u8131\u654f", + storage: "\u5b58\u50a8", + running: "\u8fd0\u884c", +} as const + +const navItems: Array<{ key: ViewKey; label: string }> = [ + { key: "dashboard", label: "\u6982\u89c8" }, + { key: "profiles", label: text.profiles }, + { key: "materials", label: "\u7d20\u6750" }, + { key: "wardrobe", label: "\u8863\u6a71" }, + { key: "jobs", label: "\u961f\u5217" }, + { key: "discovery", label: "\u63a2\u6d4b" }, + { key: "logs", label: "\u65e5\u5fd7" }, + { key: "settings", label: text.settings }, +] + const activeView = ref("dashboard") const bootstrap = ref(null) const dashboard = ref(null) @@ -42,7 +115,7 @@ const busy = ref("") const error = ref("") const selectedProfileId = computed(() => profiles.value?.items[0]?.profile_id ?? "") -const selectedProfileName = computed(() => profiles.value?.items[0]?.name ?? "未选择角色") +const selectedProfileName = computed(() => profiles.value?.items[0]?.name ?? text.noProfile) const queueTotal = computed(() => { const queue = dashboard.value?.queue return queue ? queue.pending + queue.running + queue.failed + queue.dead_letter : 0 @@ -52,14 +125,14 @@ const pendingRecognition = computed( ) const activeTitle = computed(() => { const titles: Record = { - dashboard: "运行概览", - profiles: "角色", - materials: "素材库", - wardrobe: "角色衣橱", - jobs: "任务队列", - discovery: "能力探测", - logs: "日志审计", - settings: "设置", + dashboard: text.dashboard, + profiles: text.profiles, + materials: text.materials, + wardrobe: text.wardrobe, + jobs: text.jobs, + discovery: text.discovery, + logs: text.logs, + settings: text.settings, } return titles[activeView.value] }) @@ -109,7 +182,7 @@ async function load() { await loadWardrobe(profileData.items[0]?.profile_id) await loadLogs() } catch (err) { - error.value = err instanceof Error ? err.message : "加载失败" + error.value = err instanceof Error ? err.message : text.loadFailed } finally { loading.value = false } @@ -149,39 +222,39 @@ async function runOperation(label: string, action: () => Promise, refre error.value = "" try { const result = await action() - lastOperation.value = `${label}完成` - if (label === "导出设置") { - lastOperation.value = `导出设置完成,配置已脱敏:${Boolean((result as ExportSettingsResult).redacted)}` + lastOperation.value = `${label}${text.complete}` + if (label === text.exportSettings) { + lastOperation.value = `${text.exportDone}: ${Boolean((result as ExportSettingsResult).redacted)}` } if (refresh) { await load() } } catch (err) { - error.value = err instanceof Error ? err.message : `${label}失败` + error.value = err instanceof Error ? err.message : `${label}${text.failed}` } finally { busy.value = "" } } function retryJob(taskId: string) { - return runOperation("重试任务", () => postJson(endpoints.jobRetry(taskId))) + return runOperation(text.retry, () => postJson(endpoints.jobRetry(taskId))) } function cancelJob(taskId: string) { - return runOperation("取消任务", () => postJson(endpoints.jobCancel(taskId))) + return runOperation(text.cancel, () => postJson(endpoints.jobCancel(taskId))) } function moveFailedJobs() { - return runOperation("转入死信", () => postJson(endpoints.jobDeadLetterMoveFailed, { limit: 20 })) + return runOperation(text.moveFailed, () => postJson(endpoints.jobDeadLetterMoveFailed, { limit: 20 })) } function retryDeadLetters() { - return runOperation("重试死信", () => postJson(endpoints.jobDeadLetterRetry, { limit: 20 })) + return runOperation(text.retryDead, () => postJson(endpoints.jobDeadLetterRetry, { limit: 20 })) } function safeProbeModel() { const dialect = dialects.value[0]?.dialect ?? "unknown" - return runOperation("安全探测", () => + return runOperation(text.safeProbe, () => postJson(endpoints.apiDiscoveryProbeModel, { provider_id: "local-preview", model_id: "metadata-only", @@ -192,7 +265,7 @@ function safeProbeModel() { } function setCapabilityStatus(profile: CapabilityProfile, status: CapabilityProfile["status"]) { - return runOperation("能力覆盖", () => + return runOperation(text.discovery, () => postJson(endpoints.apiDiscoveryManualOverride, { provider_id: profile.provider_id, model_id: profile.model_id, @@ -207,7 +280,7 @@ function matchWardrobe() { const profileId = selectedProfileId.value if (!profileId) return Promise.resolve() return runOperation( - "衣橱匹配", + text.matchWardrobe, async () => { wardrobeMatch.value = await postJson(endpoints.wardrobeMatch(profileId), { tags: ["daily"], @@ -220,7 +293,7 @@ function matchWardrobe() { function reloadSettings() { return runOperation( - "重载设置", + text.reload, async () => { const result = await postJson(endpoints.settingsReload) currentSettings.value = { config_path: currentSettings.value?.config_path ?? "***PATH***", config: result.config } @@ -231,17 +304,17 @@ function reloadSettings() { } function exportSettings() { - return runOperation("导出设置", () => getJson(endpoints.settingsExport), false) + return runOperation(text.exportSettings, () => getJson(endpoints.settingsExport), false) } function signFirstMaterial() { const uri = materials.value?.items.find((item) => item.image_uri?.startsWith("storage://"))?.image_uri if (!uri) { - lastOperation.value = "没有可签名的素材图片" + lastOperation.value = text.noSignableMaterial return Promise.resolve() } return runOperation( - "签名素材", + text.signMaterial, async () => { signedMedia.value = await getJson(endpoints.mediaSign, { uri }) return signedMedia.value @@ -270,29 +343,14 @@ function storageRootBytes(uriPrefix: string) { {{ bootstrap?.dashboard_user ?? "AstrBot" }} @@ -301,41 +359,41 @@ function storageRootBytes(uriPrefix: string) {

{{ activeTitle }}

-

{{ dashboard?.plugin_status ?? "loading" }} · {{ lastOperation || "等待操作" }}

+

{{ dashboard?.plugin_status ?? "loading" }} / {{ lastOperation || text.waiting }}

{{ error }}
-
加载中...
+
{{ text.loading }}