An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: https://github.com/siyuan-note/siyuan/issues/4567
Vanessa77bd2634e140
diff --git a/app/electron/main.js b/app/electron/main.jsindex 98cec7dbf0..4624a78674 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -657,12 +657,14 @@ app.whenReady().then(() => {ipcMain.on('siyuan-export-close', (event, id) => {BrowserWindow.fromId(id).webContents.send('siyuan-export-close', data)})- ipcMain.on('siyuan-quit', (id) => {+ ipcMain.on('siyuan-quit', (event, id) => {const mainWindow = BrowserWindow.fromId(id)let trayworkspaces.find((item, index) => {if (item.id === id) {- mainWindow.destroy()+ if (workspaces.length > 1) {+ mainWindow.destroy()+ }tray = item.trayworkspaces.splice(index, 1)return true@@ -830,9 +832,11 @@ app.on('second-instance', (event, commandLine) => {})app.on('activate', () => {- const mainWindow = workspaces[0].browserWindow- if (mainWindow && !mainWindow.isDestroyed()) {- mainWindow.show()+ if (workspaces.length > 0) {+ const mainWindow = workspaces[0].browserWindow+ if (mainWindow && !mainWindow.isDestroyed()) {+ mainWindow.show()+ }}if (BrowserWindow.getAllWindows().length === 0) {boot()diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.tsindex d0b081baea..4505835e62 100644--- a/app/src/dialog/processSystem.ts+++ b/app/src/dialog/processSystem.ts@@ -93,7 +93,7 @@ export const exitSiYuan = () => {buttonElement.addEventListener("click", () => {fetchPost("/api/system/exit", {force: true}, () => {/// #if !BROWSER- ipcRenderer.send(Constants.SIYUAN_QUIT);+ ipcRenderer.send(Constants.SIYUAN_QUIT, getCurrentWindow().id);/// #elseif (["ios", "android"].includes(window.siyuan.config.system.container) && (window.webkit?.messageHandlers || window.JSAndroid)) {window.location.href = "siyuan://api/system/exit";@@ -117,7 +117,7 @@ export const exitSiYuan = () => {}, 2000);// 然后等待一段时间后再退出,避免界面主进程退出以后内核子进程被杀死setTimeout(() => {- ipcRenderer.send(Constants.SIYUAN_QUIT);+ ipcRenderer.send(Constants.SIYUAN_QUIT, getCurrentWindow().id);}, 4000);/// #endif});@@ -127,13 +127,13 @@ export const exitSiYuan = () => {execInstallPkg: 1 // 0:默认检查新版本,1:不执行新版本安装,2:执行新版本安装}, () => {/// #if !BROWSER- ipcRenderer.send(Constants.SIYUAN_QUIT);+ ipcRenderer.send(Constants.SIYUAN_QUIT, getCurrentWindow().id);/// #endif});});} else { // 正常退出/// #if !BROWSER- ipcRenderer.send(Constants.SIYUAN_QUIT);+ ipcRenderer.send(Constants.SIYUAN_QUIT, getCurrentWindow().id);/// #elseif (["ios", "android"].includes(window.siyuan.config.system.container) && (window.webkit?.messageHandlers || window.JSAndroid)) {window.location.href = "siyuan://api/system/exit";diff --git a/app/src/util/fetch.ts b/app/src/util/fetch.tsindex 779de61fb1..56f31f1868 100644--- a/app/src/util/fetch.ts+++ b/app/src/util/fetch.ts@@ -1,6 +1,7 @@import {Constants} from "../constants";/// #if !BROWSERimport {ipcRenderer} from "electron";+import {getCurrentWindow} from "@electron/remote";/// #endifimport {processMessage} from "./processMessage";import {kernelError} from "../dialog/processSystem";@@ -48,7 +49,7 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDatif (url === "/api/system/exit" || url === "/api/system/setWorkspaceDir" || (["/api/system/setUILayout"].includes(url) && data.exit // 内核中断,点关闭处理)) {- ipcRenderer.send(Constants.SIYUAN_QUIT);+ ipcRenderer.send(Constants.SIYUAN_QUIT, getCurrentWindow().id);}/// #endif});diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.tsindex 97e6e13a59..0c66afd09e 100644--- a/app/src/util/onGetConfig.ts+++ b/app/src/util/onGetConfig.ts@@ -367,6 +367,7 @@ const initWindow = () => {document.body.classList.add("body--blur");});ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {+ console.log(event, url)if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) {return;}