Skip to content

feat(asset-gen): register MiniMax image provider in the image tool chain - #1284

Open
octo-patch wants to merge 3 commits into
CoplayDev:betafrom
octo-patch:octo/20260728-text-to-image-tool-recvpdWVX0VEpp
Open

feat(asset-gen): register MiniMax image provider in the image tool chain#1284
octo-patch wants to merge 3 commits into
CoplayDev:betafrom
octo-patch:octo/20260728-text-to-image-tool-recvpdWVX0VEpp

Conversation

@octo-patch

@octo-patch octo-patch commented Jul 28, 2026

Copy link
Copy Markdown

Reason: Register the MiniMax image provider in the existing image-generation provider chain.

Changes

  • Add MiniMaxImageAdapter, a synchronous IImageProviderAdapter that calls the MiniMax POST /v1/image_generation endpoint with Bearer auth. Text→image sends model + prompt (and optional width/height); image→image attaches a subject_reference entry whose image_file accepts a hosted URL or an inline base64 data URI (local image_path). Results are read from data.image_urls (default url format) or data.image_base64, and provider-level failures surfaced via base_resp.status_code are treated as errors. The endpoint host is re-validated before the key is attached, matching the existing adapters.
  • Register minimax in AssetGenProviders.Image(...) and the List() provider table (kind image, capabilities text/image).
  • Add the MiniMax image models (image-01 default, image-01-live) to AssetGenModelCatalog, with the default referencing MiniMaxImageAdapter.DefaultModel so the drift-guard test pins them together.
  • Add minimax to the secure-store provider id list and the Asset Generation panel image provider rows.
  • Surface minimax in the Python generate_image tool description and the asset-gen generate-image CLI --provider help 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, and base_resp.status_code error handling.
  • AssetGenProvidersTests: Image_MiniMax_ReturnsAdapter.
  • AssetGenModelCatalogTests: Curated_HasMiniMaxImageModels and minimax assertions in the default/drift-guard tests.
  • GenerateImageTests: Generate_MiniMax_WithKey_ReturnsPendingJobId, minimax in ListProviders_ImageOnly, and the MCPFORUNITY_MINIMAX_API_KEY env 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 EditMode tests for the C# adapters/catalog are run by the repo's unity-tests.yml CI (requires a Unity license; not runnable in this work environment).

Summary by CodeRabbit

  • New Features
    • Added MiniMax as a supported image-generation provider (including image URLs and inline image data support).
    • Added MiniMax image models to the Asset Generation catalog and exposed it in the Unity 2D Images panel.
    • Updated the asset-gen CLI and asset_gen/generate_image tool to recognize the MiniMax provider.
  • Documentation
    • Added manual verification steps for MiniMax image generation.
  • Tests
    • Added/expanded tests for MiniMax requests, polling behavior, subject reference handling, and error cases.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cb2609a0-5b18-4b99-9a6a-10de89b28d72

📥 Commits

Reviewing files that changed from the base of the PR and between 784f758 and 966c3b5.

📒 Files selected for processing (6)
  • MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.cs
  • MCPForUnity/Editor/Tools/AssetGen/GenerateImage.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/AssetGenModelCatalogTests.cs
  • website/docs/reference/tools/asset_gen/generate_image.md
  • website/docs/reference/tools/asset_gen/index.md
  • website/docs/reference/tools/index.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.cs

📝 Walkthrough

Walkthrough

Adds MiniMax image generation support across Unity request handling, provider registration, model selection, UI, server metadata, integration tests, and manual verification documentation.

Changes

MiniMax image generation

Layer / File(s) Summary
MiniMax adapter flow
MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs, MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs.meta
Adds MiniMax request submission, subject-reference handling, response validation, URL/base64 extraction, error redaction, and immediate polling results.
Provider and model registration
MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.cs, MCPForUnity/Editor/Services/AssetGen/..., MCPForUnity/Editor/Windows/Components/AssetGen/McpAssetGenSection.cs
Registers MiniMax in the key allowlist, curated image models, provider resolution/listing, and the 2D Images UI.
Server provider metadata
Server/src/cli/commands/asset_gen.py, Server/src/services/tools/generate_image.py
Updates CLI and tool descriptions to list MiniMax as a supported provider.
MiniMax integration validation
TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/..., docs/asset-gen-manual-verification.md
Adds adapter and provider tests for requests, image references, polling, errors, and listing, plus a MiniMax manual verification checklist.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: scriptwonder

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change and tests, but it omits several required template sections and checklist items. Reformat the PR description to match the template and add Type of Change, Compatibility/Package Source, Documentation Updates, Related Issues, and Additional Notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding MiniMax to the asset-gen image provider chain.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.
@octo-patch
octo-patch force-pushed the octo/20260728-text-to-image-tool-recvpdWVX0VEpp branch from f34068e to 784f758 Compare July 28, 2026 06:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between bd72241 and f34068e.

📒 Files selected for processing (13)
  • MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.cs
  • MCPForUnity/Editor/Services/AssetGen/AssetGenModelCatalog.cs
  • MCPForUnity/Editor/Services/AssetGen/Providers/AssetGenProviders.cs
  • MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs
  • MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs.meta
  • MCPForUnity/Editor/Windows/Components/AssetGen/McpAssetGenSection.cs
  • Server/src/cli/commands/asset_gen.py
  • Server/src/services/tools/generate_image.py
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/AssetGenModelCatalogTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/AssetGenProvidersTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/GenerateImageTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs.meta

Comment on lines +61 to +65
if (!image && req.Width > 0 && req.Height > 0)
{
body["width"] = req.Width;
body["height"] = req.Height;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 -S

Repository: 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:


🌐 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:


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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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' || true

Repository: 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:


🏁 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' || true

Repository: 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' || true

Repository: 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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
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.

Comment on lines +97 to +115
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 { } }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f34068e and 784f758.

📒 Files selected for processing (12)
  • MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.cs
  • MCPForUnity/Editor/Services/AssetGen/AssetGenModelCatalog.cs
  • MCPForUnity/Editor/Services/AssetGen/Providers/AssetGenProviders.cs
  • MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs
  • MCPForUnity/Editor/Services/AssetGen/Providers/MiniMaxImageAdapter.cs.meta
  • MCPForUnity/Editor/Windows/Components/AssetGen/McpAssetGenSection.cs
  • Server/src/cli/commands/asset_gen.py
  • Server/src/services/tools/generate_image.py
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/GenerateImageTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs
  • TestProjects/UnityMCPTests/Assets/Tests/EditMode/AssetGen/MiniMaxImageAdapterTests.cs.meta
  • docs/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

Comment thread MCPForUnity/Editor/Security/SecureKeyStore/SecureKeyStoreConstants.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant