🎨 Remove the check for !TesseractEnabled when saving OCR recognition results (#11708)

* 去除保存ocr识别结果时对 !TesseractEnabled 的检测

* 🐛 https://github.com/siyuan-note/siyuan/issues/11709

* https://github.com/siyuan-note/siyuan/pull/11708

修改ocr相关接口

* https://github.com/siyuan-note/siyuan/pull/11708

修改前端相关代码

* Update router.go

* Update router.go

---------

Co-authored-by: Vanessa <lly219@gmail.com>
This commit is contained in:
崮生 2024-06-15 17:51:48 +08:00 committed by GitHub
parent 6efa948859
commit b590091c9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 18 deletions

View file

@ -107,13 +107,9 @@ func getImageOCRText(c *gin.Context) {
}
path := arg["path"].(string)
force := false
if forceArg := arg["force"]; nil != forceArg {
force = forceArg.(bool)
}
ret.Data = map[string]interface{}{
"text": util.GetAssetText(path, force),
"text": util.GetAssetText(path),
}
}
@ -131,6 +127,26 @@ func setImageOCRText(c *gin.Context) {
util.SetAssetText(path, text)
}
func ocr(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
path := arg["path"].(string)
force := false
if forceArg := arg["force"]; nil != forceArg {
force = forceArg.(bool)
}
ret.Data = map[string]interface{}{
"text": util.OcrAsset(path, force),
}
}
func renameAsset(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)