mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
fix aspect error issues
This commit is contained in:
1 parent
19c223d5d5
commit
c3c5bfff45
4 files changed
+26
-8
No files matched your search
+1
-1
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user