yangdx
commited on
Commit
·
dc332df
1
Parent(s):
ad21b91
Remove graphSearchTypes.ts, move OptionItem type to GraphSearch.tsx
Browse files
lightrag_webui/src/components/graph/GraphLabels.tsx
CHANGED
@@ -111,7 +111,7 @@ const GraphLabels = () => {
|
|
111 |
// Clear current graph data to ensure complete reload when label changes
|
112 |
if (newLabel !== currentLabel) {
|
113 |
const graphStore = useGraphStore.getState();
|
114 |
-
//
|
115 |
graphStore.reset();
|
116 |
}
|
117 |
|
|
|
111 |
// Clear current graph data to ensure complete reload when label changes
|
112 |
if (newLabel !== currentLabel) {
|
113 |
const graphStore = useGraphStore.getState();
|
114 |
+
// Reset the all graph objects and status
|
115 |
graphStore.reset();
|
116 |
}
|
117 |
|
lightrag_webui/src/components/graph/GraphSearch.tsx
CHANGED
@@ -10,11 +10,17 @@ import { searchResultLimit } from '@/lib/constants'
|
|
10 |
import { useGraphStore } from '@/stores/graph'
|
11 |
import MiniSearch from 'minisearch'
|
12 |
import { useTranslation } from 'react-i18next'
|
13 |
-
import { OptionItem } from './graphSearchTypes'
|
14 |
|
15 |
// Message item identifier for search results
|
16 |
export const messageId = '__message_item'
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
const NodeOption = ({ id }: { id: string }) => {
|
19 |
const graph = useGraphStore.use.sigmaGraph()
|
20 |
if (!graph?.hasNode(id)) {
|
|
|
10 |
import { useGraphStore } from '@/stores/graph'
|
11 |
import MiniSearch from 'minisearch'
|
12 |
import { useTranslation } from 'react-i18next'
|
|
|
13 |
|
14 |
// Message item identifier for search results
|
15 |
export const messageId = '__message_item'
|
16 |
|
17 |
+
// Search result option item interface
|
18 |
+
export interface OptionItem {
|
19 |
+
id: string
|
20 |
+
type: 'nodes' | 'edges' | 'message'
|
21 |
+
message?: string
|
22 |
+
}
|
23 |
+
|
24 |
const NodeOption = ({ id }: { id: string }) => {
|
25 |
const graph = useGraphStore.use.sigmaGraph()
|
26 |
if (!graph?.hasNode(id)) {
|
lightrag_webui/src/components/graph/graphSearchTypes.ts
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
export interface OptionItem {
|
2 |
-
id: string
|
3 |
-
type: 'nodes' | 'edges' | 'message'
|
4 |
-
message?: string
|
5 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
lightrag_webui/src/stores/graph.ts
CHANGED
@@ -70,7 +70,6 @@ interface GraphState {
|
|
70 |
sigmaInstance: any | null
|
71 |
allDatabaseLabels: string[]
|
72 |
|
73 |
-
// 搜索引擎状态
|
74 |
searchEngine: MiniSearch | null
|
75 |
|
76 |
moveToSelectedNode: boolean
|
@@ -159,7 +158,7 @@ const useGraphStoreBase = create<GraphState>()((set) => ({
|
|
159 |
focusedEdge: null,
|
160 |
rawGraph: null,
|
161 |
sigmaGraph: null, // to avoid other components from acccessing graph objects
|
162 |
-
searchEngine: null,
|
163 |
moveToSelectedNode: false,
|
164 |
shouldRender: false
|
165 |
});
|
|
|
70 |
sigmaInstance: any | null
|
71 |
allDatabaseLabels: string[]
|
72 |
|
|
|
73 |
searchEngine: MiniSearch | null
|
74 |
|
75 |
moveToSelectedNode: boolean
|
|
|
158 |
focusedEdge: null,
|
159 |
rawGraph: null,
|
160 |
sigmaGraph: null, // to avoid other components from acccessing graph objects
|
161 |
+
searchEngine: null,
|
162 |
moveToSelectedNode: false,
|
163 |
shouldRender: false
|
164 |
});
|