An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Image OCR supports setting the timeout via the environment variable `SIYUAN_TESSERACT_TIMEOUT` https://github.com/siyuan-note/siyuan/issues/16419
Danielbebf8c8e9b3b
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.goindex 040468b54d..c3935212a2 100644--- a/kernel/util/ocr.go+++ b/kernel/util/ocr.go@@ -234,7 +234,16 @@ func Tesseract(imgAbsPath string) (ret []map[string]interface{}) {defer logging.Recover()- ctx, cancel := context.WithTimeout(context.Background(), 7*time.Second)+ timeout := 7000+ timeoutEnv := os.Getenv("SIYUAN_TESSERACT_TIMEOUT")+ if "" != timeoutEnv {+ if timeoutParsed, parseErr := strconv.Atoi(timeoutEnv); nil == parseErr {+ timeout = timeoutParsed+ } else {+ logging.LogWarnf("parse tesseract timeout [%s] failed: %s", timeoutEnv, parseErr)+ }+ }+ ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Millisecond)defer cancel()cmd := exec.CommandContext(ctx, TesseractBin, "-c", "debug_file=/dev/null", imgAbsPath, "stdout", "-l", strings.Join(TesseractLangs, "+"), "tsv")