Browse Source

提交代码。

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

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

@@ -391,6 +391,22 @@ func ShowSingleModel(ctx *context.Context) {
log.Info("Show single ModelInfo start.name=" + name)
models := models.QueryModelByName(name, ctx.Repo.Repository.ID)

userIds := make([]int64, len(models))
for i, model := range models {
log.Info("model=" + model.Name)
log.Info("model.UserId=" + fmt.Sprint(model.UserId))
model.IsCanOper = isOper(ctx, model.UserId)
userIds[i] = model.UserId
}
userNameMap := queryUserName(userIds)

for _, model := range models {
value := userNameMap[model.UserId]
if value != nil {
model.UserName = value.Name
model.UserRelAvatarLink = value.RelAvatarLink()
}
}
ctx.JSON(http.StatusOK, models)
}



Loading…
Cancel
Save