Skip to content

fix: KlingText2VideoRequest image and model_name - #1349

Merged
Calcium-Ion merged 1 commit into
QuantumNous:alphafrom
feitianbubu:pr/fix-kling-image-mode-name
Jul 18, 2025
Merged

Calcium-Ion merged 1 commit into
QuantumNous:alphafrom
feitianbubu:pr/fix-kling-image-mode-name

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Jul 9, 2025 •

Copy link
Copy Markdown
Member
  1. 修复没有image时没区分到文生视频问题
  2. model改为model_name跟官方参数格式一致
  3. 增加可灵官方请求格式结构体定义

Summary by CodeRabbit

  • New Features

    • Introduced new API endpoints for video generation, including generic and Kling AI-specific text-to-video and image-to-video services.
    • Added detailed API documentation for all new endpoints, outlining request parameters, response types, and error codes.
  • Refactor

    • Improved request handling logic for Kling AI services to better distinguish between text and image-based video generation requests.

feat: add video channel kling swag
@coderabbitai

coderabbitai Bot commented Jul 9, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A new Go controller file introduces HTTP handler stubs and request data structures for various video generation APIs, annotated with Swagger for documentation. Additionally, a middleware function is updated to extract the model identifier from a different request key and refines its logic for determining the action based on the presence of an image field.

Changes

File(s) Change Summary
controller/swag_video.go Added new file with HTTP handler stubs for video generation APIs, Swagger annotations, and request structs.
middleware/kling_adapter.go Modified middleware to extract model from "model_name" instead of "model" and updated image field logic.

Poem

In the warren of code, new videos appear,
Swagger docs guide us, the endpoints are clear.
Middleware sniffs for "model_name" anew,
Empty handlers await what devs will do.
From prompt or from image, let Kling magic flow—
A hop, a skip, and off to video we go!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@feitianbubu

Copy link
Copy Markdown
Member Author

1752046731003_d
自测通过

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
controller/swag_video.go (4)

23-24: Empty handler function needs implementation.

The VideoGenerations handler function is currently empty. Consider adding a TODO comment or implementation placeholder to track this.

Would you like me to generate a basic implementation structure or create an issue to track this task?


40-41: Empty handler function needs implementation.

The VideoGenerationsTaskId handler function is currently empty. Consider adding a TODO comment or implementation placeholder to track this.

Would you like me to generate a basic implementation structure or create an issue to track this task?


57-58: Empty handler function needs implementation.

The KlingText2VideoGenerations handler function is currently empty. Consider adding a TODO comment or implementation placeholder to track this.

Would you like me to generate a basic implementation structure or create an issue to track this task?


101-102: Empty handler function needs implementation.

The KlingImage2VideoGenerations handler function is currently empty. Consider adding a TODO comment or implementation placeholder to track this.

Would you like me to generate a basic implementation structure or create an issue to track this task?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78fb457 and 4196a3d.

📒 Files selected for processing (2)
  • controller/swag_video.go (1 hunks)
  • middleware/kling_adapter.go (2 hunks)
🔇 Additional comments (5)
middleware/kling_adapter.go (2)

21-21: LGTM! Parameter name aligned with official API format.

The change from "model" to "model_name" correctly aligns with the official Kling API parameter format as mentioned in the PR objectives.


39-39: Improved logic for distinguishing text-to-video requests.

The enhanced condition !ok || image == "" correctly handles both cases:

  • When the image key is missing from the request (!ok)
  • When the image key exists but is empty (image == "")

This fix addresses the issue where the system didn't correctly distinguish text-to-video requests when no image was provided.

controller/swag_video.go (3)

60-71: Well-structured request type with proper field validation.

The KlingText2VideoRequest struct is well-designed with:

  • Correct use of model_name field aligning with API changes
  • Proper JSON tags and validation (e.g., binding:"required" for prompt)
  • Comprehensive field coverage for the Kling API
  • Good example values in struct tags

73-85: Camera control structures are well-defined.

The KlingCameraControl and KlingCameraConfig structs properly model the camera movement parameters with appropriate field types and example values.


104-116: Consistent structure design for image-to-video requests.

The KlingImage2VideoRequest struct maintains consistency with the text-to-video request structure while correctly requiring the image field instead of making prompt required. This aligns well with the middleware logic changes.

@Calcium-Ion
Calcium-Ion merged commit c36c920 into QuantumNous:alpha Jul 18, 2025
x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
…ge-mode-name

fix: KlingText2VideoRequest image and model_name
jiutubaba pushed a commit to jiutubaba/fx-api that referenced this pull request May 17, 2026
…internal500-penalty

feat(antigravity): progressive penalty for consecutive INTERNAL 500 errors
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
…ge-mode-name

fix: KlingText2VideoRequest image and model_name
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
…ge-mode-name

fix: KlingText2VideoRequest image and model_name
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.

2 participants