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 Ding92ed2f38e774
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.go
index a366886024..78960cd1fd 100644
--- a/kernel/util/ocr.go
+++ b/kernel/util/ocr.go
@@ -82,9 +82,10 @@ func Tesseract(imgAbsPath string) string {
defer logging.Recover()
- ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
+ ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
+ now := time.Now()
cmd := exec.CommandContext(ctx, "tesseract", "-c", "debug_file=/dev/null", imgAbsPath, "stdout", "-l", "chi_sim+eng")
gulu.CmdAttr(cmd)
output, err := cmd.CombinedOutput()
@@ -108,7 +109,7 @@ func Tesseract(imgAbsPath string) string {
ret := string(output)
ret = strings.ReplaceAll(ret, "\r", "")
ret = strings.ReplaceAll(ret, "\n", "")
- logging.LogInfof("tesseract [path=%s, size=%d]: %s", imgAbsPath, info.Size(), ret)
+ logging.LogInfof("tesseract [path=%s, size=%d, text=%s, elapsed=%dms]", imgAbsPath, info.Size(), ret, time.Since(now).Milliseconds())
ocrResultCache.Set(imgAbsPath, ret, info.Size())
return ret
}