Skip to content

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

:art: 每次 OCR 任务最多处理 64 张图片以防止卡顿

Liang Ding2476776c83fe
diff --git a/kernel/model/ocr.go b/kernel/model/ocr.go
index 740145e4d4..96c493c8bd 100644
--- a/kernel/model/ocr.go
+++ b/kernel/model/ocr.go
@@ -53,17 +53,21 @@ func autoOCRAssets() {
util.AssetsTextsLock.Unlock()
util.AssetsTextsChanged = true
})
- for _, assetAbsPath := range assets {
+ for i, assetAbsPath := range assets {
waitGroup.Add(1)
p.Invoke(assetAbsPath)
+
+ if 63 <= i { // 一次最多处理 64 张图片,防止卡顿
+ break
+ }
}
waitGroup.Wait()
p.Release()
- cleanNotFoundAssetsTexts()
+ cleanNotExistAssetsTexts()
}
-func cleanNotFoundAssetsTexts() {
+func cleanNotExistAssetsTexts() {
tmp := util.AssetsTexts
assetsPath := util.GetDataAssetsAbsPath()