Browse Source

Merge branch 'zouap' of https://git.openi.org.cn/OpenI/aiforge into zouap

tags/v1.21.12.1^2
zhoupzh 4 years ago
parent
commit
8cf2e73660
2 changed files with 15 additions and 2 deletions
  1. +1
    -0
      models/ai_model_manage.go
  2. +14
    -2
      routers/repo/ai_model_manage.go

+ 1
- 0
models/ai_model_manage.go View File

@@ -52,6 +52,7 @@ func SaveModelToDb(model *AiModelManage) error {

re, err := sess.Insert(model)
if err != nil {
log.Info("insert error." + err.Error())
return err
}
log.Info("success to save db.re=" + fmt.Sprint((re)))


+ 14
- 2
routers/repo/ai_model_manage.go View File

@@ -89,8 +89,10 @@ func saveModelByParameters(jobId string, versionName string, name string, versio
Accuracy: string(accuracyJson),
}

models.SaveModelToDb(model)

err = models.SaveModelToDb(model)
if err != nil {
return err
}
if len(lastNewModelId) > 0 {
//udpate status and version count
models.ModifyModelNewProperty(lastNewModelId, MODEL_NOT_LATEST, 0)
@@ -110,6 +112,16 @@ func SaveModel(ctx *context.Context) {
label := ctx.Query("Label")
description := ctx.Query("Description")

if JobId == "" || VersionName == "" {
ctx.Error(500, fmt.Sprintf("JobId or VersionName is null."))
return
}

if name == "" || version == "" {
ctx.Error(500, fmt.Sprintf("name or version is null."))
return
}

err := saveModelByParameters(JobId, VersionName, name, version, label, description, ctx.User.ID)

if err != nil {


Loading…
Cancel
Save