取消直接训练

This commit is contained in:
2023-06-18 10:50:20 +08:00
parent d64e6517a1
commit 428508f443

View File

@@ -37,7 +37,7 @@ func ModelsGet(w http.ResponseWriter, r *http.Request) {
func ModelsPost(w http.ResponseWriter, r *http.Request) { func ModelsPost(w http.ResponseWriter, r *http.Request) {
models.AccountRead(w, r, func(account *models.Account) { models.AccountRead(w, r, func(account *models.Account) {
fmt.Println(account) fmt.Println(account)
// TODO: 判斷權限(是否可以創建)
// 創建模型 // 創建模型
var model models.Model var model models.Model
body, err := ioutil.ReadAll(r.Body) body, err := ioutil.ReadAll(r.Body)
@@ -52,9 +52,7 @@ func ModelsPost(w http.ResponseWriter, r *http.Request) {
} }
if model.Name == "" { if model.Name == "" {
w.WriteHeader(http.StatusBadRequest) model.Name = utils.RandomString(8)
w.Write([]byte("模型名稱不能為空"))
return
} }
if model.Type == "" { if model.Type == "" {
@@ -94,7 +92,7 @@ func ModelsPost(w http.ResponseWriter, r *http.Request) {
} }
// 直接提交訓練任務 // 直接提交訓練任務
go model.Train() // go model.Train()
// 返回創建的模型 // 返回創建的模型
w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set("Content-Type", "application/json; charset=utf-8")