-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Pr/OpenAI channel type support sora #2055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Pr/OpenAI channel type support sora #2055
Conversation
WalkthroughUpdates the JSON tag for OpenAIVideo.Metadata from "meta_data" to "metadata" and adds ChannelTypeOpenAI case to GetTaskAdaptor that returns a tasksora.TaskAdaptor, aligning OpenAI channel handling with Sora task adaptor logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
dto/openai_video.go(1 hunks)relay/relay_adaptor.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
relay/relay_adaptor.go (3)
constant/channel.go (1)
ChannelTypeOpenAI(5-5)relay/channel/adapter.go (1)
TaskAdaptor(34-53)relay/channel/task/sora/adaptor.go (1)
TaskAdaptor(58-62)
🔇 Additional comments (1)
dto/openai_video.go (1)
30-30: The review comment is incorrect—no JSON tag change is occurring in this PR.The
Metadatafield already usesjson:"metadata,omitempty"in the HEAD version (before this PR). The git history confirms this is the current state, not a change being introduced. There is no breaking change to flag.Likely an incorrect or invalid review comment.
| case constant.ChannelTypeOpenAI: | ||
| return &tasksora.TaskAdaptor{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
LGTM! Verify TaskAdaptor handles both channel types correctly.
The addition of ChannelTypeOpenAI to use tasksora.TaskAdaptor aligns with the PR objective. However, ensure that the TaskAdaptor implementation properly handles both Sora and OpenAI channel types.
Run the following script to verify the TaskAdaptor implementation:
Additionally, verify:
- Does the
Initmethod properly set theChannelTypefield fromRelayInfo? - Are there any conditional branches in TaskAdaptor that assume only Sora channel type?
- Do the base URL and API key configurations work correctly for OpenAI channels?
🏁 Script executed:
#!/bin/bash
# Description: Verify TaskAdaptor handles both channel types correctly
# Check TaskAdaptor implementation for channel-type-specific logic
echo "=== Checking TaskAdaptor implementation for channel-type-specific logic ==="
rg -n --type go -A 5 -B 2 'ChannelType.*Sora|ChannelType.*OpenAI' relay/channel/task/sora/
# Check Init method implementation
echo -e "\n=== Checking Init method implementation ==="
ast-grep --pattern 'func ($_ *TaskAdaptor) Init($$$) {
$$$
}'
# Check for any hardcoded Sora assumptions
echo -e "\n=== Checking for hardcoded Sora references ==="
rg -n --type go -i 'sora' relay/channel/task/sora/ | head -20Length of output: 2809
Implement a dedicated OpenAI TaskAdaptor instead of reusing the Sora TaskAdaptor. The Sora adaptor (relay/channel/task/sora/adaptor.go) contains Sora-specific parsing and constants and won’t handle OpenAI responses correctly.
🤖 Prompt for AI Agents
In relay/relay_adaptor.go around lines 144-145, the switch currently returns the
Sora TaskAdaptor for constant.ChannelTypeOpenAI which is incorrect; replace this
by creating and returning a dedicated OpenAI TaskAdaptor. Implement a new
adaptor at relay/channel/task/openai/adaptor.go that mirrors the TaskAdaptor
interface used by other channels but contains OpenAI-specific parsing, response
mapping, and constants (separate types/consts from Sora), export a constructor
(e.g., NewTaskAdaptor or TaskAdaptor struct) and update relay/relay_adaptor.go
to import that package and return its instance for ChannelTypeOpenAI; also
update imports and add unit tests exercising OpenAI parsing to ensure behavior
differs from Sora where needed.
|
现在的代码已经有这个OpenAI渠道自带sora视频生成的内容了 |
OpeanAI渠道类型支持sora视频生成

防呆设计, sora视频不用专门选择sora渠道, 选择OpenAI就可以正常支持