Browse Source

fix-bug

tags/v1.22.3.2^2
liuzx 3 years ago
parent
commit
24168084a0
3 changed files with 14 additions and 0 deletions
  1. +7
    -0
      models/attachment.go
  2. +2
    -0
      routers/repo/cloudbrain.go
  3. +5
    -0
      routers/repo/modelarts.go

+ 7
- 0
models/attachment.go View File

@@ -61,6 +61,7 @@ type AttachmentUsername struct {
type AttachmentInfo struct { type AttachmentInfo struct {
Attachment `xorm:"extends"` Attachment `xorm:"extends"`
Repo *Repository `xorm:"extends"` Repo *Repository `xorm:"extends"`
User *User `xorm:"extends"`
} }


type AttachmentsOptions struct { type AttachmentsOptions struct {
@@ -612,6 +613,12 @@ func Attachments(opts *AttachmentsOptions) ([]*AttachmentInfo, int64, error) {
} else { } else {
return nil, 0, fmt.Errorf("GetRepositoryByID failed error: %v", err) 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)
}
} }
} }




+ 2
- 0
routers/repo/cloudbrain.go View File

@@ -162,6 +162,8 @@ func cloudBrainNewDataPrepare(ctx *context.Context) error {
ctx.Data["brainscore_path"] = cloudbrain.BrainScoreMountPath ctx.Data["brainscore_path"] = cloudbrain.BrainScoreMountPath
ctx.Data["is_brainscore_enabled"] = setting.IsBrainScoreEnabled ctx.Data["is_brainscore_enabled"] = setting.IsBrainScoreEnabled


ctx.Data["cloudbraintype"] = models.TypeCloudBrainOne

return nil return nil
} }




+ 5
- 0
routers/repo/modelarts.go View File

@@ -132,6 +132,8 @@ func notebookNewDataPrepare(ctx *context.Context) error {
} }
ctx.Data["flavors"] = modelarts.FlavorInfos.FlavorInfo ctx.Data["flavors"] = modelarts.FlavorInfos.FlavorInfo


ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo

return nil return nil
} }


@@ -578,6 +580,7 @@ func trainJobNewDataPrepare(ctx *context.Context) error {
return err return err
} }
ctx.Data["config_list"] = configList.ParaConfigs ctx.Data["config_list"] = configList.ParaConfigs
ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo


return nil return nil
} }
@@ -751,6 +754,7 @@ func trainJobNewVersionDataPrepare(ctx *context.Context) error {
ctx.Data["uuid"] = task.Uuid ctx.Data["uuid"] = task.Uuid
ctx.Data["flavor_code"] = task.FlavorCode ctx.Data["flavor_code"] = task.FlavorCode
ctx.Data["engine_id"] = task.EngineID ctx.Data["engine_id"] = task.EngineID
ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo


configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom)
if err != nil { if err != nil {
@@ -1955,6 +1959,7 @@ func inferenceJobNewDataPrepare(ctx *context.Context) error {
New: MODEL_LATEST, New: MODEL_LATEST,
}) })
ctx.Data["MODEL_COUNT"] = model_count ctx.Data["MODEL_COUNT"] = model_count
ctx.Data["cloudbraintype"] = models.TypeCloudBrainTwo


return nil return nil
} }


Loading…
Cancel
Save