Skip to content

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

:art: 桌面端支持搜索图片中的文本 Fix https://github.com/siyuan-note/siyuan/issues/3470

Liang Ding5ae14c48f359
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.go
index 8b2ee413ab..bd5b4c231f 100644
--- a/kernel/util/ocr.go
+++ b/kernel/util/ocr.go
@@ -21,7 +21,6 @@ import (
"context"
"os"
"os/exec"
- "regexp"
"strings"
"time"
@@ -97,8 +96,8 @@ func Tesseract(imgAbsPath string) string {
}
ret := string(output)
- reg := regexp.MustCompile("\\s+")
- ret = reg.ReplaceAllString(ret, "")
+ ret = strings.ReplaceAll(ret, "\r", "")
+ ret = strings.ReplaceAll(ret, "\n", "")
logging.LogInfof("tesseract [path=%s, size=%d]: %s", imgAbsPath, info.Size(), ret)
ocrResultCache.Set(imgAbsPath, ret, info.Size())
return ret