yangdx commited on
Commit
d56ff42
·
1 Parent(s): eec75b8

Fix web title cleaning problem

Browse files
lightrag_webui/src/api/lightrag.ts CHANGED
@@ -427,10 +427,10 @@ export const getAuthStatus = async (): Promise<AuthStatusResponse> => {
427
  if (!response.data.auth_configured) {
428
  if (response.data.access_token && typeof response.data.access_token === 'string') {
429
  // Update custom title if available
430
- if (response.data.webui_title || response.data.webui_description) {
431
  useAuthStore.getState().setCustomTitle(
432
- response.data.webui_title || null,
433
- response.data.webui_description || null
434
  );
435
  }
436
  return response.data;
@@ -440,10 +440,10 @@ export const getAuthStatus = async (): Promise<AuthStatusResponse> => {
440
  } else {
441
  // For configured auth, just return the data
442
  // Update custom title if available
443
- if (response.data.webui_title || response.data.webui_description) {
444
  useAuthStore.getState().setCustomTitle(
445
- response.data.webui_title || null,
446
- response.data.webui_description || null
447
  );
448
  }
449
  return response.data;
@@ -485,10 +485,10 @@ export const loginToServer = async (username: string, password: string): Promise
485
  });
486
 
487
  // Update custom title if available
488
- if (response.data.webui_title || response.data.webui_description) {
489
  useAuthStore.getState().setCustomTitle(
490
- response.data.webui_title || null,
491
- response.data.webui_description || null
492
  );
493
  }
494
 
 
427
  if (!response.data.auth_configured) {
428
  if (response.data.access_token && typeof response.data.access_token === 'string') {
429
  // Update custom title if available
430
+ if ('webui_title' in response.data || 'webui_description' in response.data) {
431
  useAuthStore.getState().setCustomTitle(
432
+ 'webui_title' in response.data ? (response.data.webui_title ?? null) : null,
433
+ 'webui_description' in response.data ? (response.data.webui_description ?? null) : null
434
  );
435
  }
436
  return response.data;
 
440
  } else {
441
  // For configured auth, just return the data
442
  // Update custom title if available
443
+ if ('webui_title' in response.data || 'webui_description' in response.data) {
444
  useAuthStore.getState().setCustomTitle(
445
+ 'webui_title' in response.data ? (response.data.webui_title ?? null) : null,
446
+ 'webui_description' in response.data ? (response.data.webui_description ?? null) : null
447
  );
448
  }
449
  return response.data;
 
485
  });
486
 
487
  // Update custom title if available
488
+ if ('webui_title' in response.data || 'webui_description' in response.data) {
489
  useAuthStore.getState().setCustomTitle(
490
+ 'webui_title' in response.data ? (response.data.webui_title ?? null) : null,
491
+ 'webui_description' in response.data ? (response.data.webui_description ?? null) : null
492
  );
493
  }
494
 
lightrag_webui/src/stores/state.ts CHANGED
@@ -51,10 +51,10 @@ const useBackendStateStoreBase = create<BackendState>()((set) => ({
51
  }
52
 
53
  // Update custom title information if health check returns it
54
- if (health.webui_title || health.webui_description) {
55
  useAuthStore.getState().setCustomTitle(
56
- health.webui_title || null,
57
- health.webui_description || null
58
  );
59
  }
60
 
 
51
  }
52
 
53
  // Update custom title information if health check returns it
54
+ if ('webui_title' in health || 'webui_description' in health) {
55
  useAuthStore.getState().setCustomTitle(
56
+ 'webui_title' in health ? (health.webui_title ?? null) : null,
57
+ 'webui_description' in health ? (health.webui_description ?? null) : null
58
  );
59
  }
60