Skip to content

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

:sparkles: 增加公共代码 js/css 片段 https://github.com/siyuan-note/siyuan/issues/6143

Liang Ding1a8c519fb364
diff --git a/kernel/api/snippet.go b/kernel/api/snippet.go
index b6e197a720..56dbc685d6 100644
--- a/kernel/api/snippet.go
+++ b/kernel/api/snippet.go
@@ -35,7 +35,7 @@ func getSnippet(c *gin.Context) {
return
}
- typ := arg["type"].(string)
+ typ := arg["type"].(string) // js/css/all
enabledArg := int(arg["enabled"].(float64)) // 0:禁用,1:启用,2:全部
enabled := true
if 0 == enabledArg {
@@ -55,6 +55,9 @@ func getSnippet(c *gin.Context) {
snippets = append(snippets, s)
}
}
+ if 1 > len(snippets) {
+ snippets = []*conf.Snippet{}
+ }
ret.Data = map[string]interface{}{
"snippets": snippets,