Kling 节点接入官方 4.0 / Flash(文生/图生/Omni)

This commit is contained in:
Jony
2026-11-10 12:50:52 +08:00
parent b4ddd35a6c
commit af300996b9
8 changed files with 974 additions and 179 deletions
+15 -8
View File
@@ -87,18 +87,25 @@ invalid model, duration, resolution, mode, media count, or edit clip length
cannot consume an upload or paid generation request. Saved workflows retain the
`O1keyGrokVideo` ID and are migrated according to [ADR 0006](decisions/0006-grok-video-api-and-workflow-migration.md).
`K3Video` keeps its released node ID and appends a `v4` DynamicCombo branch. The
branch adds a generation-mode selector with text-to-video, keyframes, and Omni
`K3Video` keeps its released node ID and appends `v4` and `v4-flash`
DynamicCombo branches, displayed as `Kling 4.0` and `Kling 4.0 Flash`. The
branches add a generation-mode selector with text-to-video, keyframes, and Omni
reference paths. Existing v3/v2.6/v3-omni branches retain their original
DynamicCombo option order and positional widgets. Kling 4.0 keyframe sockets
and additional Omni reference sockets are appended after the released widget
block, so saved workflows do not shift their values. `clients/kling_video_client.py`
owns the v4 capability checks and builds the proxy-compatible `model_name`,
resolution `mode`, `aspect_ratio`, and `metadata` fields; the node reuses the
existing R2 upload and interruption-aware task lifecycle. Keyframes use
`metadata.first_frame`, `metadata.middle_frames`, and `metadata.last_frame`;
Omni references use `metadata.refer_images` and `metadata.videos`. The shared
video result parser also accepts Kling 4.0's `output.media[].url` envelope.
owns the official 4.0 / Flash capability checks and builds `contents`,
`settings`, and `options` bodies; the model is taken from the path
(`/kling/text-to-video/kling-4.0`, `/kling/image-to-video/kling-4.0`,
`/kling/omni-video/kling-4.0`, or the `kling-4.0-flash` variants) and is never
sent in the request body. Flash accepts only `720p` and 3–20 second durations,
and the frontend clamps a leftover 1080p value when switching from 4.0.
Keyframes omit `settings.aspect_ratio`; text defaults to `16:9` and Omni to
`adaptive`. The node reuses R2 upload and interruption-aware downloads, but
polls the official `{code, message, request_id, data}` envelope, reads
`data.id` as the task id, and takes the result from `data[].outputs[].url`
rather than the 3.0 Omni `video_url` parser. `K3MotionControl` remains a 3.0
motion-control path only.
### Shared utilities