From adb0bd1d9e46a2dff535dfd1b7670fa362931357 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 6 Dec 2021 16:16:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 6f0d6da3d..76702a8b2 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -476,7 +476,18 @@ func ModifyModelInfo(ctx *context.Context) { id := ctx.Query("ID") description := ctx.Query("Description") - err := ModifyModel(id, description) + task, err := models.QueryModelById(id) + if err != nil { + log.Error("no such model!", err.Error()) + ctx.ServerError("no such model:", err) + return + } + if !isCanDeleteOrDownload(ctx, task) { + ctx.ServerError("no right.", errors.New(ctx.Tr("repo.model_noright"))) + return + } + + err = ModifyModel(id, description) if err == nil { ctx.HTML(200, "success") From fc20da5e3d2097c900e1d67b2c71050747ec7354 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 6 Dec 2021 17:01:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/repo/http.go b/routers/repo/http.go index 8d97f7f13..fe9279a62 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -9,6 +9,7 @@ import ( "bytes" "compress/gzip" gocontext "context" + "encoding/json" "fmt" "io/ioutil" "net/http" @@ -559,6 +560,10 @@ func serviceRPC(h serviceHandler, service string) { if service == "receive-pack" { cmd.Env = append(os.Environ(), h.environ...) } + + envJson, _ := json.Marshal(cmd.Env) + //log.Info(accuracyJson=” + string(accuracyJson)) + log.Info("env=" + string(envJson)) cmd.Stdout = h.w cmd.Stdin = reqBody cmd.Stderr = &stderr From 849d564d72fa9f1beb9ba72241ec21a5b8793a3b Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 7 Dec 2021 08:44:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 76702a8b2..574cdbc5a 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -472,7 +472,7 @@ func ModifyModel(id string, description string) error { } func ModifyModelInfo(ctx *context.Context) { - log.Info("delete model start.") + log.Info("modify model start.") id := ctx.Query("ID") description := ctx.Query("Description") @@ -489,10 +489,11 @@ func ModifyModelInfo(ctx *context.Context) { err = ModifyModel(id, description) - if err == nil { - ctx.HTML(200, "success") + if err != nil { + log.Info("modify error," + err.Error()) + ctx.ServerError("error.", err) } else { - ctx.HTML(500, "Failed.") + ctx.JSON(200, "success") } }