增加即梦图片5.0和视频2.5的能力
This commit is contained in:
1 parent
542246e4ce
commit
88a4268d40
55 files changed
+1412
-200
No files matched your search
@@ -60,12 +60,18 @@ function normalizeTemplateSettings(value: unknown): ImageTemplate["settings"] {
|
||||
const engine = normalizeImageEngine(value.engine);
|
||||
const scale = optionalScale(value.scale);
|
||||
const quality = normalizeQuality(value.quality);
|
||||
const size = normalizeSeedreamSize(value.size);
|
||||
const outputFormat = normalizeOutputFormat(value.outputFormat);
|
||||
const optimizeMode = normalizeOptimizeMode(value.optimizeMode);
|
||||
return {
|
||||
...(engine ? { engine } : {}),
|
||||
...(width && height ? { width, height } : {}),
|
||||
...(typeof value.forceSingle === "boolean" ? { forceSingle: value.forceSingle } : {}),
|
||||
...(scale !== undefined ? { scale } : {}),
|
||||
...(quality ? { quality } : {})
|
||||
...(quality ? { quality } : {}),
|
||||
...(size ? { size } : {}),
|
||||
...(outputFormat ? { outputFormat } : {}),
|
||||
...(optimizeMode ? { optimizeMode } : {})
|
||||
};
|
||||
}
|
||||
|
||||
@@ -89,7 +95,25 @@ function optionalScale(value: unknown): number | undefined {
|
||||
|
||||
function normalizeImageEngine(value: unknown): ImageTemplate["settings"]["engine"] | undefined {
|
||||
const text = optionalText(value, 20);
|
||||
if (text === "jimeng" || text === "evolink" || text === "bailian") return text;
|
||||
if (text === "jimeng" || text === "evolink" || text === "bailian" || text === "seedream") return text;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function normalizeSeedreamSize(value: unknown): ImageTemplate["settings"]["size"] | undefined {
|
||||
const text = optionalText(value, 10)?.toUpperCase();
|
||||
if (text === "1K" || text === "1.5K" || text === "2K") return text;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function normalizeOutputFormat(value: unknown): ImageTemplate["settings"]["outputFormat"] | undefined {
|
||||
const text = optionalText(value, 10)?.toLowerCase();
|
||||
if (text === "png" || text === "jpeg") return text;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function normalizeOptimizeMode(value: unknown): ImageTemplate["settings"]["optimizeMode"] | undefined {
|
||||
const text = optionalText(value, 20)?.toLowerCase();
|
||||
if (text === "standard" || text === "fast") return text;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user