From 6cb493eda2526d80ad8584ea9cd18b8d61593fc8 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 13 May 2026 17:45:35 +0800 Subject: [PATCH] feat(frontend): show UI build version on system info page Inject the frontend package.json version at build time via Vite and render it as a dedicated "UI Version" row in System Info, alongside the existing app (backend) version returned by /system/info. When the two versions differ a warning tag is shown so users can tell at a glance that their weknora-ui image is out of sync with weknora-app (e.g. missing config fields for newer providers like SearXNG). Rename the existing version row label from "System Version" to "App Version" to distinguish it from the new UI version row in all four locales (zh-CN, en-US, ko-KR, ru-RU). --- frontend/env.d.ts | 4 +++- frontend/src/i18n/locales/en-US.ts | 7 +++++-- frontend/src/i18n/locales/ko-KR.ts | 7 +++++-- frontend/src/i18n/locales/ru-RU.ts | 7 +++++-- frontend/src/i18n/locales/zh-CN.ts | 7 +++++-- frontend/src/views/settings/SystemInfo.vue | 21 +++++++++++++++++++++ frontend/vite.config.ts | 6 ++++++ 7 files changed, 50 insertions(+), 9 deletions(-) diff --git a/frontend/env.d.ts b/frontend/env.d.ts index 5b580fcd..62369697 100644 --- a/frontend/env.d.ts +++ b/frontend/env.d.ts @@ -3,4 +3,6 @@ // 这段代码告诉 TypeScript,所有以 .vue 结尾的文件都是 Vue 组件,可以通过 import 语句进行导入。这样做通常可以解决无法识别模块的问题。 declare module '*.vue' { import { Component } from 'vue'; const component: Component; export default component; -} \ No newline at end of file +} + +declare const __FRONTEND_VERSION__: string; \ No newline at end of file diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 66dd9012..d769ca1b 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -2405,8 +2405,11 @@ export default { sectionDescription: 'View system version information and user account configuration', loadingInfo: 'Loading information...', retry: 'Retry', - versionLabel: 'System Version', - versionDescription: 'Current version number of the system', + versionLabel: 'App Version', + versionDescription: 'Version of the application service (weknora-app)', + frontendVersionLabel: 'UI Version', + frontendVersionDescription: 'Build version of the UI (weknora-ui)', + versionMismatch: 'Mismatch with app version', buildTimeLabel: 'Build Time', buildTimeDescription: 'Time when the system was built', goVersionLabel: 'Go Version', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 87f9bde4..3968bec0 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -1663,8 +1663,11 @@ export default { sectionDescription: "시스템 버전 정보 및 사용자 계정 설정 보기", loadingInfo: "정보 로딩 중...", retry: "재시도", - versionLabel: "시스템 버전", - versionDescription: "현재 시스템의 버전 번호", + versionLabel: "앱 버전", + versionDescription: "애플리케이션 서비스(weknora-app)의 버전 번호", + frontendVersionLabel: "UI 버전", + frontendVersionDescription: "UI(weknora-ui) 빌드 버전 번호", + versionMismatch: "앱 버전과 일치하지 않음", buildTimeLabel: "빌드 시간", buildTimeDescription: "시스템이 빌드된 시간", goVersionLabel: "Go 버전", diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index e014c14f..3b2163ba 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -1480,8 +1480,11 @@ export default { sectionDescription: 'Просмотр сведений о версии системы и конфигурации учётной записи пользователя', loadingInfo: 'Загрузка данных...', retry: 'Повторить', - versionLabel: 'Версия системы', - versionDescription: 'Текущий номер версии системы', + versionLabel: 'Версия приложения', + versionDescription: 'Версия сервиса приложения (weknora-app)', + frontendVersionLabel: 'Версия UI', + frontendVersionDescription: 'Версия сборки UI (weknora-ui)', + versionMismatch: 'Не совпадает с версией приложения', buildTimeLabel: 'Время сборки', buildTimeDescription: 'Время, когда система была собрана', goVersionLabel: 'Версия Go', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 9a74476b..92190fe5 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -1643,8 +1643,11 @@ export default { sectionDescription: "查看系统版本信息和用户账户配置", loadingInfo: "正在加载信息...", retry: "重试", - versionLabel: "系统版本", - versionDescription: "当前系统的版本号", + versionLabel: "应用版本", + versionDescription: "当前应用服务(weknora-app)的版本号", + frontendVersionLabel: "UI 版本", + frontendVersionDescription: "当前 UI 界面(weknora-ui)的构建版本号", + versionMismatch: "与应用版本不一致", buildTimeLabel: "构建时间", buildTimeDescription: "系统构建的时间", goVersionLabel: "Go 版本", diff --git a/frontend/src/views/settings/SystemInfo.vue b/frontend/src/views/settings/SystemInfo.vue index 3be50bd6..3619abe9 100644 --- a/frontend/src/views/settings/SystemInfo.vue +++ b/frontend/src/views/settings/SystemInfo.vue @@ -45,6 +45,26 @@ + +
+
+ +

{{ $t('system.frontendVersionDescription') }}

+
+
+ + {{ frontendVersion }} + {{ $t('system.versionMismatch') }} + +
+
+
@@ -126,6 +146,7 @@ const { t } = useI18n() const systemInfo = ref(null) const loading = ref(true) const error = ref('') +const frontendVersion = __FRONTEND_VERSION__ // Methods const loadInfo = async () => { diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 42d64dbe..aae11d4d 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -9,6 +9,9 @@ import vueJsx from '@vitejs/plugin-vue-jsx' const __dirname = dirname(fileURLToPath(import.meta.url)) const require = createRequire(import.meta.url) +const pkg = require('./package.json') as { version?: string } +const FRONTEND_VERSION = pkg.version ?? 'unknown' + function resolveVueOfficePptxEntry(): string { try { const pkgDir = dirname(require.resolve('@vue-office/pptx/package.json')) @@ -25,6 +28,9 @@ function resolveVueOfficePptxEntry(): string { } export default defineConfig({ + define: { + __FRONTEND_VERSION__: JSON.stringify(FRONTEND_VERSION), + }, plugins: [ vue(), vueJsx(),