diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 605284430..a45f21cca 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -122,9 +122,6 @@ func saveModelByParameters(jobId string, versionName string, name string, versio if err != nil { return "", err } - if modelSize > 0 { - go repository.IncreaseRepoModelNum(aiTask.RepoID) - } if len(lastNewModelId) > 0 { //udpate status and version count models.ModifyModelNewProperty(lastNewModelId, MODEL_NOT_LATEST, 0) @@ -174,10 +171,17 @@ func updateStatus(id string, modelSize int64, status int, modelPath string, stat if len(statusDesc) > 400 { statusDesc = statusDesc[0:400] } + m, _ := models.QueryModelById(id) err := models.ModifyModelStatus(id, modelSize, status, modelPath, statusDesc) if err != nil { log.Info("update status error." + err.Error()) } + if m != nil { + if modelSize > 0 && m.Size == 0 { + go repository.IncreaseRepoModelNum(m.RepoId) + } + } + } func SaveNewNameModel(ctx *context.Context) {