diff --git a/lightrag_webui/src/components/graph/GraphLabels.tsx b/lightrag_webui/src/components/graph/GraphLabels.tsx index 1ee46bb8..e7b955c6 100644 --- a/lightrag_webui/src/components/graph/GraphLabels.tsx +++ b/lightrag_webui/src/components/graph/GraphLabels.tsx @@ -111,7 +111,7 @@ const GraphLabels = () => { // Clear current graph data to ensure complete reload when label changes if (newLabel !== currentLabel) { const graphStore = useGraphStore.getState(); - // 完全重置图形状态 + // Reset the all graph objects and status graphStore.reset(); } diff --git a/lightrag_webui/src/components/graph/GraphSearch.tsx b/lightrag_webui/src/components/graph/GraphSearch.tsx index 2ad81326..51e76a0b 100644 --- a/lightrag_webui/src/components/graph/GraphSearch.tsx +++ b/lightrag_webui/src/components/graph/GraphSearch.tsx @@ -10,11 +10,17 @@ import { searchResultLimit } from '@/lib/constants' import { useGraphStore } from '@/stores/graph' import MiniSearch from 'minisearch' import { useTranslation } from 'react-i18next' -import { OptionItem } from './graphSearchTypes' // Message item identifier for search results export const messageId = '__message_item' +// Search result option item interface +export interface OptionItem { + id: string + type: 'nodes' | 'edges' | 'message' + message?: string +} + const NodeOption = ({ id }: { id: string }) => { const graph = useGraphStore.use.sigmaGraph() if (!graph?.hasNode(id)) { diff --git a/lightrag_webui/src/components/graph/graphSearchTypes.ts b/lightrag_webui/src/components/graph/graphSearchTypes.ts deleted file mode 100644 index 80e392da..00000000 --- a/lightrag_webui/src/components/graph/graphSearchTypes.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface OptionItem { - id: string - type: 'nodes' | 'edges' | 'message' - message?: string -} diff --git a/lightrag_webui/src/stores/graph.ts b/lightrag_webui/src/stores/graph.ts index 605c93d9..efff20ae 100644 --- a/lightrag_webui/src/stores/graph.ts +++ b/lightrag_webui/src/stores/graph.ts @@ -70,7 +70,6 @@ interface GraphState { sigmaInstance: any | null allDatabaseLabels: string[] - // 搜索引擎状态 searchEngine: MiniSearch | null moveToSelectedNode: boolean @@ -159,7 +158,7 @@ const useGraphStoreBase = create()((set) => ({ focusedEdge: null, rawGraph: null, sigmaGraph: null, // to avoid other components from acccessing graph objects - searchEngine: null, // 重置搜索引擎 + searchEngine: null, moveToSelectedNode: false, shouldRender: false });