feat: add guarded image generation controls

This commit is contained in:
john
2026-07-20 07:37:43 +08:00
parent 72ed4dde83
commit 105a72c1f1
19 changed files with 482 additions and 23 deletions
+2 -2
View File
@@ -52,7 +52,7 @@ export function createImageMakeClient({
token,
fetchImpl = globalThis.fetch,
requestTimeoutMs = 15_000,
generationTimeoutMs = 10 * 60_000,
generationTimeoutMs = 15 * 60_000,
pollIntervalMs = 1_000,
maxResultBytes = DEFAULT_MAX_RESULT_BYTES,
sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
@@ -62,7 +62,7 @@ export function createImageMakeClient({
const bearerToken = String(token ?? '').trim();
if (!bearerToken) throw new Error('image_make token is required');
const perRequestTimeout = positiveInteger(requestTimeoutMs, 15_000);
const overallTimeout = positiveInteger(generationTimeoutMs, 10 * 60_000);
const overallTimeout = positiveInteger(generationTimeoutMs, 15 * 60_000);
const pollingDelay = positiveInteger(pollIntervalMs, 1_000);
const resultLimit = positiveInteger(maxResultBytes, DEFAULT_MAX_RESULT_BYTES);