Commit a2fb3851 authored by brent's avatar brent

modify task type enum

parent 8f7aadb9
...@@ -1920,7 +1920,7 @@ func (server *TaskController) Examples() { ...@@ -1920,7 +1920,7 @@ func (server *TaskController) Examples() {
mysql.GetMysqlInstace().Ormer.Raw(sql).QueryRows(&types) mysql.GetMysqlInstace().Ormer.Raw(sql).QueryRows(&types)
var remodels []*models.ResonseModel var remodels []*models.ResonseModel
for _, data := range types { for _, data := range types {
var examples []models.ExampleType var examples interface{}
eer := json.Unmarshal([]byte(data.Examples), &examples) eer := json.Unmarshal([]byte(data.Examples), &examples)
if eer != nil { if eer != nil {
...@@ -2020,7 +2020,7 @@ func (server *TaskController) Enumeration() { ...@@ -2020,7 +2020,7 @@ func (server *TaskController) Enumeration() {
} }
var types []*models.EnumType var types []*models.EnumType
for _, value := range [...]models.ModelType{models.TXTTOIMG, models.TXTTOTXT, models.TXTTOVIDEO, models.IMGTOTXT} { for _, value := range [...]models.ModelType{models.TXTTOIMG, models.TXTTOTXT, models.TXTTOVIDEO, models.IMGTOTXT, models.IMGTOVIDEO, models.IMGTOIMG, models.IMGTXTTOTXT, models.IMGTXTTOIMG, models.IMGTXTTOVIDEO} {
typeData := models.EnumType{ typeData := models.EnumType{
Id: int(value), Id: int(value),
Desc: value.String(), Desc: value.String(),
......
{"/Users/brent/Documents/wubanWork/ai_developer_admin/controllers":1709622374686462499} {"/Users/brent/Documents/wubanWork/ai_developer_admin/controllers":1709633018662460210}
\ No newline at end of file \ No newline at end of file
...@@ -89,38 +89,38 @@ type TaskType struct { ...@@ -89,38 +89,38 @@ type TaskType struct {
} }
type NewTaskType struct { type NewTaskType struct {
Id int `orm:"column(id);auto"` Id int `orm:"column(id);auto"`
Name string `json:"name";orm:"column(desc)"` Name string `json:"name";orm:"column(desc)"`
BaseModel string `json:"base_model";orm:"column(desc)"` BaseModel string `json:"base_model";orm:"column(desc)"`
Model string `json:"model";orm:"column(model)"` Model string `json:"model";orm:"column(model)"`
Version string `json:"version";orm:"column(desc)"` Version string `json:"version";orm:"column(desc)"`
Desc string `json:"desc";orm:"column(desc);size(20)"` Desc string `json:"desc";orm:"column(desc);size(20)"`
Price float64 `json:"price";orm:"column(price)"` Price float64 `json:"price";orm:"column(price)"`
PublicKey string `json:"public_key";orm:"column(public_key)"` PublicKey string `json:"public_key";orm:"column(public_key)"`
Complexity int `json:"complexity";orm:"column(complexity)"` Complexity int `json:"complexity";orm:"column(complexity)"`
Type ModelType `json:"type,omitempty";orm:"column(type)"` Type ModelType `json:"type,omitempty";orm:"column(type)"`
Kind int `json:"kind";orm:"column(kind)"` Kind int `json:"kind";orm:"column(kind)"`
TypeDesc string `json:"type_desc"` TypeDesc string `json:"type_desc"`
KindDesc string `json:"kind_desc"` KindDesc string `json:"kind_desc"`
HardwareRequire interface{} `json:"hardware_require";orm:"column(hardware_require)"` HardwareRequire interface{} `json:"hardware_require";orm:"column(hardware_require)"`
ImageId string `json:"image_id";orm:"column(image_id)"` ImageId string `json:"image_id";orm:"column(image_id)"`
ImageUrl string `json:"image_url";orm:"column(image_url)"` ImageUrl string `json:"image_url";orm:"column(image_url)"`
Cmd interface{} `json:"cmd";orm:"column(cmd)"` Cmd interface{} `json:"cmd";orm:"column(cmd)"`
Workload int `json:"workload";orm:"column(workload)"` Workload int `json:"workload";orm:"column(workload)"`
ApiPath string `json:"api_path";orm:"column(api_path)"` ApiPath string `json:"api_path";orm:"column(api_path)"`
ImageName string `json:"image_name";orm:"column(image_name)"` ImageName string `json:"image_name";orm:"column(image_name)"`
SignUrl string `json:"sign_url";orm:"column(sign_url)"` SignUrl string `json:"sign_url";orm:"column(sign_url)"`
Username string `json:"username";orm:"column(username)"` Username string `json:"username";orm:"column(username)"`
Password string `json:"password";orm:"column(password)"` Password string `json:"password";orm:"column(password)"`
Examples []ExampleType `json:"examples,omitempty";orm:"column(examples)"` Examples interface{} `json:"examples,omitempty";orm:"column(examples)"`
ApiDocUrl string `json:"api_doc_url,omitempty";orm:"column(api_doc_url)"` ApiDocUrl string `json:"api_doc_url,omitempty";orm:"column(api_doc_url)"`
ApiDocContent string `json:"api_doc_content,omitempty";orm:"column(api_doc_content)"` ApiDocContent string `json:"api_doc_content,omitempty";orm:"column(api_doc_content)"`
Codes interface{} `json:"codes,omitempty";orm:"column(codes)"` Codes interface{} `json:"codes,omitempty";orm:"column(codes)"`
Tags []string `json:"tags,omitempty";orm:"column(tags)"` Tags []string `json:"tags,omitempty";orm:"column(tags)"`
Category int `json:"category";orm:"column(category)"` Category int `json:"category";orm:"column(category)"`
CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"` CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"`
UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"` UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"`
Deleted int `json:"deleted";orm:"column(deleted);size(1)"` Deleted int `json:"deleted";orm:"column(deleted);size(1)"`
} }
type Model struct { type Model struct {
...@@ -228,6 +228,11 @@ const ( ...@@ -228,6 +228,11 @@ const (
TXTTOTXT TXTTOTXT
TXTTOVIDEO TXTTOVIDEO
IMGTOTXT IMGTOTXT
IMGTOVIDEO
IMGTOIMG
IMGTXTTOTXT
IMGTXTTOIMG
IMGTXTTOVIDEO
) )
func (m ModelType) String() string { func (m ModelType) String() string {
...@@ -239,7 +244,17 @@ func (m ModelType) String() string { ...@@ -239,7 +244,17 @@ func (m ModelType) String() string {
case TXTTOVIDEO: case TXTTOVIDEO:
return "txt2video" return "txt2video"
case IMGTOTXT: case IMGTOTXT:
return "txt2video" return "img2txt"
case IMGTOVIDEO:
return "img2video"
case IMGTOIMG:
return "img2img"
case IMGTXTTOTXT:
return "imgtxt2txt"
case IMGTXTTOIMG:
return "imgtxt2img"
case IMGTXTTOVIDEO:
return "imgtxt2video"
default: default:
return "未知类型" return "未知类型"
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment