feat(ImageToText): add ImageToText task support

This commit is contained in:
sati.ac 2023-08-31 18:52:53 +03:00
parent 286e5aa6e5
commit c1233ea660

@ -1,5 +1,9 @@
package sati
import (
"encoding/base64"
)
type AnyTask interface {
serialize() task
Result() any
@ -101,3 +105,26 @@ type GeeTest3Result struct {
Validate string `json:"validate"`
Seccode string `json:"seccode"`
}
type ImageToTextTask struct {
Image []byte `json:"-"`
Type *string `json:"type"`
}
func (t *ImageToTextTask) serialize() task {
return task{
Type: "ImageToText",
Data: map[string]any{
"image": base64.RawStdEncoding.EncodeToString(t.Image),
"type": t.Type,
},
}
}
func (t *ImageToTextTask) Result() any {
return &ImageToTextResult{}
}
type ImageToTextResult struct {
Result string `json:"result"`
}