diff --git a/models/Model.go b/models/Model.go index dc324ca..b063171 100644 --- a/models/Model.go +++ b/models/Model.go @@ -154,9 +154,18 @@ func (model *Model) Inference(image_list []Image, callback func(Image)) { datx["n_iter"] = len(image_list) // 生成图像数量 datx["steps"] = img.Steps // 迭代步数 datx["cfg_scale"] = img.CfgScale // 提示词引导系数 (CFG Scale) + if img.Width > 0 { + datx["width"] = img.Width // 图片宽度 + } + if img.Height > 0 { + datx["height"] = img.Height // 图片高度 + } if img.SamplerName == "" { datx["sampler_name"] = img.SamplerName // 采样器名称 } + if img.NegativePrompt != "" { + datx["negative_prompt"] = img.NegativePrompt // 负面提示词 + } fmt.Println("image_list:", datx) // 接收到的图片列表 diff --git a/routers/images.go b/routers/images.go index cc1d12b..108516b 100644 --- a/routers/images.go +++ b/routers/images.go @@ -142,6 +142,8 @@ func ImagesPost(w http.ResponseWriter, r *http.Request) { Seed int `json:"seed"` // 随机种子(单张图生成时使用) NIter int `json:"n_iter"` // 生成数量 ModelID int `json:"model_id"` // 模型ID + Width int `json:"width"` // 图片宽度 + Height int `json:"height"` // 图片高度 }{} body, err := ioutil.ReadAll(r.Body) if err != nil { @@ -196,6 +198,9 @@ func ImagesPost(w http.ResponseWriter, r *http.Request) { image.CfgScale = template.CfgScale image.SamplerName = template.SamplerName image.Seed = template.Seed + image.ModelID = template.ModelID + image.Width = template.Width + image.Height = template.Height image_list = append(image_list, image) }