From 8f5b83562b1fc7831149a0cc33f49f044f011c42 Mon Sep 17 00:00:00 2001 From: Zhengyi Dong <95915069+simulacraliasing@users.noreply.github.com> Date: Sun, 3 Dec 2023 17:43:30 +0800 Subject: [PATCH] fix: fix "invalidPayload" error when request Azure dall-e-3 api without optional parameter (#764) * fix: based on #754 add 'omitempty' in ImageRequest to fit official api reference for relay * Revert "fix: based on #754 add 'omitempty' in ImageRequest to fit official api reference for relay" This reverts commit b526006ce07839f29b2d5b8c6a028147401ac295. * fix: add missing omitempty --------- Co-authored-by: JustSong --- controller/relay.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/controller/relay.go b/controller/relay.go index f91ba6da..58ee8381 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -133,12 +133,12 @@ type TextRequest struct { type ImageRequest struct { Model string `json:"model"` Prompt string `json:"prompt" binding:"required"` - N int `json:"n"` - Size string `json:"size"` - Quality string `json:"quality"` - ResponseFormat string `json:"response_format"` - Style string `json:"style"` - User string `json:"user"` + N int `json:"n,omitempty"` + Size string `json:"size,omitempty"` + Quality string `json:"quality,omitempty"` + ResponseFormat string `json:"response_format,omitempty"` + Style string `json:"style,omitempty"` + User string `json:"user,omitempty"` } type WhisperResponse struct {