Added refresh layout button to graph settings

This commit is contained in:
yangdx
2025-03-12 06:22:39 +08:00
parent c910ba1d28
commit dad36e948f
2 changed files with 132 additions and 110 deletions

View File

@@ -3,12 +3,14 @@ import { persist, createJSONStorage } from 'zustand/middleware'
import { createSelectors } from '@/lib/utils'
import { defaultQueryLabel } from '@/lib/constants'
import { Message, QueryRequest } from '@/api/lightrag'
import { useGraphStore } from '@/stores/graph'
type Theme = 'dark' | 'light' | 'system'
type Tab = 'documents' | 'knowledge-graph' | 'retrieval' | 'api'
interface SettingsState {
// Graph viewer settings
refreshLayout: () => void
showPropertyPanel: boolean
showNodeSearchBar: boolean
@@ -57,6 +59,15 @@ const useSettingsStoreBase = create<SettingsState>()(
persist(
(set) => ({
theme: 'system',
refreshLayout: () => {
const graphState = useGraphStore.getState();
const currentGraph = graphState.sigmaGraph;
graphState.clearSelection();
graphState.setSigmaGraph(null);
setTimeout(() => {
graphState.setSigmaGraph(currentGraph);
}, 10);
},
showPropertyPanel: true,
showNodeSearchBar: true,