Skip to content

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

:art: 无法添加题头图标签 https://github.com/siyuan-note/siyuan/issues/6756

Liang Ding0428d050d0c3
diff --git a/kernel/api/search.go b/kernel/api/search.go
index c71298fafe..19fe7d105c 100644
--- a/kernel/api/search.go
+++ b/kernel/api/search.go
@@ -83,6 +83,9 @@ func searchTag(c *gin.Context) {
k := arg["k"].(string)
tags := model.SearchTags(k)
+ if 1 > len(tags) {
+ tags = []string{}
+ }
ret.Data = map[string]interface{}{
"tags": tags,
"k": k,
diff --git a/kernel/model/tag.go b/kernel/model/tag.go
index a56ce975cb..0af770f646 100644
--- a/kernel/model/tag.go
+++ b/kernel/model/tag.go
@@ -20,6 +20,7 @@ import (
"bytes"
"errors"
"fmt"
+ "github.com/siyuan-note/logging"
"sort"
"strings"
@@ -282,6 +283,7 @@ func sortTags(tags Tags) {
func SearchTags(keyword string) (ret []string) {
ret = []string{}
+ defer logging.Recover() // TODO: 定位 无法添加题头图标签 https://github.com/siyuan-note/siyuan/issues/6756
labels := labelBlocksByKeyword(keyword)
for label, _ := range labels {