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/10443
Vanessa220e0b137f65
diff --git a/app/src/constants.ts b/app/src/constants.tsindex f519d3cdde..ebcd54df51 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -58,6 +58,7 @@ export abstract class Constants {// custompublic static readonly CUSTOM_SY_READONLY: string = "custom-sy-readonly";public static readonly CUSTOM_SY_FULLWIDTH: string = "custom-sy-fullwidth";+ public static readonly CUSTOM_SY_AV_VIEW: string = "custom-sy-av-view";public static readonly CUSTOM_REMINDER_WECHAT: string = "custom-reminder-wechat";public static readonly CUSTOM_RIFF_DECKS: string = "custom-riff-decks";diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.tsindex 9b785523db..4ba0ca5beb 100644--- a/app/src/protyle/render/av/asset.ts+++ b/app/src/protyle/render/av/asset.ts@@ -341,6 +341,7 @@ export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLfetchPost("/api/av/renderAttributeView", {id: avID,pageSize: parseInt(blockElement.getAttribute("data-page-size")) || undefined,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW)}, (response) => {updateAssetCell({protyle,diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex 935ef806ee..868e1af4c2 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -335,7 +335,10 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], typeinputElement.select();inputElement.focus();if (type === "template") {- fetchPost("/api/av/renderAttributeView", {id: blockElement.dataset.avId}, (response) => {+ fetchPost("/api/av/renderAttributeView", {+ id: blockElement.dataset.avId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW)+ }, (response) => {response.data.view.columns.find((item: IAVColumn) => {if (item.id === cellElements[0].dataset.colId) {inputElement.value = item.template;diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex 67243f228a..4e797cb85a 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -10,6 +10,7 @@ import {openEmojiPanel, unicode2Emoji} from "../../../emoji";import {focusBlock} from "../../util/selection";import {toggleUpdateRelationBtn} from "./relation";import {bindRollupData, getRollupHTML} from "./rollup";+import {Constants} from "../../../constants";export const duplicateCol = (options: {protyle: IProtyle,@@ -18,6 +19,7 @@ export const duplicateCol = (options: {colId: string,newValue: string,icon: string+ viewID: string}) => {const id = Lute.NewNodeID();const nameMatch = options.newValue.match(/^(.*) \((\d+)\)$/);@@ -27,7 +29,10 @@ export const duplicateCol = (options: {options.newValue = `${options.newValue} (1)`;}if (["select", "mSelect", "rollup"].includes(options.type)) {- fetchPost("/api/av/renderAttributeView", {id: options.avID}, (response) => {+ fetchPost("/api/av/renderAttributeView", {+ id: options.avID,+ viewID: options.viewID+ }, (response) => {const data = response.data as IAV;let colOptions;data.view.columns.find((item) => {@@ -747,6 +752,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemenlabel: window.siyuan.languages.duplicate,click() {duplicateCol({+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),protyle,type,avID,diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex f552326e9a..6263754549 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -55,6 +55,7 @@ export const openMenuPanel = (options: {fetchPost("/api/av/renderAttributeView", {id: avID,pageSize: parseInt(options.blockElement.getAttribute("data-page-size")) || undefined,+ viewID: options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW)}, (response) => {const isCustomAttr = !options.blockElement.classList.contains("av");const data = response.data as IAV;@@ -714,7 +715,7 @@ export const openMenuPanel = (options: {id,blockID}]);- options.blockElement.setAttribute("custom-sy-av-view", id)+ options.blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id)avPanelElement.remove();event.preventDefault();event.stopPropagation();@@ -995,7 +996,8 @@ export const openMenuPanel = (options: {avID,colId,icon: colData.icon,- newValue: colData.name+ newValue: colData.name,+ viewID: data.viewID,});avPanelElement.remove();event.preventDefault();diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex 760ac7b9f3..8b3fae01e6 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -49,18 +49,18 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v}const created = protyle.options.history?.created;const snapshot = protyle.options.history?.snapshot;- let newViewID = e.getAttribute("custom-sy-av-view") || "";+ let newViewID = e.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "";if (typeof viewID === "string") {newViewID = viewID;fetchPost("/api/av/setDatabaseBlockView", {id: e.dataset.nodeId, viewID});- e.setAttribute("custom-sy-av-view", newViewID);+ e.setAttribute(Constants.CUSTOM_SY_AV_VIEW, newViewID);}fetchPost(created ? "/api/av/renderHistoryAttributeView" : (snapshot ? "/api/av/renderSnapshotAttributeView" : "/api/av/renderAttributeView"), {id: e.getAttribute("data-av-id"),created,snapshot,pageSize: parseInt(e.dataset.pageSize) || undefined,- viewID: newViewID || e.getAttribute("custom-sy-av-view")+ viewID: newViewID}, (response) => {const data = response.data.view as IAVTable;if (!e.dataset.pageSize) {diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.tsindex 5cfc5ea2a5..e18cdb7be4 100644--- a/app/src/protyle/render/av/view.ts+++ b/app/src/protyle/render/av/view.ts@@ -4,6 +4,7 @@ import {transaction} from "../../wysiwyg/transaction";import {openMenuPanel} from "./openMenuPanel";import {removeBlock} from "../../wysiwyg/remove";import {getEditorRange} from "../../util/selection";+import {Constants} from "../../../constants";export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLElement, element: HTMLElement }) => {const menu = new Menu("av-view");@@ -56,7 +57,7 @@ export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLEleid,blockID: options.blockElement.dataset.nodeId}]);- options.blockElement.setAttribute("custom-sy-av-view", id)+ options.blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id)}});menu.addItem({@@ -210,5 +211,5 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {id,blockID: blockElement.getAttribute("data-node-id")}]);- blockElement.setAttribute("custom-sy-av-view", id);+ blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);};