Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/13261

Daniele0f1f789c383
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 4db1cc3cc5..9f3a190000 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -4707,10 +4707,26 @@ func updateAttributeViewColumnOptions(operation *Operation) (err error) {
return
}
- for _, keyValues := range attrView.KeyValues {
- if keyValues.Key.ID == operation.ID {
- keyValues.Key.Options = options
- break
+ selectKey, _ := attrView.GetKey(operation.ID)
+ if nil == selectKey {
+ return
+ }
+ existingOptions := map[string]*av.SelectOption{}
+ for _, opt := range selectKey.Options {
+ existingOptions[opt.Name] = opt
+ }
+ for _, opt := range options {
+ if existingOpt, exists := existingOptions[opt.Name]; exists {
+ // 如果选项已经存在则更新颜色和描述
+ existingOpt.Color = opt.Color
+ existingOpt.Desc = opt.Desc
+ } else {
+ // 如果选项不存在则添加新选项
+ selectKey.Options = append(selectKey.Options, &av.SelectOption{
+ Name: opt.Name,
+ Color: opt.Color,
+ Desc: opt.Desc,
+ })
}
}