Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Runs: a split batch's checks read the number of outputs asked for

Adarsha95c64294512
diff --git a/src/app/api/generations/route.ts b/src/app/api/generations/route.ts
index 8337a865..a2af77f6 100644
--- a/src/app/api/generations/route.ts
+++ b/src/app/api/generations/route.ts
@@ -100,7 +100,9 @@ function replacedRun(body: unknown, accountId: string): Replaced | Blocked | nul
if (!ids.includes(id)) ids.push(id);
let asked = 1;
try {
- asked = Math.max(1, Number((JSON.parse(row.request_json) as { params?: { numOutputs?: unknown } }).params?.numOutputs) || 1);
+ // A run split one job per output keeps the number asked for as askedOutputs (its numOutputs is the job's own).
+ const r = JSON.parse(row.request_json) as { askedOutputs?: unknown; params?: { numOutputs?: unknown } };
+ asked = Math.max(1, Number(r.askedOutputs ?? r.params?.numOutputs) || 1);
} catch {}
// Each job made its share of the outputs asked for.
const outputs = Math.min(asked, ids.length * Math.ceil(asked / Math.max(1, jobs.length)));
diff --git a/src/server/hosted-run.ts b/src/server/hosted-run.ts
index 297eb80e..b08d5822 100644
--- a/src/server/hosted-run.ts
+++ b/src/server/hosted-run.ts
@@ -281,13 +281,17 @@ export function stepsProblem(p: Policy, steps: PlannedStep[]): string | null {
*/
const madeHere3d = (s: { provider: string; op: string; modelId: string }): boolean => s.modelId === ANY_ANGLE.buildModel || poolFinishes3d(s);
-/** How many outputs each row asks for (its request's numOutputs: a run split into one job per output keeps it on each). */
+/**
+ * How many outputs each row asks for: a run split into one job per output keeps the number asked for as askedOutputs
+ * (its own params.numOutputs is that job's), otherwise its request's numOutputs.
+ */
function rowOutputs(ids: string[]): number[] {
const q = db().prepare("SELECT request_json FROM generations WHERE id = ?");
return ids.map((id) => {
const r = q.get(id) as { request_json: string } | undefined;
try {
- const n = r ? Number((JSON.parse(r.request_json) as GenerationRequest).params?.numOutputs ?? 1) : 1;
+ const req = r ? (JSON.parse(r.request_json) as GenerationRequest) : null;
+ const n = req ? Number(req.askedOutputs ?? req.params?.numOutputs ?? 1) : 1;
return Number.isFinite(n) ? n : 1;
} catch {
return 1;