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: Database template column support using values from other columns https://github.com/siyuan-note/siyuan/issues/9327
Danielcc3b4e320ef8
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex a6be59a0d9..e4defeeb1a 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -55,7 +55,9 @@ func renderTemplateCol(blockID, tplContent string, rowValues []*av.KeyValues) stdataModel[strings.ReplaceAll(k, "custom-", "custom_")] = v}for _, rowValue := range rowValues {- dataModel[rowValue.Key.Name] = rowValue.Values[0].String()+ if 0 < len(rowValue.Values) {+ dataModel[rowValue.Key.Name] = rowValue.Values[0].String()+ }}if err := tpl.Execute(buf, dataModel); nil != err {logging.LogWarnf("execute template [%s] failed: %s", tplContent, err)@@ -111,8 +113,9 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {// 渲染模板列for _, kv := range keyValues {if av.KeyTypeTemplate == kv.Key.Type {- content := renderTemplateCol(blockID, kv.Key.Template, keyValues)- kv.Values[0].Template.Content = content+ if 0 < len(kv.Values) {+ kv.Values[0].Template.Content = renderTemplateCol(blockID, kv.Key.Template, keyValues)+ }}}@@ -222,7 +225,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *afor _, val := range keyValues.Values {values := rows[val.BlockID]if nil == values {- values = []*av.KeyValues{&av.KeyValues{Key: keyValues.Key, Values: []*av.Value{val}}}+ values = []*av.KeyValues{{Key: keyValues.Key, Values: []*av.Value{val}}}} else {values = append(values, &av.KeyValues{Key: keyValues.Key, Values: []*av.Value{val}})}@@ -327,7 +330,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *afunc getRowBlockValue(keyValues []*av.KeyValues) (ret *av.Value) {for _, kv := range keyValues {- if av.KeyTypeBlock == kv.Key.Type {+ if av.KeyTypeBlock == kv.Key.Type && 0 < len(kv.Values) {ret = kv.Values[0]break}