An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: Improve loading doc performance
Daniel9c4b8bd74cdf
diff --git a/kernel/model/file.go b/kernel/model/file.goindex 85aaf3c395..18d80ce491 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -872,7 +872,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[sluteEngine.RenderOptions.NodeIndexStart = indexdom = luteEngine.Tree2BlockDOM(subTree, luteEngine.RenderOptions)- SetRecentDocByTree(tree)+ go setRecentDocByTree(tree)return}diff --git a/kernel/model/storage.go b/kernel/model/storage.goindex 818ee9bbad..db145a0523 100644--- a/kernel/model/storage.go+++ b/kernel/model/storage.go@@ -63,17 +63,13 @@ func RemoveRecentDoc(ids []string) {return}-func SetRecentDocByTree(tree *parse.Tree) {+func setRecentDocByTree(tree *parse.Tree) {recentDoc := &RecentDoc{RootID: tree.Root.ID,Icon: tree.Root.IALAttr("icon"),Title: tree.Root.IALAttr("title"),}- SetRecentDoc(recentDoc)-}--func SetRecentDoc(doc *RecentDoc) (err error) {recentDocLock.Lock()defer recentDocLock.Unlock()@@ -83,13 +79,13 @@ func SetRecentDoc(doc *RecentDoc) (err error) {}for i, c := range recentDocs {- if c.RootID == doc.RootID {+ if c.RootID == recentDoc.RootID {recentDocs = append(recentDocs[:i], recentDocs[i+1:]...)break}}- recentDocs = append([]*RecentDoc{doc}, recentDocs...)+ recentDocs = append([]*RecentDoc{recentDoc}, recentDocs...)if 32 < len(recentDocs) {recentDocs = recentDocs[:32]}