From 4c36d5456b32d92d7a9db00a2c1cf5f14bffc0f3 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 7 Nov 2022 15:02:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E5=88=A4=E6=96=AD=E5=BD=93=E5=89=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=8D=E7=A7=B0=E9=80=BB=E8=BE=91=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 3a25c37d2..0cac858ed 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -1057,9 +1057,17 @@ func ModifyModelInfo(ctx *context.Context) { engine := ctx.QueryInt("engine") aimodels := models.QueryModelByName(name, task.RepoId) if aimodels != nil && len(aimodels) > 0 { - re["msg"] = ctx.Tr("repo.model.manage.create_error") - ctx.JSON(200, re) - return + if len(aimodels) == 1 { + if aimodels[0].ID != task.ID { + re["msg"] = ctx.Tr("repo.model.manage.create_error") + ctx.JSON(200, re) + return + } + } else { + re["msg"] = ctx.Tr("repo.model.manage.create_error") + ctx.JSON(200, re) + return + } } err = models.ModifyLocalModel(id, name, label, description, engine)