Browse Source

新增模型转换任务Api接口

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.11.2^2
zouap 3 years ago
parent
commit
c4632710ca
3 changed files with 18 additions and 1 deletions
  1. +3
    -1
      routers/api/v1/api.go
  2. +9
    -0
      routers/api/v1/repo/modelmanage.go
  3. +6
    -0
      routers/repo/ai_model_convert.go

+ 3
- 1
routers/api/v1/api.go View File

@@ -962,7 +962,9 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/query_modelfile_for_predict", repo.QueryModelFileForPredict)
m.Get("/query_train_model", repo.QueryTrainModelList)
m.Post("/create_model_convert", repo.CreateModelConvert)
m.Get("/show_model_convert_page")
m.Get("/show_model_convert_page", repo.ShowModelConvertPage)
m.Get("/query_model_convert_byId", repo.QueryModelConvertById)

m.Get("/:id", repo.GetCloudbrainModelConvertTask)
m.Get("/:id/log", repo.CloudbrainForModelConvertGetLog)
m.Get("/:id/modelartlog", repo.TrainJobForModelConvertGetLog)


+ 9
- 0
routers/api/v1/repo/modelmanage.go View File

@@ -104,3 +104,12 @@ func ShowModelConvertPage(ctx *context.APIContext) {
}

}

func QueryModelConvertById(ctx *context.APIContext) {
modelResult, err := routerRepo.GetModelConvertById(ctx.Context)
if err == nil {
ctx.JSON(http.StatusOK, modelResult)
} else {
ctx.JSON(http.StatusOK, nil)
}
}

+ 6
- 0
routers/repo/ai_model_convert.go View File

@@ -150,6 +150,7 @@ func SaveModelConvert(ctx *context.Context) {
go goCreateTask(modelConvert, ctx, task)

ctx.JSON(200, map[string]string{
"id": id,
"code": "0",
})
}
@@ -726,6 +727,11 @@ func ShowModelConvertPageInfo(ctx *context.Context) {
}
}

func GetModelConvertById(ctx *context.Context) (*models.AiModelConvert, error) {
id := ctx.Query("id")
return models.QueryModelConvertById(id)
}

func GetModelConvertPageData(ctx *context.Context) ([]*models.AiModelConvert, int64, error) {
page := ctx.QueryInt("page")
if page <= 0 {


Loading…
Cancel
Save