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: Improve av https://github.com/siyuan-note/siyuan/issues/14511
Daniel0deda92cac80
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 6b43035342..264306d5c0 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -1783,80 +1783,6 @@ func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, erreturn}-func (tx *Transaction) doUnbindAttrViewBlock(operation *Operation) (ret *TxErr) {- err := unbindAttributeViewBlock(operation, tx)- if err != nil {- return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID}- }- return-}--func unbindAttributeViewBlock(operation *Operation, tx *Transaction) (err error) {- attrView, err := av.ParseAttributeView(operation.AvID)- if err != nil {- return- }-- node, _, _ := getNodeByBlockID(tx, operation.ID)- if nil == node {- return- }-- var changedAvIDs []string- for _, keyValues := range attrView.KeyValues {- for _, value := range keyValues.Values {- if av.KeyTypeRelation == value.Type {- if nil != value.Relation {- for i, relBlockID := range value.Relation.BlockIDs {- if relBlockID == operation.ID {- value.Relation.BlockIDs[i] = operation.NextID- changedAvIDs = append(changedAvIDs, attrView.ID)- }- }- }- }-- if value.BlockID != operation.ID {- continue- }-- if av.KeyTypeBlock == value.Type {- unbindBlockAv(tx, operation.AvID, value.Block.ID)- }- value.IsDetached = true- if nil != value.Block {- value.Block.ID = ""- }-- avIDs := replaceRelationAvValues(operation.AvID, operation.ID, operation.NextID)- changedAvIDs = append(changedAvIDs, avIDs...)- }- }-- replacedRowID := false- for _, v := range attrView.Views {- for i, itemID := range v.ItemIDs {- if itemID == operation.ID {- v.ItemIDs[i] = operation.NextID- replacedRowID = true- break- }- }-- if !replacedRowID {- v.ItemIDs = append(v.ItemIDs, operation.NextID)- }- }-- err = av.SaveAttributeView(attrView)-- changedAvIDs = gulu.Str.RemoveDuplicatedElem(changedAvIDs)- for _, avID := range changedAvIDs {- ReloadAttrView(avID)- }- return-}-func (tx *Transaction) doSetAttrViewColDate(operation *Operation) (ret *TxErr) {err := setAttributeViewColDate(operation)if err != nil {@@ -4058,29 +3984,25 @@ func replaceAttributeViewBlock0(attrView *av.AttributeView, oldBlockID, newBlockcontinue}- if av.KeyTypeBlock == value.Type && value.Block.ID != newBlockID {- // 换绑- unbindBlockAv(tx, avID, value.Block.ID)- }-- if av.KeyTypeBlock == value.Type && nil != value.Block {+ if av.KeyTypeBlock == value.Type {value.IsDetached = isDetachedif !isDetached {+ if value.Block.ID != newBlockID {+ unbindBlockAv(tx, avID, value.Block.ID)+ bindBlockAv(tx, avID, newBlockID)+ }+value.Block.ID = newBlockIDicon, content := getNodeAvBlockText(node)content = util.UnescapeHTML(content)value.Block.Icon, value.Block.Content = icon, content++ avIDs := replaceRelationAvValues(avID, oldBlockID, newBlockID)+ changedAvIDs = append(changedAvIDs, avIDs...)} else {value.Block.ID = ""}}-- if av.KeyTypeBlock == value.Type && !isDetached {- bindBlockAv(tx, avID, newBlockID)-- avIDs := replaceRelationAvValues(avID, oldBlockID, newBlockID)- changedAvIDs = append(changedAvIDs, avIDs...)- }}}diff --git a/kernel/model/transaction.go b/kernel/model/transaction.goindex 4537f5dba0..1cc4b5afaf 100644--- a/kernel/model/transaction.go+++ b/kernel/model/transaction.go@@ -277,8 +277,6 @@ func performTx(tx *Transaction) (ret *TxErr) {ret = tx.doHideAttrViewName(op)case "setAttrViewColDate":ret = tx.doSetAttrViewColDate(op)- case "unbindAttrViewBlock":- ret = tx.doUnbindAttrViewBlock(op)case "duplicateAttrViewKey":ret = tx.doDuplicateAttrViewKey(op)case "setAttrViewCoverFrom":