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: 细化启动进度 https://github.com/siyuan-note/siyuan/issues/5451
Liang Dingd7e7e1642270
diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex 61adb77458..241eb3956b 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -662,44 +662,47 @@ func subscribeEvents() {eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadIndex, func(context map[string]interface{}, id string) {msg := fmt.Sprintf(Conf.Language(164), id[:7])- util.SetBootDetails(msg)+ util.IncBootProgress(1, msg)contextPushMsg(context, msg)})+ var bootProgressPart float64eventbus.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))contextPushMsg(context, msg)})eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadFile, func(context map[string]interface{}, id string) {msg := fmt.Sprintf(Conf.Language(165), id[:7])+ util.IncBootProgress(bootProgressPart, msg)count++if 0 == count%32 {- util.SetBootDetails(msg)contextPushMsg(context, msg)}})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))contextPushMsg(context, msg)})eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadChunk, func(context map[string]interface{}, id string) {msg := fmt.Sprintf(Conf.Language(166), id[:7])+ util.IncBootProgress(bootProgressPart, msg)count++if 0 == count%32 {- util.SetBootDetails(msg)contextPushMsg(context, msg)}})eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadRef, func(context map[string]interface{}, ref string) {msg := fmt.Sprintf(Conf.Language(167), ref)- util.SetBootDetails(msg)+ util.IncBootProgress(1, msg)contextPushMsg(context, msg)})eventbus.Subscribe(dejavu.EvtCloudBeforeUploadIndex, func(context map[string]interface{}, id string) {msg := fmt.Sprintf(Conf.Language(168), id[:7])- util.SetBootDetails(msg)+ util.IncBootProgress(1, msg)contextPushMsg(context, msg)})eventbus.Subscribe(dejavu.EvtCloudBeforeUploadFiles, func(context map[string]interface{}, files []*entity.File) {diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex 996d5dc949..335345a181 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -135,6 +135,7 @@ func incReindex(upserts, removes []string) {logging.LogDebugf("sync reindex [upserts=%d, removes=%d]", len(upserts), len(removes))// 先执行 remove,否则移动文档时 upsert 会被忽略,导致未被索引+ bootProgressPart := 10 / float64(len(removes))for _, removeFile := range removes {if !strings.HasSuffix(removeFile, ".sy") {continue@@ -143,7 +144,7 @@ func incReindex(upserts, removes []string) {id := strings.TrimSuffix(filepath.Base(removeFile), ".sy")block := treenode.GetBlockTree(id)if nil != block {- util.SetBootDetails("Sync remove tree " + block.Path)+ util.IncBootProgress(bootProgressPart, "Sync remove tree "+block.Path)treenode.RemoveBlockTreesByRootID(block.RootID)sql.RemoveTreeQueue(block.BoxID, block.RootID)msg = fmt.Sprintf(Conf.Language(39), block.RootID)@@ -160,6 +161,7 @@ func incReindex(upserts, removes []string) {util.PushEndlessProgress(msg)}+ bootProgressPart = 10 / float64(len(upserts))for _, upsertFile := range upserts {if !strings.HasSuffix(upsertFile, ".sy") {continue@@ -177,7 +179,7 @@ func incReindex(upserts, removes []string) {box := upsertFile[:idx]p := strings.TrimPrefix(upsertFile, box)- util.SetBootDetails("Sync upsert tree " + p)+ util.IncBootProgress(bootProgressPart, "Sync upsert tree "+p)tree, err0 := LoadTree(box, p)if nil != err0 {continue