novita: fix Wan 2.7 R2V media item types to match upstream enum#9
Merged
Conversation
The Wan 2.7 R2V (`/v3/async/wan2.7-r2v`) endpoint requires each item
in the `media` array to carry a `type` value from the enum:
- `reference_image`
- `reference_video`
- `first_frame`
We were sending `image` and `video`, which Novita rejects with the
generic "failed to exec task" 500 — every R2V submission via the
playground / legacy `image_urls`+`video_urls` shape was failing
silently for that reason.
Two changes in `build_body`:
1. Repack each `image_urls[]` URL as `{type: "reference_image", url}`
and each `video_urls[]` URL as `{type: "reference_video", url}`.
No way to express `first_frame` or per-item `reference_voice`
from the legacy flat shape — callers who want those use the new
pass-through path below.
2. Pass `media` through the allowed-fields whitelist for the R2V
shape so direct API callers / a future media-editor UI can
submit the rich shape (`[{type, url, reference_voice?}, ...]`)
verbatim. The `!body.contains_key("media")` guard in the repack
block ensures the pass-through wins when both shapes are present.
Also cap the synthesised `media` array at 5 items to match Novita's
documented ceiling (combined images+videos ≤ 5), so users who upload
more get a deterministic truncate-from-front rather than a 422.
|
I have read the Contributor License Agreement (CLA) and hereby sign the CLA. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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.
Summary
{type:"image"|"video"}in eachmedia[]item; Novita's enum isreference_image | reference_video | first_frame. Upstream rejected every R2V request with "failed to exec task".reference_image/reference_videofrom the legacy flatimage_urls+video_urlsshape.mediaadded to the R2V allowed-fields whitelist so direct API callers can submit the rich shape (includingfirst_frameand per-itemreference_voice) verbatim. The repack block is skipped whenmediais already present.mediaarray truncated at 5 to match Novita's combined-items cap.Test plan
image_urls+video_urlsflow) and confirm Novita accepts the call (status moves pastfailed to exec task).media: [{type:"first_frame", url}, ...]body and confirm pass-through.