Skip to content

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

:art: Supports via environment var `SIYUAN_TESSERACT_ENABLED=false` to close OCR Fix https://github.com/siyuan-note/siyuan/issues/9619

Daniel524776c0056c
diff --git a/kernel/model/ocr.go b/kernel/model/ocr.go
index 8acb61f8c4..067a32232b 100644
--- a/kernel/model/ocr.go
+++ b/kernel/model/ocr.go
@@ -37,8 +37,9 @@ func autoOCRAssets() {
util.AssetsTextsLock.Lock()
util.AssetsTexts[p] = text
util.AssetsTextsLock.Unlock()
- util.AssetsTextsChanged = true
-
+ if "" != text {
+ util.AssetsTextsChanged = true
+ }
if 4 <= i { // 一次任务中最多处理 4 张图片,防止卡顿
break
}
diff --git a/kernel/util/tesseract.go b/kernel/util/tesseract.go
index 17d50ac25c..589fd9b3ca 100644
--- a/kernel/util/tesseract.go
+++ b/kernel/util/tesseract.go
@@ -69,7 +69,9 @@ func GetAssetText(asset string, force bool) string {
AssetsTextsLock.Lock()
AssetsTexts[asset] = ret
AssetsTextsLock.Unlock()
- AssetsTextsChanged = true
+ if "" != ret {
+ AssetsTextsChanged = true
+ }
return ret
}