Added core and API version to health check

- Bumped API version to 1.2.2
This commit is contained in:
yangdx
2025-03-23 00:28:50 +08:00
parent ea51ff05c1
commit 31c7923067
4 changed files with 31 additions and 1 deletions

View File

@@ -41,6 +41,9 @@ export type LightragStatus = {
graph_storage: string
vector_storage: string
}
update_status?: Record<string, any>
core_version?: string
api_version?: string
}
export type LightragDocumentsScanProgress = {

View File

@@ -23,6 +23,7 @@ interface AuthState {
apiVersion: string | null;
login: (token: string, isGuest?: boolean, coreVersion?: string | null, apiVersion?: string | null) => void;
logout: () => void;
setVersion: (coreVersion: string | null, apiVersion: string | null) => void;
}
const useBackendStateStoreBase = create<BackendState>()((set) => ({
@@ -35,6 +36,14 @@ const useBackendStateStoreBase = create<BackendState>()((set) => ({
check: async () => {
const health = await checkHealth()
if (health.status === 'healthy') {
// Update version information if health check returns it
if (health.core_version || health.api_version) {
useAuthStore.getState().setVersion(
health.core_version || null,
health.api_version || null
);
}
set({
health: true,
message: null,
@@ -148,6 +157,22 @@ export const useAuthStore = create<AuthState>(set => {
coreVersion: coreVersion,
apiVersion: apiVersion
});
},
setVersion: (coreVersion, apiVersion) => {
// Update localStorage
if (coreVersion) {
localStorage.setItem('LIGHTRAG-CORE-VERSION', coreVersion);
}
if (apiVersion) {
localStorage.setItem('LIGHTRAG-API-VERSION', apiVersion);
}
// Update state
set({
coreVersion: coreVersion,
apiVersion: apiVersion
});
}
};
});