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: 支持基于文档复习闪卡 https://github.com/siyuan-note/siyuan/issues/7057
Liang Ding3dc2d80821b7
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.goindex 1dd810409e..2cea61fa76 100644--- a/kernel/model/flashcard.go+++ b/kernel/model/flashcard.go@@ -18,7 +18,6 @@ package modelimport ("errors"- "github.com/siyuan-note/siyuan/kernel/sql""math""os""path/filepath"@@ -34,6 +33,8 @@ import ("github.com/siyuan-note/logging""github.com/siyuan-note/riff""github.com/siyuan-note/siyuan/kernel/cache"+ "github.com/siyuan-note/siyuan/kernel/filesys"+ "github.com/siyuan-note/siyuan/kernel/sql""github.com/siyuan-note/siyuan/kernel/treenode""github.com/siyuan-note/siyuan/kernel/util")@@ -49,15 +50,34 @@ func GetTreeFlashcards(rootID string, page int) (blocks []*Block, total, pageCoureturn}- treeBlockIDs := map[string]bool{}- ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {- if !entering || !n.IsBlock() {- return ast.WalkContinue+ trees := []*parse.Tree{tree}+ box := Conf.Box(tree.Box)+ luteEngine := util.NewLute()+ files := box.ListFiles(tree.Path)+ for _, subFile := range files {+ if !strings.HasSuffix(subFile.path, ".sy") {+ continue}- treeBlockIDs[n.ID] = true- return ast.WalkContinue- })+ subTree, loadErr := filesys.LoadTree(box.ID, subFile.path, luteEngine)+ if nil != loadErr {+ continue+ }++ trees = append(trees, subTree)+ }++ treeBlockIDs := map[string]bool{}+ for _, t := range trees {+ ast.Walk(t.Root, func(n *ast.Node, entering bool) ast.WalkStatus {+ if !entering || !n.IsBlock() {+ return ast.WalkContinue+ }++ treeBlockIDs[n.ID] = true+ return ast.WalkContinue+ })+ }var allBlockIDs []stringconst pageSize = 20