Skip to content

feat: kling2.6 支持有声视频生成#2921

Open
feitianbubu wants to merge 1 commit intoQuantumNous:mainfrom
feitianbubu:pr/a7cc6498f63cafe56e6efeb09b47fa96e88e2ab9
Open

feat: kling2.6 支持有声视频生成#2921
feitianbubu wants to merge 1 commit intoQuantumNous:mainfrom
feitianbubu:pr/a7cc6498f63cafe56e6efeb09b47fa96e88e2ab9

Conversation

@feitianbubu
Copy link
Contributor

@feitianbubu feitianbubu commented Feb 11, 2026

https://app.klingai.com/cn/dev/document-api/apiReference/model/textToVideo
sound=on
mode=pro
image

Summary by CodeRabbit

  • New Features
    • Added support for three new Kling model variants: v2-1-master, v2-5-turbo, and v2-6
    • Introduced sound parameter configuration (v2.6+)
    • Added watermark management functionality

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Walkthrough

The Kling adaptor is enhanced to support new Kling v2.6+ features. A new WatermarkInfo struct is introduced alongside a Sound field in the request payload. The GetModelList method is updated to include additional Kling model variants (v2-1-master, v2-5-turbo, v2-6) beyond the existing ones.

Changes

Cohort / File(s) Summary
Kling Adaptor Enhancement
relay/channel/task/kling/adaptor.go
Added Sound field to requestPayload for audio control (v2.6+). Introduced new WatermarkInfo struct with Enabled bool field and integrated it into requestPayload. Expanded GetModelList() to support three new Kling v2 model variants in addition to existing v1 and v2-master models.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 Hop, hop, the Kling adaptor grows!
New sounds and watermarks now flow,
With v2 models fresh and bright,
Supporting v2.6's delight!
Features bloom where data goes! 🎬

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: kling2.6 支持有声视频生成' (feature: kling2.6 support for sound video generation) accurately reflects the main change: adding support for the kling-v2-6 model with sound generation capabilities.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
relay/channel/task/kling/adaptor.go (2)

5-5: 🛠️ Refactor suggestion | 🟠 Major

Direct encoding/json import violates coding guidelines.

This file imports encoding/json and uses json.Marshal/json.Unmarshal directly in multiple places (lines 165, 189, 276, 280, 349, 383) instead of the required wrapper functions. Line 410 already correctly uses common.Marshal. The new fields introduced in this PR (Sound, WatermarkInfo) are serialized through these non-compliant calls.

Suggested fix

Replace all direct json.Marshal/json.Unmarshal calls with common.Marshal/common.Unmarshal, and remove the encoding/json import (keeping only type references like json.RawMessage if needed — though none appear used here).

-	"encoding/json"
-	data, err := json.Marshal(body)
+	data, err := common.Marshal(body)
-	err = json.Unmarshal(responseBody, &kResp)
+	err = common.Unmarshal(responseBody, &kResp)
-	medaBytes, err := json.Marshal(metadata)
+	medaBytes, err := common.Marshal(metadata)
-	err = json.Unmarshal(medaBytes, &r)
+	err = common.Unmarshal(medaBytes, &r)
-	err := json.Unmarshal(respBody, &resPayload)
+	err := common.Unmarshal(respBody, &resPayload)
-	if err := json.Unmarshal(originTask.Data, &klingResp); err != nil {
+	if err := common.Unmarshal(originTask.Data, &klingResp); err != nil {

As per coding guidelines, "All JSON marshal/unmarshal operations MUST use the wrapper functions in common/json.go: common.Marshal(), common.Unmarshal() ... Do NOT directly import or call encoding/json in business code."


256-284: ⚠️ Potential issue | 🔴 Critical

Replace direct json.Marshal/json.Unmarshal calls with common.Marshal and common.Unmarshal wrappers.

Lines 276 and 280 use json.Marshal() and json.Unmarshal() directly. Per coding guidelines, all JSON operations must use the wrapper functions from common/json.go: common.Marshal() and common.Unmarshal(). Apply this fix to all JSON operations in this file.

The metadata unmarshal pattern for Sound and WatermarkInfo is correct — these fields are intentionally populated via the metadata pass-through mechanism, which is consistent with TaskSubmitReq.Metadata being map[string]interface{}.

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

Comments