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: Supports cleaning up unreferenced databases https://github.com/siyuan-note/siyuan/issues/11569
Danield23d9d61caf0
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex cf6169d2c2..5edb0f2f08 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -96,18 +96,20 @@ func RemoveUnusedAttributeViews() (ret []string) {return}- for _, unusedAvID := range unusedAttributeViews {- srcPath := filepath.Join(util.DataDir, "storage", "av", unusedAvID+".json")+ for _, unusedAv := range unusedAttributeViews {+ id := unusedAv["id"].(string)+ srcPath := filepath.Join(util.DataDir, "storage", "av", id+".json")if filelock.IsExist(srcPath) {- historyPath := filepath.Join(historyDir, "storage", "av", unusedAvID+".json")+ historyPath := filepath.Join(historyDir, "storage", "av", id+".json")if err = filelock.Copy(srcPath, historyPath); err != nil {return}}}- for _, unusedAvID := range unusedAttributeViews {- absPath := filepath.Join(util.DataDir, "storage", "av", unusedAvID+".json")+ for _, unusedAv := range unusedAttributeViews {+ id := unusedAv["id"].(string)+ absPath := filepath.Join(util.DataDir, "storage", "av", id+".json")if filelock.IsExist(absPath) {info, statErr := os.Stat(absPath)if statErr == nil {@@ -130,9 +132,9 @@ func RemoveUnusedAttributeViews() (ret []string) {return}-func UnusedAttributeViews() (ret []string) {+func UnusedAttributeViews() (ret []map[string]any) {defer logging.Recover()- ret = []string{}+ ret = []map[string]any{}allAvIDs, err := getAllAvIDs()if err != nil {@@ -169,13 +171,16 @@ func UnusedAttributeViews() (ret []string) {checkedAvIDs := map[string]bool{}for _, id := range allAvIDs {if !docReferencedAvIDs[id] && !isRelatedSrcAvDocReferenced(id, docReferencedAvIDs, checkedAvIDs) {- ret = append(ret, id)+ name, _ := av.GetAttributeViewName(id)+ ret = append(ret, map[string]any{+ "id": id,+ "name": name,+ })}}- ret = gulu.Str.RemoveDuplicatedElem(ret)if 1 > len(ret) {- ret = []string{}+ ret = []map[string]any{}}return}