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/8274
Vanessac3cf8bca4709
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 7be99ac993..d715357c05 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -255,7 +255,6 @@ export class Protyle {private getDoc(mergedOptions: IOptions) {fetchPost("/api/filetree/getDoc", {id: mergedOptions.blockId,- k: mergedOptions.key || "",isBacklink: mergedOptions.action.includes(Constants.CB_GET_BACKLINK),// 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后mode: (mergedOptions.action && mergedOptions.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0,diff --git a/app/src/protyle/scroll/event.ts b/app/src/protyle/scroll/event.tsindex 0519bce0a5..b8f9b7b9fc 100644--- a/app/src/protyle/scroll/event.ts+++ b/app/src/protyle/scroll/event.ts@@ -66,7 +66,6 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {fetchPost("/api/filetree/getDoc", {id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),mode: 1,- k: protyle.options.key || "",size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {protyle.contentElement.style.overflow = "";@@ -81,7 +80,6 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {fetchPost("/api/filetree/getDoc", {id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),mode: 2,- k: protyle.options.key || "",size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex df9fba4e6a..01a6a98021 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -246,7 +246,6 @@ const setHTML = (options: {fetchPost("/api/filetree/getDoc", {id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),mode: 2,- k: protyle.options.key || "",size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 14170d6c8b..2bade3bdd3 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1304,7 +1304,6 @@ export class WYSIWYG {fetchPost("/api/filetree/getDoc", {id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),mode: 1,- k: protyle.options.key || "",size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {preventGetTopHTML = false;diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex b2301b46f2..3a87f64a6c 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -133,7 +133,6 @@ const promiseTransaction = () => {fetchPost("/api/filetree/getDoc", {id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),mode: 2,- k: protyle.options.key || "",size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex 9a56259b2a..2daaeefd1b 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -625,7 +625,8 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clogetArticle({edit,id: target.getAttribute("data-node-id"),- k: getKeyByLiElement(target)+ config,+ value: searchInputElement.value,});searchInputElement.focus();} else if (target.classList.contains("b3-list-item--focus")) {@@ -740,7 +741,8 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo}getArticle({id: currentList.getAttribute("data-node-id"),- k: getKeyByLiElement(currentList),+ config,+ value: searchInputElement.value,edit});event.preventDefault();@@ -766,7 +768,8 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo}getArticle({id: currentList.getAttribute("data-node-id"),- k: getKeyByLiElement(currentList),+ config,+ value: searchInputElement.value,edit});event.preventDefault();@@ -888,15 +891,18 @@ const renderNextSearchMark = (options: {const getArticle = (options: {id: string,- k: string,+ config: ISearchOption,edit: Protyle+ value: string,}) => {fetchPost("/api/block/checkBlockFold", {id: options.id}, (foldResponse) => {options.edit.protyle.scroll.lastScrollTop = 0;addLoading(options.edit.protyle);fetchPost("/api/filetree/getDoc", {id: options.id,- k: options.k,+ query: options.value,+ method: options.config.method,+ types: options.config.types,mode: foldResponse.data ? 0 : 3,size: foldResponse.data ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,zoom: foldResponse.data,@@ -920,6 +926,7 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, isAll:}const searchPanelElement = element.querySelector("#searchList");const replaceInputElement = element.querySelector("#replaceInput") as HTMLInputElement;+ const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;const loadElement = replaceInputElement.nextElementSibling;if (!loadElement.classList.contains("fn__none")) {@@ -943,7 +950,7 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, isAll:rootIds = [currentList.getAttribute("data-root-id")];}fetchPost("/api/search/findReplace", {- k: config.method === 0 ? getKeyByLiElement(currentList) : (element.querySelector("#searchInput") as HTMLInputElement).value,+ k: config.method === 0 ? getKeyByLiElement(currentList) : searchInputElement.value,r: replaceInputElement.value,ids,types: config.types,@@ -997,7 +1004,8 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, isAll:getArticle({edit,id: currentList.getAttribute("data-node-id"),- k: getKeyByLiElement(currentList)+ config,+ value: searchInputElement.value,});});};@@ -1017,7 +1025,7 @@ const inputEvent = (element: Element, config: ISearchOption, inputTimeout: numbeconst nextElement = element.querySelector('[data-type="next"]');if (inputValue === "" && (!config.idPath || config.idPath.length === 0)) {fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {- onSearch(response.data, edit, element);+ onSearch(response.data, edit, element, config);loadingElement.classList.add("fn__none");element.querySelector("#searchResult").innerHTML = "";previousElement.setAttribute("disabled", "true");@@ -1046,7 +1054,7 @@ const inputEvent = (element: Element, config: ISearchOption, inputTimeout: numbe} else {nextElement.setAttribute("disabled", "disabled");}- onSearch(response.data.blocks, edit, element);+ onSearch(response.data.blocks, edit, element, config);element.querySelector("#searchResult").innerHTML = `${config.page}/${response.data.pageCount || 1}<span class="fn__space"></span><span class="ft__on-surface">${window.siyuan.languages.findInDoc.replace("${x}", response.data.matchedRootCount).replace("${y}", response.data.matchedBlockCount)}</span>`;loadingElement.classList.add("fn__none");@@ -1056,7 +1064,7 @@ const inputEvent = (element: Element, config: ISearchOption, inputTimeout: numbereturn inputTimeout;};-const onSearch = (data: IBlock[], edit: Protyle, element: Element) => {+const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: ISearchOption) => {let resultHTML = "";data.forEach((item, index) => {const title = getNotebookName(item.box) + getDisplayName(item.hPath, false);@@ -1089,20 +1097,20 @@ ${unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic", true)}if (data[0]) {edit.protyle.element.classList.remove("fn__none");element.querySelector(".search__drag").classList.remove("fn__none");- const contentElement = document.createElement("div");+ const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;if (data[0].children) {- contentElement.innerHTML = data[0].children[0].content;getArticle({edit,id: data[0].children[0].id,- k: getKeyByLiElement(contentElement),+ config,+ value: searchInputElement.value,});} else {- contentElement.innerHTML = data[0].content;getArticle({edit,id: data[0].id,- k: getKeyByLiElement(contentElement),+ config,+ value: searchInputElement.value,});}} else {