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).
This commit is contained in:
wizardchen
2026-05-13 17:45:35 +08:00
committed by lyingbug
parent 588394a8e6
commit 6cb493eda2
7 changed files with 50 additions and 9 deletions
+2
View File
@@ -4,3 +4,5 @@
declare module '*.vue' { declare module '*.vue' {
import { Component } from 'vue'; const component: Component; export default component; import { Component } from 'vue'; const component: Component; export default component;
} }
declare const __FRONTEND_VERSION__: string;
+5 -2
View File
@@ -2405,8 +2405,11 @@ export default {
sectionDescription: 'View system version information and user account configuration', sectionDescription: 'View system version information and user account configuration',
loadingInfo: 'Loading information...', loadingInfo: 'Loading information...',
retry: 'Retry', retry: 'Retry',
versionLabel: 'System Version', versionLabel: 'App Version',
versionDescription: 'Current version number of the system', 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', buildTimeLabel: 'Build Time',
buildTimeDescription: 'Time when the system was built', buildTimeDescription: 'Time when the system was built',
goVersionLabel: 'Go Version', goVersionLabel: 'Go Version',
+5 -2
View File
@@ -1663,8 +1663,11 @@ export default {
sectionDescription: "시스템 버전 정보 및 사용자 계정 설정 보기", sectionDescription: "시스템 버전 정보 및 사용자 계정 설정 보기",
loadingInfo: "정보 로딩 중...", loadingInfo: "정보 로딩 중...",
retry: "재시도", retry: "재시도",
versionLabel: "시스템 버전", versionLabel: "앱 버전",
versionDescription: "현재 시스템의 버전 번호", versionDescription: "애플리케이션 서비스(weknora-app)의 버전 번호",
frontendVersionLabel: "UI 버전",
frontendVersionDescription: "UI(weknora-ui) 빌드 버전 번호",
versionMismatch: "앱 버전과 일치하지 않음",
buildTimeLabel: "빌드 시간", buildTimeLabel: "빌드 시간",
buildTimeDescription: "시스템이 빌드된 시간", buildTimeDescription: "시스템이 빌드된 시간",
goVersionLabel: "Go 버전", goVersionLabel: "Go 버전",
+5 -2
View File
@@ -1480,8 +1480,11 @@ export default {
sectionDescription: 'Просмотр сведений о версии системы и конфигурации учётной записи пользователя', sectionDescription: 'Просмотр сведений о версии системы и конфигурации учётной записи пользователя',
loadingInfo: 'Загрузка данных...', loadingInfo: 'Загрузка данных...',
retry: 'Повторить', retry: 'Повторить',
versionLabel: 'Версия системы', versionLabel: 'Версия приложения',
versionDescription: 'Текущий номер версии системы', versionDescription: 'Версия сервиса приложения (weknora-app)',
frontendVersionLabel: 'Версия UI',
frontendVersionDescription: 'Версия сборки UI (weknora-ui)',
versionMismatch: 'Не совпадает с версией приложения',
buildTimeLabel: 'Время сборки', buildTimeLabel: 'Время сборки',
buildTimeDescription: 'Время, когда система была собрана', buildTimeDescription: 'Время, когда система была собрана',
goVersionLabel: 'Версия Go', goVersionLabel: 'Версия Go',
+5 -2
View File
@@ -1643,8 +1643,11 @@ export default {
sectionDescription: "查看系统版本信息和用户账户配置", sectionDescription: "查看系统版本信息和用户账户配置",
loadingInfo: "正在加载信息...", loadingInfo: "正在加载信息...",
retry: "重试", retry: "重试",
versionLabel: "系统版本", versionLabel: "应用版本",
versionDescription: "当前系统的版本号", versionDescription: "当前应用服务(weknora-app)的版本号",
frontendVersionLabel: "UI 版本",
frontendVersionDescription: "当前 UI 界面(weknora-ui)的构建版本号",
versionMismatch: "与应用版本不一致",
buildTimeLabel: "构建时间", buildTimeLabel: "构建时间",
buildTimeDescription: "系统构建的时间", buildTimeDescription: "系统构建的时间",
goVersionLabel: "Go 版本", goVersionLabel: "Go 版本",
@@ -45,6 +45,26 @@
</div> </div>
</div> </div>
<!-- Frontend version -->
<div class="setting-row">
<div class="setting-info">
<label>{{ $t('system.frontendVersionLabel') }}</label>
<p class="desc">{{ $t('system.frontendVersionDescription') }}</p>
</div>
<div class="setting-control">
<span class="info-value">
{{ frontendVersion }}
<t-tag
v-if="systemInfo?.version && systemInfo.version !== 'unknown' && frontendVersion !== 'unknown' && systemInfo.version !== frontendVersion"
theme="warning"
variant="light"
size="small"
style="margin-left: 8px;"
>{{ $t('system.versionMismatch') }}</t-tag>
</span>
</div>
</div>
<!-- Build time --> <!-- Build time -->
<div v-if="systemInfo?.build_time" class="setting-row"> <div v-if="systemInfo?.build_time" class="setting-row">
<div class="setting-info"> <div class="setting-info">
@@ -126,6 +146,7 @@ const { t } = useI18n()
const systemInfo = ref<SystemInfo | null>(null) const systemInfo = ref<SystemInfo | null>(null)
const loading = ref(true) const loading = ref(true)
const error = ref('') const error = ref('')
const frontendVersion = __FRONTEND_VERSION__
// Methods // Methods
const loadInfo = async () => { const loadInfo = async () => {
+6
View File
@@ -9,6 +9,9 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
const __dirname = dirname(fileURLToPath(import.meta.url)) const __dirname = dirname(fileURLToPath(import.meta.url))
const require = createRequire(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 { function resolveVueOfficePptxEntry(): string {
try { try {
const pkgDir = dirname(require.resolve('@vue-office/pptx/package.json')) const pkgDir = dirname(require.resolve('@vue-office/pptx/package.json'))
@@ -25,6 +28,9 @@ function resolveVueOfficePptxEntry(): string {
} }
export default defineConfig({ export default defineConfig({
define: {
__FRONTEND_VERSION__: JSON.stringify(FRONTEND_VERSION),
},
plugins: [ plugins: [
vue(), vue(),
vueJsx(), vueJsx(),