feat: add kling video new params support
for example: image_tail,negative_prompt,camera_control
This commit is contained in:
@@ -38,15 +38,46 @@ type SubmitReq struct {
|
|||||||
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TrajectoryPoint struct {
|
||||||
|
X int `json:"x"`
|
||||||
|
Y int `json:"y"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DynamicMask struct {
|
||||||
|
Mask string `json:"mask,omitempty"`
|
||||||
|
Trajectories []TrajectoryPoint `json:"trajectories,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CameraConfig struct {
|
||||||
|
Horizontal float64 `json:"horizontal,omitempty"`
|
||||||
|
Vertical float64 `json:"vertical,omitempty"`
|
||||||
|
Pan float64 `json:"pan,omitempty"`
|
||||||
|
Tilt float64 `json:"tilt,omitempty"`
|
||||||
|
Roll float64 `json:"roll,omitempty"`
|
||||||
|
Zoom float64 `json:"zoom,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CameraControl struct {
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
|
Config *CameraConfig `json:"config,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type requestPayload struct {
|
type requestPayload struct {
|
||||||
Prompt string `json:"prompt,omitempty"`
|
Prompt string `json:"prompt,omitempty"`
|
||||||
Image string `json:"image,omitempty"`
|
Image string `json:"image,omitempty"`
|
||||||
|
ImageTail string `json:"image_tail,omitempty"`
|
||||||
|
NegativePrompt string `json:"negative_prompt,omitempty"`
|
||||||
Mode string `json:"mode,omitempty"`
|
Mode string `json:"mode,omitempty"`
|
||||||
Duration string `json:"duration,omitempty"`
|
Duration string `json:"duration,omitempty"`
|
||||||
AspectRatio string `json:"aspect_ratio,omitempty"`
|
AspectRatio string `json:"aspect_ratio,omitempty"`
|
||||||
ModelName string `json:"model_name,omitempty"`
|
ModelName string `json:"model_name,omitempty"`
|
||||||
Model string `json:"model,omitempty"` // Compatible with upstreams that only recognize "model"
|
Model string `json:"model,omitempty"` // Compatible with upstreams that only recognize "model"
|
||||||
CfgScale float64 `json:"cfg_scale,omitempty"`
|
CfgScale float64 `json:"cfg_scale,omitempty"`
|
||||||
|
StaticMask string `json:"static_mask,omitempty"`
|
||||||
|
DynamicMasks []DynamicMask `json:"dynamic_masks,omitempty"`
|
||||||
|
CameraControl *CameraControl `json:"camera_control,omitempty"`
|
||||||
|
CallbackUrl string `json:"callback_url,omitempty"`
|
||||||
|
ExternalTaskId string `json:"external_task_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type responsePayload struct {
|
type responsePayload struct {
|
||||||
@@ -231,6 +262,11 @@ func (a *TaskAdaptor) convertToRequestPayload(req *SubmitReq) (*requestPayload,
|
|||||||
ModelName: req.Model,
|
ModelName: req.Model,
|
||||||
Model: req.Model, // Keep consistent with model_name, double writing improves compatibility
|
Model: req.Model, // Keep consistent with model_name, double writing improves compatibility
|
||||||
CfgScale: 0.5,
|
CfgScale: 0.5,
|
||||||
|
StaticMask: "",
|
||||||
|
DynamicMasks: []DynamicMask{},
|
||||||
|
CameraControl: nil,
|
||||||
|
CallbackUrl: "",
|
||||||
|
ExternalTaskId: "",
|
||||||
}
|
}
|
||||||
if r.ModelName == "" {
|
if r.ModelName == "" {
|
||||||
r.ModelName = "kling-v1"
|
r.ModelName = "kling-v1"
|
||||||
|
|||||||
Reference in New Issue
Block a user