Skip to content

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

:zap: Improve flashcard tree performance

Liang Ding094593de2511
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go
index 4c693743f0..b98d32f5ea 100644
--- a/kernel/model/flashcard.go
+++ b/kernel/model/flashcard.go
@@ -396,12 +396,12 @@ func GetTreeDueFlashcards(rootID string, reviewedCardIDs []string) (ret []*Flash
}
func getTreeSubTreeChildBlocks(rootID string) (treeBlockIDs []string) {
- tree, err := loadTreeByBlockID(rootID)
- if nil != err {
+ root := treenode.GetBlockTree(rootID)
+ if nil == root {
return
}
- bts := treenode.GetBlockTreesByPathPrefix(strings.TrimSuffix(tree.Path, ".sy"))
+ bts := treenode.GetBlockTreesByPathPrefix(strings.TrimSuffix(root.Path, ".sy"))
for _, bt := range bts {
treeBlockIDs = append(treeBlockIDs, bt.ID)
}