Skip to content

refactor: Openai video model 移动到 dto - #2027

Merged
xyfacai merged 1 commit into
QuantumNous:mainfrom
xyfacai:refactor/openai-video
Oct 13, 2025
Merged

refactor: Openai video model 移动到 dto#2027
xyfacai merged 1 commit into
QuantumNous:mainfrom
xyfacai:refactor/openai-video

Conversation

@xyfacai

@xyfacai xyfacai commented Oct 13, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Refactor
    • Unified video task response format across all channels (Jimeng, Kling, Sora, Vidu) for consistent structure and error handling.
    • Standardized status mapping to ensure consistent states across the app.
    • Internal cleanup to streamline conversions and reduce duplication.
    • No changes to visible behavior or response content; existing integrations continue to work as before.

@coderabbitai

coderabbitai Bot commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Renames the OpenAIVideo DTO package from common to dto and updates all related references. Adjusts status mapping in model/task.go to use dto constants. Changes converter interfaces to return dto.OpenAIVideo. Updates multiple task adaptors (jimeng, kling, sora, vidu) to construct, return, and error with dto.OpenAIVideo types.

Changes

Cohort / File(s) Summary
DTO package rename
dto/openai_video.go
Package declaration changed from common to dto, moving OpenAIVideo types under dto.
Model status mapping
model/task.go
Imports dto and switches ToVideoStatus mappings from commonRelay constants to dto constants.
Relay adapter interface
relay/channel/adapter.go
OpenAIVideoConverter.ConvertToOpenAIVideo return type changed from *relaycommon.OpenAIVideo to *dto.OpenAIVideo.
Channel task adaptors migration
relay/channel/task/jimeng/adaptor.go, relay/channel/task/kling/adaptor.go, relay/channel/task/sora/adaptor.go, relay/channel/task/vidu/adaptor.go
Replace relaycommon.OpenAIVideo and OpenAIVideoError with dto.OpenAIVideo and dto.OpenAIVideoError; update function signatures to return *dto.OpenAIVideo; instantiate via dto.NewOpenAIVideo() where applicable.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • seefs001
  • Calcium-Ion

Poem

I hop between packages, tidy and neat,
DTO burrows where types now meet.
Adaptors aligned, the carrots agree,
Errors and videos in dto harmony.
Tap-tap the keys—migration complete! 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely describes the core refactor of moving the OpenAI video model to the dto package, matching the primary changes of the pull request and giving a clear summary.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec0633b and a6e6897.

📒 Files selected for processing (7)
  • dto/openai_video.go (1 hunks)
  • model/task.go (2 hunks)
  • relay/channel/adapter.go (1 hunks)
  • relay/channel/task/jimeng/adaptor.go (3 hunks)
  • relay/channel/task/kling/adaptor.go (3 hunks)
  • relay/channel/task/sora/adaptor.go (1 hunks)
  • relay/channel/task/vidu/adaptor.go (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
relay/channel/adapter.go (2)
model/task.go (3)
  • Task (42-61)
  • Task (250-254)
  • Task (256-260)
dto/openai_video.go (1)
  • OpenAIVideo (16-31)
relay/channel/task/jimeng/adaptor.go (2)
dto/openai_video.go (3)
  • NewOpenAIVideo (43-47)
  • OpenAIVideo (16-31)
  • OpenAIVideoError (49-52)
model/task.go (3)
  • Task (42-61)
  • Task (250-254)
  • Task (256-260)
relay/channel/task/sora/adaptor.go (3)
relay/channel/task/jimeng/adaptor.go (1)
  • TaskAdaptor (71-76)
model/task.go (3)
  • Task (42-61)
  • Task (250-254)
  • Task (256-260)
dto/openai_video.go (1)
  • OpenAIVideo (16-31)
relay/channel/task/kling/adaptor.go (1)
dto/openai_video.go (3)
  • NewOpenAIVideo (43-47)
  • OpenAIVideo (16-31)
  • OpenAIVideoError (49-52)
model/task.go (1)
dto/openai_video.go (5)
  • VideoStatusQueued (10-10)
  • VideoStatusInProgress (11-11)
  • VideoStatusCompleted (12-12)
  • VideoStatusFailed (13-13)
  • VideoStatusUnknown (9-9)
relay/channel/task/vidu/adaptor.go (2)
dto/openai_video.go (3)
  • NewOpenAIVideo (43-47)
  • OpenAIVideo (16-31)
  • OpenAIVideoError (49-52)
model/task.go (3)
  • Task (42-61)
  • Task (250-254)
  • Task (256-260)
🔇 Additional comments (12)
dto/openai_video.go (1)

1-1: LGTM: Clean package refactoring.

The package declaration change from common to dto is straightforward and aligns with the PR objective to reorganize the OpenAI video model.

model/task.go (2)

9-9: LGTM: Import added for dto package.

The dto import is correctly added to support the updated status constant references.


15-30: LGTM: Status mapping correctly updated.

All status constant references have been properly updated from commonRelay.* to dto.*, maintaining the same mapping logic.

relay/channel/adapter.go (1)

55-57: LGTM: Interface signature updated.

The OpenAIVideoConverter interface correctly reflects the return type change from *relaycommon.OpenAIVideo to *dto.OpenAIVideo, aligning with the package refactoring.

relay/channel/task/sora/adaptor.go (1)

189-196: LGTM: Implementation correctly updated.

The ConvertToOpenAIVideo method signature and internal type usage have been properly updated to use dto.OpenAIVideo, maintaining the same unmarshaling logic.

relay/channel/task/jimeng/adaptor.go (2)

161-167: LGTM: DoResponse correctly updated.

The instantiation has been properly updated to use dto.NewOpenAIVideo() instead of relaycommon.NewOpenAIVideo().


408-430: LGTM: ConvertToOpenAIVideo correctly refactored.

The method signature, internal instantiation via dto.NewOpenAIVideo(), and error type dto.OpenAIVideoError have all been consistently updated to use the dto package.

relay/channel/task/vidu/adaptor.go (2)

158-164: LGTM: DoResponse correctly updated.

The instantiation has been properly updated to use dto.NewOpenAIVideo().


266-291: LGTM: ConvertToOpenAIVideo correctly refactored.

All dto package references are consistent: dto.NewOpenAIVideo() for instantiation, *dto.OpenAIVideo for return type, and dto.OpenAIVideoError for error type.

relay/channel/task/kling/adaptor.go (3)

191-197: LGTM: DoResponse correctly updated.

The instantiation has been properly updated to use dto.NewOpenAIVideo().


370-401: LGTM: ConvertToOpenAIVideo correctly refactored.

All dto package references are consistent throughout the implementation.


370-401: No stale relaycommon.OpenAIVideo references remain. All instances of the old types and factory calls have been removed; dto.OpenAIVideo and dto.OpenAIVideoError are used throughout.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xyfacai
xyfacai merged commit 9805b0f into QuantumNous:main Oct 13, 2025
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
refactor: Openai video model 移动到 dto
jiutubaba pushed a commit to jiutubaba/fx-api that referenced this pull request May 17, 2026
…te-limit-reset

fix(api-key): reset rate limit usage cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant