This commit is contained in:
Brandon Thomas committed 2025-10-03 23:53:02 -04:00
1 parent 9687a7fb98
commit a3b7273b1d
4 files changed
+25 -12

No files matched your search

@@ -74,18 +74,17 @@ pub struct EnqueueImageToVideoRequest {
/// Text prompt used to direct the video.
pub prompt: Option<String>,
/// Optional.
pub orientation: Option<VideoOrientation>,
/// OPTIONAL.
/// Only for Sora2 model currently.
pub sora_orientation: Option<SoraOrientation>,
}
// 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)]
@@ -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,
};
@@ -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);
@@ -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,
});