An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:boom: https://github.com/siyuan-note/siyuan/issues/15727
Daniel1b34bcf4fad2
diff --git a/kernel/api/attr.go b/kernel/api/attr.goindex 4611e9c217..b075e5dc1a 100644--- a/kernel/api/attr.go+++ b/kernel/api/attr.go@@ -161,36 +161,3 @@ func batchSetBlockAttrs(c *gin.Context) {return}}--func resetBlockAttrs(c *gin.Context) {- ret := gulu.Ret.NewResult()- defer c.JSON(http.StatusOK, ret)-- arg, ok := util.JsonArg(c, ret)- if !ok {- return- }-- id := arg["id"].(string)- attrs := arg["attrs"].(map[string]any)- nameValues := map[string]string{}- for name, value := range attrs {- if nil == value {- // 接口会先清空所有属性,nil 值可忽略- continue- }- strValue, ok := value.(string)- if !ok {- ret.Code = -1- ret.Msg = fmt.Sprintf("the value of attr [%s] must be a string", name)- return- }- nameValues[name] = strValue- }- err := model.ResetBlockAttrs(id, nameValues)- if err != nil {- ret.Code = -1- ret.Msg = err.Error()- return- }-}diff --git a/kernel/api/av.go b/kernel/api/av.goindex 09dc792cae..7c7b73e4c1 100644--- a/kernel/api/av.go+++ b/kernel/api/av.go@@ -628,24 +628,6 @@ func getAttributeViewFilterSort(c *gin.Context) {}}-func searchAttributeViewNonRelationKey(c *gin.Context) {- ret := gulu.Ret.NewResult()- defer c.JSON(http.StatusOK, ret)-- arg, _ := util.JsonArg(c, ret)- if nil == arg {- return- }-- avID := arg["avID"].(string)- keyword := arg["keyword"].(string)-- nonRelationKeys := model.SearchAttributeViewNonRelationKey(avID, keyword)- ret.Data = map[string]any{- "keys": nonRelationKeys,- }-}-func searchAttributeViewRollupDestKeys(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)@@ -994,10 +976,13 @@ func setAttributeViewBlockAttr(c *gin.Context) {if _, ok := arg["itemID"]; ok {itemID = arg["itemID"].(string)} else if _, ok := arg["rowID"]; ok {- // TODO 计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15708#issuecomment-3239694546- itemID = arg["rowID"].(string)- logging.LogWarnf("[%s] parameter [%s] is deprecated, it will be removed at [%s], visit [https://github.com/siyuan-note/siyuan/issues/15727] for details",- c.Request.RequestURI, "rowID", "2026-06-30")+ // TODO 该参数将于 2026 年 12 月 1 日后删除+ msg := fmt.Sprintf("[%s] parameter [%s] is deprecated, visit [https://github.com/siyuan-note/siyuan/issues/15727] for details",+ c.Request.RequestURI, "rowID")+ logging.LogWarnf(msg)+ ret.Code = -1+ ret.Msg = msg+ return}value := arg["value"].(any)updatedVal, err := model.UpdateAttributeViewCell(nil, avID, keyID, itemID, value)diff --git a/kernel/api/router.go b/kernel/api/router.goindex 678a2f0e0f..ed1a710500 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -17,6 +17,10 @@package apiimport (+ "fmt"+ "net/http"++ "github.com/88250/gulu""github.com/gin-gonic/gin""github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/model"@@ -69,14 +73,14 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/system/exportConf", model.CheckAuth, model.CheckAdminRole, exportConf)ginServer.Handle("POST", "/api/system/importConf", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, importConf)ginServer.Handle("POST", "/api/system/getWorkspaceInfo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getWorkspaceInfo)- ginServer.Handle("POST", "/api/system/reloadUI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadUI, deprecated) // TODO 请使用 /api/ui/reloadUI,该端点计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15308#issuecomment-3077675356+ ginServer.Handle("POST", "/api/system/reloadUI", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, deprecated) // TODO 请使用 /api/ui/reloadUI,该端点将于 2026 年 12 月 1 日后删除ginServer.Handle("POST", "/api/system/addMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, addMicrosoftDefenderExclusion)ginServer.Handle("POST", "/api/system/ignoreAddMicrosoftDefenderExclusion", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, ignoreAddMicrosoftDefenderExclusion)ginServer.Handle("POST", "/api/system/vacuumDataIndex", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, vacuumDataIndex)ginServer.Handle("POST", "/api/system/clearTempFiles", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, clearTempFiles)ginServer.Handle("POST", "/api/system/rebuildDataIndex", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, rebuildDataIndex)- ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setLocalStorage, deprecated) // TODO 请使用 /api/storage/setLocalStorageVal,该端点计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/16664#issuecomment-3694774305+ ginServer.Handle("POST", "/api/storage/setLocalStorage", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, deprecated) // TODO 请使用 /api/storage/setLocalStorageVal,该端点将于 2026 年 12 月 1 日后删除ginServer.Handle("POST", "/api/storage/getLocalStorage", model.CheckAuth, getLocalStorage)ginServer.Handle("POST", "/api/storage/setLocalStorageVal", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setLocalStorageVal)ginServer.Handle("POST", "/api/storage/removeLocalStorageVals", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, removeLocalStorageVals)@@ -141,7 +145,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/filetree/removeIndexes", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, removeIndexes)ginServer.Handle("POST", "/api/filetree/listDocTree", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, listDocTree)ginServer.Handle("POST", "/api/filetree/moveLocalShorthands", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, moveLocalShorthands)- ginServer.Handle("POST", "/api/filetree/refreshFiletree ", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, rebuildDataIndex, deprecated) // TODO 请使用 /api/system/rebuildDataIndex,该端点计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15663#issuecomment-3219296189+ ginServer.Handle("POST", "/api/filetree/refreshFiletree ", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, deprecated) // TODO 请使用 /api/system/rebuildDataIndex,该端点将于 2026 年 12 月 1 日后删除ginServer.Handle("POST", "/api/filetree/setPublishAccess", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setPublishAccess)ginServer.Handle("POST", "/api/filetree/getPublishAccess", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getPublishAccess)ginServer.Handle("POST", "/api/filetree/authFilePublishAccess", model.CheckAuth, authFilePublishAccess)@@ -267,7 +271,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/ref/getBackmentionDoc", model.CheckAuth, getBackmentionDoc)ginServer.Handle("POST", "/api/attr/getBookmarkLabels", model.CheckAuth, getBookmarkLabels)- ginServer.Handle("POST", "/api/attr/resetBlockAttrs", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, resetBlockAttrs, deprecated) // TODO 请使用 /api/attr/setBlockAttrs,该端点计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/pull/17027+ ginServer.Handle("POST", "/api/attr/resetBlockAttrs", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, deprecated) // TODO 请使用 /api/attr/setBlockAttrs,该端点将于 2026 年 12 月 1 日后删除ginServer.Handle("POST", "/api/attr/setBlockAttrs", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setBlockAttrs)ginServer.Handle("POST", "/api/attr/batchSetBlockAttrs", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, batchSetBlockAttrs)ginServer.Handle("POST", "/api/attr/getBlockAttrs", model.CheckAuth, getBlockAttrs)@@ -482,7 +486,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/av/searchAttributeView", model.CheckAuth, model.CheckReadonly, searchAttributeView)ginServer.Handle("POST", "/api/av/getAttributeView", model.CheckAuth, model.CheckReadonly, getAttributeView)ginServer.Handle("POST", "/api/av/searchAttributeViewRelationKey", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, searchAttributeViewRelationKey)- ginServer.Handle("POST", "/api/av/searchAttributeViewNonRelationKey", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, searchAttributeViewNonRelationKey, deprecated) // TODO 请勿使用,该端点计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15727+ ginServer.Handle("POST", "/api/av/searchAttributeViewNonRelationKey", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, deprecated) // TODO 请勿使用,该端点将于 2026 年 12 月 1 日后删除ginServer.Handle("POST", "/api/av/searchAttributeViewRollupDestKeys", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, searchAttributeViewRollupDestKeys)ginServer.Handle("POST", "/api/av/getAttributeViewFilterSort", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getAttributeViewFilterSort)ginServer.Handle("POST", "/api/av/addAttributeViewKey", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, addAttributeViewKey)@@ -539,6 +543,13 @@ func ServeAPI(ginServer *gin.Engine) {}func deprecated(c *gin.Context) {- logging.LogWarnf("[%s] is deprecated, it will be removed at [%s], visit [https://github.com/siyuan-note/siyuan/issues/15727] for details",- c.Request.RequestURI, "2026-06-30")+ ret := gulu.Ret.NewResult()+ defer c.JSON(http.StatusOK, ret)++ msg := fmt.Sprintf("[%s] is deprecated, visit [https://github.com/siyuan-note/siyuan/issues/15727] for details",+ c.Request.RequestURI)+ logging.LogWarnf(msg)++ ret.Code = -1+ ret.Msg = msg}diff --git a/kernel/go.mod b/kernel/go.modindex 30fe09b750..0b36722d4c 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -8,7 +8,7 @@ require (github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7github.com/88250/gulu v1.2.3-0.20260409163331-8c1dab1828ba- github.com/88250/lute v1.7.7-0.20260430042315-5351f112c452+ github.com/88250/lute v1.7.7-0.20260507040010-645112718ffagithub.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4github.com/ConradIrwin/font v0.2.2-0.20260202161408-44ae4cf5fb22diff --git a/kernel/go.sum b/kernel/go.sumindex 6ba827a157..acbb830f97 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -14,8 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceTgithub.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=github.com/88250/gulu v1.2.3-0.20260409163331-8c1dab1828ba h1:F9nZLeLTSPUIyYrQqprqElKFef4xVI7fzjxkLXRb2Bo=github.com/88250/gulu v1.2.3-0.20260409163331-8c1dab1828ba/go.mod h1:D+Db16m0N7r9MLZCMcj1a0ZsEGQAxDZkadOn79Gh0vI=-github.com/88250/lute v1.7.7-0.20260430042315-5351f112c452 h1:fUesDfstLn4Ser77dwReR5iDI6OwZQ9BivYBBIEB65A=-github.com/88250/lute v1.7.7-0.20260430042315-5351f112c452/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=+github.com/88250/lute v1.7.7-0.20260507040010-645112718ffa h1:gfHC4ILNRL0bFcJSSld/T2UCsi4TuicHaA0MQozQeuM=+github.com/88250/lute v1.7.7-0.20260507040010-645112718ffa/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46 h1:Bq1JsDfVbHKUxNL/B2JXd8cC/1h6aFjrlXpGycnh0Hk=github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex ff8d44487c..cf4897cf85 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -1630,26 +1630,6 @@ func GetAttributeViewFilterSort(avID, blockID string) (filters []*av.ViewFilter,return}-func SearchAttributeViewNonRelationKey(avID, keyword string) (ret []*av.Key) {- waitForSyncingStorages()-- ret = []*av.Key{}- attrView, err := av.ParseAttributeView(avID)- if err != nil {- logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)- return- }-- for _, keyValues := range attrView.KeyValues {- if av.KeyTypeRelation != keyValues.Key.Type && av.KeyTypeRollup != keyValues.Key.Type && av.KeyTypeLineNumber != keyValues.Key.Type {- if strings.Contains(strings.ToLower(keyValues.Key.Name), strings.ToLower(keyword)) {- ret = append(ret, keyValues.Key)- }- }- }- return-}-func SearchAttributeViewRollupDestKeys(avID, keyword string) (ret []*av.Key) {waitForSyncingStorages()@@ -5005,10 +4985,13 @@ func BatchUpdateAttributeViewCells(tx *Transaction, avID string, values []any) (if _, ok := v["itemID"]; ok {itemID = v["itemID"].(string)} else if _, ok := v["rowID"]; ok {- // TODO 计划于 2026 年 6 月 30 日后删除 https://github.com/siyuan-note/siyuan/issues/15708#issuecomment-3239694546+ // TODO 该参数将于 2026 年 12 月 1 日后删除itemID = v["rowID"].(string)- logging.LogWarnf("[%s] parameter [%s] is deprecated, it will be removed at [%s], visit [https://github.com/siyuan-note/siyuan/issues/15727] for details",- "/api/av/batchSetAttributeViewBlockAttrs", "rowID", "2026-06-30")+ msg := fmt.Sprintf("[%s] parameter [%s] is deprecated, visit [https://github.com/siyuan-note/siyuan/issues/15727] for details",+ "/api/av/batchSetAttributeViewBlockAttrs", "rowID")+ logging.LogWarnf(msg)+ err = fmt.Errorf(msg)+ return}valueData := v["value"]_, err = updateAttributeViewValue(tx, attrView, keyID, itemID, valueData)diff --git a/kernel/model/blockial.go b/kernel/model/blockial.goindex bac0dad1ed..44a06e351f 100644--- a/kernel/model/blockial.go+++ b/kernel/model/blockial.go@@ -270,47 +270,6 @@ func setNodeAttrs0(node *ast.Node, nameValues map[string]string) (oldAttrs map[sreturn}-func ResetBlockAttrs(id string, nameValues map[string]string) (err error) {- if util.ReadOnly {- return- }-- FlushTxQueue()-- tree, err := LoadTreeByBlockID(id)- if err != nil {- return err- }-- node := treenode.GetNodeInTree(tree, id)- if nil == node {- return fmt.Errorf(Conf.Language(15), id)- }-- oldAttrs := parse.IAL2Map(node.KramdownIAL)- node.ClearIALAttrs()-- _, err = setNodeAttrs0(node, nameValues)- if err != nil {- return- }-- if err = indexWriteTreeUpsertQueue(tree); err != nil {- return- }-- IncSync()- cache.PutBlockIAL(node.ID, parse.IAL2Map(node.KramdownIAL))-- pushBlockAttrs(oldAttrs, node)-- go func() {- sql.FlushQueue()- refreshDynamicRefText(node, tree)- }()- return-}-// isValidAttrName 验证属性名是否合法func isValidAttrName(name string) bool {n := len(name)