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: Rows non-bound in the database support `Add to Database` https://github.com/siyuan-note/siyuan/issues/11093
Daniel26cfc586f0ae
diff --git a/kernel/api/av.go b/kernel/api/av.goindex b66fe32edc..9d460a6c5e 100644--- a/kernel/api/av.go+++ b/kernel/api/av.go@@ -118,28 +118,17 @@ func addAttributeViewValues(c *gin.Context) {if nil != arg["previousID"] {previousID = arg["previousID"].(string)}- isDetached := arg["isDetached"].(bool)ignoreFillFilter := trueif nil != arg["ignoreFillFilter"] {ignoreFillFilter = arg["ignoreFillFilter"].(bool)}var srcs []map[string]interface{}- if nil != arg["srcIDs"] {- var srcIDs []string- for _, v := range arg["srcIDs"].([]interface{}) {- srcIDs = append(srcIDs, v.(string))- }- for _, srcID := range srcIDs {- src := map[string]interface{}{- "id": srcID,- }- srcs = append(srcs, src)- }- } else {- srcs = arg["srcs"].([]map[string]interface{})+ for _, v := range arg["srcs"].([]interface{}) {+ src := v.(map[string]interface{})+ srcs = append(srcs, src)}- err := model.AddAttributeViewBlock(nil, srcs, avID, blockID, previousID, isDetached, ignoreFillFilter)+ err := model.AddAttributeViewBlock(nil, srcs, avID, blockID, previousID, ignoreFillFilter)if nil != err {ret.Code = -1ret.Msg = err.Error()diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex ea944812e2..7a4a7a6b91 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -2165,25 +2165,17 @@ func setAttributeViewColumnCalc(operation *Operation) (err error) {}func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr) {- var srcs []map[string]interface{}- if 0 < len(operation.Srcs) {- srcs = operation.Srcs- } else {- for _, srcID := range operation.SrcIDs {- srcs = append(srcs, map[string]interface{}{"id": srcID})- }- }-- err := AddAttributeViewBlock(tx, srcs, operation.AvID, operation.BlockID, operation.PreviousID, operation.IsDetached, operation.IgnoreFillFilterVal)+ err := AddAttributeViewBlock(tx, operation.Srcs, operation.AvID, operation.BlockID, operation.PreviousID, operation.IgnoreFillFilterVal)if nil != err {return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}}return}-func AddAttributeViewBlock(tx *Transaction, srcs []map[string]interface{}, avID, blockID, previousBlockID string, isDetached, ignoreFillFilter bool) (err error) {+func AddAttributeViewBlock(tx *Transaction, srcs []map[string]interface{}, avID, blockID, previousBlockID string, ignoreFillFilter bool) (err error) {for _, src := range srcs {srcID := src["id"].(string)+ isDetached := src["isDetached"].(bool)var tree *parse.Treeif !isDetached {var loadErr error@@ -3166,12 +3158,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,// 将游离行绑定到新建的块上bindBlockAv(tx, avID, rowID)}- } else { // 之前绑定了块+ } else { // 之前绑定了块if isUpdatingBlockKey { // 正在更新主键if val.IsDetached { // 现在是游离行// 将绑定的块从属性视图中移除unbindBlockAv(tx, avID, rowID)- } else { // 现在绑定了块+ } else { // 现在绑定了块if oldBoundBlockID != val.BlockID { // 之前绑定的块和现在绑定的块不一样// 换绑块unbindBlockAv(tx, avID, oldBoundBlockID)diff --git a/kernel/model/transaction.go b/kernel/model/transaction.goindex 76626e3739..3f3e1ff1df 100644--- a/kernel/model/transaction.go+++ b/kernel/model/transaction.go@@ -1263,8 +1263,8 @@ type Operation struct {DeckID string `json:"deckID"` // 用于添加/删除闪卡AvID string `json:"avID"` // 属性视图 ID- SrcIDs []string `json:"srcIDs"` // 用于将块拖拽到属性视图中- Srcs []map[string]interface{} `json:"srcs"` // 属性视图中多选 添加到数据库+ SrcIDs []string `json:"srcIDs"` // 用于从属性视图中删除行+ Srcs []map[string]interface{} `json:"srcs"` // 用于添加属性视图行(包括绑定块){id, content, isDetached}IsDetached bool `json:"isDetached"` // 用于标识是否未绑定块,仅存在于属性视图中IgnoreFillFilterVal bool `json:"ignoreFillFilter"` // 用于标识是否忽略填充筛选值Name string `json:"name"` // 属性视图列名