Browse Source

提交代码,修改Bug

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.11.2^2
zouap 3 years ago
parent
commit
718eb51f2d
3 changed files with 5 additions and 31 deletions
  1. +0
    -13
      models/ai_model_manage.go
  2. +5
    -17
      routers/repo/ai_model_manage.go
  3. +0
    -1
      routers/repo/attachment.go

+ 0
- 13
models/ai_model_manage.go View File

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


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

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


+ 0
- 1
routers/repo/attachment.go View File

@@ -713,7 +713,6 @@ func GetSuccessChunks(ctx *context.Context) {
"fileName": attach.Name,
})
}

return
} else {
model, err := models.QueryModelById(dbmodeluuid)


Loading…
Cancel
Save