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: 云端同步时自动创建数据快照
Liang Ding3538a01d3bc7
diff --git a/kernel/go.mod b/kernel/go.modindex 67e993c845..ba234f9ad2 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -40,7 +40,7 @@ require (github.com/patrickmn/go-cache v2.1.0+incompatiblegithub.com/qiniu/go-sdk/v7 v7.13.0github.com/radovskyb/watcher v1.0.7- github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730+ github.com/siyuan-note/dejavu v0.0.0-20220616050739-e25262132c10github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676github.com/siyuan-note/filelock v0.0.0-20220615164210-064676f342aagithub.com/vmihailenco/msgpack/v5 v5.3.5@@ -109,7 +109,8 @@ require (replace github.com/mattn/go-sqlite3 => github.com/88250/go-sqlite3 v1.14.13-0.20220412041952-88c3aaa8595e-//replace github.com/siyuan-note/dejavu => D:\88250\dejavu+replace github.com/siyuan-note/dejavu => D:\88250\dejavu+//replace github.com/88250/lute => D:\gogogo\src\github.com\88250\lute//replace github.com/88250/enumfonts => D:\88250\enumfonts//replace github.com/88250/pdfcpu => D:\88250\pdfcpudiff --git a/kernel/go.sum b/kernel/go.sumindex c1bd6e0f24..e11fc0a444 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -419,10 +419,6 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJgithub.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=-github.com/siyuan-note/dejavu v0.0.0-20220615164826-201b6516adf3 h1:pWPKLb4bpv5Cj8jErsuVKAvXqmudz+0XVfVWZjVxGJc=-github.com/siyuan-note/dejavu v0.0.0-20220615164826-201b6516adf3/go.mod h1:0XMLF+6gtwqr3ZJTk3nZmNbmQ4xNdaoP9RXKDR2ggkw=-github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730 h1:leFyjVzzx8/6upv6ciFl3tVZtTkXGi+71NESaMeuC30=-github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730/go.mod h1:0XMLF+6gtwqr3ZJTk3nZmNbmQ4xNdaoP9RXKDR2ggkw=github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=github.com/siyuan-note/filelock v0.0.0-20220615164210-064676f342aa h1:6bXZdsdA5EU1NUChdFV4EwH8nvYUis0H1TxwgadLM38=@@ -657,8 +653,6 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBcgolang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 h1:PgOr27OhUx2IRqGJ2RxAWI4dJQ7bi9cSrB82uzFzfUA=-golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c h1:aFV+BgZ4svzjfabn8ERpuB4JI4N6/rdy1iusx77G3oU=golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex 9ec1db85bb..a5cb9292da 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -20,6 +20,7 @@ import ("crypto/rand""encoding/hex""errors"+ "fmt""os""time"@@ -214,13 +215,23 @@ func indexRepoBeforeCloudSync() {}start := time.Now()- _, err = repo.Index("[Auto] Cloud sync", nil, nil)+ latest, err := repo.Latest()+ index, err := repo.Index("[Auto] Cloud sync", nil, nil)if nil != err {util.LogErrorf("index repo before cloud sync failed: %s", err)return}- elapsed := time.Since(start).Milliseconds()- if 7000 < elapsed {- util.LogWarnf("index repo before cloud sync elapsed [%dms]", elapsed)+ elapsed := time.Since(start)+ if nil != latest && latest.ID != index.ID {+ // 对新创建的快照需要更新备注,加入耗时统计+ index.Memo = fmt.Sprintf("[Auto] Cloud sync, completed in [%.2fs]", elapsed.Seconds())+ err = repo.PutIndex(index)+ if nil != err {+ util.LogErrorf("put index into repo before cloud sync failed: %s", err)+ return+ }+ }+ if 7000 < elapsed.Milliseconds() {+ util.LogWarnf("index repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())}}