diff --git a/routers/repo/aisafety.go b/routers/repo/aisafety.go index c350c66f1..e4a41fd85 100644 --- a/routers/repo/aisafety.go +++ b/routers/repo/aisafety.go @@ -201,17 +201,14 @@ func StopAiSafetyTask(ctx *context.Context) { func DelAiSafetyTask(ctx *context.Context) { var ID = ctx.Params(":jobid") task, err := models.GetCloudbrainByIDWithDeleted(ID) - result := make(map[string]interface{}) - result["code"] = 1 + if err != nil { log.Error("GetCloudbrainByJobID failed:" + err.Error()) - result["msg"] = "No such task." ctx.ServerError("No such task.", err) return } if task.Status != string(models.JobStopped) && task.Status != string(models.JobFailed) && task.Status != string(models.JobSucceeded) { log.Error("the job(%s) has not been stopped", task.JobName, ctx.Data["msgID"]) - result["msg"] = "the job(" + task.JobName + ") has not been stopped" ctx.ServerError("the job("+task.JobName+") has not been stopped", nil) return } @@ -220,7 +217,6 @@ func DelAiSafetyTask(ctx *context.Context) { } err = models.DeleteJob(task) if err != nil { - result["msg"] = err.Error() ctx.ServerError(err.Error(), err) return }