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: Document-level new card/review card limit control https://github.com/siyuan-note/siyuan/issues/9365
Daniel5ebb7f10b0fd
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.goindex 8717d6cd87..cd1d42c1f5 100644--- a/kernel/model/flashcard.go+++ b/kernel/model/flashcard.go@@ -21,6 +21,7 @@ import ("os""path/filepath""sort"+ "strconv""strings""sync""time"@@ -390,7 +391,7 @@ func GetNotebookDueFlashcards(boxID string, reviewedCardIDs []string) (ret []*Flreturn}- cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs)+ cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs, Conf.Flashcard.NewCardLimit, Conf.Flashcard.ReviewCardLimit)now := time.Now()for _, card := range cards {blockID := card.BlockID()@@ -415,7 +416,26 @@ func GetTreeDueFlashcards(rootID string, reviewedCardIDs []string) (ret []*Flash}_, treeBlockIDs := getTreeSubTreeChildBlocks(rootID)- cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs)+ newCardLimit := Conf.Flashcard.NewCardLimit+ reviewCardLimit := Conf.Flashcard.ReviewCardLimit+ // 文档级新卡/复习卡上限控制 Document-level new card/review card limit control https://github.com/siyuan-note/siyuan/issues/9365+ ial := GetBlockAttrs(rootID)+ if newCardLimitStr := ial["custom-riff-new-card-limit"]; "" != newCardLimitStr {+ var convertErr error+ newCardLimit, convertErr = strconv.Atoi(newCardLimitStr)+ if nil != convertErr {+ logging.LogWarnf("invalid new card limit [%s]: %s", newCardLimitStr, convertErr)+ }+ }+ if reviewCardLimitStr := ial["custom-riff-review-card-limit"]; "" != reviewCardLimitStr {+ var convertErr error+ reviewCardLimit, convertErr = strconv.Atoi(reviewCardLimitStr)+ if nil != convertErr {+ logging.LogWarnf("invalid review card limit [%s]: %s", reviewCardLimitStr, convertErr)+ }+ }++ cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs, newCardLimit, reviewCardLimit)now := time.Now()for _, card := range cards {blockID := card.BlockID()@@ -485,7 +505,7 @@ func getDueFlashcards(deckID string, reviewedCardIDs []string) (ret []*Flashcardreturn}- cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, nil)+ cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, nil, Conf.Flashcard.NewCardLimit, Conf.Flashcard.ReviewCardLimit)now := time.Now()for _, card := range cards {blockID := card.BlockID()@@ -506,7 +526,7 @@ func getDueFlashcards(deckID string, reviewedCardIDs []string) (ret []*Flashcardfunc getAllDueFlashcards(reviewedCardIDs []string) (ret []*Flashcard, unreviewedCount int) {now := time.Now()for _, deck := range Decks {- cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, nil)+ cards, unreviewedCnt := getDeckDueCards(deck, reviewedCardIDs, nil, Conf.Flashcard.NewCardLimit, Conf.Flashcard.ReviewCardLimit)unreviewedCount += unreviewedCntfor _, card := range cards {blockID := card.BlockID()@@ -874,7 +894,7 @@ func getDeckIDs() (deckIDs []string) {return}-func getDeckDueCards(deck *riff.Deck, reviewedCardIDs, blockIDs []string) (ret []riff.Card, unreviewedCount int) {+func getDeckDueCards(deck *riff.Deck, reviewedCardIDs, blockIDs []string, newCardLimit, reviewCardLimit int) (ret []riff.Card, unreviewedCount int) {ret = []riff.Card{}dues := deck.Dues()@@ -911,12 +931,12 @@ func getDeckDueCards(deck *riff.Deck, reviewedCardIDs, blockIDs []string) (ret [fsrsCard := c.Impl().(*fsrs.Card)if fsrs.New == fsrsCard.State {newCount++- if newCount > Conf.Flashcard.NewCardLimit {+ if newCount > newCardLimit {continue}} else {reviewCount++- if reviewCount > Conf.Flashcard.ReviewCardLimit {+ if reviewCount > reviewCardLimit {continue}}