Skip to content

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

:art: Rows non-bound in the database support `Add to Database` https://github.com/siyuan-note/siyuan/issues/11093

Daniele16c3cb0fe0f
diff --git a/kernel/api/av.go b/kernel/api/av.go
index 9d460a6c5e..08fcc4415e 100644
--- a/kernel/api/av.go
+++ b/kernel/api/av.go
@@ -318,7 +318,13 @@ func searchAttributeView(c *gin.Context) {
}
keyword := arg["keyword"].(string)
- results := model.SearchAttributeView(keyword)
+ var excludes []string
+ if nil != arg["excludes"] {
+ for _, e := range arg["excludes"].([]interface{}) {
+ excludes = append(excludes, e.(string))
+ }
+ }
+ results := model.SearchAttributeView(keyword, excludes)
ret.Data = map[string]interface{}{
"results": results,
}
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 7a4a7a6b91..ad8d3d96d9 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -186,8 +186,9 @@ type SearchAttributeViewResult struct {
HPath string `json:"hPath"`
}
-func SearchAttributeView(keyword string) (ret []*SearchAttributeViewResult) {
+func SearchAttributeView(keyword string, excludes []string) (ret []*SearchAttributeViewResult) {
waitForSyncingStorages()
+
ret = []*SearchAttributeViewResult{}
keyword = strings.TrimSpace(keyword)
@@ -321,7 +322,7 @@ func SearchAttributeView(keyword string) (ret []*SearchAttributeViewResult) {
hPath = box.Name + hPath
}
- if !exist {
+ if !exist && !gulu.Str.Contains(avID, excludes) {
ret = append(ret, &SearchAttributeViewResult{
AvID: avID,
AvName: existAv.AvName,