An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/9669
Vanessa363466025ea6
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.tsindex f28aeea7b8..1c374064d1 100644--- a/app/src/boot/globalEvent/keydown.ts+++ b/app/src/boot/globalEvent/keydown.ts@@ -1265,7 +1265,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {return;}if (!isTabWindow && matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) {- newDailyNote();+ newDailyNote(app);event.stopPropagation();event.preventDefault();return;diff --git a/app/src/index.ts b/app/src/index.tsindex 81905ee576..04892f0175 100644--- a/app/src/index.ts+++ b/app/src/index.ts@@ -135,9 +135,6 @@ export class App {(document.getElementById("themeDefaultStyle") as HTMLLinkElement).href = data.data.theme;}break;- case "createdailynote":- openFileById({app: this, id: data.data.id, action: [Constants.CB_GET_FOCUS]});- break;case "openFileById":openFileById({app: this, id: data.data.id, action: [Constants.CB_GET_FOCUS]});break;diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.tsindex c03ab6172e..8f6f6d5fde 100644--- a/app/src/menus/workspace.ts+++ b/app/src/menus/workspace.ts@@ -4,7 +4,7 @@ import {ipcRenderer} from "electron";/// #endifimport {openHistory} from "../history/history";import {getOpenNotebookCount, originalPath, pathPosix, showFileInFolder} from "../util/pathName";-import {mountHelp, newDailyNote} from "../util/mount";+import {fetchNewDailyNote, mountHelp, newDailyNote} from "../util/mount";import {fetchPost} from "../util/fetch";import {Constants} from "../constants";import {isInAndroid, isInIOS, setStorageVal, writeText} from "../protyle/util/compatibility";@@ -324,7 +324,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {icon: "iconCalendar",accelerator: window.siyuan.config.keymap.general.dailyNote.custom,click: () => {- newDailyNote();+ newDailyNote(app);}}).element);} else {@@ -336,10 +336,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {iconHTML: unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_NOTE, "b3-menu__icon", true),accelerator: window.siyuan.storage[Constants.LOCAL_DAILYNOTEID] === item.id ? window.siyuan.config.keymap.general.dailyNote.custom : "",click: () => {- fetchPost("/api/filetree/createDailyNote", {- notebook: item.id,- app: Constants.SIYUAN_APPID,- });+ fetchNewDailyNote(app, item.id);window.siyuan.storage[Constants.LOCAL_DAILYNOTEID] = item.id;setStorageVal(Constants.LOCAL_DAILYNOTEID, window.siyuan.storage[Constants.LOCAL_DAILYNOTEID]);}diff --git a/app/src/mobile/menu/index.ts b/app/src/mobile/menu/index.tsindex d4f0f1f5ca..61a6375783 100644--- a/app/src/mobile/menu/index.ts+++ b/app/src/mobile/menu/index.ts@@ -161,7 +161,7 @@ export const initRightMenu = (app: App) => {event.stopPropagation();break;} else if (target.id === "menuNewDaily") {- newDailyNote();+ newDailyNote(app);closePanel();event.preventDefault();event.stopPropagation();diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.tsindex bda2ee437f..0ff7801668 100644--- a/app/src/mobile/util/onMessage.ts+++ b/app/src/mobile/util/onMessage.ts@@ -21,9 +21,6 @@ export const onMessage = (app: App, data: IWebSocketData) => {document.getElementById("toolbarSync").classList.add("fn__none");}break;- case "createdailynote":- openMobileFileById(app, data.data.id);- break;case "openFileById":openMobileFileById(app, data.data.id, [Constants.CB_GET_FOCUS]);break;diff --git a/app/src/util/mount.ts b/app/src/util/mount.tsindex 429ebe8d31..f8c82414fb 100644--- a/app/src/util/mount.ts+++ b/app/src/util/mount.ts@@ -6,8 +6,24 @@ import {Dialog} from "../dialog";import {getOpenNotebookCount} from "./pathName";import {validateName} from "../editor/rename";import {setStorageVal} from "../protyle/util/compatibility";+import {openFileById} from "../editor/util";+import {openMobileFileById} from "../mobile/editor";+import {App} from "../index";-export const newDailyNote = () => {+export const fetchNewDailyNote = (app: App, notebook: string) => {+ fetchPost("/api/filetree/createDailyNote", {+ notebook,+ app: Constants.SIYUAN_APPID,+ }, (response) => {+ /// #if MOBILE+ openMobileFileById(app, response.data.id);+ /// #else+ openFileById({app, id: response.data.id, action: [Constants.CB_GET_FOCUS]});+ /// #endif+ });+};++export const newDailyNote = (app: App) => {const exit = window.siyuan.dialogs.find(item => {if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.dailyNote.custom) {item.destroy();@@ -29,10 +45,7 @@ export const newDailyNote = () => {notebookId = item.id;}});- fetchPost("/api/filetree/createDailyNote", {- notebook: notebookId,- app: Constants.SIYUAN_APPID,- });+ fetchNewDailyNote(app, notebookId);return;}const localNotebookId = window.siyuan.storage[Constants.LOCAL_DAILYNOTEID];@@ -42,10 +55,7 @@ export const newDailyNote = () => {}});if (localNotebookId && localNotebookIsOpen && !isMobile()) {- fetchPost("/api/filetree/createDailyNote", {- notebook: localNotebookId,- app: Constants.SIYUAN_APPID,- });+ fetchNewDailyNote(app, localNotebookId);} else {let optionsHTML = "";window.siyuan.notebooks.forEach(item => {@@ -75,10 +85,7 @@ export const newDailyNote = () => {const notebook = selectElement.value;window.siyuan.storage[Constants.LOCAL_DAILYNOTEID] = notebook;setStorageVal(Constants.LOCAL_DAILYNOTEID, window.siyuan.storage[Constants.LOCAL_DAILYNOTEID]);- fetchPost("/api/filetree/createDailyNote", {- notebook,- app: Constants.SIYUAN_APPID,- });+ fetchNewDailyNote(app, notebook);dialog.destroy();});}diff --git a/app/src/window/index.ts b/app/src/window/index.tsindex 7c5228bacd..45ce18446d 100644--- a/app/src/window/index.ts+++ b/app/src/window/index.ts@@ -117,9 +117,6 @@ class App {(document.getElementById("themeDefaultStyle") as HTMLLinkElement).href = data.data.theme;}break;- case "createdailynote":- openFileById({app: this, id: data.data.id, action: [Constants.CB_GET_FOCUS]});- break;case "openFileById":openFileById({app: this, id: data.data.id, action: [Constants.CB_GET_FOCUS]});break;