From 718eb51f2d43234f5f8eb716e4301d208d477921 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 10 Nov 2022 15:31:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/ai_model_manage.go | 13 ------------- routers/repo/ai_model_manage.go | 22 +++++----------------- routers/repo/attachment.go | 1 - 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/models/ai_model_manage.go b/models/ai_model_manage.go index 40e5d5378..5b14b9ba2 100644 --- a/models/ai_model_manage.go +++ b/models/ai_model_manage.go @@ -287,19 +287,6 @@ func ModifyModelDescription(id string, description string) error { log.Info("success to update description from db.re=" + fmt.Sprint((re))) return nil } -func ModifyModelLabel(id string, label string) error { - var sess *xorm.Session - sess = x.ID(id) - defer sess.Close() - re, err := sess.Cols("label").Update(&AiModelManage{ - Label: label, - }) - if err != nil { - return err - } - log.Info("success to update description from db.re=" + fmt.Sprint((re))) - return nil -} func ModifyLocalModel(id string, name, label, description string, engine int) error { var sess *xorm.Session diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 750fe4c5b..ad4b4b91f 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -1083,20 +1083,9 @@ func ModifyModel(id string, description string) error { return err } -func ModifyModelLabel(id string, label string) error { - err := models.ModifyModelLabel(id, label) - if err == nil { - log.Info("modify success.") - } else { - log.Info("Failed to modify.id=" + id + " desc=" + label + " error:" + err.Error()) - } - return err -} - func ModifyModelInfo(ctx *context.Context) { log.Info("modify model start.") id := ctx.Query("id") - description := ctx.Query("description") re := map[string]string{ "code": "-1", } @@ -1134,12 +1123,11 @@ func ModifyModelInfo(ctx *context.Context) { err = models.ModifyLocalModel(id, name, label, description, engine) } else { - _, ok := ctx.Req.Form["label"] - if ok { - err = ModifyModelLabel(id, ctx.Query("label")) - } else { - err = ModifyModel(id, description) - } + label := ctx.Query("label") + description := ctx.Query("description") + engine := task.Engine + name := task.Name + err = models.ModifyLocalModel(id, name, label, description, int(engine)) } if err != nil { diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index fb56d494e..555330491 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -713,7 +713,6 @@ func GetSuccessChunks(ctx *context.Context) { "fileName": attach.Name, }) } - return } else { model, err := models.QueryModelById(dbmodeluuid)