Skip to content

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

:art: 改进 Tesseract 识别

Liang Ding82145475a8ce
diff --git a/kernel/util/tesseract.go b/kernel/util/tesseract.go
index 8b860cf7ea..6143f278d5 100644
--- a/kernel/util/tesseract.go
+++ b/kernel/util/tesseract.go
@@ -110,13 +110,21 @@ func initTesseract() {
TesseractEnabled = false
return
}
- if !gulu.Str.Contains("eng", langs) {
+
+ for _, lang := range langs {
+ if "eng" == lang || strings.HasPrefix(lang, "chi") {
+ TesseractLangs = append(TesseractLangs, lang)
+ }
+ }
+ logging.LogInfof("tesseract-ocr enabled [ver=%s, langs=%s]", ver, strings.Join(TesseractLangs, "+"))
+
+ if !gulu.Str.Contains("eng", TesseractLangs) {
logging.LogWarnf("no eng tesseract lang found")
return
}
foundChi := false
- for _, lang := range langs {
+ for _, lang := range TesseractLangs {
if strings.Contains(lang, "chi") {
foundChi = true
break
@@ -126,13 +134,6 @@ func initTesseract() {
logging.LogWarnf("no chi_* tesseract lang found")
return
}
-
- for _, lang := range langs {
- if "eng" == lang || strings.HasPrefix(lang, "chi") {
- TesseractLangs = append(TesseractLangs, lang)
- }
- }
- logging.LogInfof("tesseract-ocr enabled [ver=%s, langs=%s]", ver, strings.Join(TesseractLangs, "+"))
}
func getTesseractVer() (ret string) {