diff --git a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/enqueue_image_to_video_command.rs b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/enqueue_image_to_video_command.rs index d9be8a4f94..b82cf842eb 100644 --- a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/enqueue_image_to_video_command.rs +++ b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/enqueue_image_to_video_command.rs @@ -74,18 +74,17 @@ pub struct EnqueueImageToVideoRequest { /// Text prompt used to direct the video. pub prompt: Option, - /// Optional. - pub orientation: Option, + /// OPTIONAL. + /// Only for Sora2 model currently. + pub sora_orientation: Option, } // TODO: Not sure how to handle so many different types of video (model) x (services). #[derive(Deserialize)] #[serde(rename_all = "snake_case")] -pub enum VideoOrientation { +pub enum SoraOrientation { Portrait, Landscape, - //Square, - // TODO: others... } #[derive(Serialize)] diff --git a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/sora2/handle_sora2_video_sora.rs b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/sora2/handle_sora2_video_sora.rs index 3ac70fe0ff..2cecf9a60c 100644 --- a/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/sora2/handle_sora2_video_sora.rs +++ b/crates/desktop/artcraft/src/core/commands/enqueue/image_to_video/sora2/handle_sora2_video_sora.rs @@ -1,5 +1,5 @@ use crate::core::commands::enqueue::generate_error::GenerateError; -use crate::core::commands::enqueue::image_to_video::enqueue_image_to_video_command::{EnqueueImageToVideoRequest, VideoOrientation}; +use crate::core::commands::enqueue::image_to_video::enqueue_image_to_video_command::{EnqueueImageToVideoRequest, SoraOrientation}; use crate::core::commands::enqueue::task_enqueue_success::TaskEnqueueSuccess; use crate::core::events::generation_events::common::GenerationModel; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; @@ -54,9 +54,9 @@ pub (super) async fn handle_sora2_video_sora( image_reference_media_ids = Some(result.sora_media_tokens); } - let orientation = match request.orientation { - Some(VideoOrientation::Landscape) => Orientation::Landscape, - Some(VideoOrientation::Portrait) => Orientation::Portrait, + let orientation = match request.sora_orientation { + Some(SoraOrientation::Landscape) => Orientation::Landscape, + Some(SoraOrientation::Portrait) => Orientation::Portrait, None => Orientation::Landscape, }; diff --git a/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx b/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx index 378e4dc8ae..616d33acf0 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx @@ -6,7 +6,7 @@ import { PopoverMenu, PopoverItem } from "@storyteller/ui-popover"; import { Tooltip } from "@storyteller/ui-tooltip"; import { Button, ToggleButton } from "@storyteller/ui-button"; import { Modal } from "@storyteller/ui-modal"; -import { EnqueueImageToVideo } from "@storyteller/tauri-api"; +import { EnqueueImageToVideo, EnqueueImageToVideoRequest } from "@storyteller/tauri-api"; import { faMessageXmark, faMessageCheck, @@ -194,14 +194,20 @@ export const PromptBoxVideo = ({ setIsEnqueueing(false); }, 10000); - await EnqueueImageToVideo({ + let request : EnqueueImageToVideoRequest = { model: selectedModel, image_media_token: imageMediaToken, prompt: prompt, end_frame_image_media_token: endFrameImage?.mediaToken, frontend_caller: "image_to_video", frontend_subscriber_id: subscriberId, - }); + }; + + if (selectedModel?.tauriId === "sora_2") { + request.sora_orientation = resolution === "720p" ? "landscape" : "portrait"; + } + + await EnqueueImageToVideo(request); onEnqueuePressed?.(prompt, subscriberId); diff --git a/frontend/libs/tauri-api/src/lib/enqueue/EnqueueImageToVideo.ts b/frontend/libs/tauri-api/src/lib/enqueue/EnqueueImageToVideo.ts index 6e53821d24..55129a0e64 100644 --- a/frontend/libs/tauri-api/src/lib/enqueue/EnqueueImageToVideo.ts +++ b/frontend/libs/tauri-api/src/lib/enqueue/EnqueueImageToVideo.ts @@ -31,6 +31,9 @@ export interface EnqueueImageToVideoRequest { // Optional frontend state to return later. frontend_subscriber_id?: string; + + // Optional. Orientation of the video for Sora 2. + sora_orientation?: "portrait" | "landscape"; } interface RawEnqueueImageToVideoRequest { @@ -40,6 +43,7 @@ interface RawEnqueueImageToVideoRequest { prompt?: string; frontend_caller?: string; frontend_subscriber_id?: string; + sora_orientation?: "portrait" | "landscape"; } export interface EnqueueImageToVideoError extends CommandResult { @@ -82,6 +86,10 @@ export const EnqueueImageToVideo = async ( mutableRequest.frontend_subscriber_id = request.frontend_subscriber_id; } + if (!!request.sora_orientation) { + mutableRequest.sora_orientation = request.sora_orientation; + } + const result = await invoke("enqueue_image_to_video_command", { request: mutableRequest, });