fix(image): 修复图片生成和编辑请求中尺寸参数传递问题

- 添加 resolveRequestSize 函数处理尺寸参数解析逻辑
- 将 pixelSize 变量重命名为 requestSize 以提高代码可读性
- 修复当尺寸为 auto 时不发送 size 参数的功能
- 确保所有非 auto 尺寸值都会正确传递到请求中
- 更新图片生成和编辑函数中的尺寸参数处理逻辑
This commit is contained in:
HouYunFei
2026-05-26 11:26:27 +08:00
parent 778fd065ec
commit 9754af3bf9
8 changed files with 427 additions and 392 deletions
+2 -1
View File
@@ -53,10 +53,11 @@ export async function requestVideoGeneration(config: AiConfig, prompt: string, r
function normalizeVideoSeconds(value: string) {
const seconds = Math.floor(Number(value) || 6);
return String([6, 10, 12, 16, 20].includes(seconds) ? seconds : 6);
return String(Math.max(1, Math.min(20, seconds)));
}
function normalizeVideoSize(value: string) {
if (value === "auto") return null;
const size = value || "1280x720";
if (/^\d+x\d+$/.test(size)) return size;
return ["9:16", "2:3", "3:4"].includes(size) ? "720x1280" : "1280x720";