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: Update av
Danielad70e42fd6db
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex e00a29e490..a2e1985c62 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -58,6 +58,7 @@ func filterRows(ret *av.AttributeView) {}}}+ colIndexes = util.RemoveDuplicatedElem(colIndexes)var rows []*av.Rowfor _, row := range ret.Rows {@@ -92,6 +93,7 @@ func sortRows(ret *av.AttributeView) {}}}+ colIndexes = util.RemoveDuplicatedElem(colIndexes)sort.Slice(ret.Rows, func(i, j int) bool {for _, index := range colIndexes {@@ -408,12 +410,12 @@ func sortAttributeViewColumn(columnID, previousColumnID, avID string) (err errorbreak}}- attrView.Columns = util.InsertElement(attrView.Columns, previousIndex, col)+ attrView.Columns = util.InsertElem(attrView.Columns, previousIndex, col)for _, row := range attrView.Rows {cel := row.Cells[index]row.Cells = append(row.Cells[:index], row.Cells[index+1:]...)- row.Cells = util.InsertElement(row.Cells, previousIndex, cel)+ row.Cells = util.InsertElem(row.Cells, previousIndex, cel)}err = av.SaveAttributeView(attrView)@@ -446,7 +448,7 @@ func sortAttributeViewRow(rowID, previousRowID, avID string) (err error) {break}}- attrView.Rows = util.InsertElement(attrView.Rows, previousIndex, row)+ attrView.Rows = util.InsertElem(attrView.Rows, previousIndex, row)err = av.SaveAttributeView(attrView)returndiff --git a/kernel/util/misc.go b/kernel/util/misc.goindex 310f7fc297..feb3f4fcf8 100644--- a/kernel/util/misc.go+++ b/kernel/util/misc.go@@ -24,9 +24,21 @@ import ("github.com/88250/lute/html")-// InsertElement inserts a new element value at the specified index position.+// RemoveDuplicatedElem removes the duplicated elements from the slice.+func RemoveDuplicatedElem(slice []int) (ret []int) {+ allKeys := make(map[int]bool)+ for _, item := range slice {+ if _, value := allKeys[item]; !value {+ allKeys[item] = true+ ret = append(ret, item)+ }+ }+ return+}++// InsertElem inserts a new element value at the specified index position.// 0 <= index <= len(a)-func InsertElement[T any](ret []T, index int, value T) []T {+func InsertElem[T any](ret []T, index int, value T) []T {if len(ret) == index { // nil or empty slice or after last elementreturn append(ret, value)}