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 db tv relation render
Daniel5700a9f18a24
diff --git a/kernel/av/filter.go b/kernel/av/filter.goindex 8e254fedff..c395cfa4db 100644--- a/kernel/av/filter.go+++ b/kernel/av/filter.go@@ -300,7 +300,7 @@ func (filter *ViewFilter) GetAffectValue(key *Key, defaultVal *Value) (ret *Valu}case FilterOperatorDoesNotContain:case FilterOperatorIsEmpty:- ret.Relation = &ValueRelation{Contents: []string{}}+ ret.Relation = &ValueRelation{Contents: []*Value{}}case FilterOperatorIsNotEmpty:}}diff --git a/kernel/av/value.go b/kernel/av/value.goindex 81b919708a..979a43f143 100644--- a/kernel/av/value.go+++ b/kernel/av/value.go@@ -141,16 +141,16 @@ func (value *Value) String() string {}return ""case KeyTypeRelation:- if 1 > len(value.Relation.Contents) {+ if nil == value.Relation || 1 > len(value.Relation.Contents) {return ""}var ret []stringfor _, v := range value.Relation.Contents {- ret = append(ret, v)+ ret = append(ret, v.String())}return strings.TrimSpace(strings.Join(ret, ", "))case KeyTypeRollup:- if nil == value.Rollup || nil == value.Rollup.Contents {+ if nil == value.Rollup || 1 > len(value.Rollup.Contents) {return ""}var ret []string@@ -648,8 +648,8 @@ type ValueCheckbox struct {}type ValueRelation struct {- Contents []string `json:"contents"`BlockIDs []string `json:"blockIDs"`+ Contents []*Value `json:"contents"`}type ValueRollup struct {diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 36f99d5064..856e907867 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -403,9 +403,9 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {break}- blocks := map[string]string{}+ blocks := map[string]*av.Value{}for _, blockValue := range destAv.GetBlockKeyValues().Values {- blocks[blockValue.BlockID] = blockValue.Block.Content+ blocks[blockValue.BlockID] = blockValue}for _, bID := range kv.Values[0].Relation.BlockIDs {kv.Values[0].Relation.Contents = append(kv.Values[0].Relation.Contents, blocks[bID])@@ -1029,9 +1029,9 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *aif nil != relKey && nil != relKey.Relation {destAv, _ := av.ParseAttributeView(relKey.Relation.AvID)if nil != destAv {- blocks := map[string]string{}+ blocks := map[string]*av.Value{}for _, blockValue := range destAv.GetBlockKeyValues().Values {- blocks[blockValue.BlockID] = blockValue.Block.Content+ blocks[blockValue.BlockID] = blockValue}for _, blockID := range cell.Value.Relation.BlockIDs {cell.Value.Relation.Contents = append(cell.Value.Relation.Contents, blocks[blockID])diff --git a/kernel/treenode/node.go b/kernel/treenode/node.goindex 6795b783d4..c068992197 100644--- a/kernel/treenode/node.go+++ b/kernel/treenode/node.go@@ -827,9 +827,9 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *aif nil != relKey && nil != relKey.Relation {destAv, _ := av.ParseAttributeView(relKey.Relation.AvID)if nil != destAv {- blocks := map[string]string{}+ blocks := map[string]*av.Value{}for _, blockValue := range destAv.GetBlockKeyValues().Values {- blocks[blockValue.BlockID] = blockValue.Block.Content+ blocks[blockValue.BlockID] = blockValue}for _, blockID := range cell.Value.Relation.BlockIDs {cell.Value.Relation.Contents = append(cell.Value.Relation.Contents, blocks[blockID])