From ee7cd4d66d0641dddf3c70edd5874b6323f1aea0 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 12 Jan 2022 15:30:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E6=A8=A1=E5=9E=8B=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/ai_model_manage.go | 9 +++++++-- routers/repo/setting.go | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 4b6e91772..79f69beea 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -487,8 +487,7 @@ func ShowOneVersionOtherModel(ctx *context.Context) { } } -func ShowModelTemplate(ctx *context.Context) { - ctx.Data["isModelManage"] = true +func SetModelCount(ctx *context.Context) { repoId := ctx.Repo.Repository.ID Type := -1 _, count, _ := models.QueryModel(&models.AiModelQueryOptions{ @@ -501,6 +500,12 @@ func ShowModelTemplate(ctx *context.Context) { New: MODEL_LATEST, }) ctx.Data["MODEL_COUNT"] = count +} + +func ShowModelTemplate(ctx *context.Context) { + ctx.Data["isModelManage"] = true + repoId := ctx.Repo.Repository.ID + SetModelCount(ctx) _, trainCount, _ := models.QueryModelTrainJobList(repoId) log.Info("query train count=" + fmt.Sprint(trainCount)) diff --git a/routers/repo/setting.go b/routers/repo/setting.go index f7da8f4a8..bc80a66ff 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -50,6 +50,7 @@ func Settings(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsOptions"] = true ctx.Data["ForcePrivate"] = setting.Repository.ForcePrivate + SetModelCount(ctx) ctx.HTML(200, tplSettingsOptions) } @@ -57,7 +58,7 @@ func Settings(ctx *context.Context) { func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsOptions"] = true - + SetModelCount(ctx) repo := ctx.Repo.Repository switch ctx.Query("action") {