An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: 关闭关系图时进行销毁
Vanessa38ad9eff13b5
diff --git a/app/src/layout/dock/Graph.ts b/app/src/layout/dock/Graph.tsindex e6407bb7a4..2ccf6c40fc 100644--- a/app/src/layout/dock/Graph.ts+++ b/app/src/layout/dock/Graph.ts@@ -505,6 +505,10 @@ export class Graph extends Model {this.network.selectNodes([id]);}+ public destroy() {+ this.network?.destroy();+ }+public onGraph(hl: boolean) {if (this.graphElement.clientHeight === 0) {// 界面没有渲染时不能进行渲染diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.tsindex aa8d5d930a..94d808082d 100644--- a/app/src/layout/dock/index.ts+++ b/app/src/layout/dock/index.ts@@ -534,8 +534,12 @@ export class Dock {clearTimeout(this.hideResizeTimeout);this.hideDock();}- if ((type === "graph" || type === "globalGraph") && this.layout.element.querySelector(".fullscreen")) {- document.getElementById("drag")?.classList.remove("fn__hidden");+ if ((type === "graph" || type === "globalGraph")) {+ if (this.layout.element.querySelector(".fullscreen")) {+ document.getElementById("drag")?.classList.remove("fn__hidden");+ }+ const graph = this.data[type] as Graph+ graph.destroy();}// 关闭 dock 后设置光标,初始化的时候不能设置,否则关闭文档树且多页签时会请求两次 getDocif (isSaveLayout && !document.querySelector(".layout__center .layout__wnd--active")) {@@ -752,6 +756,10 @@ export class Dock {}resizeTabs(isSaveLayout);this.showDock();+ if (target.classList.contains("dock__item--active") && !hide && (type === "graph" || type === "globalGraph")) {+ const graph = this.data[type] as Graph+ graph.onGraph(false);+ }}public add(index: number, sourceElement: Element, previousType?: string) {@@ -794,7 +802,7 @@ export class Dock {saveLayout();}- public remove(key: TDock|string) {+ public remove(key: TDock | string) {this.toggleModel(key, false, true, true);this.element.querySelector(`[data-type="${key}"]`).remove();const custom = this.data[key] as Custom;