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: Reindex notebook and reload UI after data sync if notebook conf changed https://github.com/siyuan-note/siyuan/issues/11850
Daniel222635c5a11c
diff --git a/kernel/model/file.go b/kernel/model/file.goindex 18d80ce491..24a71670a4 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -1312,11 +1312,11 @@ func GetFullHPathByID(id string) (hPath string, err error) {}box := Conf.Box(tree.Box)- var boxName string- if nil != box {- boxName = box.Name+ if nil == box {+ err = ErrBoxNotFound+ return}- hPath = boxName + tree.HPath+ hPath = box.Name + tree.HPathreturn}diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex a5afac2ca5..1e336f8c41 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -1413,6 +1413,7 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,// 可能需要重新加载部分功能var needReloadFlashcard, needReloadOcrTexts, needReloadPlugin boolupsertPluginSet := hashset.New()+ needUnindexBoxes, needIndexBoxes := map[string]bool{}, map[string]bool{}for _, file := range mergeResult.Upserts {upserts = append(upserts, file.Path)if strings.HasPrefix(file.Path, "/storage/riff/") {@@ -1425,6 +1426,9 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,if strings.HasSuffix(file.Path, "/.siyuan/conf.json") {needReloadFiletree = true+ boxID := strings.TrimSuffix(strings.TrimPrefix(file.Path, "/"), "/.siyuan/conf.json")+ needUnindexBoxes[boxID] = true+ needIndexBoxes[boxID] = true}if strings.HasPrefix(file.Path, "/storage/petal/") {@@ -1456,6 +1460,8 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,if strings.HasSuffix(file.Path, "/.siyuan/conf.json") {needReloadFiletree = true+ boxID := strings.TrimSuffix(strings.TrimPrefix(file.Path, "/"), "/.siyuan/conf.json")+ needUnindexBoxes[boxID] = true}if strings.HasPrefix(file.Path, "/storage/petal/") {@@ -1509,6 +1515,20 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,return}+ for boxID := range needUnindexBoxes {+ if box := Conf.GetBox(boxID); nil != box {+ box.Unindex()+ }+ }+ for boxID := range needIndexBoxes {+ if box := Conf.GetBox(boxID); nil != box {+ box.Index()+ }+ }+ if 0 < len(needUnindexBoxes) || 0 < len(needIndexBoxes) {+ util.ReloadUI()+ }+upsertRootIDs, removeRootIDs := incReindex(upserts, removes)go func() {util.WaitForUILoaded()