An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: https://github.com/siyuan-note/siyuan/issues/17537
Daniel9fee2993f9b8
diff --git a/kernel/sql/block.go b/kernel/sql/block.goindex b5631d0436..c5437e11ae 100644--- a/kernel/sql/block.go+++ b/kernel/sql/block.go@@ -58,18 +58,18 @@ type Block struct {Updated string}-func updateRootContent(tx *sql.Tx, content, updated, id string) (err error) {- stmt := "UPDATE blocks SET content = ?, fcontent = ?, updated = ? WHERE id = ?"- if err = execStmtTx(tx, stmt, content, content, updated, id); err != nil {+func updateRootContent(tx *sql.Tx, content, updated, ialContent, id string) (err error) {+ stmt := "UPDATE blocks SET content = ?, fcontent = ?, updated = ?, ial = ? WHERE id = ?"+ if err = execStmtTx(tx, stmt, content, content, updated, ialContent, id); err != nil {return}- stmt = "UPDATE blocks_fts SET content = ?, fcontent = ?, updated = ? WHERE id = ?"- if err = execStmtTx(tx, stmt, content, content, updated, id); err != nil {+ stmt = "UPDATE blocks_fts SET content = ?, fcontent = ?, updated = ?, ial = ? WHERE id = ?"+ if err = execStmtTx(tx, stmt, content, content, updated, ialContent, id); err != nil {return}if !caseSensitive {- stmt = "UPDATE blocks_fts_case_insensitive SET content = ?, fcontent = ?, updated = ? WHERE id = ?"- if err = execStmtTx(tx, stmt, content, content, updated, id); err != nil {+ stmt = "UPDATE blocks_fts_case_insensitive SET content = ?, fcontent = ?, updated = ?, ial = ? WHERE id = ?"+ if err = execStmtTx(tx, stmt, content, content, updated, ialContent, id); err != nil {return}}diff --git a/kernel/sql/database.go b/kernel/sql/database.goindex 2fae97d622..0fbdf9445f 100644--- a/kernel/sql/database.go+++ b/kernel/sql/database.go@@ -1242,18 +1242,17 @@ func batchDeleteByPathPrefix(tx *sql.Tx, boxID, pathPrefix string) (err error) {}func batchUpdatePath(tx *sql.Tx, tree *parse.Tree, context map[string]any) (err error) {- ialContent := treenode.IALStr(tree.Root)- stmt := "UPDATE blocks SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?"- if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {+ stmt := "UPDATE blocks SET box = ?, path = ?, hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {return}- stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?"- if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {+ stmt = "UPDATE blocks_fts SET box = ?, path = ?, hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {return}if !caseSensitive {- stmt = "UPDATE blocks_fts_case_insensitive SET box = ?, path = ?, hpath = ?, ial = ? WHERE root_id = ?"- if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, ialContent, tree.ID); err != nil {+ stmt = "UPDATE blocks_fts_case_insensitive SET box = ?, path = ?, hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, tree.Box, tree.Path, tree.HPath, tree.ID); err != nil {return}}@@ -1264,18 +1263,17 @@ func batchUpdatePath(tx *sql.Tx, tree *parse.Tree, context map[string]any) (err}func batchUpdateHPath(tx *sql.Tx, tree *parse.Tree, context map[string]any) (err error) {- ialContent := treenode.IALStr(tree.Root)- stmt := "UPDATE blocks SET hpath = ?, ial = ? WHERE root_id = ?"- if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {+ stmt := "UPDATE blocks SET hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {return}- stmt = "UPDATE blocks_fts SET hpath = ?, ial = ? WHERE root_id = ?"- if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {+ stmt = "UPDATE blocks_fts SET hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {return}if !caseSensitive {- stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ?, ial = ? WHERE root_id = ?"- if err = execStmtTx(tx, stmt, tree.HPath, ialContent, tree.ID); err != nil {+ stmt = "UPDATE blocks_fts_case_insensitive SET hpath = ? WHERE root_id = ?"+ if err = execStmtTx(tx, stmt, tree.HPath, tree.ID); err != nil {return}}diff --git a/kernel/sql/queue.go b/kernel/sql/queue.goindex d984c95ac3..112433976d 100644--- a/kernel/sql/queue.go+++ b/kernel/sql/queue.go@@ -222,7 +222,8 @@ func execOp(op *dbQueueOperation, tx *sql.Tx, context map[string]any) (err errorif err != nil {break}- err = updateRootContent(tx, path.Base(op.renameTree.HPath), op.renameTree.Root.IALAttr("updated"), op.renameTree.ID)++ err = updateRootContent(tx, path.Base(op.renameTree.HPath), op.renameTree.Root.IALAttr("updated"), treenode.IALStr(op.renameTree.Root), op.renameTree.ID)case "rename_sub_tree":err = batchUpdatePath(tx, op.renameTree, context)case "delete_box":