diff --git a/tasks.go b/tasks.go index e9f158a..14d69c0 100644 --- a/tasks.go +++ b/tasks.go @@ -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]string{ + "image": base64.RawStdEncoding.EncodeToString(t.Image), + "type": t.Type, + }, + } +} + +func (t *ImageToTextTask) Result() any { + return &ImageToTextResult{} +} + +type ImageToTextResult struct { + Result string `json:"result"` +}