Browse Source

Merge branch 'V20211228' of git.openi.org.cn:OpenI/aiforge into fix-1067

pull/1166/head
lewis 3 years ago
parent
commit
440f88cd88
4 changed files with 23 additions and 0 deletions
  1. +4
    -0
      options/locale/locale_en-US.ini
  2. +1
    -0
      options/locale/locale_zh-CN.ini
  3. +17
    -0
      routers/repo/ai_model_manage.go
  4. +1
    -0
      routers/routes/routes.go

+ 4
- 0
options/locale/locale_en-US.ini View File

@@ -778,6 +778,10 @@ datasets = Datasets
datasets.desc = Enable Dataset
cloudbrain_helper=Use GPU/NPU resources to open notebooks, model training tasks, etc.

model_manager = Model
model_noright=No right
model_rename=Duplicate model name, please modify model name.

debug=Debug
stop=Stop
delete=Delete


+ 1
- 0
options/locale/locale_zh-CN.ini View File

@@ -784,6 +784,7 @@ cloudbrain_helper=使用GPU/NPU资源,开启Notebook、模型训练任务等

model_manager = 模型
model_noright=无权限操作
model_rename=模型名称重复,请修改模型名称

debug=调试
stop=停止


+ 17
- 0
routers/repo/ai_model_manage.go View File

@@ -105,6 +105,23 @@ func saveModelByParameters(jobId string, versionName string, name string, versio
return nil
}

func SaveNewNameModel(ctx *context.Context) {
name := ctx.Query("Name")
if name == "" {
ctx.Error(500, fmt.Sprintf("name or version is null."))
return
}

aimodels := models.QueryModelByName(name, ctx.Repo.Repository.ID)
if len(aimodels) > 0 {
ctx.Error(500, ctx.Tr("repo.model_rename"))
return
}
SaveModel(ctx)

log.Info("save model end.")
}

func SaveModel(ctx *context.Context) {
log.Info("save model start.")
JobId := ctx.Query("JobId")


+ 1
- 0
routers/routes/routes.go View File

@@ -978,6 +978,7 @@ func RegisterRoutes(m *macaron.Macaron) {
}, context.RepoRef())
m.Group("/modelmanage", func() {
m.Post("/create_model", reqRepoModelManageWriter, repo.SaveModel)
m.Post("/create_new_model", reqRepoModelManageWriter, repo.SaveNewNameModel)
m.Delete("/delete_model", repo.DeleteModel)
m.Put("/modify_model", repo.ModifyModelInfo)
m.Get("/show_model", reqRepoModelManageReader, repo.ShowModelTemplate)


Loading…
Cancel
Save