mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-03 16:17:16 +00:00
feat: show version in sidebar
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
|||||||
import { useRouter, usePathname } from 'next/navigation';
|
import { useRouter, usePathname } from 'next/navigation';
|
||||||
import { sidebarConfigList } from '@/app/home/components/home-sidebar/sidbarConfigList';
|
import { sidebarConfigList } from '@/app/home/components/home-sidebar/sidbarConfigList';
|
||||||
import langbotIcon from '@/app/assets/langbot-logo.webp';
|
import langbotIcon from '@/app/assets/langbot-logo.webp';
|
||||||
|
import { httpClient } from '@/app/infra/http/HttpClient';
|
||||||
|
|
||||||
// TODO 侧边导航栏要加动画
|
// TODO 侧边导航栏要加动画
|
||||||
export default function HomeSidebar({
|
export default function HomeSidebar({
|
||||||
@@ -90,7 +91,9 @@ export default function HomeSidebar({
|
|||||||
{/* 文字 */}
|
{/* 文字 */}
|
||||||
<div className={`${styles.langbotTextContainer}`}>
|
<div className={`${styles.langbotTextContainer}`}>
|
||||||
<div className={`${styles.langbotText}`}>LangBot</div>
|
<div className={`${styles.langbotText}`}>LangBot</div>
|
||||||
<div className={`${styles.langbotVersion}`}>v4.0.0</div>
|
<div className={`${styles.langbotVersion}`}>
|
||||||
|
{httpClient.systemInfo?.version}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* 菜单列表,后期可升级成配置驱动 */}
|
{/* 菜单列表,后期可升级成配置驱动 */}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class HttpClient {
|
|||||||
private disableToken: boolean = false;
|
private disableToken: boolean = false;
|
||||||
// 暂不需要SSR
|
// 暂不需要SSR
|
||||||
// private ssrInstance: AxiosInstance | null = null
|
// private ssrInstance: AxiosInstance | null = null
|
||||||
|
public systemInfo: ApiRespSystemInfo | null = null;
|
||||||
|
|
||||||
constructor(baseURL?: string, disableToken?: boolean) {
|
constructor(baseURL?: string, disableToken?: boolean) {
|
||||||
this.instance = axios.create({
|
this.instance = axios.create({
|
||||||
@@ -65,6 +66,12 @@ class HttpClient {
|
|||||||
});
|
});
|
||||||
this.disableToken = disableToken || false;
|
this.disableToken = disableToken || false;
|
||||||
this.initInterceptors();
|
this.initInterceptors();
|
||||||
|
|
||||||
|
if (this.systemInfo === null) {
|
||||||
|
this.getSystemInfo().then((res) => {
|
||||||
|
this.systemInfo = res;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 兜底URL,如果使用未配置会走到这里
|
// 兜底URL,如果使用未配置会走到这里
|
||||||
|
|||||||
Reference in New Issue
Block a user