An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:rotating_light:
Vanessa22a4fd92858a
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.tsindex 22b32fa583..9f54ff43df 100644--- a/app/src/ai/actions.ts+++ b/app/src/ai/actions.ts@@ -49,7 +49,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {</div>`,width: isMobile() ? "92vw" : "520px",});- const nameElement = dialog.element.querySelector("input")+ const nameElement = dialog.element.querySelector("input");const customElement = dialog.element.querySelector("textarea");const btnsElement = dialog.element.querySelectorAll(".b3-button");dialog.bindInput(customElement, () => {@@ -60,8 +60,8 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {});btnsElement[1].addEventListener("click", () => {if (!customElement.value) {- showMessage(window.siyuan.languages["_kernel"][142])- return+ showMessage(window.siyuan.languages["_kernel"][142]);+ return;}fetchPost("/api/ai/chatGPTWithAction", {ids,@@ -73,8 +73,8 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {});btnsElement[2].addEventListener("click", () => {if (!nameElement.value && !customElement.value) {- showMessage(window.siyuan.languages["_kernel"][142])- return+ showMessage(window.siyuan.languages["_kernel"][142]);+ return;}window.siyuan.storage[Constants.LOCAL_AI].push({name: nameElement.value,@@ -149,7 +149,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {});dialog.destroy();});- nameElement.focus()+ nameElement.focus();} else {fetchPost("/api/ai/chatGPTWithAction", {ids,diff --git a/app/src/block/util.ts b/app/src/block/util.tsindex c31b4ae583..8908f27400 100644--- a/app/src/block/util.ts+++ b/app/src/block/util.ts@@ -88,9 +88,9 @@ export const jumpToParentNext = (protyle: IProtyle, nodeElement: Element) => {zoomOut({protyle,id: response.data.id,- })+ });}- })+ });}}};diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.tsindex 946fae129b..2a6b7f3b5a 100644--- a/app/src/boot/onGetConfig.ts+++ b/app/src/boot/onGetConfig.ts@@ -29,7 +29,6 @@ import {App} from "../index";import {initWindowEvent} from "./globalEvent/event";import {sendGlobalShortcut} from "./globalEvent/keydown";import {closeWindow} from "../window/closeWin";-import {loadPlugins} from "../plugin/loader";const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {if (key1 === "general") {diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.tsindex 90f7906882..b41fb30113 100644--- a/app/src/layout/dock/Files.ts+++ b/app/src/layout/dock/Files.ts@@ -926,7 +926,7 @@ export class Files extends Model {item.removeAttribute("style");});if (typeof scrollTop === "number") {- this.element.scroll({top: scrollTop, behavior: "smooth"})+ this.element.scroll({top: scrollTop, behavior: "smooth"});}}, 120);}, 2);diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.tsindex 3e9ef7cd71..4cd872b34d 100644--- a/app/src/mobile/menu/search.ts+++ b/app/src/mobile/menu/search.ts@@ -676,7 +676,7 @@ export const popSearch = (app: App, config = window.siyuan.storage[Constants.LOCbindEvent(element) {document.querySelector("#toolbarSearchNew").addEventListener("click", () => {newFileByName(app, (document.querySelector("#toolbarSearch") as HTMLInputElement).value);- })+ });initSearchEvent(app, element.firstElementChild, config);updateSearchResult(config, element);}diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.tsindex 9212373436..ce468b462f 100644--- a/app/src/protyle/header/Background.ts+++ b/app/src/protyle/header/Background.ts@@ -266,10 +266,10 @@ export class Background {event.stopPropagation();break;} else if (type === "show-random") {- let html = ""+ let html = "";bgs.forEach((item: string, index: number) => {- html += `<div data-index="${index}" style="height: 148px;width: 148px;${item}" class="b3-card"></div>`- })+ html += `<div data-index="${index}" style="height: 148px;width: 148px;${item}" class="b3-card"></div>`;+ });const dialog = new Dialog({title: window.siyuan.languages.random,content: `<div class="b3-cards" style="margin-right: 0">${html}</div>`,@@ -277,7 +277,7 @@ export class Background {height: isMobile() ? "80vh" : "70vh",});dialog.element.addEventListener("click", (event) => {- const target = event.target as HTMLElement+ const target = event.target as HTMLElement;if (target.classList.contains("b3-card")) {this.ial["title-img"] = bgs[parseInt(target.getAttribute("data-index"))];this.render(this.ial, protyle.block.rootID);@@ -287,7 +287,7 @@ export class Background {});dialog.destroy();}- })+ });event.preventDefault();event.stopPropagation();break;diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.tsindex 93536499b4..e8fdc8cc5d 100644--- a/app/src/protyle/hint/index.ts+++ b/app/src/protyle/hint/index.ts@@ -350,7 +350,7 @@ ${genHintItemHTML(item)}searchHTML = `<button style="width: calc(100% - 16px)" class="b3-list-item b3-list-item--two" data-value="">${window.siyuan.languages.emptyContent}</button>`;}this.element.lastElementChild.innerHTML = searchHTML;- setPosition(this.element, parseInt(this.element.style.left), parseInt(this.element.style.right))+ setPosition(this.element, parseInt(this.element.style.left), parseInt(this.element.style.right));});}diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.tsindex 1b29c0a2e2..c697f7226b 100644--- a/app/src/protyle/render/av/asset.ts+++ b/app/src/protyle/render/av/asset.ts@@ -334,24 +334,24 @@ export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLid: protyle.block.rootID}, (response) => {hideMessage(msgId);- const addUpdateValue: IAVCellAssetValue[] = []+ const addUpdateValue: IAVCellAssetValue[] = [];Object.keys(response.data.succMap).forEach(key => {const type = pathPosix().extname(key).toLowerCase();- const name = key.substring(0, key.length - type.length)+ const name = key.substring(0, key.length - type.length);if (Constants.SIYUAN_ASSETS_IMAGE.includes(type)) {addUpdateValue.push({type: "image",name,content: response.data.succMap[key],- })+ });} else {addUpdateValue.push({type: "file",name,content: response.data.succMap[key],- })+ });}- })+ });fetchPost("/api/av/renderAttributeView", {id: avID,}, (response) => {@@ -362,6 +362,6 @@ export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLtype: "addUpdate",addUpdateValue});- })+ });});-}+};diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 141db1382b..c87871c0f1 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -990,7 +990,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {} else if (!window.siyuan.dragElement && (event.dataTransfer.types[0] === "Files" || event.dataTransfer.types.includes("text/html"))) {// 外部文件拖入编辑器中或者编辑器内选中文字拖拽// https://github.com/siyuan-note/siyuan/issues/9544- const avElement = hasClosestByClassName(event.target, 'av')+ const avElement = hasClosestByClassName(event.target, "av");if (!avElement) {focusByRange(getRangeByPoint(event.clientX, event.clientY));if (event.dataTransfer.types[0] === "Files" && !isBrowser()) {@@ -1003,9 +1003,9 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {paste(protyle, event);}} else {- const cellElement = hasClosestByClassName(event.target, 'av__cell')+ const cellElement = hasClosestByClassName(event.target, "av__cell");if (cellElement) {- const cellType = avElement.querySelector(`.av__row--header [data-col-id="${cellElement.dataset.colId}"]`)?.getAttribute("data-dtype")+ const cellType = avElement.querySelector(`.av__row--header [data-col-id="${cellElement.dataset.colId}"]`)?.getAttribute("data-dtype");if (cellType === "mAsset" && event.dataTransfer.types[0] === "Files" && !isBrowser()) {const files: string[] = [];for (let i = 0; i < event.dataTransfer.files.length; i++) {