Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.1.1^2
zouap 4 years ago
parent
commit
a963a89960
2 changed files with 15 additions and 4 deletions
  1. +14
    -4
      routers/repo/ai_model_manage.go
  2. +1
    -0
      routers/routes/routes.go

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

@@ -626,7 +626,6 @@ func QueryModelListForPredict(ctx *context.Context) {

func QueryModelFileForPredict(ctx *context.Context) {
id := ctx.Query("ID")
parentDir := ctx.Query("parentDir")
model, err := models.QueryModelById(id)
if err != nil {
log.Error("no such model!", err.Error())
@@ -634,9 +633,20 @@ func QueryModelFileForPredict(ctx *context.Context) {
return
}
prefix := model.Path[len(setting.Bucket)+1:]
if parentDir != "" {
prefix = prefix + parentDir
}
fileinfos, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, prefix)
ctx.JSON(http.StatusOK, fileinfos)
}

func QueryOneLevelModelFile(ctx *context.Context) {
id := ctx.Query("ID")
parentDir := ctx.Query("parentDir")
model, err := models.QueryModelById(id)
if err != nil {
log.Error("no such model!", err.Error())
ctx.ServerError("no such model:", err)
return
}
prefix := model.Path[len(setting.Bucket)+1:]
fileinfos, err := storage.GetOneLevelAllObjectUnderDir(setting.Bucket, prefix, parentDir)
ctx.JSON(http.StatusOK, fileinfos)
}

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

@@ -994,6 +994,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/query_train_job_version", reqRepoCloudBrainReader, repo.QueryTrainJobVersionList)
m.Get("/query_model_for_predict", reqRepoCloudBrainReader, repo.QueryModelListForPredict)
m.Get("/query_modelfile_for_predict", reqRepoCloudBrainReader, repo.QueryModelFileForPredict)
m.Get("/query_onelevel_modelfile", reqRepoCloudBrainReader, repo.QueryOneLevelModelFile)
m.Group("/:ID", func() {
m.Get("", repo.ShowSingleModel)
m.Get("/downloadsingle", repo.DownloadSingleModelFile)


Loading…
Cancel
Save