Skip to content

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

:art: 支持间隔复习 https://github.com/siyuan-note/siyuan/issues/6710

Liang Dinga76cfb442c97
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go
index 4adbfc401c..c5e4d1a44f 100644
--- a/kernel/model/flashcard.go
+++ b/kernel/model/flashcard.go
@@ -164,6 +164,7 @@ func RemoveFlashcards(deckID string, blockIDs []string) (err error) {
}
rootIDs = gulu.Str.RemoveDuplicatedElem(rootIDs)
+ availableDeckIDs := getDeckIDs()
trees := map[string]*parse.Tree{}
for _, blockID := range blockIDs {
rootID := blockRoots[blockID]
@@ -187,7 +188,7 @@ func RemoveFlashcards(deckID string, blockIDs []string) (err error) {
deckAttrs := node.IALAttr("custom-riff-decks")
var deckIDs []string
for _, dID := range strings.Split(deckAttrs, ",") {
- if dID != deckID {
+ if dID != deckID && gulu.Str.Contains(dID, availableDeckIDs) {
deckIDs = append(deckIDs, dID)
}
}
@@ -434,3 +435,10 @@ func GetDecks() (decks []*riff.Deck) {
func getRiffDir() string {
return filepath.Join(util.DataDir, "storage", "riff")
}
+
+func getDeckIDs() (deckIDs []string) {
+ for deckID := range Decks {
+ deckIDs = append(deckIDs, deckID)
+ }
+ return
+}