Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve performance of exporting .sy.zip for notebook https://github.com/siyuan-note/siyuan/issues/12653

Daniel0dbc8c293342
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 72f9469fd9..b4a07469f2 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -1567,6 +1567,8 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
util.PushEndlessProgress(Conf.Language(65))
// 按文件夹结构复制选择的树
+ count := 0
+ total := len(trees) + len(refTrees)
for _, tree := range trees {
readPath := filepath.Join(util.DataDir, tree.Box, tree.Path)
data, readErr := filelock.ReadFile(readPath)
@@ -1586,6 +1588,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
logging.LogErrorf("write export file [%s] failed: %s", writePath, writeErr)
continue
}
+ count++
+
+ util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
}
// 引用树放在导出文件夹根路径下
@@ -1603,6 +1608,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
logging.LogErrorf("write export file [%s] failed: %s", writePath, writeErr)
continue
}
+ count++
+
+ util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
}
// 将引用树合并到选择树中,以便后面一次性导出资源文件