mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-18 14:13:34 +00:00
fix(tools): remove unsupported duration_seconds param from MiniMax music API
MiniMax music generation API silently ignores duration_seconds — audio length is determined by lyrics length (vocal) or model default (~3-4 min for instrumental). Updated tool description to clarify this limitation.
This commit is contained in:
1 parent
d839e034af
commit
faf66cf453
2 files changed
+4
-9
No files matched your search
@@ -40,7 +40,7 @@ func NewCreateAudioTool(registry *providers.Registry, elevenlabsKey, elevenlabsB
|
||||
func (t *CreateAudioTool) Name() string { return "create_audio" }
|
||||
|
||||
func (t *CreateAudioTool) Description() string {
|
||||
return "Generate music, sound effects, or ambient audio from a text description. Returns a MEDIA: path to the generated audio file."
|
||||
return "Generate music, sound effects, or ambient audio from a text description. Returns a MEDIA: path to the generated audio file. Note: for music, duration is determined by lyrics length — provide longer/shorter lyrics to control length. The 'duration' parameter only applies to sound effects."
|
||||
}
|
||||
|
||||
func (t *CreateAudioTool) Parameters() map[string]interface{} {
|
||||
@@ -57,7 +57,7 @@ func (t *CreateAudioTool) Parameters() map[string]interface{} {
|
||||
},
|
||||
"duration": map[string]interface{}{
|
||||
"type": "integer",
|
||||
"description": "Duration in seconds.",
|
||||
"description": "Duration in seconds (only for sound effects). For music, duration is controlled by lyrics length.",
|
||||
},
|
||||
"lyrics": map[string]interface{}{
|
||||
"type": "string",
|
||||
@@ -125,9 +125,6 @@ func (t *CreateAudioTool) Execute(ctx context.Context, args map[string]interface
|
||||
chain[i].Params["prompt"] = prompt
|
||||
chain[i].Params["lyrics"] = lyrics
|
||||
chain[i].Params["instrumental"] = instrumental
|
||||
if duration > 0 {
|
||||
chain[i].Params["duration"] = duration
|
||||
}
|
||||
}
|
||||
|
||||
// Override timeout to 300s for music generation (slow API).
|
||||
|
||||
@@ -27,7 +27,8 @@ func callMinimaxMusicGen(ctx context.Context, apiKey, apiBase, model, prompt str
|
||||
instrumental = true
|
||||
}
|
||||
|
||||
duration := GetParamInt(params, "duration", 0)
|
||||
// NOTE: MiniMax music API does NOT support a duration parameter.
|
||||
// Audio length is determined by lyrics length (vocal) or the model's default (~3-4 min for instrumental).
|
||||
|
||||
body := map[string]interface{}{
|
||||
"model": model,
|
||||
@@ -44,9 +45,6 @@ func callMinimaxMusicGen(ctx context.Context, apiKey, apiBase, model, prompt str
|
||||
if lyrics != "" {
|
||||
body["lyrics"] = lyrics
|
||||
}
|
||||
if duration > 0 {
|
||||
body["duration_seconds"] = duration
|
||||
}
|
||||
|
||||
jsonBody, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user