[Partner Nodes] add SeeDance 2.0 nodes#13364
Conversation
📝 WalkthroughWalkthroughThis pull request adds Seedance 2.0 support to the ByteDance integration: new Seedance2 model mappings and a task-status endpoint, Seedance2 pricing and reference-video pixel-limit configuration, and helper functions for pixel validation and price extraction. It extends media upload utilities with audio/image/video upload functions and new Seedance2 content types. The video task flow was reworked (updated 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Signed-off-by: bigcat88 <bigcat88@icloud.com>
c7eae40 to
0452210
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@comfy_api_nodes/nodes_bytedance.py`:
- Around line 101-105: The extractor function may access
response.usage.total_tokens when usage exists but total_tokens is missing;
update extractor to guard that field by checking response.usage is not None and
that response.usage.total_tokens is present and numeric (e.g., using
hasattr/getattr or an explicit None check and isinstance/issubclass for
int/float) before performing the math; if total_tokens is missing or not a
number, return None, otherwise compute and return response.usage.total_tokens *
1.43 * rate / 1_000.0.
- Around line 1491-1493: The duration calculation using dur =
int(audio["waveform"].shape[-1]) / int(audio["sample_rate"]) can raise
ZeroDivisionError or type errors for malformed metadata; before dividing,
validate that audio["sample_rate"] exists, is an int (or numeric) and > 0, and
that audio["waveform"] has a valid shape with a numeric last-dimension length;
if any check fails, raise a ValueError (include the reference index i and the
offending value) explaining the issue (e.g., "invalid or zero sample_rate" or
"invalid waveform shape") so callers get a clear validation error instead of a
crash.
- Around line 1476-1484: The current try/except around video.get_duration()
swallows all exceptions (except ValueError) which bypasses duration checks and
can allow invalid downstream requests; in the block with video.get_duration(),
replace the broad "except Exception: pass" with explicit handling: catch known
parse/attribute errors (e.g., TypeError, AttributeError) and either log the
failure including the reference index `i` and the problematic `video`, then
raise a ValueError (or re-raise the original exception) so minimum-duration
enforcement and `total_video_duration` updates cannot be bypassed; ensure the
handlers reference `dur`, `total_video_duration`, `video.get_duration`, and `i`
so failures are surfaced rather than silently ignored.
- Around line 77-80: The try/except around video.get_dimensions() is swallowing
all exceptions and allowing invalid videos to proceed; update the error handling
in the block that calls video.get_dimensions() so you catch and handle specific
exceptions (e.g., ValueError, IOError) instead of a blanket Exception, log the
error with context (including video identifier) and then return a clear
failure/raise the exception to stop upload/task creation; reference the
video.get_dimensions() call and the surrounding guard that currently returns on
exception and ensure it either returns an explicit error result or re-raises
after logging so invalid metadata cannot bypass validation.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b91285f4-2a48-4490-9092-f762ce3b61ef
⛔ Files ignored due to path filters (1)
comfy_api_nodes/apis/bytedance.pyis excluded by!comfy_api_nodes/apis/**
📒 Files selected for processing (1)
comfy_api_nodes/nodes_bytedance.py
API Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms