修改模型tag

This commit is contained in:
2023-08-13 08:58:06 +08:00
parent 1467568f1d
commit b4f943a930

View File

@@ -314,8 +314,9 @@ func ModelItemPatch(w http.ResponseWriter, r *http.Request) {
return
}
// 判断数据类型是否JSON
if r.Header.Get("Content-Type") == "application/json" {
// 判断数据类型是否JSON(正则匹配)
//if r.Header.Get("Content-Type") == "application/json" {
if regexp.MustCompile(`application/json`).MatchString(r.Header.Get("Content-Type")) {
// 取出更新数据
var model_new models.Model
@@ -369,7 +370,7 @@ func ModelItemPatch(w http.ResponseWriter, r *http.Request) {
if model_new.Progress != 0 && model_new.Progress != model.Progress {
model.Progress = model_new.Progress
}
if model_new.Tags != nil && len(model_new.Tags) != len(model.Tags) {
if model_new.Tags != nil {
model.Tags = model_new.Tags
}