feat(platform): 多模态创作 - 新增统一创作页、历史会话与视频参数控制

This commit is contained in:
ddCat
2026-08-02 14:52:49 +08:00
parent 0317ac5bc7
commit 64f32d3607
10 changed files with 3348 additions and 48 deletions

View File

@@ -531,14 +531,23 @@ function normalizeVideoSeconds(value: string) {
function normalizeVideoSize(value: string) {
if (value === "auto") return null;
const size = value || "1280x720";
const size = (value || "1280x720").trim().toLowerCase().replace("×", "x");
if (/^\d+x\d+$/.test(size)) return size;
return ["9:16", "2:3", "3:4"].includes(size) ? "720x1280" : "1280x720";
const ratio = size.match(/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/);
if (!ratio) return "1280x720";
const widthRatio = Number(ratio[1]);
const heightRatio = Number(ratio[2]);
if (!Number.isFinite(widthRatio) || !Number.isFinite(heightRatio) || widthRatio <= 0 || heightRatio <= 0) return "1280x720";
const aspect = widthRatio / heightRatio;
const width = aspect >= 1 ? 1280 : Math.max(256, Math.round((720 * aspect) / 2) * 2);
const height = aspect >= 1 ? Math.max(256, Math.round((1280 / aspect) / 2) * 2) : 720;
return `${width}x${height}`;
}
function normalizeVideoResolution(value: string) {
if (value === "low") return "480p";
if (value === "auto" || value === "high" || value === "medium") return "720p";
if (value.toLowerCase() === "4k") return "2160p";
const resolution = value.replace(/p$/i, "") || "720";
return `${resolution}p`;
}