diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go index 06eac1665..3f7ebfd91 100755 --- a/modules/modelarts/modelarts.go +++ b/modules/modelarts/modelarts.go @@ -357,7 +357,7 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job CommitID: req.CommitID, IsLatestVersion: req.IsLatestVersion, PreVersionName: req.PreVersionName, - ComputeResource: models.GPUResource, + ComputeResource: models.NPUResource, EngineID: req.EngineID, TrainUrl: req.TrainUrl, BranchName: req.BranchName, diff --git a/modules/util/util.go b/modules/util/util.go old mode 100644 new mode 100755 index 6d02b5f52..017277281 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -6,6 +6,7 @@ package util import ( "bytes" + "strconv" "strings" ) @@ -100,3 +101,12 @@ func NormalizeEOL(input []byte) []byte { } return tmp[:pos] } + +func AddZero(t int64) (m string) { + if t < 10 { + m = "0" + strconv.FormatInt(t, 10) + return m + } else { + return strconv.FormatInt(t, 10) + } +} diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 35f0a98bf..272957887 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2659,3 +2659,5 @@ foot.member_news = Member news foot.industry_advisory = Industry Advisory foot.help = help foot.copyright= Copyright: New Generation Artificial Intelligence Open Source Open Platform (OpenI) +Platform_Tutorial=Platform Tutorial +foot.advice_feedback=advice feedback diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 0389471c2..efa730002 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2667,3 +2667,5 @@ foot.member_news=成员动态 foot.industry_advisory=行业资讯 foot.help=帮助 foot.copyright= 版权所有:新一代人工智能开源开放平台(OpenI) +Platform_Tutorial=新手指引 +foot.advice_feedback = 意见反馈 diff --git a/routers/api/v1/repo/modelarts.go b/routers/api/v1/repo/modelarts.go index 283696007..05c31b5f5 100755 --- a/routers/api/v1/repo/modelarts.go +++ b/routers/api/v1/repo/modelarts.go @@ -6,6 +6,7 @@ package repo import ( + "code.gitea.io/gitea/modules/util" "net/http" "strconv" "strings" @@ -106,7 +107,7 @@ func GetModelArtsTrainJobVersion(ctx *context.APIContext) { job.TrainJobDuration = result.TrainJobDuration if result.Duration != 0 { - job.TrainJobDuration = addZero(result.Duration/3600000) + ":" + addZero(result.Duration%3600000/60000) + ":" + addZero(result.Duration%60000/1000) + job.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) } else { job.TrainJobDuration = "00:00:00" @@ -125,15 +126,6 @@ func GetModelArtsTrainJobVersion(ctx *context.APIContext) { } -func addZero(t int64) (m string) { - if t < 10 { - m = "0" + strconv.FormatInt(t, 10) - return m - } else { - return strconv.FormatInt(t, 10) - } -} - func TrainJobGetLog(ctx *context.APIContext) { var ( err error diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index ab3303408..b24b4e90e 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -14,18 +14,17 @@ import ( "strings" "time" - "code.gitea.io/gitea/modules/modelarts" - - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/storage" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/cloudbrain" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/modelarts" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/storage" + "code.gitea.io/gitea/modules/util" ) const ( @@ -277,7 +276,7 @@ func CloudBrainRestart(ctx *context.Context) { break } - if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()){ + if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()) { log.Error("the user has no right ro restart the job", task.JobName, ctx.Data["MsgID"]) resultCode = "-1" errorMsg = "you have no right to restart the job" @@ -949,6 +948,13 @@ func SyncCloudbrainStatus() { task.Duration = result.Duration task.TrainJobDuration = result.TrainJobDuration + if result.Duration != 0 { + task.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) + + } else { + task.TrainJobDuration = "00:00:00" + } + err = models.UpdateJob(task) if err != nil { log.Error("UpdateJob(%s) failed:%v", task.JobName, err) diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl index 86ef0d98e..9a708fc2c 100755 --- a/templates/base/footer_content.tmpl +++ b/templates/base/footer_content.tmpl @@ -26,7 +26,14 @@ {{end}} + {{.i18n.Tr "custom.Platform_Tutorial"}} {{if .EnableSwagger}}API{{end}} + {{if .IsSigned}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{else}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{end}} + {{template "custom/extra_links_footer" .}} diff --git a/templates/base/footer_content_fluid.tmpl b/templates/base/footer_content_fluid.tmpl index e07a4d5ab..8d9f2ba40 100644 --- a/templates/base/footer_content_fluid.tmpl +++ b/templates/base/footer_content_fluid.tmpl @@ -26,7 +26,13 @@ {{end}} + {{.i18n.Tr "custom.Platform_Tutorial"}} {{if .EnableSwagger}}API{{end}} + {{if .IsSigned}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{else}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{end}} {{template "custom/extra_links_footer" .}} diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 53d0f8839..506f8792a 100755 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -168,6 +168,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/templates/base/head_navbar_fluid.tmpl b/templates/base/head_navbar_fluid.tmpl index 32ad7ca2f..f364518cc 100644 --- a/templates/base/head_navbar_fluid.tmpl +++ b/templates/base/head_navbar_fluid.tmpl @@ -166,6 +166,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/templates/base/head_navbar_home.tmpl b/templates/base/head_navbar_home.tmpl index 4cd35da76..539b8bc21 100644 --- a/templates/base/head_navbar_home.tmpl +++ b/templates/base/head_navbar_home.tmpl @@ -148,6 +148,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/templates/base/head_navbar_pro.tmpl b/templates/base/head_navbar_pro.tmpl index bacd19944..45b1e7925 100644 --- a/templates/base/head_navbar_pro.tmpl +++ b/templates/base/head_navbar_pro.tmpl @@ -169,6 +169,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/web_src/less/openi.less b/web_src/less/openi.less index ab788bcf4..4418f8205 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -585,3 +585,7 @@ display: block; margin-top: 0.7rem; color: #888888; } +.tutorial_icon{ + vertical-align: middle; + margin-right: 0.75em; +} \ No newline at end of file