Skip to content

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

:art: Improve blocktree

Daniela8b3f6cc2548
diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go
index 10cf2bb3fa..aa88342072 100644
--- a/kernel/treenode/blocktree.go
+++ b/kernel/treenode/blocktree.go
@@ -306,6 +306,10 @@ func ExistBlockTree(id string) bool {
func ExistBlockTrees(ids []string) (ret map[string]bool) {
ret = map[string]bool{}
+ if 1 > len(ids) {
+ return
+ }
+
for _, id := range ids {
ret[id] = false
}
@@ -330,6 +334,10 @@ func ExistBlockTrees(ids []string) (ret map[string]bool) {
func GetBlockTrees(ids []string) (ret map[string]*BlockTree) {
ret = map[string]*BlockTree{}
+ if 1 > len(ids) {
+ return
+ }
+
sqlStmt := "SELECT * FROM blocktrees WHERE id IN ('" + strings.Join(ids, "','") + "')"
rows, err := db.Query(sqlStmt)
if nil != err {