Browse Source

Merge branch 'zouap' of https://git.openi.org.cn/OpenI/aiforge into zouap

tags/v1.21.12.1^2
zhoupzh 4 years ago
parent
commit
c108906d19
2 changed files with 22 additions and 5 deletions
  1. +17
    -5
      routers/repo/ai_model_manage.go
  2. +5
    -0
      routers/repo/http.go

+ 17
- 5
routers/repo/ai_model_manage.go View File

@@ -472,16 +472,28 @@ 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")

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")
if err != nil {
log.Info("modify error," + err.Error())
ctx.ServerError("error.", err)
} else {
ctx.HTML(500, "Failed.")
ctx.JSON(200, "success")
}

}

+ 5
- 0
routers/repo/http.go View File

@@ -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


Loading…
Cancel
Save