diff --git a/web/src/components/FileTable.vue b/web/src/components/FileTable.vue index f54f4b0a..c3ef2d7e 100644 --- a/web/src/components/FileTable.vue +++ b/web/src/components/FileTable.vue @@ -372,6 +372,7 @@ import { parseToShanghai } from '@/utils/time'; \ No newline at end of file + diff --git a/web/src/stores/database.js b/web/src/stores/database.js index 678a39d1..ef089f5d 100644 --- a/web/src/stores/database.js +++ b/web/src/stores/database.js @@ -18,6 +18,8 @@ export const useDatabaseStore = defineStore('database', () => { const queryParams = ref([]); const meta = reactive({}); const graphStats = ref({ + total_nodes: 0, + total_edges: 0, displayed_nodes: 0, displayed_edges: 0, is_truncated: false, @@ -35,7 +37,6 @@ export const useDatabaseStore = defineStore('database', () => { chunkLoading: false, autoRefresh: false, queryParamsLoading: false, - isGraphMaximized: false, rightPanelVisible: true, }); diff --git a/web/src/views/DataBaseInfoView.vue b/web/src/views/DataBaseInfoView.vue index e304f937..55887bb7 100644 --- a/web/src/views/DataBaseInfoView.vue +++ b/web/src/views/DataBaseInfoView.vue @@ -1,38 +1,5 @@ - - - - - 知识图谱 (最大化) - - 退出最大化 - - - - - - - 知识图谱不可用 - 当前知识库类型 "{{ getKbTypeLabel(database.kb_type || 'lightrag') }}" 不支持知识图谱功能。 - 只有 LightRAG 类型的知识库支持知识图谱。 - - - - - - store.databaseId); const database = computed(() => store.database); const state = computed(() => store.state); -const isGraphMaximized = computed({ - get: () => store.state.isGraphMaximized, - set: (val) => store.state.isGraphMaximized = val -}); - // 计算属性:是否支持知识图谱 const isGraphSupported = computed(() => { const kbType = database.value.kb_type?.toLowerCase(); @@ -110,15 +69,34 @@ const isGraphSupported = computed(() => { // Tab 切换逻辑 - 智能默认 const activeTab = ref('query'); + +const resetGraphStats = () => { + store.graphStats = { + total_nodes: 0, + total_edges: 0, + displayed_nodes: 0, + displayed_edges: 0, + is_truncated: false + }; +}; + + // LightRAG 默认展示知识图谱 watch( () => [databaseId.value, isGraphSupported.value], ([newDbId, supported], oldValue = []) => { const [oldDbId, previouslySupported] = oldValue; + if (!newDbId) { return; } + if (newDbId && newDbId !== oldDbId) { + resetGraphStats(); + } else if (!supported && previouslySupported) { + resetGraphStats(); + } + if (supported && (newDbId !== oldDbId || previouslySupported === false || previouslySupported === undefined)) { activeTab.value = 'graph'; return; @@ -149,11 +127,7 @@ const showAddFilesModal = () => { addFilesModalVisible.value = true; }; -// 切换图谱最大化状态 -const toggleGraphMaximize = () => { - isGraphMaximized.value = !isGraphMaximized.value; -}; - +// 重置文件选中状态 const resetFileSelectionState = () => { store.selectedRowKeys = []; store.selectedFile = null; @@ -163,6 +137,7 @@ const resetFileSelectionState = () => { watch(() => route.params.database_id, async (newId) => { store.databaseId = newId; resetFileSelectionState(); + resetGraphStats(); store.stopAutoRefresh(); await store.getDatabaseInfo(newId, false); // Explicitly load query params on initial load store.startAutoRefresh(); @@ -360,47 +335,6 @@ const handleMouseUp = () => {
当前知识库类型 "{{ getKbTypeLabel(database.kb_type || 'lightrag') }}" 不支持知识图谱功能。
只有 LightRAG 类型的知识库支持知识图谱。