diff --git a/lightrag/api/__init__.py b/lightrag/api/__init__.py index 627c599f..005c738a 100644 --- a/lightrag/api/__init__.py +++ b/lightrag/api/__init__.py @@ -1 +1 @@ -__api_version__ = "1.2.1" +__api_version__ = "1.2.2" diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index f36e4dc4..b743ccb6 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -438,6 +438,8 @@ def create_app(args): "enable_llm_cache_for_extract": args.enable_llm_cache_for_extract, }, "update_status": update_status, + "core_version": core_version, + "api_version": __api_version__ } # Custom StaticFiles class to prevent caching of HTML files diff --git a/lightrag_webui/src/api/lightrag.ts b/lightrag_webui/src/api/lightrag.ts index 19c7f385..3b8b46f2 100644 --- a/lightrag_webui/src/api/lightrag.ts +++ b/lightrag_webui/src/api/lightrag.ts @@ -41,6 +41,9 @@ export type LightragStatus = { graph_storage: string vector_storage: string } + update_status?: Record + core_version?: string + api_version?: string } export type LightragDocumentsScanProgress = { diff --git a/lightrag_webui/src/stores/state.ts b/lightrag_webui/src/stores/state.ts index 7f0e89a1..fb9db79e 100644 --- a/lightrag_webui/src/stores/state.ts +++ b/lightrag_webui/src/stores/state.ts @@ -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()((set) => ({ @@ -35,6 +36,14 @@ const useBackendStateStoreBase = create()((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(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 + }); } }; });