fix(canvas): 局部重绘、图片规格与任务参数修复
This commit is contained in:
@@ -2,7 +2,7 @@ import { buildImageResolutionOptions, type ImageResolutionOption, type ImageReso
|
||||
import type { ImageCapabilityConfig } from "./model-capabilities";
|
||||
|
||||
export const IMAGE_RESOLUTIONS: ImageResolutionTier[] = ["1k", "2k", "4k"];
|
||||
export const IMAGE_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "21:9"];
|
||||
export const IMAGE_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "4:5", "5:4", "21:9"];
|
||||
const standardSizes: Record<string, string[]> = {
|
||||
"1:1": ["1024x1024", "2048x2048", "2880x2880"],
|
||||
"16:9": ["1824x1024", "2752x1536", "3840x2160"],
|
||||
@@ -11,6 +11,8 @@ const standardSizes: Record<string, string[]> = {
|
||||
"3:4": ["1024x1360", "1728x2304", "2448x3264"],
|
||||
"3:2": ["1536x1024", "2496x1664", "3504x2336"],
|
||||
"2:3": ["1024x1536", "1664x2496", "2336x3504"],
|
||||
"4:5": ["1024x1280", "1792x2240", "2560x3200"],
|
||||
"5:4": ["1280x1024", "2240x1792", "3200x2560"],
|
||||
"21:9": ["2048x878", "3136x1344", "3808x1632"],
|
||||
};
|
||||
|
||||
|
||||
@@ -896,7 +896,14 @@ function matchWorkflowValue(value: string, options: string[]) {
|
||||
|
||||
export function normalizeImageValue(profile: ImageCapabilityConfig, value: { size?: string; quality?: string; count?: string; transparentBackground?: string }) {
|
||||
const size = normalizeImageSizeSetting(profile, value.size);
|
||||
const quality = profile.quality.supported ? (value.quality && profile.quality.values.includes(value.quality) ? value.quality : profile.quality.default || "auto") : profile.quality.default || "auto";
|
||||
const requestedQuality = String(value.quality || "").trim().toLowerCase();
|
||||
const quality = profile.quality.supported
|
||||
? requestedQuality === "auto" || requestedQuality === "any"
|
||||
? "auto"
|
||||
: value.quality && profile.quality.values.includes(value.quality)
|
||||
? value.quality
|
||||
: profile.quality.default || "auto"
|
||||
: profile.quality.default || "auto";
|
||||
const count = String(Math.max(1, Math.min(profile.maxOutputs, Math.floor(Math.abs(Number(value.count)) || 1))));
|
||||
const transparentBackground = profile.transparentBackground.supported && value.transparentBackground === "true" ? "true" : "false";
|
||||
return { size, quality, count, transparentBackground };
|
||||
|
||||
Reference in New Issue
Block a user