From c3c5bfff45f07d3606bfb84cadbbde9ab9aadb50 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 8 Mar 2026 18:47:16 -0400 Subject: [PATCH] fix aspect error issues --- .../enqueue_image_to_video_command.rs | 2 +- .../promptbox/src/lib/PromptBoxVideo.tsx | 21 ++++++++++++------- .../model-list/src/lib/classes/VideoModel.ts | 8 +++++++ .../model-list/src/lib/lists/VideoModels.ts | 3 +++ 4 files changed, 26 insertions(+), 8 deletions(-) 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 c426bbc14c..b842da7b2f 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 @@ -15,6 +15,7 @@ use crate::core::events::generation_events::generation_enqueue_failure_event::Ge use crate::core::events::generation_events::generation_enqueue_success_event::GenerationEnqueueSuccessEvent; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::core::state::artcraft_usage_tracker::artcraft_usage_tracker::ArtcraftUsageTracker; +use crate::core::state::artcraft_usage_tracker::artcraft_usage_type::{ArtcraftUsagePage, ArtcraftUsageType}; use crate::core::state::data_dir::app_data_root::AppDataRoot; use crate::core::state::provider_priority::{Provider, ProviderPriorityStore}; use crate::core::state::task_database::TaskDatabase; @@ -29,7 +30,6 @@ use log::{error, info, warn}; use serde_derive::{Deserialize, Serialize}; use tauri::{AppHandle, State}; use tokens::tokens::media_files::MediaFileToken; -use crate::core::state::artcraft_usage_tracker::artcraft_usage_type::{ArtcraftUsagePage, ArtcraftUsageType}; /// This is used in the Tauri command bridge. /// Don't change the serializations without coordinating with the frontend. diff --git a/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx b/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx index a5ef61906b..859fd9fe8a 100644 --- a/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx +++ b/frontend/libs/components/promptbox/src/lib/PromptBoxVideo.tsx @@ -469,16 +469,23 @@ export const PromptBoxVideo = ({ request.sora_orientation = resolution === "720p" ? "landscape" : "portrait"; break; + } - case "seedance_2p0": { - const selectedOption = selectedModel.sizeOptions?.find( - (option) => option.textLabel === aspectRatio, - ); - if (selectedOption) { + if (selectedModel.supportsCommonAspectRatio) { + // NB: This should be the *new* aspect ratio behavior for all models. + const selectedOption = selectedModel.sizeOptions?.find( + (option) => option.textLabel === aspectRatio, + ); + + if (selectedOption) { + request.aspect_ratio = + selectedOption.tauriValue as typeof request.aspect_ratio; + } else { + const maybeDefault = selectedModel.sizeOptions[0]; + if (!!maybeDefault) { request.aspect_ratio = - selectedOption.tauriValue as typeof request.aspect_ratio; + maybeDefault.tauriValue as typeof request.aspect_ratio; } - break; } } diff --git a/frontend/libs/model-list/src/lib/classes/VideoModel.ts b/frontend/libs/model-list/src/lib/classes/VideoModel.ts index 31f5064e57..ead21c7a60 100644 --- a/frontend/libs/model-list/src/lib/classes/VideoModel.ts +++ b/frontend/libs/model-list/src/lib/classes/VideoModel.ts @@ -41,6 +41,12 @@ export class VideoModel extends Model { // Available resolution options (e.g. ["480p", "720p"]) readonly resolutionOptions?: string[]; + // Whether the model supports using the CommonAspectRatio enum + // We're just using this to select how to propagate aspect ratios + // to the more recent models. + // NB: Soon all the models will support this. + readonly supportsCommonAspectRatio: boolean; + // Default resolution readonly defaultResolution?: string; @@ -71,6 +77,7 @@ export class VideoModel extends Model { resolutionOptions?: string[]; defaultResolution?: string; supportsSystemPrompt?: boolean; + supportsCommonAspectRatio?: boolean; }) { super(args); this.startFrame = args.startFrame; @@ -85,5 +92,6 @@ export class VideoModel extends Model { this.resolutionOptions = args.resolutionOptions; this.defaultResolution = args.defaultResolution; this.supportsSystemPrompt = args.supportsSystemPrompt ?? true; + this.supportsCommonAspectRatio = args.supportsCommonAspectRatio ?? false; } } diff --git a/frontend/libs/model-list/src/lib/lists/VideoModels.ts b/frontend/libs/model-list/src/lib/lists/VideoModels.ts index 4946c5160f..c90d000528 100644 --- a/frontend/libs/model-list/src/lib/lists/VideoModels.ts +++ b/frontend/libs/model-list/src/lib/lists/VideoModels.ts @@ -140,6 +140,7 @@ export const VIDEO_MODELS: VideoModel[] = [ icon: SizeIconOption.Portrait9x16, }, ], + supportsCommonAspectRatio: true, durationOptions: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], defaultDuration: 5, progressBarTime: 100000, @@ -174,6 +175,7 @@ export const VIDEO_MODELS: VideoModel[] = [ icon: SizeIconOption.Portrait9x16, }, ], + supportsCommonAspectRatio: true, durationOptions: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], defaultDuration: 5, progressBarTime: 100000, @@ -283,6 +285,7 @@ export const VIDEO_MODELS: VideoModel[] = [ icon: SizeIconOption.Portrait9x16, }, ], + supportsCommonAspectRatio: true, durationOptions: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], defaultDuration: 5, supportsReferenceMode: true,