An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:octocat: 补充 PR 模板 https://github.com/siyuan-note/siyuan/pull/6471
Liang Ding75925c9e4f72
diff --git a/kernel/model/file.go b/kernel/model/file.goindex ce2acf031f..ee90f0a02e 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -1028,12 +1028,6 @@ func MoveDoc(fromBoxID, fromPath, toBoxID, toPath string) (newPath string, err e}func MoveDocs(fromPaths []string, toPath string) (err error) {- util.PushEndlessProgress(Conf.Language(116))-- WaitForWritingFiles()- fromPaths = util.FilterMoveDocFromPaths(fromPaths, toPath)- pathsBoxes := getBoxesByPaths(fromPaths)-toID := strings.TrimSuffix(path.Base(toPath), ".sy")toBlock := treenode.GetBlockTree(toID)if nil == toBlock {@@ -1047,6 +1041,14 @@ func MoveDocs(fromPaths []string, toPath string) (err error) {return}+ fromPaths = util.FilterMoveDocFromPaths(fromPaths, toPath)+ pathsBoxes := getBoxesByPaths(fromPaths)+ needShowProgress := 32 < len(fromPaths)+ if needShowProgress {+ util.PushEndlessProgress(Conf.Language(116))+ }++ WaitForWritingFiles()for fromPath, fromBox := range pathsBoxes {_, err = moveDoc(fromBox, fromPath, toBox, toPath)if nil != err {@@ -1056,9 +1058,11 @@ func MoveDocs(fromPaths []string, toPath string) (err error) {cache.ClearDocsIAL()IncSync()- util.PushEndlessProgress(Conf.Language(113))- sql.WaitForWritingDatabase()- util.ReloadUI()+ if needShowProgress {+ util.PushEndlessProgress(Conf.Language(113))+ sql.WaitForWritingDatabase()+ util.ReloadUI()+ }return}@@ -1167,6 +1171,16 @@ func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string) (newPathmoveTree(tree)moveSorts(tree.ID, fromBox.ID, toBox.ID)}++ evt := util.NewCmdResult("moveDoc", 0, util.PushModeBroadcast, util.PushModeNone)+ evt.Data = map[string]interface{}{+ "fromNotebook": fromBox.ID,+ "fromPath": fromPath,+ "toNotebook": toBox.ID,+ "toPath": toPath,+ "newPath": newPath,+ }+ util.PushEvent(evt)return}diff --git a/kernel/util/path.go b/kernel/util/path.goindex 54dad66771..2c82e3cea3 100644--- a/kernel/util/path.go+++ b/kernel/util/path.go@@ -178,11 +178,12 @@ func NormalizeEndpoint(endpoint string) string {func FilterMoveDocFromPaths(fromPaths []string, toPath string) (retFromPaths []string) {fromPaths = append(fromPaths, toPath)retFromPaths = FilterSelfChildDocs(fromPaths)+ retFromPaths = gulu.Str.ExcludeElem(retFromPaths, []string{toPath})return}func FilterSelfChildDocs(paths []string) (ret []string) {- sort.Slice(paths, func(i, j int) bool { return len(paths[i]) < len(paths[j]) })+ sort.Slice(paths, func(i, j int) bool { return strings.Count(paths[i], "/") < strings.Count(paths[j], "/") })dirs := map[string]string{}for _, fromPath := range paths {