Skip to content

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

:zap: 改进多个功能点的性能 https://github.com/siyuan-note/siyuan/issues/7177

Liang Ding6235d722d127
diff --git a/kernel/model/path.go b/kernel/model/path.go
index b403968147..d775e706aa 100644
--- a/kernel/model/path.go
+++ b/kernel/model/path.go
@@ -87,7 +87,7 @@ func toFlatTree(blocks []*Block, baseDepth int, typ string) (ret []*Path) {
for _, block := range blocks {
root := getBlockIn(blockRoots, block.RootID)
if nil == root {
- root, _ = getBlock(block.RootID)
+ root, _ = getBlock(block.RootID, nil)
blockRoots = append(blockRoots, root)
}
if nil == root {
@@ -134,7 +134,7 @@ func toSubTree(blocks []*Block, keyword string) (ret []*Path) {
for _, block := range blocks {
root := getBlockIn(blockRoots, block.RootID)
if nil == root {
- root, _ = getBlock(block.RootID)
+ root, _ = getBlock(block.RootID, nil)
blockRoots = append(blockRoots, root)
}
block.Depth = 1
@@ -195,11 +195,11 @@ func toSubTree(blocks []*Block, keyword string) (ret []*Path) {
}
}
for next := li.FirstChild.Next; nil != next; next = next.Next {
- subBlock, _ := getBlock(next.ID)
+ subBlock, _ := getBlock(next.ID, tree)
if unfold {
if ast.NodeList == next.Type {
for subLi := next.FirstChild; nil != subLi; subLi = subLi.Next {
- subLiBlock, _ := getBlock(subLi.ID)
+ subLiBlock, _ := getBlock(subLi.ID, tree)
var subFirst *sql.Block
if 3 != subLi.ListData.Typ {
subFirst = sql.GetBlock(subLi.FirstChild.ID)
@@ -224,7 +224,7 @@ func toSubTree(blocks []*Block, keyword string) (ret []*Path) {
headingChildren := treenode.HeadingChildren(next)
var breakSub bool
for _, n := range headingChildren {
- block, _ := getBlock(n.ID)
+ block, _ := getBlock(n.ID, tree)
subPos := 0
content := block.Content
if "" != keyword {
@@ -295,7 +295,7 @@ func toSubTree(blocks []*Block, keyword string) (ret []*Path) {
for _, headingChild := range headingChildren {
if ast.NodeList == headingChild.Type {
for subLi := headingChild.FirstChild; nil != subLi; subLi = subLi.Next {
- subLiBlock, _ := getBlock(subLi.ID)
+ subLiBlock, _ := getBlock(subLi.ID, tree)
var subFirst *sql.Block
if 3 != subLi.ListData.Typ {
subFirst = sql.GetBlock(subLi.FirstChild.ID)
@@ -315,7 +315,7 @@ func toSubTree(blocks []*Block, keyword string) (ret []*Path) {
subRoot.Blocks = append(subRoot.Blocks, subLiBlock)
}
} else {
- subBlock, _ := getBlock(headingChild.ID)
+ subBlock, _ := getBlock(headingChild.ID, tree)
subBlock.Depth = 2
subRoot.Blocks = append(subRoot.Blocks, subBlock)
}