Skip to content

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

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

Liang Ding0e5d2dc87c4d
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.go
index 9eef498d53..2fe001f831 100644
--- a/kernel/util/ocr.go
+++ b/kernel/util/ocr.go
@@ -24,6 +24,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
+ "runtime"
"runtime/debug"
"strings"
"sync"
@@ -117,8 +118,12 @@ func autoOCRAssets() {
assetsPath := GetDataAssetsAbsPath()
assets := getUnOCRAssetsAbsPaths()
+ poolSize := runtime.NumCPU()
+ if 4 < poolSize {
+ poolSize = 4
+ }
waitGroup := &sync.WaitGroup{}
- p, _ := ants.NewPoolWithFunc(4, func(arg interface{}) {
+ p, _ := ants.NewPoolWithFunc(poolSize, func(arg interface{}) {
defer waitGroup.Done()
assetAbsPath := arg.(string)