From 24168084a0a4d6f1d3bbbd52fb7fa43220448f5a Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 17 Mar 2022 19:58:58 +0800 Subject: [PATCH] fix-bug --- models/attachment.go | 7 +++++++ routers/repo/cloudbrain.go | 2 ++ routers/repo/modelarts.go | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/models/attachment.go b/models/attachment.go index a981aa987..45f86e8a0 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -61,6 +61,7 @@ type AttachmentUsername struct { type AttachmentInfo struct { Attachment `xorm:"extends"` Repo *Repository `xorm:"extends"` + User *User `xorm:"extends"` } type AttachmentsOptions struct { @@ -612,6 +613,12 @@ func Attachments(opts *AttachmentsOptions) ([]*AttachmentInfo, int64, error) { } else { return nil, 0, fmt.Errorf("GetRepositoryByID failed error: %v", err) } + user, err := GetUserByID(attachment.UploaderID) + if err == nil { + attachment.User = user + } else { + return nil, 0, fmt.Errorf("GetUserByID failed error: %v", err) + } } } diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 4cde5d40d..203d29e78 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -162,6 +162,8 @@ func cloudBrainNewDataPrepare(ctx *context.Context) error { ctx.Data["brainscore_path"] = cloudbrain.BrainScoreMountPath ctx.Data["is_brainscore_enabled"] = setting.IsBrainScoreEnabled + ctx.Data["cloudbraintype"] = models.TypeCloudBrainOne + return nil } diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index c60740b87..799f1f4c6 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -132,6 +132,8 @@ func notebookNewDataPrepare(ctx *context.Context) error { } ctx.Data["flavors"] = modelarts.FlavorInfos.FlavorInfo + ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo + return nil } @@ -578,6 +580,7 @@ func trainJobNewDataPrepare(ctx *context.Context) error { return err } ctx.Data["config_list"] = configList.ParaConfigs + ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo return nil } @@ -751,6 +754,7 @@ func trainJobNewVersionDataPrepare(ctx *context.Context) error { ctx.Data["uuid"] = task.Uuid ctx.Data["flavor_code"] = task.FlavorCode ctx.Data["engine_id"] = task.EngineID + ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) if err != nil { @@ -1955,6 +1959,7 @@ func inferenceJobNewDataPrepare(ctx *context.Context) error { New: MODEL_LATEST, }) ctx.Data["MODEL_COUNT"] = model_count + ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo return nil }