Skip to content

Commit a188159

Browse files
committed
fix(handlers): remove references to unsupported n parameter in OpenAI image handlers
1 parent fd71960 commit a188159

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

sdk/api/handlers/openai/openai_images_handlers.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,6 @@ func (h *OpenAIAPIHandler) ImagesGenerations(c *gin.Context) {
240240
tool, _ = sjson.SetBytes(tool, "partial_images", v.Int())
241241
}
242242
}
243-
if v := gjson.GetBytes(rawJSON, "n"); v.Exists() {
244-
if v.Type == gjson.Number {
245-
tool, _ = sjson.SetBytes(tool, "n", v.Int())
246-
}
247-
}
248243
if v := strings.TrimSpace(gjson.GetBytes(rawJSON, "moderation").String()); v != "" {
249244
tool, _ = sjson.SetBytes(tool, "moderation", v)
250245
}
@@ -384,11 +379,6 @@ func (h *OpenAIAPIHandler) imagesEditsFromMultipart(c *gin.Context) {
384379
tool, _ = sjson.SetBytes(tool, "partial_images", parseIntField(v, 0))
385380
}
386381

387-
// Unsupported parameter
388-
// if v := strings.TrimSpace(c.PostForm("n")); v != "" {
389-
// tool, _ = sjson.SetBytes(tool, "n", parseIntField(v, 0))
390-
// }
391-
392382
if maskDataURL != nil && strings.TrimSpace(*maskDataURL) != "" {
393383
tool, _ = sjson.SetBytes(tool, "input_image_mask.image_url", strings.TrimSpace(*maskDataURL))
394384
}
@@ -489,7 +479,7 @@ func (h *OpenAIAPIHandler) imagesEditsFromJSON(c *gin.Context) {
489479
}
490480
}
491481

492-
for _, field := range []string{"output_compression", "partial_images", "n"} {
482+
for _, field := range []string{"output_compression", "partial_images"} {
493483
if v := gjson.GetBytes(rawJSON, field); v.Exists() && v.Type == gjson.Number {
494484
tool, _ = sjson.SetBytes(tool, field, v.Int())
495485
}

0 commit comments

Comments
 (0)