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: 同步下载后如果 20% 的文件存在更新则全量重建索引 Fix https://github.com/siyuan-note/siyuan/issues/5456
Liang Dingd92f805e31fa
diff --git a/kernel/model/index.go b/kernel/model/index.goindex 46cd41c5b2..18e245b457 100644--- a/kernel/model/index.go+++ b/kernel/model/index.go@@ -183,7 +183,7 @@ func (box *Box) Index(fullRebuildIndex bool) (treeCount int, treeSize int64) {}}- bootProgressPart = 40.0 / float64(boxLen) / float64(treeCount)+ bootProgressPart = 20.0 / float64(boxLen) / float64(treeCount)i = 0// 块级行级入库,缓存块diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex 69095c8a4a..a85c573b04 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -455,7 +455,7 @@ func syncRepo(boot, exit, byHand bool) {return}- err = indexRepoBeforeCloudSync(repo)+ indexBeforeSync, err := indexRepoBeforeCloudSync(repo)if nil != err {syncDownloadErrCount++planSyncAfter(fixSyncInterval)@@ -467,9 +467,9 @@ func syncRepo(boot, exit, byHand bool) {if nil != err {return}+syncContext := map[string]interface{}{dejavu.CtxPushMsg: dejavu.CtxPushMsgToStatusBar}_, mergeResult, trafficStat, err := repo.Sync(cloudInfo, syncContext)-elapsed := time.Since(start)if nil != err {syncDownloadErrCount++@@ -526,9 +526,15 @@ func syncRepo(boot, exit, byHand bool) {treenode.InitBlockTree()}- incReindex(upserts, removes)cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939+ fullReindex := 0.2 < float64(len(upserts))/float64(len(indexBeforeSync.Files))+ if fullReindex {+ RefreshFileTree()+ return+ }+ incReindex(upserts, removes)+if !boot && !exit {util.ReloadUI()}@@ -543,10 +549,10 @@ func syncRepo(boot, exit, byHand bool) {return}-func indexRepoBeforeCloudSync(repo *dejavu.Repo) (err error) {+func indexRepoBeforeCloudSync(repo *dejavu.Repo) (index *entity.Index, err error) {start := time.Now()latest, _ := repo.Latest()- index, err := repo.Index("[Sync] Cloud sync", map[string]interface{}{+ index, err = repo.Index("[Sync] Cloud sync", map[string]interface{}{dejavu.CtxPushMsg: dejavu.CtxPushMsgToStatusBar,})if nil != err {@@ -682,7 +688,7 @@ func subscribeEvents() {eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadFiles, func(context map[string]interface{}, ids []string) {msg := fmt.Sprintf(Conf.Language(165), len(ids))util.SetBootDetails(msg)- bootProgressPart = 20 / float64(len(ids))+ bootProgressPart = 10 / float64(len(ids))contextPushMsg(context, msg)})eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadFile, func(context map[string]interface{}, id string) {@@ -696,7 +702,7 @@ func subscribeEvents() {eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadChunks, func(context map[string]interface{}, ids []string) {msg := fmt.Sprintf(Conf.Language(166), len(ids))util.SetBootDetails(msg)- bootProgressPart = 20 / float64(len(ids))+ bootProgressPart = 10 / float64(len(ids))contextPushMsg(context, msg)})eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadChunk, func(context map[string]interface{}, id string) {