Add MiniMax image-to-image backend for garment and modeled stages - #11
Open
octo-patch wants to merge 2 commits into
Open
Add MiniMax image-to-image backend for garment and modeled stages#11octo-patch wants to merge 2 commits into
octo-patch wants to merge 2 commits into
Conversation
Author
|
Updated the MiniMax image response handling to decode base64 from data.image_urls and download URL responses, added n: 1 and seed configuration, and added focused tests. I ran npm test and npm run check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason: Add a MiniMax image-to-image backend so garment and modeled edits can run through the /v1/image_generation endpoint instead of only the OpenAI edits schema.
What changed
The import pipeline generated the garment and modeled stages exclusively through the
OpenAI multipart
/images/editsschema and parseddata[0].b64_json. This adds analternative MiniMax image-to-image backend behind a provider switch, so the generated
bytes flow into the existing chroma-cleanup and review pipeline unchanged.
miniMaxEdit()posts JSON to<base>/image_generationwithAuthorization: Bearer,mapping the one or two reference images to
subject_reference(
{ type: "character", image_file: "data:image/png;base64,..." }).model(image-01/image-01-live),prompt,response_format,width/heightderived from the stage size (validated to the[512, 2048], multiple-of-8 range) withaspect_ratiotaking priority when set, plusoptional
prompt_optimizerandseed. The prompt is clamped to the documented1500-character limit.
data.image_base64[0]is decoded directly, anddata.image_urls[0]is downloaded, returning PNG bytes either way. Non-zerobase_resp.status_codesurfacesstatus_msgas an error.editImage()dispatcher selects the backend fromWARDROBE_IMAGE_PROVIDER(default
openai), preserving the existing OpenAI behavior. Clothing detection stilluses the OpenAI vision model.
https://api.minimax.io/v1; the China endpoint(
https://api.minimaxi.com/v1) is configurable viaMINIMAX_API_BASE_URL..env.exampleand the README configuration table document the new variables.Checks
npm run check(Vite production build) passes.miniMaxEdit()with a stubbed fetch: verified endpoint/auth/JSON headers,subject_referencemapping for one and two references,width/heightvsaspect_ratioselection, prompt clamping, base64 and URL response decoding to PNGbytes, and error propagation on a non-zero status code.