yangdx commited on
Commit
15aa24f
·
1 Parent(s): cfdc80c

Refactor code and update environment type definitions.

Browse files

- Consolidate type definitions in vite-env.d.ts
- Update TypeScript include paths

lightrag/api/webui/assets/index-CJz72b6Q.js CHANGED
Binary files a/lightrag/api/webui/assets/index-CJz72b6Q.js and b/lightrag/api/webui/assets/index-CJz72b6Q.js differ
 
lightrag/lightrag.py CHANGED
@@ -523,19 +523,19 @@ class LightRAG:
523
  """
524
  # get params supported by get_knowledge_graph of specified storage
525
  import inspect
526
- storage_params = inspect.signature(self.chunk_entity_relation_graph.get_knowledge_graph).parameters
527
-
528
- kwargs = {
529
- 'node_label': node_label,
530
- 'max_depth': max_depth
531
- }
532
-
533
- if 'min_degree' in storage_params and min_degree > 0:
534
- kwargs['min_degree'] = min_degree
535
-
536
- if 'inclusive' in storage_params:
537
- kwargs['inclusive'] = inclusive
538
-
539
  return await self.chunk_entity_relation_graph.get_knowledge_graph(**kwargs)
540
 
541
  def _get_storage_class(self, storage_name: str) -> Callable[..., Any]:
 
523
  """
524
  # get params supported by get_knowledge_graph of specified storage
525
  import inspect
526
+
527
+ storage_params = inspect.signature(
528
+ self.chunk_entity_relation_graph.get_knowledge_graph
529
+ ).parameters
530
+
531
+ kwargs = {"node_label": node_label, "max_depth": max_depth}
532
+
533
+ if "min_degree" in storage_params and min_degree > 0:
534
+ kwargs["min_degree"] = min_degree
535
+
536
+ if "inclusive" in storage_params:
537
+ kwargs["inclusive"] = inclusive
538
+
539
  return await self.chunk_entity_relation_graph.get_knowledge_graph(**kwargs)
540
 
541
  def _get_storage_class(self, storage_name: str) -> Callable[..., Any]:
lightrag_webui/src/env.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- interface ImportMetaEnv {
4
- readonly VITE_API_PROXY: string
5
- readonly VITE_API_ENDPOINTS: string
6
- readonly VITE_BACKEND_URL: string
7
- }
 
 
 
 
 
 
 
 
lightrag_webui/src/vite-env.d.ts CHANGED
@@ -1 +1,11 @@
1
  /// <reference types="vite/client" />
 
 
 
 
 
 
 
 
 
 
 
1
  /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_API_PROXY: string
5
+ readonly VITE_API_ENDPOINTS: string
6
+ readonly VITE_BACKEND_URL: string
7
+ }
8
+
9
+ interface ImportMeta {
10
+ readonly env: ImportMetaEnv
11
+ }
lightrag_webui/tsconfig.json CHANGED
@@ -26,5 +26,5 @@
26
  "@/*": ["./src/*"]
27
  }
28
  },
29
- "include": ["src"]
30
  }
 
26
  "@/*": ["./src/*"]
27
  }
28
  },
29
+ "include": ["src", "vite.config.ts"]
30
  }
lightrag_webui/vite.config.ts CHANGED
@@ -18,14 +18,14 @@ export default defineConfig({
18
  emptyOutDir: true
19
  },
20
  server: {
21
- proxy: import.meta.env.VITE_API_PROXY === 'true' && import.meta.env.VITE_API_ENDPOINTS ?
22
  Object.fromEntries(
23
  import.meta.env.VITE_API_ENDPOINTS.split(',').map(endpoint => [
24
  endpoint,
25
  {
26
  target: import.meta.env.VITE_BACKEND_URL || 'http://localhost:9621',
27
  changeOrigin: true,
28
- rewrite: endpoint === '/api' ?
29
  (path) => path.replace(/^\/api/, '') : undefined
30
  }
31
  ])
 
18
  emptyOutDir: true
19
  },
20
  server: {
21
+ proxy: import.meta.env.VITE_API_PROXY === 'true' && import.meta.env.VITE_API_ENDPOINTS ?
22
  Object.fromEntries(
23
  import.meta.env.VITE_API_ENDPOINTS.split(',').map(endpoint => [
24
  endpoint,
25
  {
26
  target: import.meta.env.VITE_BACKEND_URL || 'http://localhost:9621',
27
  changeOrigin: true,
28
+ rewrite: endpoint === '/api' ?
29
  (path) => path.replace(/^\/api/, '') : undefined
30
  }
31
  ])