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: Display the database title on the block superscript https://github.com/siyuan-note/siyuan/issues/10545
Danielcc8841cc8c4c
diff --git a/kernel/av/av.go b/kernel/av/av.goindex 4d9e6f8447..222d5b143c 100644--- a/kernel/av/av.go+++ b/kernel/av/av.go@@ -29,6 +29,7 @@ import ("github.com/88250/gulu""github.com/88250/lute/ast"+ jsoniter "github.com/json-iterator/go""github.com/siyuan-note/filelock""github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/util"@@ -212,6 +213,26 @@ func NewAttributeView(id string) (ret *AttributeView) {return}+func GetAttributeViewName(avID string) (ret string, err error) {+ avJSONPath := GetAttributeViewDataPath(avID)+ if !filelock.IsExist(avJSONPath) {+ return+ }++ data, err := filelock.ReadFile(avJSONPath)+ if nil != err {+ logging.LogErrorf("read attribute view [%s] failed: %s", avID, err)+ return+ }++ val := jsoniter.Get(data, "name")+ if nil == val || val.ValueType() == jsoniter.InvalidValue {+ return+ }+ ret = val.ToString()+ return+}+func IsAttributeViewExist(avID string) bool {avJSONPath := GetAttributeViewDataPath(avID)return filelock.IsExist(avJSONPath)diff --git a/kernel/model/file.go b/kernel/model/file.goindex b5d2017120..662280ecb3 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -17,6 +17,7 @@package modelimport (+ "bytes""errors""fmt""os"@@ -40,6 +41,7 @@ import ("github.com/siyuan-note/filelock""github.com/siyuan-note/logging""github.com/siyuan-note/riff"+ "github.com/siyuan-note/siyuan/kernel/av""github.com/siyuan-note/siyuan/kernel/cache""github.com/siyuan-note/siyuan/kernel/filesys""github.com/siyuan-note/siyuan/kernel/search"@@ -731,6 +733,28 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s}}+ if avs := n.IALAttr(av.NodeAttrNameAvs); "" != avs {+ // 填充属性视图名称+ avNames := bytes.Buffer{}+ avIDs := strings.Split(avs, ",")+ for _, avID := range avIDs {+ avName, getErr := av.GetAttributeViewName(avID)+ if nil != getErr {+ continue+ }++ if "" == avName {+ avName = "Untitled"+ }+ avNames.WriteString(avName)+ avNames.WriteString(",")+ }+ if 0 < avNames.Len() {+ avNames.Truncate(avNames.Len() - 1)+ n.SetIALAttr("av-names", avNames.String())+ }+ }+if "" != n.ID {// 填充块引计数if cnt := refCount[n.ID]; 0 < cnt {