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: Improve export av
Daniel058d652e71d7
diff --git a/kernel/model/export.go b/kernel/model/export.goindex 62d6f02d60..deee190650 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -1479,10 +1479,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (return ast.WalkContinue}- // 导出资源文件列 https://github.com/siyuan-note/siyuan/issues/9919for _, keyValues := range attrView.KeyValues {switch keyValues.Key.Type {- case av.KeyTypeMAsset:+ case av.KeyTypeMAsset: // 导出资源文件列 https://github.com/siyuan-note/siyuan/issues/9919for _, value := range keyValues.Values {for _, asset := range value.MAsset {if !isRelativePath([]byte(asset.Content)) {@@ -1501,22 +1500,11 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (}}}- case av.KeyTypeRelation:- if nil == keyValues.Key.Relation {- break- }-- relAvJSONPath := av.GetAttributeViewDataPath(keyValues.Key.Relation.AvID)- if !filelock.IsExist(relAvJSONPath) {- break- }-- if copyErr := filelock.Copy(relAvJSONPath, filepath.Join(exportStorageAvDir, avID+".json")); nil != copyErr {- logging.LogErrorf("copy av json failed: %s", copyErr)- }}}+ // 级联导出关联列关联的数据库+ exportRelationAvs(avID, exportStorageAvDir)return ast.WalkContinue})}@@ -1605,6 +1593,47 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (return}+func exportRelationAvs(avID, exportStorageAvDir string) {+ avIDs := hashset.New()+ avIDs.Add(avID)+ walkRelationAvs(avID, exportStorageAvDir, avIDs)++ for _, v := range avIDs.Values() {+ relAvID := v.(string)+ relAvJSONPath := av.GetAttributeViewDataPath(relAvID)+ if !filelock.IsExist(relAvJSONPath) {+ continue+ }++ if copyErr := filelock.Copy(relAvJSONPath, filepath.Join(exportStorageAvDir, relAvID+".json")); nil != copyErr {+ logging.LogErrorf("copy av json failed: %s", copyErr)+ }+ }+}++func walkRelationAvs(avID, exportStorageAvDir string, exportAvIDs *hashset.Set) {+ if exportAvIDs.Contains(avID) {+ return+ }++ attrView, _ := av.ParseAttributeView(avID)+ if nil == attrView {+ return+ }++ exportAvIDs.Add(avID)+ for _, keyValues := range attrView.KeyValues {+ switch keyValues.Key.Type {+ case av.KeyTypeRelation: // 导出关联列+ if nil == keyValues.Key.Relation {+ break+ }++ walkRelationAvs(keyValues.Key.Relation.AvID, exportStorageAvDir, exportAvIDs)+ }+ }+}+func ExportMarkdownContent(id string) (hPath, exportedMd string) {return exportMarkdownContent(id)}