This commit is contained in:
2023-05-14 07:57:23 +08:00
parent 5b8d0ca3c0
commit acb4839912
4 changed files with 7 additions and 9 deletions

View File

@@ -105,8 +105,9 @@ func ModelItemGet(w http.ResponseWriter, r *http.Request) {
func ModelItemPatch(w http.ResponseWriter, r *http.Request) {
var model = models.Model{ID: utils.ParamInt(mux.Vars(r)["id"], 0)}
if err := configs.ORMDB().Take(&model, utils.ParamInt(mux.Vars(r)["id"], 0)); err != nil {
if err := configs.ORMDB().Take(&model, utils.ParamInt(mux.Vars(r)["id"], 0)).Error; err != nil {
w.WriteHeader(http.StatusNotFound)
w.Write([]byte(err.Error()))
return
}
@@ -133,9 +134,9 @@ func ModelItemPatch(w http.ResponseWriter, r *http.Request) {
if model_new.Status != "" && model_new.Status != model.Status {
model.Status = model_new.Status
// 如果狀態被改變爲 ready, 將模型發送到訓練隊列
if model.Status == "ready" {
//model.SendToTrain()
}
//if model.Status == "ready" {
// model.SendToTrain()
//}
}
if model_new.Image != "" && model_new.Image != model.Image {
model.Image = model_new.Image