duration param

This commit is contained in:
Brandon Thomas committed 2025-06-16 21:51:22 -04:00
1 parent 47e18ae3f8
commit bafafaae2e
3 files changed
+24 -5

No files matched your search

@@ -17,11 +17,15 @@ pub struct GenerateKling16ProImageToVideoRequest {
/// Optional text prompt.
pub prompt: Option<String>,
/// Optional: apsect ratio of the generated video.
/// Optional: aspect ratio of the generated video.
pub aspect_ratio: Option<GenerateKling16ProAspectRatio>,
/// Optional: aspect ratio of the generated video.
pub duration: Option<GenerateKling16ProDuration>,
}
#[derive(Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum GenerateKling16ProAspectRatio {
/// 16:9 aspect ratio
WideSixteenNine,
@@ -31,6 +35,13 @@ pub enum GenerateKling16ProAspectRatio {
Square,
}
#[derive(Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum GenerateKling16ProDuration {
FiveSeconds,
TenSeconds,
}
#[derive(Serialize, Deserialize, ToSchema)]
pub struct GenerateKling16ProImageToVideoResponse {
pub success: bool,
@@ -23,6 +23,7 @@ use artcraft_api_defs::generate::object::generate_hunyuan_21_image_to_3d::Genera
use artcraft_api_defs::generate::object::generate_hunyuan_2_image_to_3d::GenerateHunyuan2ImageTo3dRequest;
use artcraft_api_defs::generate::object::generate_hunyuan_2_image_to_3d::GenerateHunyuan2ImageTo3dResponse;
use artcraft_api_defs::generate::video::generate_kling_1_6_pro_image_to_video::GenerateKling16ProAspectRatio;
use artcraft_api_defs::generate::video::generate_kling_1_6_pro_image_to_video::GenerateKling16ProDuration;
use artcraft_api_defs::generate::video::generate_kling_1_6_pro_image_to_video::GenerateKling16ProImageToVideoRequest;
use artcraft_api_defs::generate::video::generate_kling_1_6_pro_image_to_video::GenerateKling16ProImageToVideoResponse;
use billing_component::stripe::http_endpoints::checkout::create::stripe_create_checkout_session_error::CreateCheckoutSessionError;
@@ -506,6 +507,7 @@ use crate::http_server::web_utils::response_success_helpers::*;
GenerateFluxPro11UltraTextToImageRequest,
GenerateFluxPro11UltraTextToImageResponse,
GenerateHunyuan21ImageTo3dRequest,
GenerateKling16ProDuration,
GenerateHunyuan21ImageTo3dResponse,
GenerateHunyuan2ImageTo3dRequest,
GenerateHunyuan2ImageTo3dResponse,
@@ -16,8 +16,8 @@ use actix_web::http::StatusCode;
use actix_web::web::Json;
use actix_web::web::Path;
use actix_web::{web, HttpRequest, HttpResponse};
use artcraft_api_defs::generate::video::generate_kling_1_6_pro_image_to_video::GenerateKling16ProImageToVideoResponse;
use artcraft_api_defs::generate::video::generate_kling_1_6_pro_image_to_video::{GenerateKling16ProAspectRatio, GenerateKling16ProImageToVideoRequest};
use artcraft_api_defs::generate::video::generate_kling_1_6_pro_image_to_video::{GenerateKling16ProDuration, GenerateKling16ProImageToVideoResponse};
use bucket_paths::legacy::typified_paths::public::media_files::bucket_file_path::MediaFileBucketPath;
use enums::common::visibility::Visibility;
use fal_client::requests::webhook::video::enqueue_kling_16_pro_image_to_video_webhook::enqueue_kling_16_pro_image_to_video_webhook;
@@ -166,12 +166,18 @@ pub async fn generate_kling_1_6_pro_video_handler(
None => Kling16ProAspectRatio::WideSixteenNine, // Default to 16:9
};
let duration = match &request.duration {
Some(GenerateKling16ProDuration::FiveSeconds) => Kling16Duration::FiveSeconds,
Some(GenerateKling16ProDuration::TenSeconds) => Kling16Duration::TenSeconds,
None => Kling16Duration::FiveSeconds,
};
let args = Kling16ProArgs {
image_url: media_links.cdn_url,
webhook_url: &server_state.fal.webhook_url,
duration: Kling16Duration::Default,
prompt: prompt,
aspect_ratio: aspect_ratio,
duration,
prompt,
aspect_ratio,
api_key: &server_state.fal.api_key,
};