Skip to content

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

:art: Improve code snippet writing https://github.com/siyuan-note/siyuan/issues/13101

Daniel738a53f43e22
diff --git a/kernel/model/snippet.go b/kernel/model/snippet.go
index 98449bd455..b1484bf12b 100644
--- a/kernel/model/snippet.go
+++ b/kernel/model/snippet.go
@@ -108,6 +108,10 @@ func writeSnippetsConf(snippets []*conf.Snippet) (err error) {
}
confPath := filepath.Join(util.SnippetsPath, "conf.json")
+ oldData, _ := filelock.ReadFile(confPath)
+ if string(oldData) == string(data) {
+ return
+ }
err = filelock.WriteFile(confPath, data)
return
}