From aaf36c28ac9f836372f676f0ecf8bafe6e80ca3b Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Sun, 8 Dec 2024 12:02:34 +0800 Subject: [PATCH] change: simplify ocr texts summary --- hrp/internal/version/VERSION | 2 +- hrp/pkg/uixt/ai.go | 12 ++++++++---- hrp/pkg/uixt/client.go | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index 84b043ec..8f10fb09 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v5.0.0+2412081145 +v5.0.0+2412081202 diff --git a/hrp/pkg/uixt/ai.go b/hrp/pkg/uixt/ai.go index 613dfc18..c4abc087 100644 --- a/hrp/pkg/uixt/ai.go +++ b/hrp/pkg/uixt/ai.go @@ -57,9 +57,12 @@ func (o OCRResults) ToOCRTexts() (ocrTexts OCRTexts) { Y: int(ocrResult.Points[2].Y), }, } + rectStr := fmt.Sprintf("%d,%d,%d,%d", + rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y) ocrText := OCRText{ - Text: ocrResult.Text, - Rect: rect, + Text: ocrResult.Text, + Rect: rect, + RectStr: rectStr, } ocrTexts = append(ocrTexts, ocrText) } @@ -67,8 +70,9 @@ func (o OCRResults) ToOCRTexts() (ocrTexts OCRTexts) { } type OCRText struct { - Text string - Rect image.Rectangle + Text string `json:"text"` + RectStr string `json:"rect"` + Rect image.Rectangle `json:"-"` } func (t OCRText) Size() Size { diff --git a/hrp/pkg/uixt/client.go b/hrp/pkg/uixt/client.go index f99bcd1f..9af75c1c 100644 --- a/hrp/pkg/uixt/client.go +++ b/hrp/pkg/uixt/client.go @@ -80,7 +80,7 @@ type DriverResult struct { Success bool `json:"success"` ResponseStatus int `json:"response_status"` ResponseDuration int64 `json:"response_duration(ms)"` // ms - ResponseBody string `json:"response_body,omitempty"` + ResponseBody string `json:"response_body"` Error string `json:"error,omitempty"` }