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: Clean code https://github.com/siyuan-note/siyuan/pull/16894
Danielac184d61fa26
diff --git a/kernel/cache/asset.go b/kernel/cache/asset.goindex fce48acdb3..d3386e3a2f 100644--- a/kernel/cache/asset.go+++ b/kernel/cache/asset.go@@ -104,19 +104,6 @@ var (assetsLock = sync.Mutex{})-// GetAssets 返回所有资源的副本-func GetAssets() (ret map[string]*Asset) {- assetsLock.Lock()- defer assetsLock.Unlock()-- // 指定长度避免分配新内存时扩容和迁移- ret = make(map[string]*Asset, len(assetsCache))- for k, v := range assetsCache {- ret[k] = v- }- return-}-// IterateAssets 遍历所有资源,适合只读场景func IterateAssets(fn func(path string, asset *Asset) bool) {assetsLock.Lock()@@ -134,7 +121,7 @@ func FilterAssets(filter func(path string, asset *Asset) bool) (ret map[string]*assetsLock.Lock()defer assetsLock.Unlock()- ret = make(map[string]*Asset)+ ret = map[string]*Asset{}for path, asset := range assetsCache {if filter(path, asset) {ret[path] = asset