feat: show version in sidebar

This commit is contained in:
Junyan Qin
2025-05-10 18:31:10 +08:00
parent 055b389353
commit 11d94ae8c3
2 changed files with 11 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import {
import { useRouter, usePathname } from 'next/navigation';
import { sidebarConfigList } from '@/app/home/components/home-sidebar/sidbarConfigList';
import langbotIcon from '@/app/assets/langbot-logo.webp';
import { httpClient } from '@/app/infra/http/HttpClient';
// TODO 侧边导航栏要加动画
export default function HomeSidebar({
@@ -90,7 +91,9 @@ export default function HomeSidebar({
{/* 文字 */}
<div className={`${styles.langbotTextContainer}`}>
<div className={`${styles.langbotText}`}>LangBot</div>
<div className={`${styles.langbotVersion}`}>v4.0.0</div>
<div className={`${styles.langbotVersion}`}>
{httpClient.systemInfo?.version}
</div>
</div>
</div>
{/* 菜单列表,后期可升级成配置驱动 */}

View File

@@ -54,6 +54,7 @@ class HttpClient {
private disableToken: boolean = false;
// 暂不需要SSR
// private ssrInstance: AxiosInstance | null = null
public systemInfo: ApiRespSystemInfo | null = null;
constructor(baseURL?: string, disableToken?: boolean) {
this.instance = axios.create({
@@ -65,6 +66,12 @@ class HttpClient {
});
this.disableToken = disableToken || false;
this.initInterceptors();
if (this.systemInfo === null) {
this.getSystemInfo().then((res) => {
this.systemInfo = res;
});
}
}
// 兜底URL如果使用未配置会走到这里