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: Avoid creating empty ocr-texts.json when OCR is disabled (#16597)
Jeffrey Chene7914f99f6ab
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.goindex b038247564..bc127e2ec8 100644--- a/kernel/util/ocr.go+++ b/kernel/util/ocr.go@@ -109,16 +109,24 @@ func SaveAssetsTexts() {start := time.Now()+ assetsPath := GetDataAssetsAbsPath()+ assetsTextsPath := filepath.Join(assetsPath, "ocr-texts.json")+assetsTextsLock.Lock()+ // OCR 功能未开启且 ocr-texts.json 不存在时,如果 assetsTexts 为空则不创建文件+ if !TesseractEnabled && !filelock.IsExist(assetsTextsPath) && 0 == len(assetsTexts) {+ assetsTextsLock.Unlock()+ assetsTextsChanged.Store(false)+ return+ }data, err := gulu.JSON.MarshalIndentJSON(assetsTexts, "", " ")if err != nil {logging.LogErrorf("marshal assets texts failed: %s", err)+ assetsTextsLock.Unlock()return}assetsTextsLock.Unlock()- assetsPath := GetDataAssetsAbsPath()- assetsTextsPath := filepath.Join(assetsPath, "ocr-texts.json")if err = filelock.WriteFile(assetsTextsPath, data); err != nil {logging.LogErrorf("write assets texts failed: %s", err)return