From 747cc9b89885bc89fec0e2769f4524faf48f24ab Mon Sep 17 00:00:00 2001 From: luisjones <11049493+luisjones@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:26:46 +0100 Subject: [PATCH] fix: edit image endpoint --- azure/azure.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/azure/azure.go b/azure/azure.go index 866e80ad..ac729c09 100644 --- a/azure/azure.go +++ b/azure/azure.go @@ -136,11 +136,12 @@ var jsonRoutes = map[string]bool{ "/openai/images/generations": true, } -// audioMultipartRoutes have mime/multipart payloads. These are less generic - we're very much +// multipartRoutes have mime/multipart payloads. These are less generic - we're very much // expecting a transcription or translation payload for these. -var audioMultipartRoutes = map[string]bool{ +var multipartRoutes = map[string]bool{ "/openai/audio/transcriptions": true, "/openai/audio/translations": true, + "/openai/images/edits": true, } // getReplacementPathWithDeployment parses the request body to extract out the Model parameter (or equivalent) @@ -150,8 +151,8 @@ func getReplacementPathWithDeployment(req *http.Request) (string, error) { return getJSONRoute(req) } - if audioMultipartRoutes[req.URL.Path] { - return getAudioMultipartRoute(req) + if multipartRoutes[req.URL.Path] { + return getMultipartRoute(req) } // No need to relocate the path. We've already tacked on /openai when we setup the endpoint. @@ -181,7 +182,7 @@ func getJSONRoute(req *http.Request) (string, error) { return strings.Replace(req.URL.Path, "/openai/", "/openai/deployments/"+escapedDeployment+"/", 1), nil } -func getAudioMultipartRoute(req *http.Request) (string, error) { +func getMultipartRoute(req *http.Request) (string, error) { // body is a multipart/mime body type instead. mimeBytes, err := io.ReadAll(req.Body)