84 lines
2.2 KiB
Go
84 lines
2.2 KiB
Go
package mkt2
|
|
|
|
import (
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
|
)
|
|
|
|
type AddTaskRequest struct {
|
|
*requests.JsonRequest
|
|
TaskType string `position:"Json" field:"task_type"`
|
|
MaxRetry int64 `position:"Json" field:"max_retry"`
|
|
TraceId string `position:"Json" field:"trace_id"`
|
|
Payload any `position:"Json" field:"payload"`
|
|
Extra any `position:"Json" field:"extra"`
|
|
}
|
|
|
|
type AddTaskResponseData struct {
|
|
TaskId int64 `json:"task_id"`
|
|
}
|
|
type AddTaskResponse struct {
|
|
*responses.BaseResponse
|
|
Data AddTaskResponseData `json:"data"`
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Err string `json:"err"`
|
|
TraceId string `json:"trace_id"`
|
|
}
|
|
|
|
type AddTaskParam struct {
|
|
TaskType string `position:"Json" field:"task_type"`
|
|
MaxRetry int64 `position:"Json" field:"max_retry"`
|
|
TraceId string `position:"Json" field:"trace_id"`
|
|
Payload any `position:"Json" field:"payload"`
|
|
Extra any `position:"Json" field:"extra"`
|
|
}
|
|
|
|
func CreateAddTaskRequest(param AddTaskParam) (req *AddTaskRequest) {
|
|
req = &AddTaskRequest{
|
|
JsonRequest: &requests.JsonRequest{},
|
|
TaskType: param.TaskType,
|
|
MaxRetry: param.MaxRetry,
|
|
TraceId: param.TraceId,
|
|
Payload: param.Payload,
|
|
Extra: param.Extra,
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/api/task/add")
|
|
req.Method = requests.POST
|
|
return
|
|
}
|
|
|
|
func CreateAddTaskResponse() (response *AddTaskResponse) {
|
|
response = &AddTaskResponse{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
return
|
|
}
|
|
|
|
// ResourceToVdbPayload
|
|
//素材上传向量库任务playLod
|
|
|
|
const TaskTypeResourceToVdb = "resource_to_vdb"
|
|
|
|
type ResourceToVdbPayload struct {
|
|
ResourceURL string `json:"resource_url"` // 资源 URL
|
|
MD5 string `json:"md5"` // 资源 MD5
|
|
}
|
|
|
|
type ResourceToVdbTaskParam struct {
|
|
MaxRetry int64
|
|
TraceId string
|
|
Payload ResourceToVdbPayload
|
|
Extra map[string]any
|
|
}
|
|
|
|
func CreateResourceToVdbTaskRequest(param ResourceToVdbTaskParam) (req *AddTaskRequest) {
|
|
return CreateAddTaskRequest(AddTaskParam{
|
|
TaskType: TaskTypeResourceToVdb,
|
|
MaxRetry: param.MaxRetry,
|
|
TraceId: param.TraceId,
|
|
Payload: param.Payload,
|
|
Extra: param.Extra,
|
|
})
|
|
}
|