|
|
@@ -152,6 +152,10 @@ func saveModelByParameters(jobId string, versionName string, name string, versio |
|
|
|
} |
|
|
|
|
|
|
|
func SaveNewNameModel(ctx *context.Context) { |
|
|
|
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { |
|
|
|
ctx.Error(403, ctx.Tr("repo.model_noright")) |
|
|
|
return |
|
|
|
} |
|
|
|
name := ctx.Query("Name") |
|
|
|
if name == "" { |
|
|
|
ctx.Error(500, fmt.Sprintf("name or version is null.")) |
|
|
@@ -169,6 +173,10 @@ func SaveNewNameModel(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
func SaveModel(ctx *context.Context) { |
|
|
|
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { |
|
|
|
ctx.Error(403, ctx.Tr("repo.model_noright")) |
|
|
|
return |
|
|
|
} |
|
|
|
log.Info("save model start.") |
|
|
|
JobId := ctx.Query("JobId") |
|
|
|
VersionName := ctx.Query("VersionName") |
|
|
@@ -177,16 +185,8 @@ func SaveModel(ctx *context.Context) { |
|
|
|
label := ctx.Query("Label") |
|
|
|
description := ctx.Query("Description") |
|
|
|
engine := ctx.QueryInt("Engine") |
|
|
|
trainTaskCreate := ctx.QueryBool("trainTaskCreate") |
|
|
|
modelSelectedFile := ctx.Query("modelSelectedFile") |
|
|
|
log.Info("engine=" + fmt.Sprint(engine) + " modelSelectedFile=" + modelSelectedFile) |
|
|
|
if !trainTaskCreate { |
|
|
|
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { |
|
|
|
//ctx.NotFound(ctx.Req.URL.RequestURI(), nil) |
|
|
|
ctx.JSON(403, ctx.Tr("repo.model_noright")) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if JobId == "" || VersionName == "" { |
|
|
|
ctx.Error(500, fmt.Sprintf("JobId or VersionName is null.")) |
|
|
|