fix: validate pixverse video seeds · openclaw/openclaw@4512363
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -133,6 +133,13 @@ function appendOptionalNumber(body: Record<string, unknown>, key: string, value:
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
| 136 | +function appendOptionalInt32Seed(body: Record<string, unknown>, value: unknown): void { |
| 137 | +const seed = asFiniteNumber(value); |
| 138 | +if (seed != null && Number.isSafeInteger(seed) && seed >= 0 && seed <= 2_147_483_647) { |
| 139 | +body.seed = seed; |
| 140 | +} |
| 141 | +} |
| 142 | + |
136 | 143 | function appendOptionalString(body: Record<string, unknown>, key: string, value: unknown): void { |
137 | 144 | const stringValue = normalizeOptionalString(value); |
138 | 145 | if (stringValue) { |
@@ -257,7 +264,7 @@ function buildVideoBody(
|
257 | 264 | "template_id", |
258 | 265 | asFiniteNumber(options.template_id) ?? asFiniteNumber(options.templateId), |
259 | 266 | ); |
260 | | -appendOptionalNumber(body, "seed", options.seed); |
| 267 | +appendOptionalInt32Seed(body, options.seed); |
261 | 268 | if (req.audio !== undefined) { |
262 | 269 | body.generate_audio_switch = req.audio; |
263 | 270 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。