Skip to content

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

:art: Improve ocr text indexing

崮生0309e1772e1f
diff --git a/kernel/api/asset.go b/kernel/api/asset.go
index 4dbac0c02a..c42e438d2d 100644
--- a/kernel/api/asset.go
+++ b/kernel/api/asset.go
@@ -29,6 +29,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/siyuan/kernel/model"
+ "github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/util"
)
@@ -128,6 +129,14 @@ func setImageOCRText(c *gin.Context) {
path := arg["path"].(string)
text := arg["text"].(string)
util.SetAssetText(path, text)
+
+ // 刷新 OCR 结果到数据库
+ util.NodeOCRQueueLock.Lock()
+ defer util.NodeOCRQueueLock.Unlock()
+ for _, id := range util.NodeOCRQueue {
+ sql.IndexNodeQueue(id)
+ }
+ util.NodeOCRQueue = nil
}
func ocr(c *gin.Context) {