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: https://ld246.com/article/1783048253136
Daniel4cc83d64022f
diff --git a/kernel/cache/asset.go b/kernel/cache/asset.goindex 2263a88307..06da417f37 100644--- a/kernel/cache/asset.go+++ b/kernel/cache/asset.go@@ -159,7 +159,7 @@ func LoadAssets() {}return nil}- if strings.HasSuffix(d.Name(), ".sya") || strings.HasPrefix(d.Name(), ".") || filelock.IsHidden(path) {+ if strings.HasSuffix(d.Name(), ".sya") || strings.HasPrefix(d.Name(), ".") || filelock.IsHidden(path) || util.IsOfficeTempFile(path) {return nil}diff --git a/kernel/model/assets.go b/kernel/model/assets.goindex 0cb838a83e..65ba7f49e6 100644--- a/kernel/model/assets.go+++ b/kernel/model/assets.go@@ -93,6 +93,9 @@ func HandleAssetsRemoveEvent(assetAbsPath string) {if filelock.IsHidden(assetAbsPath) {return}+ if util.IsOfficeTempFile(assetAbsPath) {+ return+ }if strings.HasSuffix(assetAbsPath, ".tmp") {return}@@ -118,6 +121,9 @@ func HandleAssetsChangeEvent(assetAbsPath string) {if filelock.IsHidden(assetAbsPath) {return}+ if util.IsOfficeTempFile(assetAbsPath) {+ return+ }if strings.HasSuffix(assetAbsPath, ".tmp") {return}diff --git a/kernel/model/history.go b/kernel/model/history.goindex 4852641eac..007e518c56 100644--- a/kernel/model/history.go+++ b/kernel/model/history.go@@ -810,6 +810,9 @@ func recentModifiedAssets() (ret []string) {if filelock.IsHidden(absPath) {return false}+ if util.IsOfficeTempFile(absPath) {+ return false+ }return true})diff --git a/kernel/util/file.go b/kernel/util/file.goindex f8fdfc9831..3f61e4a186 100644--- a/kernel/util/file.go+++ b/kernel/util/file.go@@ -36,6 +36,12 @@ import ("github.com/siyuan-note/logging")+// IsOfficeTempFile 判断是否为 Office(Word/Excel/PowerPoint/WPS)打开文档时生成的临时文件。+// 这些文件名以 `~$` 开头,且被宿主程序独占,尝试读取会触发 filelock 的致命错误,需跳过。+func IsOfficeTempFile(assetAbsPath string) bool {+ return strings.HasPrefix(filepath.Base(assetAbsPath), "~$")+}+func GetFilePathsByExts(dirPath string, exts []string) (ret []string) {filelock.Walk(dirPath, func(path string, d fs.DirEntry, err error) error {if err != nil {