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: Official data sync counts the number of cloud storage API calls https://github.com/siyuan-note/siyuan/issues/8048
Liang Ding78a5c05d28c6
diff --git a/app/src/config/repos.ts b/app/src/config/repos.tsindex 452c3ff444..d935bf4239 100644--- a/app/src/config/repos.ts+++ b/app/src/config/repos.ts@@ -176,6 +176,8 @@ const bindProviderEvent = () => {<ul class="b3-list"><li class="b3-list-item" style="cursor: auto;">${window.siyuan.languages.upload}<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficUploadSize}</span></li><li class="b3-list-item" style="cursor: auto;">${window.siyuan.languages.download}<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficDownloadSize}</span></li>+ <li class="b3-list-item" style="cursor: auto;">API GET<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficAPIGet}</span></li>+ <li class="b3-list-item" style="cursor: auto;">API PUT<span class="fn__space"></span><span class="ft__on-surface">${response.data.hTrafficAPIPut}</span></li></ul></div></div>`;diff --git a/kernel/api/repo.go b/kernel/api/repo.goindex 26d18ac848..0fac53e8ed 100644--- a/kernel/api/repo.go+++ b/kernel/api/repo.go@@ -83,7 +83,7 @@ func getCloudSpace(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)- sync, backup, hSize, hAssetSize, hTotalSize, exchangeSize, hTrafficUploadSize, hTrafficDownloadSize, err := model.GetCloudSpace()+ sync, backup, hSize, hAssetSize, hTotalSize, exchangeSize, hTrafficUploadSize, hTrafficDownloadSize, htrafficAPIGet, hTrafficAPIPut, err := model.GetCloudSpace()if nil != err {ret.Code = 1ret.Msg = err.Error()@@ -100,6 +100,8 @@ func getCloudSpace(c *gin.Context) {"hExchangeSize": exchangeSize,"hTrafficUploadSize": hTrafficUploadSize,"hTrafficDownloadSize": hTrafficDownloadSize,+ "hTrafficAPIGet": htrafficAPIGet,+ "hTrafficAPIPut": hTrafficAPIPut,}}diff --git a/kernel/conf/user.go b/kernel/conf/user.goindex c4b708a03d..f7bc98fb72 100644--- a/kernel/conf/user.go+++ b/kernel/conf/user.go@@ -34,6 +34,8 @@ type User struct {UserSiYuanAssetSize float64 `json:"userSiYuanAssetSize"`UserTrafficUpload float64 `json:"userTrafficUpload"`UserTrafficDownload float64 `json:"userTrafficDownload"`+ UserTrafficAPIGet float64 `json:"userTrafficAPIGet"`+ UserTrafficAPIPut float64 `json:"userTrafficAPIPut"`UserTrafficTime float64 `json:"userTrafficTime"`UserSiYuanSubscriptionPlan float64 `json:"userSiYuanSubscriptionPlan"` // -1:未订阅,0:标准订阅,1:教育订阅,2:试用UserSiYuanSubscriptionStatus float64 `json:"userSiYuanSubscriptionStatus"` // -1:未订阅,0:订阅可用,1:订阅封禁,2:订阅过期diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex 226c57cf97..e0ed15b150 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -1599,7 +1599,7 @@ type Sync struct {SaveDir string `json:"saveDir"` // 本地同步数据存放目录路径}-func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchangeSize, hTrafficUploadSize, hTrafficDownloadSize string, err error) {+func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchangeSize, hTrafficUploadSize, hTrafficDownloadSize, hTrafficAPIGet, hTrafficAPIPut string, err error) {stat, err := getCloudSpaceOSS()if nil != err {err = errors.New(Conf.Language(30) + " " + err.Error())@@ -1630,6 +1630,8 @@ func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchanhExchangeSize = "-"hTrafficUploadSize = "-"hTrafficDownloadSize = "-"+ hTrafficAPIGet = "-"+ hTrafficAPIPut = "-"if conf.ProviderSiYuan == Conf.Sync.Provider {s.HSize = humanize.Bytes(uint64(syncSize))b.HSize = humanize.Bytes(uint64(backupSize))@@ -1639,6 +1641,8 @@ func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchanhExchangeSize = humanize.Bytes(uint64(Conf.User.UserSiYuanPointExchangeRepoSize))hTrafficUploadSize = humanize.Bytes(uint64(Conf.User.UserTrafficUpload))hTrafficDownloadSize = humanize.Bytes(uint64(Conf.User.UserTrafficDownload))+ hTrafficAPIGet = fmt.Sprintf("%d", int(Conf.User.UserTrafficAPIGet))+ hTrafficAPIPut = fmt.Sprintf("%d", int(Conf.User.UserTrafficAPIPut))}return}