feat(asset-gen): add MiniMax music-generation audio provider - #1301
Open
octo-patch wants to merge 1 commit into
Open
feat(asset-gen): add MiniMax music-generation audio provider#1301octo-patch wants to merge 1 commit into
octo-patch wants to merge 1 commit into
Conversation
Register a MiniMax audio provider in the asset-gen provider registry so background music can be generated alongside the existing audio provider. The adapter posts the synchronous /v1/music_generation endpoint, covers the global and China regional hosts (selected via MCPFORUNITY_MINIMAX_REGION), sends the JSON request fields, requests mp3 output, and parses the base_resp.status_code / data.status / data.audio response, returning either a hosted URL or a decoded hex payload. Adds curated catalog entries for the music-generation models and unit tests covering submit, region selection, URL and hex results, and error/redaction paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
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 (8)
📝 WalkthroughWalkthroughAdded MiniMax music generation support with regional endpoints, curated models, provider registration, URL or hex audio results, and EditMode tests covering success and failure paths. ChangesMiniMax audio generation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant AudioGenRequest
participant MiniMaxAudioAdapter
participant MiniMaxMusicAPI
participant ProviderPollResult
AudioGenRequest->>MiniMaxAudioAdapter: SubmitAsync request
MiniMaxAudioAdapter->>MiniMaxMusicAPI: POST music_generation with model and prompt
MiniMaxMusicAPI-->>MiniMaxAudioAdapter: URL or hex audio response
MiniMaxAudioAdapter->>ProviderPollResult: PollAsync returns audio result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
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: The asset-gen provider registry generates background music through the existing audio provider only, with no MiniMax music-generation integration.
What this adds
Registers a MiniMax audio provider for background-music generation in the asset-gen provider chain, so
generate_audiocan target it the same way as the existing audio provider.MiniMaxAudioAdapter— a newIAudioProviderAdapterfor the synchronous/v1/music_generationendpoint. Because the endpoint returns the result inline in a single response (no task id or poll endpoint), the request runs inSubmitAsyncandPollAsyncreturns the stored result immediately — the same shape the OpenRouter image adapter already uses.api.minimax.io) and China (api.minimaxi.com) — selected via theMCPFORUNITY_MINIMAX_REGIONenv var (globaldefault,cnfor China). The key is only ever attached to the resolved region host (validated through the sharedProviderHttp.RequireHostguard).model,prompt,is_instrumental,output_format,audio_setting) with aBearerkey and requestsmp3(an import-allowed extension).base_resp.status_code == 0,data.status == 2(completed), anddata.audio— returning either a hosted URL (output_format: url) or a decoded hex payload. Error messages are scrubbed of the key.AssetGenProviders— registersminimaxin theAudio(id)factory and advertises a key-freeminimaxaudio row (capabilitiestext,music) inList().AssetGenModelCatalog— adds curated entries for the music-generation models (default first, referencing the adapter constant via the existing drift guard). These are prompt-only (the model returns a full track), so they carry no duration knob.MiniMaxAudioAdapterTests(submit endpoint/host/key, default and override model, region selection, URL and hex results, non-zero status / in-progress / no-audio / HTTP-error failure and key redaction), plus additions toAssetGenProvidersTestsandAssetGenModelCatalogTestsfor the registry row, factory resolution, catalog default and model list.Checks
The changed code is Unity Editor C# under
MCPForUnity/; the added EditMode tests run under the Unity Test Runner, which is not available in this environment, so no build or test command was run here.Summary by CodeRabbit
New Features
Tests