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: Distinguish between new cards and review cards during spaced repetition https://github.com/siyuan-note/siyuan/issues/9377
Danielec46cebe773c
diff --git a/kernel/go.mod b/kernel/go.modindex ef1f027cc2..c6ae279677 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -56,7 +56,7 @@ require (github.com/siyuan-note/filelock v0.0.0-20231211015131-3b3dfabdce9cgithub.com/siyuan-note/httpclient v0.0.0-20231219001541-d75e4dce39fagithub.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0- github.com/siyuan-note/riff v0.0.0-20231128081053-0cd7a5fa0076+ github.com/siyuan-note/riff v0.0.0-20231221011852-241358ff96dfgithub.com/spf13/cast v1.6.0github.com/steambap/captcha v1.4.1github.com/studio-b12/gowebdav v0.9.0diff --git a/kernel/go.sum b/kernel/go.sumindex 7f7683ae15..e0fa88a6c5 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -366,8 +366,8 @@ github.com/siyuan-note/httpclient v0.0.0-20231219001541-d75e4dce39fa h1:kfWxJzNPgithub.com/siyuan-note/httpclient v0.0.0-20231219001541-d75e4dce39fa/go.mod h1:ejS8ChupXGP89C8N4nM+xhyxVVf/IfcwOXboql6o3+g=github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0 h1:+XjUr9UMXsczdO2bGA72p/k9wa2ShPb8ybi7CDBJ7HQ=github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4=-github.com/siyuan-note/riff v0.0.0-20231128081053-0cd7a5fa0076 h1:mfXnjcnOyY+2Rhtn5VhWjeYBfdHln9MppR91Yory0M4=-github.com/siyuan-note/riff v0.0.0-20231128081053-0cd7a5fa0076/go.mod h1:vizseu1SWCiP6lZM2Hx2dJD4t7nCIgChwkJR7B/hQ2A=+github.com/siyuan-note/riff v0.0.0-20231221011852-241358ff96df h1:v/lE1SBL4wd0cAbhr+o2GAdafBQhhikKauCSKGCkO6M=+github.com/siyuan-note/riff v0.0.0-20231221011852-241358ff96df/go.mod h1:wLzj67jwt8PM+qWPGlC4V7m0fzkUlkwPKf9vLF6ru/k=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 306208e542..81b94929d1 100644--- a/kernel/model/flashcard.go+++ b/kernel/model/flashcard.go@@ -434,6 +434,7 @@ type Flashcard struct {DeckID string `json:"deckID"`CardID string `json:"cardID"`BlockID string `json:"blockID"`+ State riff.State `json:"state"`NextDues map[riff.Rating]string `json:"nextDues"`}@@ -447,6 +448,7 @@ func newFlashcard(card riff.Card, blockID, deckID string, now time.Time) *FlashcDeckID: deckID,CardID: card.ID(),BlockID: blockID,+ State: card.GetState(),NextDues: nextDues,}}@@ -632,7 +634,7 @@ func (tx *Transaction) doRemoveFlashcards(operation *Operation) (ret *TxErr) {deckLock.Lock()defer deckLock.Unlock()- if syncingStorages {+ if syncingStorages.Load() {ret = &TxErr{code: TxErrCodeDataIsSyncing}return}@@ -744,7 +746,7 @@ func (tx *Transaction) doAddFlashcards(operation *Operation) (ret *TxErr) {deckLock.Lock()defer deckLock.Unlock()- if syncingStorages {+ if syncingStorages.Load() {ret = &TxErr{code: TxErrCodeDataIsSyncing}return}@@ -991,6 +993,7 @@ func getDeckDueCards(deck *riff.Deck, reviewedCardIDs, blockIDs []string, newCartmp = append(tmp, c)}dues = tmp+ tmp = nilfor _, c := range dues {if 0 < len(blockIDs) && !gulu.Str.Contains(c.BlockID(), blockIDs) {diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex f4e2b343a4..91ea8674b5 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -31,6 +31,7 @@ import ("sort""strings""sync"+ "sync/atomic""time""github.com/88250/gulu"@@ -934,10 +935,10 @@ func IndexRepo(memo string) (err error) {}var syncingFiles = sync.Map{}-var syncingStorages = false+var syncingStorages = atomic.Bool{}func waitForSyncingStorages() {- for syncingStorages {+ for syncingStorages.Load() {time.Sleep(time.Second)}}@@ -1129,7 +1130,7 @@ func bootSyncRepo() (err error) {}syncingFiles = sync.Map{}- syncingStorages = false+ syncingStorages.Store(false)for _, fetchedFile := range fetchedFiles {name := path.Base(fetchedFile.Path)if strings.HasSuffix(name, ".sy") {@@ -1138,7 +1139,7 @@ func bootSyncRepo() (err error) {continue}if strings.HasPrefix(fetchedFile.Path, "/storage/") {- syncingStorages = true+ syncingStorages.Store(true)}}@@ -1362,7 +1363,7 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,}syncingFiles = sync.Map{}- syncingStorages = false+ syncingStorages.Store(false)cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939if needFullReindex(upsertTrees) { // 改进同步后全量重建索引判断 https://github.com/siyuan-note/siyuan/issues/5764