From 1c0b94c46f8f7c79f057e4ecae1f6321aee8f118 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 5 Apr 2025 00:41:49 +0800 Subject: [PATCH] Fix web title cleaning problem --- lightrag_webui/src/api/lightrag.ts | 18 +++++++++--------- lightrag_webui/src/stores/state.ts | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lightrag_webui/src/api/lightrag.ts b/lightrag_webui/src/api/lightrag.ts index 6892cc14..bf208f8b 100644 --- a/lightrag_webui/src/api/lightrag.ts +++ b/lightrag_webui/src/api/lightrag.ts @@ -427,10 +427,10 @@ export const getAuthStatus = async (): Promise => { if (!response.data.auth_configured) { if (response.data.access_token && typeof response.data.access_token === 'string') { // Update custom title if available - if (response.data.webui_title || response.data.webui_description) { + if ('webui_title' in response.data || 'webui_description' in response.data) { useAuthStore.getState().setCustomTitle( - response.data.webui_title || null, - response.data.webui_description || null + 'webui_title' in response.data ? (response.data.webui_title ?? null) : null, + 'webui_description' in response.data ? (response.data.webui_description ?? null) : null ); } return response.data; @@ -440,10 +440,10 @@ export const getAuthStatus = async (): Promise => { } else { // For configured auth, just return the data // Update custom title if available - if (response.data.webui_title || response.data.webui_description) { + if ('webui_title' in response.data || 'webui_description' in response.data) { useAuthStore.getState().setCustomTitle( - response.data.webui_title || null, - response.data.webui_description || null + 'webui_title' in response.data ? (response.data.webui_title ?? null) : null, + 'webui_description' in response.data ? (response.data.webui_description ?? null) : null ); } return response.data; @@ -485,10 +485,10 @@ export const loginToServer = async (username: string, password: string): Promise }); // Update custom title if available - if (response.data.webui_title || response.data.webui_description) { + if ('webui_title' in response.data || 'webui_description' in response.data) { useAuthStore.getState().setCustomTitle( - response.data.webui_title || null, - response.data.webui_description || null + 'webui_title' in response.data ? (response.data.webui_title ?? null) : null, + 'webui_description' in response.data ? (response.data.webui_description ?? null) : null ); } diff --git a/lightrag_webui/src/stores/state.ts b/lightrag_webui/src/stores/state.ts index 66651b35..785af199 100644 --- a/lightrag_webui/src/stores/state.ts +++ b/lightrag_webui/src/stores/state.ts @@ -51,10 +51,10 @@ const useBackendStateStoreBase = create()((set) => ({ } // Update custom title information if health check returns it - if (health.webui_title || health.webui_description) { + if ('webui_title' in health || 'webui_description' in health) { useAuthStore.getState().setCustomTitle( - health.webui_title || null, - health.webui_description || null + 'webui_title' in health ? (health.webui_title ?? null) : null, + 'webui_description' in health ? (health.webui_description ?? null) : null ); }