feat(asset-gen): register MiniMax image provider in the image tool chain - #1284
feat(asset-gen): register MiniMax image provider in the image tool chain#1284octo-patch wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds MiniMax image generation support across Unity request handling, provider registration, model selection, UI, server metadata, integration tests, and manual verification documentation. ChangesMiniMax image generation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add MiniMaxImageAdapter (IImageProviderAdapter) for the synchronous /v1/image_generation endpoint: text->image and image->image (subject_reference) with a URL or inline base64 data URI. Register minimax in the image provider chain, catalog (image-01 default, image-01-live), secure-key provider list, settings panel, CLI/server tool descriptions, and the manual-verification doc.
f34068e to
784f758
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs`:
- Around line 61-65: Update the dimension handling in MiniMaxImageAdapter so
width and height are sent only for the image-01 model when both are provided,
each is within 512–2048, and both are divisible by 8; remove the image-to-image
exclusion. For other models or invalid/unpaired dimensions, do not forward
width/height and preserve their aspect_ratio-only behavior.
In `@Server/src/services/tools/generate_image.py`:
- Line 45: Update the provider transparency disclaimer associated with the
provider annotation to include MiniMax alongside the existing providers, making
clear that transparency is import-only for MiniMax as well.
In
`@TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/GenerateImageTests.cs`:
- Line 28: Preserve and restore the prior MCPFORUNITY_MINIMAX_API_KEY value
around the test that clears it: capture the existing value before
Environment.SetEnvironmentVariable in the relevant setup, then restore that
captured value during TearDown, including restoring null when it was originally
unset.
In
`@TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs`:
- Around line 97-115: Update the cleanup in
Submit_ImageMode_LocalPath_SendsDataUri so the finally block removes both the
generated directory and its Unity metadata file,
Assets/Generated/__assetgen_minimax_adapter.meta. Preserve the existing
best-effort cleanup behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d31566d6-6311-4f29-8101-794c8c8337df
📒 Files selected for processing (13)
MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.csMCPForUnity/Editor/Services/AssetGen/AssetGenModelCatalog.csMCPForUnity/Editor/Services/AssetGen/Providers/AssetGenProviders.csMCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.csMCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs.metaMCPForUnity/Editor/Windows/Components/AssetGen/McpAssetGenSection.csServer/src/cli/commands/asset_gen.pyServer/src/services/tools/generate_image.pyTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/AssetGenModelCatalogTests.csTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/AssetGenProvidersTests.csTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/GenerateImageTests.csTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.csTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs.meta
| if (!image && req.Width > 0 && req.Height > 0) | ||
| { | ||
| body["width"] = req.Width; | ||
| body["height"] = req.Height; | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "## candidate file size and outline"
wc -l MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs
ast-grep outline MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs || true
echo "## relevant source"
sed -n '1,150p' MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs
echo "## MiniMax image adapter references"
rg -n "MiniMax|image-01|image-01-live|DefaultModel|Width|Height|width|height|image =" MCPForUnity -SRepository: CoplayDev/unity-mcp
Length of output: 50375
🌐 Web query:
MiniMax image generation API image-01 width height requirements image 01 dimensions divisible by 8
💡 Result:
For the MiniMax image-01 model, the width and height requirements are as follows: - Dimension Range: You can specify custom image dimensions ranging from 512 to 2048 pixels for both width and height [1][2][3]. - Divisibility Rule: Both the width and height must be divisible by 8 [1][4][2]. - Requirement to Set Together: When using custom dimensions, both width and height must be set together in the API request [1][3]. - Aspect Ratio Priority: If you provide both custom width/height and an aspect_ratio parameter, the aspect_ratio takes priority and the custom width/height values will be ignored [1][4][5].
Citations:
- 1: https://platform.minimax.io/docs/api-reference/image-generation-i2i
- 2: https://wavespeed.ai/docs/docs-api/minimax/minimax-image-01-text-to-image
- 3: https://minimax-ai.chat/models/minimax-image-01/
- 4: https://www.modellix.ai/models/minimax/minimax-image-01-t2i
- 5: https://platform.minimaxi.com/docs/api-reference/image-generation-t2i
🌐 Web query:
MiniMax image generation API image-01-live width height parameters
💡 Result:
In the MiniMax image generation API, the width and height parameters are explicitly documented as being supported only for the image-01 model [1][2][3]. These parameters do not apply to the image-01-live model [1][4]. For the image-01 model, if you choose to use manual pixel dimensions: - Both width and height must be provided together [1][2][3]. - The allowed range for both parameters is [1][2][3]. - Both values must be a multiple of 8 [1][2][3]. - If aspect_ratio and custom width/height are both specified in the same request, the aspect_ratio parameter takes precedence [1][2]. For the image-01-live model, dimension control is handled exclusively via the aspect_ratio parameter [1][4]. The available aspect ratios include standard presets such as 1:1, 16:9, 4:3, 3:2, 2:3, 3:4, and 9:16 [1][3].
Citations:
- 1: https://platform.minimaxi.com/docs/api-reference/image-generation-t2i
- 2: https://powower.mintlify.app/en/zmodelImage/minimax/image-generation/image-to-image
- 3: https://github.com/MiniMax-AI/skills/blob/main/skills/frontend-dev/references/minimax-image-guide.md
- 4: https://github.com/JimLiu/baoyu-skills/blob/main/skills/baoyu-image-gen/references/providers/minimax.md
Enforce MiniMax dimension/model rules before sending width/height.
The current !image && req.Width > 0 && req.Height > 0 guard ignores supported image-01 image-to-image dimensions, and for non-default models it can forward dimensions to a model that only supports aspect_ratio. Only send width/height when the requested model is image-01 and both dimensions are paired, 512–2048, and divisible by 8; otherwise reject or ignore the unsupported values.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs` around
lines 61 - 65, Update the dimension handling in MiniMaxImageAdapter so width and
height are sent only for the image-01 model when both are provided, each is
within 512–2048, and both are divisible by 8; remove the image-to-image
exclusion. For other models or invalid/unpaired dimensions, do not forward
width/height and preserve their aspect_ratio-only behavior.
| "Action to perform."], | ||
|
|
||
| provider: Annotated[str, "Provider id (fal, openrouter)."] | None = None, | ||
| provider: Annotated[str, "Provider id (fal, openrouter, minimax)."] | None = None, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate and inspect the relevant tool and related documentation/transparency references.
printf 'Files matching generate_image.py:\n'
fd -a 'generate_image\.py$' . || true
printf '\nRelevant snippets:\n'
for f in $(fd 'generate_image\.py$' .); do
echo "--- $f"
wc -l "$f"
sed -n '1,140p' "$f"
done
printf '\nTransparency mentions in repo:\n'
rg -n "transparency|OpenRouter|fal|MiniMax|minimax|MiniMax" -S . --glob '!node_modules' --glob '!dist' --glob '!build' || trueRepository: CoplayDev/unity-mcp
Length of output: 50376
🌐 Web query:
MiniMax image generation API transparency request parameter platform.minimax.io image-generation-i2i
💡 Result:
Based on the official MiniMax API documentation and technical resources, there is no parameter named transparency available in the image-generation-i2i API [1][2][3]. The MiniMax image-to-image (I2I) generation service, accessed via the /v1/image_generation endpoint, primarily utilizes the subject_reference parameter to handle reference images for maintaining character consistency [4][5][3]. Supported request parameters for this endpoint include [1][2][3]: - model: The model identifier (e.g., image-01) [1][3]. - prompt: The text description for the generated image [2][3]. - subject_reference: An array of objects specifying the reference image (e.g., using image_file and type: character) [1][4][3]. - aspect_ratio: Controls the dimensions of the output (e.g., 16:9, 1:1) [1][2][3]. - width and height: Alternative manual dimension controls (must be divisible by 8) [1][2]. - n: The number of images to generate (range 1 to 9) [1][2][3]. - response_format: The output format (url or base64) [1][3]. - prompt_optimizer: A boolean to enable automatic prompt optimization [1][2][3]. - seed: An integer for result reproduction [1][2][3]. If you are attempting to adjust image blending, opacity, or transparency for the reference image, these features are not explicitly exposed as parameters in the documented MiniMax API [1][2][5]. [1][2][6]
Citations:
- 1: https://platform.minimax.io/docs/api-reference/image-generation-i2i
- 2: https://www.modellix.ai/zh_CN/models/minimax/minimax-image-01-i2i
- 3: https://github.com/MiniMax-AI/skills/blob/main/skills/gif-sticker-maker/scripts/minimax_image.py
- 4: https://platform.minimax.io/docs/guides/image-generation
- 5: https://www.amux.ai/docs/amux-api/image/minimax-image-01
- 6: https://platform.minimax.io/docs/api-reference/api-overview
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'generate_image.py files:\n'
git ls-files | rg '^Server/src/services/tools/generate_image\.py$' || true
printf '\nRelevant snippets from generate_image.py:\n'
while IFS= read -r f; do
echo "--- $f"
wc -l "$f"
sed -n '1,140p' "$f"
done < <(git ls-files | rg '^Server/src/services/tools/generate_image\.py$' || true)
printf '\nFocused transparency/MiniMax/OpenRouter/fal mentions:\n'
rg -n "transparency|OpenRouter|fal|MiniMax|minimax" Server/src/services/tools README.md docs . --glob '!Server/src/services/tools/generate_image.py' --glob '!node_modules' --glob '!dist' --glob '!build' || trueRepository: CoplayDev/unity-mcp
Length of output: 322
🏁 Script executed:
#!/bin/bash
set -euo pipefail
f="Server/src/services/tools/generate_image.py"
echo "--- $f"
wc -l "$f"
sed -n '1,140p' "$f"
echo
echo 'Focused transparency/MiniMax/OpenRouter/fal mentions outside generate_image.py:'
rg -n "transparency|OpenRouter|fal|MiniMax|minimax" --glob '!node_modules' --glob '!dist' --glob '!build' || trueRepository: CoplayDev/unity-mcp
Length of output: 4355
Include MiniMax in the transparency disclaimer.
MiniMax’s image API does not expose a transparency request parameter, so the import-only transparency note should also name MiniMax to avoid implying generated alpha is supported.
- "and OpenRouter have no generation-time transparency, so this only sets the "
+ "OpenRouter, and MiniMax have no generation-time transparency, so this only sets the "🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Server/src/services/tools/generate_image.py` at line 45, Update the provider
transparency disclaimer associated with the provider annotation to include
MiniMax alongside the existing providers, making clear that transparency is
import-only for MiniMax as well.
| AssetGenJobManager.ResetForTests(); | ||
| Environment.SetEnvironmentVariable("MCPFORUNITY_FAL_API_KEY", null); | ||
| Environment.SetEnvironmentVariable("MCPFORUNITY_OPENROUTER_API_KEY", null); | ||
| Environment.SetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY", null); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Restore the pre-test MiniMax environment value.
Line 28 clears a process-wide variable, but TearDown never restores its prior value. This can disable a developer’s configured MiniMax key for subsequent editor tests or tooling in the same process.
Proposed fix
private EncryptedFileKeyStore _store;
+private string _originalMiniMaxApiKey;
public void SetUp()
{
+ _originalMiniMaxApiKey = Environment.GetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY");
AssetGenJobManager.ResetForTests();
Environment.SetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY", null);
@@
public void TearDown()
{
+ Environment.SetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY", _originalMiniMaxApiKey);
AssetGenJobManager.ResetForTests();📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Environment.SetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY", null); | |
| private EncryptedFileKeyStore _store; | |
| private string _originalMiniMaxApiKey; | |
| public void SetUp() | |
| { | |
| _originalMiniMaxApiKey = Environment.GetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY"); | |
| AssetGenJobManager.ResetForTests(); | |
| Environment.SetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY", null); | |
| ... | |
| } | |
| public void TearDown() | |
| { | |
| Environment.SetEnvironmentVariable("MCPFORUNITY_MINIMAX_API_KEY", _originalMiniMaxApiKey); | |
| AssetGenJobManager.ResetForTests(); | |
| ... | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/GenerateImageTests.cs`
at line 28, Preserve and restore the prior MCPFORUNITY_MINIMAX_API_KEY value
around the test that clears it: capture the existing value before
Environment.SetEnvironmentVariable in the relevant setup, then restore that
captured value during TearDown, including restoring null when it was originally
unset.
| public void Submit_ImageMode_LocalPath_SendsDataUri() | ||
| { | ||
| string rel = WriteProjectFile("Assets/Generated/__assetgen_minimax_adapter/ref.png", new byte[] { 137, 80, 78, 71 }); | ||
| try | ||
| { | ||
| var fake = new FakeHttpTransport | ||
| { | ||
| Handler = spec => Json("{\"data\":{\"image_urls\":[\"https://cdn.minimax.io/img/x.png\"]},\"base_resp\":{\"status_code\":0}}") | ||
| }; | ||
| var adapter = new MiniMaxImageAdapter(); | ||
| var req = new ImageGenRequest { Provider = "minimax", Mode = "image", Prompt = "watercolor", ImagePath = rel }; | ||
|
|
||
| adapter.SubmitAsync(req, "mmkey", fake, CancellationToken.None).GetAwaiter().GetResult(); | ||
|
|
||
| string sent = Encoding.UTF8.GetString(fake.RecordedRequests[0].Body); | ||
| StringAssert.Contains("subject_reference", sent); | ||
| StringAssert.Contains("data:image/png;base64,", sent); | ||
| } | ||
| finally { try { Directory.Delete(Path.Combine(ProjectRoot(), "Assets/Generated/__assetgen_minimax_adapter"), true); } catch { } } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the generated folder .meta too.
Line 115 removes the directory but can leave Assets/Generated/__assetgen_minimax_adapter.meta after Unity imports the folder, polluting the project and affecting later tests.
Proposed fix
-finally { try { Directory.Delete(Path.Combine(ProjectRoot(), "Assets/Generated/__assetgen_minimax_adapter"), true); } catch { } }
+finally
+{
+ string folder = Path.Combine(ProjectRoot(), "Assets/Generated/__assetgen_minimax_adapter");
+ try { if (Directory.Exists(folder)) Directory.Delete(folder, true); } catch { }
+ try { if (File.Exists(folder + ".meta")) File.Delete(folder + ".meta"); } catch { }
+}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| public void Submit_ImageMode_LocalPath_SendsDataUri() | |
| { | |
| string rel = WriteProjectFile("Assets/Generated/__assetgen_minimax_adapter/ref.png", new byte[] { 137, 80, 78, 71 }); | |
| try | |
| { | |
| var fake = new FakeHttpTransport | |
| { | |
| Handler = spec => Json("{\"data\":{\"image_urls\":[\"https://cdn.minimax.io/img/x.png\"]},\"base_resp\":{\"status_code\":0}}") | |
| }; | |
| var adapter = new MiniMaxImageAdapter(); | |
| var req = new ImageGenRequest { Provider = "minimax", Mode = "image", Prompt = "watercolor", ImagePath = rel }; | |
| adapter.SubmitAsync(req, "mmkey", fake, CancellationToken.None).GetAwaiter().GetResult(); | |
| string sent = Encoding.UTF8.GetString(fake.RecordedRequests[0].Body); | |
| StringAssert.Contains("subject_reference", sent); | |
| StringAssert.Contains("data:image/png;base64,", sent); | |
| } | |
| finally { try { Directory.Delete(Path.Combine(ProjectRoot(), "Assets/Generated/__assetgen_minimax_adapter"), true); } catch { } } | |
| public void Submit_ImageMode_LocalPath_SendsDataUri() | |
| { | |
| string rel = WriteProjectFile("Assets/Generated/__assetgen_minimax_adapter/ref.png", new byte[] { 137, 80, 78, 71 }); | |
| try | |
| { | |
| var fake = new FakeHttpTransport | |
| { | |
| Handler = spec => Json("{\"data\":{\"image_urls\":[\"https://cdn.minimax.io/img/x.png\"]},\"base_resp\":{\"status_code\":0}}") | |
| }; | |
| var adapter = new MiniMaxImageAdapter(); | |
| var req = new ImageGenRequest { Provider = "minimax", Mode = "image", Prompt = "watercolor", ImagePath = rel }; | |
| adapter.SubmitAsync(req, "mmkey", fake, CancellationToken.None).GetAwaiter().GetResult(); | |
| string sent = Encoding.UTF8.GetString(fake.RecordedRequests[0].Body); | |
| StringAssert.Contains("subject_reference", sent); | |
| StringAssert.Contains("data:image/png;base64,", sent); | |
| } | |
| finally | |
| { | |
| string folder = Path.Combine(ProjectRoot(), "Assets/Generated/__assetgen_minimax_adapter"); | |
| try { if (Directory.Exists(folder)) Directory.Delete(folder, true); } catch { } | |
| try { if (File.Exists(folder + ".meta")) File.Delete(folder + ".meta"); } catch { } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs`
around lines 97 - 115, Update the cleanup in
Submit_ImageMode_LocalPath_SendsDataUri so the finally block removes both the
generated directory and its Unity metadata file,
Assets/Generated/__assetgen_minimax_adapter.meta. Preserve the existing
best-effort cleanup behavior.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.cs`:
- Line 12: Remove the duplicate "minimax" entry from the provider ID registry in
SecureKeyStoreConstants, leaving exactly one occurrence while preserving the
existing ordering of the other provider IDs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 574fdb8a-86e7-4055-b655-3f212ec65d4e
📒 Files selected for processing (12)
MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.csMCPForUnity/Editor/Services/AssetGen/AssetGenModelCatalog.csMCPForUnity/Editor/Services/AssetGen/Providers/AssetGenProviders.csMCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.csMCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs.metaMCPForUnity/Editor/Windows/Components/AssetGen/McpAssetGenSection.csServer/src/cli/commands/asset_gen.pyServer/src/services/tools/generate_image.pyTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/GenerateImageTests.csTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.csTestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs.metadocs/asset-gen-manual-verification.md
🚧 Files skipped from review as they are similar to previous changes (8)
- Server/src/cli/commands/asset_gen.py
- MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs.meta
- TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs.meta
- Server/src/services/tools/generate_image.py
- MCPForUnity/Editor/Services/AssetGen/Providers/AssetGenProviders.cs
- MCPForUnity/Editor/Windows/Components/AssetGen/McpAssetGenSection.cs
- TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/GenerateImageTests.cs
- MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs
Reason: Register the MiniMax image provider in the existing image-generation provider chain.
Changes
MiniMaxImageAdapter, a synchronousIImageProviderAdapterthat calls the MiniMaxPOST /v1/image_generationendpoint withBearerauth. Text→image sendsmodel+prompt(and optionalwidth/height); image→image attaches asubject_referenceentry whoseimage_fileaccepts a hosted URL or an inline base64 data URI (localimage_path). Results are read fromdata.image_urls(defaulturlformat) ordata.image_base64, and provider-level failures surfaced viabase_resp.status_codeare treated as errors. The endpoint host is re-validated before the key is attached, matching the existing adapters.minimaxinAssetGenProviders.Image(...)and theList()provider table (kindimage, capabilitiestext/image).image-01default,image-01-live) toAssetGenModelCatalog, with the default referencingMiniMaxImageAdapter.DefaultModelso the drift-guard test pins them together.minimaxto the secure-store provider id list and the Asset Generation panel image provider rows.minimaxin the Pythongenerate_imagetool description and theasset-gen generate-imageCLI--providerhelp text (the Python side remains a thin pass-through; the C# side owns the key and provider call).Tests
MiniMaxImageAdapterTests: submit/poll for URL and base64 results, image-mode subject_reference (hosted URL + local data URI), no-image failure, andbase_resp.status_codeerror handling.AssetGenProvidersTests:Image_MiniMax_ReturnsAdapter.AssetGenModelCatalogTests:Curated_HasMiniMaxImageModelsand minimax assertions in the default/drift-guard tests.GenerateImageTests:Generate_MiniMax_WithKey_ReturnsPendingJobId,minimaxinListProviders_ImageOnly, and theMCPFORUNITY_MINIMAX_API_KEYenv reset.Checks run
uv run pytest Server/tests/test_asset_gen_image.py— 10 passed.uv run pytest Server/tests/test_asset_gen_scaffold.py— 2 passed.unity-tests.ymlCI (requires a Unity license; not runnable in this work environment).Summary by CodeRabbit