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/15524
Daniel7b8d16372398
diff --git a/kernel/sql/av.go b/kernel/sql/av.goindex 2e0bd4d157..6a383e4d4e 100644--- a/kernel/sql/av.go+++ b/kernel/sql/av.go@@ -333,7 +333,7 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collectionswitch value.Type {case av.KeyTypeBlock: // 对于主键可能需要填充静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049if nil != value.Block {- for k, v := range ials[itemID] {+ for k, v := range ials[value.Block.ID] {if k == av.NodeAttrViewStaticText+"-"+attrView.ID {value.Block.Content = vbreak@@ -451,11 +451,11 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collectionkeyValues = append(keyValues, &av.KeyValues{Key: createdKey, Values: []*av.Value{{ID: value.ID, KeyID: createdKey.ID, BlockID: itemID, Type: av.KeyTypeCreated, Created: value.Created}}})items[itemID] = keyValuescase av.KeyTypeUpdated: // 渲染更新时间- ial := ials[itemID]- if nil == ial {- ial = map[string]string{}- }+ ial := map[string]string{}block := item.GetBlockValue()+ if nil != block {+ ial = ials[block.Block.ID]+ }updatedStr := ial["updated"]if "" == updatedStr && nil != block {value.Updated = av.NewFormattedValueUpdated(block.Block.Updated, 0, av.UpdatedFormatNone)@@ -488,9 +488,10 @@ func fillAttributeViewTemplateValues(attrView *av.AttributeView, collection av.Cswitch value.Type {case av.KeyTypeTemplate: // 渲染模板字段keyValues := items[itemID]- ial := ials[itemID]- if nil == ial {- ial = map[string]string{}+ ial := map[string]string{}+ blockVal := item.GetBlockValue()+ if nil != blockVal {+ ial = ials[blockVal.Block.ID]}content, renderErr := RenderTemplateField(ial, keyValues, value.Template.Content)value.Template.Content = contentdiff --git a/kernel/sql/av_gallery.go b/kernel/sql/av_gallery.goindex 258ffa9618..2b0162dfb4 100644--- a/kernel/sql/av_gallery.go+++ b/kernel/sql/av_gallery.go@@ -65,11 +65,11 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query// 批量加载绑定块对应的树var ialIDs []string- for cardID, keyValues := range cardsValues {+ for _, keyValues := range cardsValues {for _, kValues := range keyValues {- block := kValues.GetBlockValue()- if nil != block && !block.IsDetached {- ialIDs = append(ialIDs, cardID)+ blockVal := kValues.GetBlockValue()+ if nil != blockVal && !blockVal.IsDetached {+ ialIDs = append(ialIDs, blockVal.Block.ID)}}}diff --git a/kernel/sql/av_table.go b/kernel/sql/av_table.goindex ef88149eb8..40866beacd 100644--- a/kernel/sql/av_table.go+++ b/kernel/sql/av_table.go@@ -99,9 +99,9 @@ func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s// 批量获取块属性以提升性能var ialIDs []stringfor _, row := range ret.Rows {- block := row.GetBlockValue()- if nil != block && !block.IsDetached {- ialIDs = append(ialIDs, row.ID)+ blockVal := row.GetBlockValue()+ if nil != blockVal && !blockVal.IsDetached {+ ialIDs = append(ialIDs, blockVal.Block.ID)}}ials := BatchGetBlockAttrs(ialIDs)