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/11931
Vanessae674cfec703b
diff --git a/app/src/constants.ts b/app/src/constants.tsindex d2df4b00a0..7b334e4a6b 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -121,6 +121,7 @@ export abstract class Constants {public static readonly LOCAL_DIALOGPOSITION = "local-dialogposition";public static readonly LOCAL_SESSION_FIRSTLOAD = "local-session-firstload";public static readonly LOCAL_OUTLINE = "local-outline";+ public static readonly LOCAL_PLUGIN_DOCKS = "local-plugin-docks";// dialogpublic static readonly DIALOG_OPENCARD = "dialog-opencard";diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.tsindex c5daf82ee2..93a8dec7a9 100644--- a/app/src/plugin/loader.ts+++ b/app/src/plugin/loader.ts@@ -8,6 +8,7 @@ import {API} from "./API";import {getFrontend, isMobile, isWindow} from "../util/functions";import {Constants} from "../constants";import {uninstall} from "./uninstall";+import {setStorageVal} from "../protyle/util/compatibility";const requireFunc = (key: string) => {const modules = {@@ -102,6 +103,11 @@ const updateDock = (dockItem: Config.IUILayoutDockTab[], index: number, plugin:plugin.docks[tabItem.type].config.index = tabIndex;plugin.docks[tabItem.type].config.show = tabItem.show;plugin.docks[tabItem.type].config.size = tabItem.size;+ if (!window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name]) {+ window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] = {}+ }+ window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][tabItem.type] = plugin.docks[tabItem.type].config;+ setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]);}});};@@ -153,6 +159,9 @@ export const afterLoadPlugin = (plugin: Plugin) => {updateDock(dockItem, index, plugin, "Bottom");});Object.keys(plugin.docks).forEach(key => {+ if (window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key]) {+ plugin.docks[key].config = window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key];+ }const dock = plugin.docks[key];const hotkey = window.siyuan.config.keymap.plugin[plugin.name] ? window.siyuan.config.keymap.plugin[plugin.name][key]?.custom : undefined;if (dock.config.position.startsWith("Left")) {diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.tsindex fcc7c7ecd4..09280fc659 100644--- a/app/src/plugin/uninstall.ts+++ b/app/src/plugin/uninstall.ts@@ -4,6 +4,8 @@ import {Plugin} from "../plugin";import {getAllModels} from "../layout/getAll";import {resizeTopBar} from "../layout/util";/// #endif+import {Constants} from "../constants";+import {setStorageVal} from "../protyle/util/compatibility";export const uninstall = (app: App, name: string, isUninstall = false) => {app.plugins.find((plugin: Plugin, index) => {@@ -13,6 +15,8 @@ export const uninstall = (app: App, name: string, isUninstall = false) => {plugin.onunload();if (isUninstall) {plugin.uninstall();+ window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] = {};+ setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]);}} catch (e) {console.error(`plugin ${plugin.name} onunload error:`, e);diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.tsindex c68cedb426..402a45c6d2 100644--- a/app/src/protyle/util/compatibility.ts+++ b/app/src/protyle/util/compatibility.ts@@ -200,6 +200,7 @@ export const getLocalStorage = (cb: () => void) => {};defaultStorage[Constants.LOCAL_LAYOUTS] = []; // {name: "", layout:{}, time: number, filespaths: filesPath[]}defaultStorage[Constants.LOCAL_AI] = []; // {name: "", memo: ""}+ defaultStorage[Constants.LOCAL_PLUGIN_DOCKS] = {}; // { pluginName: {dockId: IPluginDockTab}}defaultStorage[Constants.LOCAL_PLUGINTOPUNPIN] = [];defaultStorage[Constants.LOCAL_OUTLINE] = {keepExpand: true};defaultStorage[Constants.LOCAL_FILEPOSITION] = {}; // {id: IScrollAttr}@@ -270,7 +271,8 @@ export const getLocalStorage = (cb: () => void) => {Constants.LOCAL_SEARCHDATA, Constants.LOCAL_ZOOM, Constants.LOCAL_LAYOUTS, Constants.LOCAL_AI,Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD,Constants.LOCAL_DIALOGPOSITION, Constants.LOCAL_SEARCHUNREF, Constants.LOCAL_HISTORY,- Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION, Constants.LOCAL_FILESPATHS].forEach((key) => {+ Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION, Constants.LOCAL_FILESPATHS,+ Constants.LOCAL_PLUGIN_DOCKS].forEach((key) => {if (typeof response.data[key] === "string") {try {const parseData = JSON.parse(response.data[key]);