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: Persist flashcard review log records https://github.com/siyuan-note/siyuan/issues/8833
Daniel4ac9278a14f5
diff --git a/kernel/go.mod b/kernel/go.modindex 5293688c9f..455b7b9e9d 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -51,7 +51,7 @@ require (github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524github.com/siyuan-note/httpclient v0.0.0-20230726100424-dca968525ec6github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493- github.com/siyuan-note/riff v0.0.0-20230516073320-b440b8feaabd+ github.com/siyuan-note/riff v0.0.0-20230726165442-33fecb5dcf9dgithub.com/steambap/captcha v1.4.1github.com/studio-b12/gowebdav v0.9.0github.com/vmihailenco/msgpack/v5 v5.3.5diff --git a/kernel/go.sum b/kernel/go.sumindex 0317696658..3a49496910 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -290,10 +290,6 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5ggithub.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=-github.com/siyuan-note/dejavu v0.0.0-20230726100545-ae7efdf72dc6 h1:gr5xMKR0h2+AnWIpKKBHvyeztVaQiZNsiNlFpmHO2Hw=-github.com/siyuan-note/dejavu v0.0.0-20230726100545-ae7efdf72dc6/go.mod h1:9IW5sPUKd2bLtdKKhvCBAQEtKKtqMy94hZ5DIP9SwfE=-github.com/siyuan-note/dejavu v0.0.0-20230726101238-8af49418073e h1:ssNcALG/+uEtc1mXadZIz0wumfQ4soS/TsKmLpv4unw=-github.com/siyuan-note/dejavu v0.0.0-20230726101238-8af49418073e/go.mod h1:9IW5sPUKd2bLtdKKhvCBAQEtKKtqMy94hZ5DIP9SwfE=github.com/siyuan-note/dejavu v0.0.0-20230726101657-a7de20433ff9 h1:VtAhOSiyxGdj7lRkIiNy5Yr3Rw1+5bHrQOZwTXA+S2w=github.com/siyuan-note/dejavu v0.0.0-20230726101657-a7de20433ff9/go.mod h1:9IW5sPUKd2bLtdKKhvCBAQEtKKtqMy94hZ5DIP9SwfE=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=@@ -306,8 +302,8 @@ github.com/siyuan-note/httpclient v0.0.0-20230726100424-dca968525ec6 h1:h96nJtx5github.com/siyuan-note/httpclient v0.0.0-20230726100424-dca968525ec6/go.mod h1:NBC9D4kBDDHJk00trpUBl7bVedYkjGk7TEsfVXyr6jg=github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 h1:oaN5b0WDFkjdBgGxmmBnMrtZxaJ76LZLwhQSZnznJMI=github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4=-github.com/siyuan-note/riff v0.0.0-20230516073320-b440b8feaabd h1:mBNAqQ7B9cA+tpyoE0gActVP690unEkJMdb1L48olaI=-github.com/siyuan-note/riff v0.0.0-20230516073320-b440b8feaabd/go.mod h1:VZ2C485pcV1Uz89lq2DDBgoxmFp7dFC7FEyA+55Robs=+github.com/siyuan-note/riff v0.0.0-20230726165442-33fecb5dcf9d h1:R3M1PM5tVhKwnRob/bbcXmhQPguae/XjkqOJlgXAPmA=+github.com/siyuan-note/riff v0.0.0-20230726165442-33fecb5dcf9d/go.mod h1:OSs9s7tR+nOSnf/3Y3pSkA9LMKr5zGdwpWGTlRVQ9l0=github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=github.com/smartystreets/goconvey v1.6.7 h1:I6tZjLXD2Q1kjvNbIzB1wvQBsXmKXiVrhpRE8ZjP5jY=diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.goindex 7da66a5429..999be7c440 100644--- a/kernel/model/flashcard.go+++ b/kernel/model/flashcard.go@@ -272,13 +272,17 @@ func ReviewFlashcard(deckID, cardID string, rating riff.Rating, reviewedCardIDsreviewCardCache[cardID] = card}- deck.Review(cardID, rating)- err = deck.Save()- if nil != err {+ log := deck.Review(cardID, rating)+ if err = deck.Save(); nil != err {logging.LogErrorf("save deck [%s] failed: %s", deckID, err)return}+ if err = deck.SaveLog(log); nil != err {+ logging.LogErrorf("save review log [%s] failed: %s", deckID, err)+ return+ }+dueCards, _ := getDueFlashcards(deckID, reviewedCardIDs)if 1 > len(dueCards) {// 该卡包中没有待复习的卡片了,说明最后一张卡片已经复习完了,清空撤销缓存和跳过缓存