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: Clean code
Danield5f7bf2c02fc
diff --git a/kernel/model/virutalref.go b/kernel/model/virutalref.goindex 05405a6d3a..5bb65de18c 100644--- a/kernel/model/virutalref.go+++ b/kernel/model/virutalref.go@@ -253,7 +253,7 @@ func parseKeywords(keywordsStr string) (keywords []string) {// 先处理转义的逗号keywordsStr = strings.ReplaceAll(keywordsStr, "\\,", "__comma@sep__")// 再将连续或单个换行符替换为一个逗号,避免把 `\\\n` 转换为 `\,`- keywordsStr = regexp.MustCompile(`[\r\n]+`).ReplaceAllString(keywordsStr, ",")+ keywordsStr = util.ReplaceNewline(keywordsStr, ",")// 按逗号分隔for part := range strings.SplitSeq(keywordsStr, ",") {part = strings.TrimSpace(part) // 剔除前后的空白字符diff --git a/kernel/util/rune.go b/kernel/util/rune.goindex 9e58df926c..6533508f00 100644--- a/kernel/util/rune.go+++ b/kernel/util/rune.go@@ -27,6 +27,10 @@ import ("github.com/siyuan-note/logging")+func ReplaceNewline(text, replaceWith string) string {+ return regexp.MustCompile(`[\r\n]+`).ReplaceAllString(text, replaceWith)+}+func ContainsCJK(text string) bool {for _, r := range text {ret := unicode.Is(unicode.Han, r) || unicode.Is(unicode.Lm, r) ||