Skip to content

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

:art: Support downloading cloud data snapshots to local on demand https://github.com/siyuan-note/siyuan/issues/8057

Liang Ding3f6421cf1702
diff --git a/kernel/go.mod b/kernel/go.mod
index 8803844f73..04952bc728 100644
--- a/kernel/go.mod
+++ b/kernel/go.mod
@@ -44,7 +44,7 @@ require (
github.com/radovskyb/watcher v1.0.7
github.com/sashabaranov/go-gpt3 v1.4.0
github.com/shirou/gopsutil/v3 v3.23.2
- github.com/siyuan-note/dejavu v0.0.0-20230421124852-3096ef1f7c1a
+ github.com/siyuan-note/dejavu v0.0.0-20230421133029-69679a7f4e07
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b
github.com/siyuan-note/filelock v0.0.0-20230417044524-125ee78b5cc9
diff --git a/kernel/go.sum b/kernel/go.sum
index 1ff7fd2cdf..88c9e76d3a 100644
--- a/kernel/go.sum
+++ b/kernel/go.sum
@@ -277,10 +277,8 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g
github.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-20230421122923-cb79db5323e0 h1:iaqx8D2somQMoY5khaUTeUvL8j5geCKNiXH2cGvGSSU=
-github.com/siyuan-note/dejavu v0.0.0-20230421122923-cb79db5323e0/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI=
-github.com/siyuan-note/dejavu v0.0.0-20230421124852-3096ef1f7c1a h1:peB9ArOWWcRim5D76DdFMEMEbj4rBtClnRCnw+BmWMA=
-github.com/siyuan-note/dejavu v0.0.0-20230421124852-3096ef1f7c1a/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI=
+github.com/siyuan-note/dejavu v0.0.0-20230421133029-69679a7f4e07 h1:gSfQLXrr3hOriRP7r38fakauefBF/oRWvha9vG0n238=
+github.com/siyuan-note/dejavu v0.0.0-20230421133029-69679a7f4e07/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg=
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index b598fcbe62..06b4025d0b 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -588,7 +588,14 @@ func DownloadCloudSnapshot(tag, id string) (err error) {
}
defer util.PushClearProgress()
- downloadFileCount, downloadChunkCount, downloadBytes, err := repo.DownloadTagIndex(tag, id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
+
+ var downloadFileCount, downloadChunkCount int
+ var downloadBytes int64
+ if "" == tag {
+ downloadFileCount, downloadChunkCount, downloadBytes, err = repo.DownloadIndex(id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
+ } else {
+ downloadFileCount, downloadChunkCount, downloadBytes, err = repo.DownloadTagIndex(tag, id, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
+ }
if nil != err {
return
}