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 importing conf https://github.com/siyuan-note/siyuan/issues/13767
Daniela83d4f2bef9a
diff --git a/kernel/api/system.go b/kernel/api/system.goindex 04cdef53d2..ca3d1d2caa 100644--- a/kernel/api/system.go+++ b/kernel/api/system.go@@ -28,7 +28,6 @@ import ("github.com/88250/gulu""github.com/88250/lute""github.com/gin-gonic/gin"- "github.com/jinzhu/copier""github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/conf""github.com/siyuan-note/siyuan/kernel/model"@@ -266,8 +265,15 @@ func exportConf(c *gin.Context) {return}+ data, err := gulu.JSON.MarshalJSON(model.Conf)+ if err != nil {+ logging.LogErrorf("export conf failed: %s", err)+ ret.Code = -1+ ret.Msg = err.Error()+ return+ }clonedConf := &model.AppConf{}- if err := copier.CopyWithOption(clonedConf, model.Conf, copier.Option{IgnoreEmpty: false, DeepCopy: true}); err != nil {+ if err = gulu.JSON.UnmarshalJSON(data, clonedConf); err != nil {logging.LogErrorf("export conf failed: %s", err)ret.Code = -1ret.Msg = err.Error()@@ -305,7 +311,7 @@ func exportConf(c *gin.Context) {clonedConf.CloudRegion = 0clonedConf.DataIndexState = 0- data, err := gulu.JSON.MarshalIndentJSON(clonedConf, "", " ")+ data, err = gulu.JSON.MarshalIndentJSON(clonedConf, "", " ")if err != nil {logging.LogErrorf("export conf failed: %s", err)ret.Code = -1@@ -461,12 +467,19 @@ func importConf(c *gin.Context) {return}- if err = copier.CopyWithOption(model.Conf, importedConf, copier.Option{IgnoreEmpty: true, DeepCopy: true}); err != nil {- logging.LogErrorf("import conf failed: %s", err)- ret.Code = -1- ret.Msg = err.Error()- return- }+ model.Conf.FileTree = importedConf.FileTree+ model.Conf.Tag = importedConf.Tag+ model.Conf.Editor = importedConf.Editor+ model.Conf.Export = importedConf.Export+ model.Conf.Graph = importedConf.Graph+ model.Conf.UILayout = importedConf.UILayout+ model.Conf.System = importedConf.System+ model.Conf.Keymap = importedConf.Keymap+ model.Conf.Search = importedConf.Search+ model.Conf.Flashcard = importedConf.Flashcard+ model.Conf.AI = importedConf.AI+ model.Conf.Bazaar = importedConf.Bazaar+ model.Conf.Save()logging.LogInfof("imported conf")}