update deployinstancelist logic

Former-commit-id: e2761861c27d0dba9afa2361bb7c7be105cbbbf9
This commit is contained in:
tzwang 2024-09-09 09:27:46 +08:00
parent aa2510ef6c
commit 19838aab83
3 changed files with 9 additions and 7 deletions

View File

@ -38,6 +38,14 @@ func (l *DeployInstanceListLogic) DeployInstanceList(req *types.DeployInstanceLi
return nil, tx.Error return nil, tx.Error
} }
if len(tasklist) == 0 {
resp.List = nil
resp.PageSize = req.PageSize
resp.PageNum = req.PageNum
resp.Total = 0
return
}
//count total //count total
var total int64 var total int64
err = tx.Count(&total).Error err = tx.Count(&total).Error

View File

@ -70,12 +70,6 @@ func removeItem(items *[]*models.AiDeployInstanceTask, id int64) {
if len(*items) == 0 { if len(*items) == 0 {
return return
} }
if len(*items) == 1 {
if (*items)[0].Id == id {
(*items) = nil
return
}
}
for i := len(*items) - 1; i >= 0; i-- { for i := len(*items) - 1; i >= 0; i-- {
if (*items)[i].Id == id { if (*items)[i].Id == id {
*items = append((*items)[:i], (*items)[i+1:]...) *items = append((*items)[:i], (*items)[i+1:]...)

View File

@ -80,7 +80,7 @@ var (
} }
ModelTypeMap = map[string][]string{ ModelTypeMap = map[string][]string{
"image_classification": {"imagenet_resnet50"}, "image_classification": {"imagenet_resnet50"},
"text_to_text": {"chatGLM_6B"}, "text_to_text": {"ChatGLM-6B"},
"image_to_text": {"blip-image-captioning-base"}, "image_to_text": {"blip-image-captioning-base"},
"text_to_image": {"stable-diffusion-xl-base-1.0"}, "text_to_image": {"stable-diffusion-xl-base-1.0"},
} }