diff --git a/.github/time/cloudflare/inference.js b/.github/time/cloudflare/inference.js index 19e33df..6689233 100644 --- a/.github/time/cloudflare/inference.js +++ b/.github/time/cloudflare/inference.js @@ -87,7 +87,7 @@ async function renderRunware(body, env) { duration: Math.max(30, Math.min(num(body.duration, 120), num(env.AUDIO_SECONDS, 120))), outputType: "URL", outputFormat: "MP3", deliveryMethod: "sync", includeCost: true, audioSettings: { bitrate: 192, channels: 2, sampleRate: 44100 }, settings: {} }; if (Number.isInteger(+body.seed) && +body.seed >= 0) task.seed = Math.min(2147483647, +body.seed); - if (typeof body.reference === "string" && /^data:audio\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/i.test(body.reference)) task.inputs = { audio: body.reference }; + if (typeof body.reference === "string" && /^data:audio\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/i.test(body.reference)) { task.inputs = { audio: body.reference }; delete task.duration; } // the reference sets the length const beats = String(body.timeSignature || "").match(/^(\d)\/(4|8)$/); // "3/4" → 3; Runware takes 2, 3, 4 or 6 beats to the bar if (beats && [2, 3, 4, 6].includes(+beats[1])) task.settings.timeSignature = +beats[1]; if (body.steps) task.steps = Math.min(20, Math.max(1, +body.steps | 0));