Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.7.1
zouap 3 years ago
parent
commit
c297692927
2 changed files with 15 additions and 10 deletions
  1. +3
    -0
      models/ai_model_manage.go
  2. +12
    -10
      routers/repo/ai_model_manage.go

+ 3
- 0
models/ai_model_manage.go View File

@@ -125,8 +125,11 @@ func QueryModelById(id string) (*AiModelManage, error) {
err := sess.Find(&aiModelManageList)
if err == nil {
if len(aiModelManageList) == 1 {
log.Info("return a model.")
return aiModelManageList[0], nil
}
} else {
log.Info("error=" + err.Error())
}
return nil, err
}


+ 12
- 10
routers/repo/ai_model_manage.go View File

@@ -782,20 +782,22 @@ func QueryModelListForPredict(ctx *context.Context) {
func QueryModelFileForPredict(ctx *context.Context) {
id := ctx.Query("ID")
model, err := models.QueryModelById(id)
if err != nil {
if err == nil {
if model.Type == models.TypeCloudBrainTwo {
prefix := model.Path[len(setting.Bucket)+1:]
fileinfos, _ := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, prefix)
ctx.JSON(http.StatusOK, fileinfos)
} else if model.Type == models.TypeCloudBrainOne {
prefix := model.Path[len(setting.Attachment.Minio.Bucket)+1:]
fileinfos, _ := storage.GetAllObjectByBucketAndPrefixMinio(setting.Attachment.Minio.Bucket, prefix)
ctx.JSON(http.StatusOK, fileinfos)
}
} else {
log.Error("no such model!", err.Error())
ctx.ServerError("no such model:", err)
return
}
if model.Type == models.TypeCloudBrainTwo {
prefix := model.Path[len(setting.Bucket)+1:]
fileinfos, _ := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, prefix)
ctx.JSON(http.StatusOK, fileinfos)
} else if model.Type == models.TypeCloudBrainOne {
prefix := model.Path[len(setting.Attachment.Minio.Bucket)+1:]
fileinfos, _ := storage.GetAllObjectByBucketAndPrefixMinio(setting.Attachment.Minio.Bucket, prefix)
ctx.JSON(http.StatusOK, fileinfos)
}

}

func QueryOneLevelModelFile(ctx *context.Context) {


Loading…
Cancel
Save