Daniel.y commited on
Commit
f3a4077
·
unverified ·
2 Parent(s): fd79709 9798584

Merge pull request #1272 from danielaskdd/main

Browse files

Fix <div> in <p> problem and keep graph query label after 401 error for post-login data reload

lightrag/api/webui/assets/{index-Cb_7ABt2.js → index-D4h_QQ3K.js} RENAMED
Binary files a/lightrag/api/webui/assets/index-Cb_7ABt2.js and b/lightrag/api/webui/assets/index-D4h_QQ3K.js differ
 
lightrag/api/webui/index.html CHANGED
Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ
 
lightrag_webui/src/components/documents/ClearDocumentsDialog.tsx CHANGED
@@ -103,15 +103,17 @@ export default function ClearDocumentsDialog({ onDocumentsCleared }: ClearDocume
103
  {t('documentPanel.clearDocuments.title')}
104
  </DialogTitle>
105
  <DialogDescription className="pt-2">
106
- <div className="text-red-500 dark:text-red-400 font-semibold mb-4">
107
- {t('documentPanel.clearDocuments.warning')}
108
- </div>
109
- <div className="mb-4">
110
- {t('documentPanel.clearDocuments.confirm')}
111
- </div>
112
  </DialogDescription>
113
  </DialogHeader>
114
 
 
 
 
 
 
 
 
115
  <div className="space-y-4">
116
  <div className="space-y-2">
117
  <Label htmlFor="confirm-text" className="text-sm font-medium">
 
103
  {t('documentPanel.clearDocuments.title')}
104
  </DialogTitle>
105
  <DialogDescription className="pt-2">
106
+ {t('documentPanel.clearDocuments.description')}
 
 
 
 
 
107
  </DialogDescription>
108
  </DialogHeader>
109
 
110
+ <div className="text-red-500 dark:text-red-400 font-semibold mb-4">
111
+ {t('documentPanel.clearDocuments.warning')}
112
+ </div>
113
+ <div className="mb-4">
114
+ {t('documentPanel.clearDocuments.confirm')}
115
+ </div>
116
+
117
  <div className="space-y-4">
118
  <div className="space-y-2">
119
  <Label htmlFor="confirm-text" className="text-sm font-medium">
lightrag_webui/src/hooks/useLightragGraph.tsx CHANGED
@@ -342,15 +342,23 @@ const useLightrangeGraph = () => {
342
  // Still mark graph as empty for other logic
343
  state.setGraphIsEmpty(true);
344
 
345
- // Only clear current label if it's not already empty
346
- if (currentQueryLabel) {
 
 
 
 
347
  useSettingsStore.getState().setQueryLabel('');
348
  }
349
 
350
- // Clear last successful query label to ensure labels are fetched next time
351
- state.setLastSuccessfulQueryLabel('');
 
 
 
 
352
 
353
- console.log('Graph data is empty, created graph with empty graph node');
354
  } else {
355
  // Create and set new graph
356
  const newSigmaGraph = createSigmaGraph(data);
 
342
  // Still mark graph as empty for other logic
343
  state.setGraphIsEmpty(true);
344
 
345
+ // Check if the empty graph is due to 401 authentication error
346
+ const errorMessage = useBackendState.getState().message;
347
+ const isAuthError = errorMessage && errorMessage.includes('Authentication required');
348
+
349
+ // Only clear queryLabel if it's not an auth error and current label is not empty
350
+ if (!isAuthError && currentQueryLabel) {
351
  useSettingsStore.getState().setQueryLabel('');
352
  }
353
 
354
+ // Only clear last successful query label if it's not an auth error
355
+ if (!isAuthError) {
356
+ state.setLastSuccessfulQueryLabel('');
357
+ } else {
358
+ console.log('Keep queryLabel for post-login reload');
359
+ }
360
 
361
+ console.log(`Graph data is empty, created graph with empty graph node. Auth error: ${isAuthError}`);
362
  } else {
363
  // Create and set new graph
364
  const newSigmaGraph = createSigmaGraph(data);
lightrag_webui/src/locales/ar.json CHANGED
@@ -40,6 +40,7 @@
40
  "button": "مسح",
41
  "tooltip": "مسح المستندات",
42
  "title": "مسح المستندات",
 
43
  "warning": "تحذير: سيؤدي هذا الإجراء إلى حذف جميع المستندات بشكل دائم ولا يمكن التراجع عنه!",
44
  "confirm": "هل تريد حقًا مسح جميع المستندات؟",
45
  "confirmPrompt": "اكتب 'yes' لتأكيد هذا الإجراء",
 
40
  "button": "مسح",
41
  "tooltip": "مسح المستندات",
42
  "title": "مسح المستندات",
43
+ "description": "سيؤدي هذا إلى إزالة جميع المستندات من النظام",
44
  "warning": "تحذير: سيؤدي هذا الإجراء إلى حذف جميع المستندات بشكل دائم ولا يمكن التراجع عنه!",
45
  "confirm": "هل تريد حقًا مسح جميع المستندات؟",
46
  "confirmPrompt": "اكتب 'yes' لتأكيد هذا الإجراء",
lightrag_webui/src/locales/en.json CHANGED
@@ -40,6 +40,7 @@
40
  "button": "Clear",
41
  "tooltip": "Clear documents",
42
  "title": "Clear Documents",
 
43
  "warning": "WARNING: This action will permanently delete all documents and cannot be undone!",
44
  "confirm": "Do you really want to clear all documents?",
45
  "confirmPrompt": "Type 'yes' to confirm this action",
 
40
  "button": "Clear",
41
  "tooltip": "Clear documents",
42
  "title": "Clear Documents",
43
+ "description": "This will remove all documents from the system",
44
  "warning": "WARNING: This action will permanently delete all documents and cannot be undone!",
45
  "confirm": "Do you really want to clear all documents?",
46
  "confirmPrompt": "Type 'yes' to confirm this action",
lightrag_webui/src/locales/fr.json CHANGED
@@ -40,6 +40,7 @@
40
  "button": "Effacer",
41
  "tooltip": "Effacer les documents",
42
  "title": "Effacer les documents",
 
43
  "warning": "ATTENTION : Cette action supprimera définitivement tous les documents et ne peut pas être annulée !",
44
  "confirm": "Voulez-vous vraiment effacer tous les documents ?",
45
  "confirmPrompt": "Tapez 'yes' pour confirmer cette action",
 
40
  "button": "Effacer",
41
  "tooltip": "Effacer les documents",
42
  "title": "Effacer les documents",
43
+ "description": "Cette action supprimera tous les documents du système",
44
  "warning": "ATTENTION : Cette action supprimera définitivement tous les documents et ne peut pas être annulée !",
45
  "confirm": "Voulez-vous vraiment effacer tous les documents ?",
46
  "confirmPrompt": "Tapez 'yes' pour confirmer cette action",
lightrag_webui/src/locales/zh.json CHANGED
@@ -40,6 +40,7 @@
40
  "button": "清空",
41
  "tooltip": "清空文档",
42
  "title": "清空文档",
 
43
  "warning": "警告:此操作将永久删除所有文档,无法恢复!",
44
  "confirm": "确定要清空所有文档吗?",
45
  "confirmPrompt": "请输入 yes 确认操作",
 
40
  "button": "清空",
41
  "tooltip": "清空文档",
42
  "title": "清空文档",
43
+ "description": "此操作将从系统中移除所有文档",
44
  "warning": "警告:此操作将永久删除所有文档,无法恢复!",
45
  "confirm": "确定要清空所有文档吗?",
46
  "confirmPrompt": "请输入 yes 确认操作",
lightrag_webui/src/services/navigation.ts CHANGED
@@ -32,7 +32,7 @@ class NavigationService {
32
  // Reset backend state
33
  useBackendState.getState().clear();
34
 
35
- // Reset retrieval history while preserving other user preferences
36
  useSettingsStore.getState().setRetrievalHistory([]);
37
 
38
  // Clear authentication state
 
32
  // Reset backend state
33
  useBackendState.getState().clear();
34
 
35
+ // Reset retrieval history message while preserving other user preferences
36
  useSettingsStore.getState().setRetrievalHistory([]);
37
 
38
  // Clear authentication state