Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:zap: Improve performance of loading database table view

Daniel238609f25f39
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index eefa015621..34718e82bb 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -413,7 +413,11 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
switch cell.ValueType {
case av.KeyTypeTemplate: // 渲染模板列
keyValues := rows[row.ID]
- ial := GetBlockAttrs(row.ID)
+ ial := map[string]string{}
+ block := row.GetBlockValue()
+ if !block.IsDetached {
+ ial = GetBlockAttrs(row.ID)
+ }
content := renderTemplateCol(ial, cell.Value.Template.Content, keyValues)
cell.Value.Template.Content = content
case av.KeyTypeCreated: // 渲染创建时间
@@ -426,7 +430,11 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
cell.Value.Created = av.NewFormattedValueCreated(time.Now().UnixMilli(), 0, av.CreatedFormatNone)
}
case av.KeyTypeUpdated: // 渲染更新时间
- ial := GetBlockAttrs(row.ID)
+ ial := map[string]string{}
+ block := row.GetBlockValue()
+ if !block.IsDetached {
+ ial = GetBlockAttrs(row.ID)
+ }
updatedStr := ial["updated"]
if "" == updatedStr {
block := row.GetBlockValue()