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: Update av
Daniel034843e52b75
diff --git a/kernel/av/row.go b/kernel/av/row.goindex be580ecb95..383a9b34d8 100644--- a/kernel/av/row.go+++ b/kernel/av/row.go@@ -26,3 +26,12 @@ type Row struct {func NewRow() *Row {return &Row{ID: ast.NewNodeID()}}++func (row *Row) GetBlockCell() *Cell {+ for _, cell := range row.Cells {+ if ColumnTypeBlock == cell.ValueType {+ return cell+ }+ }+ return nil+}diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 1911a590af..f3c44184bb 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -38,39 +38,6 @@ func RenderAttributeView(avID string) (ret *av.AttributeView, err error) {logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)return}-- // TODO: render value- //trees := map[string]*parse.Tree{}- //luteEngine := util.NewLute()- //for _, r := range ret.Rows {- // blockID := r.Cells[0].Value- //- // bt := treenode.GetBlockTree(blockID)- // if nil == bt {- // err = ErrBlockNotFound- // return- // }- //- // var tree *parse.Tree- // if tree = trees[bt.RootID]; nil == tree {- // tree, _ = filesys.LoadTree(bt.BoxID, bt.Path, luteEngine)- // if nil == tree {- // err = ErrTreeNotFound- // return- // }- //- // trees[bt.RootID] = tree- // }- //- // node := treenode.GetNodeInTree(tree, blockID)- // if nil == node {- // err = ErrBlockNotFound- // return- // }- //- // r.Cells[0].RenderValue = getNodeRefText(node)- //}-return}@@ -89,8 +56,13 @@ func (tx *Transaction) doUpdateAttrViewCell(operation *Operation) (ret *TxErr) {continue}- blockID = row.Cells[0].Value.Block.ID- for _, cell := range row.Cells[1:] {+ blockCell := row.GetBlockCell()+ if nil == blockCell {+ continue+ }++ blockID = blockCell.Value.Block.ID+ for _, cell := range row.Cells {if cell.ID == operation.ID {c = cellbreak@@ -467,7 +439,12 @@ func removeAttributeViewBlock(blockID, avID string) (ret *av.AttributeView, err}for i, row := range ret.Rows {- if row.Cells[0].Value.Block.ID == blockID {+ blockCell := row.GetBlockCell()+ if nil == blockCell {+ continue+ }++ if blockCell.Value.Block.ID == blockID {// 从行中移除,但是不移除属性ret.Rows = append(ret.Rows[:i], ret.Rows[i+1:]...)break@@ -503,7 +480,12 @@ func addAttributeViewBlock(blockID, previousRowID, avID string, tree *parse.Tree// 不允许重复添加相同的块到属性视图中for _, row := range ret.Rows {- if row.Cells[0].Value.Block.ID == blockID {+ blockCell := row.GetBlockCell()+ if nil == blockCell {+ continue+ }++ if blockCell.Value.Block.ID == blockID {return}}