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.

Regenerate: MiniMax H3's 2K on your GPU, Finish in 2K on your GPU, Enhance and Faceless's Regenerate stay held with it

Claude3315f811f520
diff --git a/src/components/cinema/cinema-feed.tsx b/src/components/cinema/cinema-feed.tsx
index a147c521..ad6866cf 100644
--- a/src/components/cinema/cinema-feed.tsx
+++ b/src/components/cinema/cinema-feed.tsx
@@ -58,7 +58,7 @@ import type { CinemaFolder } from "@/lib/catalog/cinema";
import type { Generation, OutputFile } from "@/lib/catalog/types";
import { formatCost, timeAgo } from "@/lib/format";
import { useEngineMode, useLikelyVisitor } from "@/lib/api";
-import { finishedTakes, finishIn2k } from "@/lib/catalog/regenerate";
+import { finishedTakes, finishIn2k, REGEN_OFFERED } from "@/lib/catalog/regenerate";
import { useSubmitGuard } from "@/components/shorts/hooks";
import { cn } from "@/lib/utils";
import { copyWithToast } from "@/lib/clipboard";
@@ -206,7 +206,9 @@ function TileMenu({ u, folders, projectId, handlers, onDelete }: { u: Unit; fold
const elsewhere = foreign(u.g, projectId);
// Finish in 2K: a MiniMax H3 take below 2K (fal renders it again at 2K; your GPU redraws it with Open-H3 Regenerate),
// once: not on a take whose 2K finish is under way or made (a 2K run's own 768p draft included).
- const finish = o?.kind === "video" && !u.tile && !finished.has(u.g.id) ? finishIn2k(u.g, engineMode) : null;
+ // A take from your GPU is finished by Open-H3 Regenerate (perSecond null): offered only while Regenerate is.
+ const offered = o?.kind === "video" && !u.tile && !finished.has(u.g.id) ? finishIn2k(u.g, engineMode) : null;
+ const finish = offered && (offered.perSecond !== null || REGEN_OFFERED) ? offered : null;
const seconds = Number(u.g.request.params?.duration ?? 0);
const finishPrice = !finish ? "" : finish.perSecond === null ? "Free" : seconds > 0 ? `≈ ${formatCost(finish.perSecond * seconds)}` : `$${finish.perSecond.toFixed(2)}/s`;
return (
diff --git a/src/components/shorts/session-view.tsx b/src/components/shorts/session-view.tsx
index 92f65b45..4b7f3823 100644
--- a/src/components/shorts/session-view.tsx
+++ b/src/components/shorts/session-view.tsx
@@ -23,7 +23,7 @@ import { MediaThumb } from "@/components/studio/result-media";
import { radioKeys, radioTab } from "@/components/studio/radio-keys";
import { Viewer } from "@/components/studio/viewer";
import { chainState, ENHANCE_COPY, formatSeconds, segmentSeconds, stitchCurrent, stitchSteps, takeSteps, type ChainState, type ShortsSessionSegment } from "@/lib/catalog/shorts";
-import { finishLengthProblem } from "@/lib/catalog/regenerate";
+import { finishLengthProblem, REGEN_OFFERED } from "@/lib/catalog/regenerate";
import { useEngineMode } from "@/lib/api";
import type { Generation } from "@/lib/catalog/types";
import { formatCost, ratioValue, timeAgo } from "@/lib/format";
@@ -255,7 +255,7 @@ function Session({ s }: { s: View }) {
onRegenerate={() => regenerate(i)}
regenerating={actions.regenerate.isPending && actions.regenerate.variables?.index === i}
busy={actions.regenerate.isPending}
- enhanceable={s.engine === "open" && engineMode !== "cloud"}
+ enhanceable={REGEN_OFFERED && s.engine === "open" && engineMode !== "cloud"}
onEnhance={() => enhance(i)}
enhancing={actions.enhance.isPending && actions.enhance.variables?.index === i}
onPrimary={(gid) => actions.primary.mutate({ index: i, generationId: gid }, { onError: (e) => toastError(e) })}
@@ -263,7 +263,7 @@ function Session({ s }: { s: View }) {
))}
</div>
{/* A cloud short: Enhance (H3 regenerate) needs your GPU, said once rather than on every segment. */}
- {s.engine === "cloud" && engineMode !== "cloud" && <p className="text-[12px] text-muted-foreground">{ENHANCE_COPY.cloudSession}.</p>}
+ {REGEN_OFFERED && s.engine === "cloud" && engineMode !== "cloud" && <p className="text-[12px] text-muted-foreground">{ENHANCE_COPY.cloudSession}.</p>}
</section>
</div>
{open && <Viewer generation={open} index={0} onClose={() => setOpen(null)} />}
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index de15da60..b4c2cce1 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -672,8 +672,8 @@ const open: ModelDef[] = [
durations: [3, 5, 10, 15],
resolutions: ["768p"],
// 2K in the Video studio and Cinema only: a 768p draft, then Open-H3 Regenerate at 2K from it (from its latent for
- // text to video), on your GPU (n7-10).
- finishTiers: ["2K"],
+ // text to video), on your GPU. Offered while Regenerate is (REGEN_OFFERED).
+ ...(REGEN_OFFERED && { finishTiers: ["2K"] }),
seed: true,
endFrame: true,
audio: "always",
diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.ts
index 718c0ebd..bc052bab 100644
--- a/src/lib/output-actions.ts
+++ b/src/lib/output-actions.ts
@@ -277,7 +277,7 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =
if (canRerender(g, ctx.engineMode)) out.push({ id: "rerender-2k", label: rerenderLabel(g.modelId), placement: "menu" });
else if (REGEN_OFFERED && (g.engine === "open" || g.feature === "upload") && ctx.engineMode !== "cloud") out.push({ id: "regenerate", label: "Regenerate in 2K", placement: "menu", href: regenerateHref(o.url, g.feature === "upload" ? null : g.request.prompt) });
// An Edit video result (up to 15 s): redrawn at 1080p on your GPU, from the edit's own words.
- if (canEnhance(g, o, ctx.engineMode)) out.push({ id: "enhance-h3", label: ENHANCE_LABEL, placement: "menu" });
+ if (REGEN_OFFERED && canEnhance(g, o, ctx.engineMode)) out.push({ id: "enhance-h3", label: ENHANCE_LABEL, placement: "menu" });
}
if (ctx.compare) out.push({ id: "compare", label: "Compare with original", placement: "menu" });
if (ctx.reuse) out.push({ id: "reuse", label: "Reuse settings", placement: "menu" });
diff --git a/src/server/cinema.ts b/src/server/cinema.ts
index a6478e96..796393a7 100644
--- a/src/server/cinema.ts
+++ b/src/server/cinema.ts
@@ -2,7 +2,7 @@ import "server-only";
import { nanoid } from "nanoid";
import { getModel } from "@/lib/catalog";
import type { CinemaFolder, CinemaItem, CinemaProject, CinemaTakeInfo, CinemaTile, DirectorMessage, DirectorSettings } from "@/lib/catalog/cinema";
-import { finishIn2k } from "@/lib/catalog/regenerate";
+import { finishIn2k, REGEN_OFFERED } from "@/lib/catalog/regenerate";
import type { Generation, GenerationRequest } from "@/lib/catalog/types";
import { db } from "./db";
import { ConnectComfyError, createGenerations, getGeneration, listGenerations, previewChained, previewGeneration, toGeneration } from "./generations";
@@ -714,7 +714,9 @@ export function finishTake(projectId: string, generationId: string): Generation[
const row = itemRow(projectId, generationId);
const g = row ? liveGeneration(generationId) : null;
if (!row || !g) throw new CinemaError("That take isn't in this project", 404);
- const finish = finishIn2k(g, engineMode());
+ // A take from your GPU is finished by Open-H3 Regenerate (perSecond null): only while it is offered (REGEN_OFFERED).
+ const offered = finishIn2k(g, engineMode());
+ const finish = offered && (offered.perSecond !== null || REGEN_OFFERED) ? offered : null;
if (!finish) throw new CinemaError("Finish in 2K is for finished MiniMax H3 takes made below 2K", 422);
// Once per take: a 2K finish under way or made (this action's, or the 2K run's own finish of its draft) isn't repeated.
if (finishedIn2k(generationId)) throw new CinemaError("This take already has a 2K finish", 409);
diff --git a/src/server/faceless.ts b/src/server/faceless.ts
index 03377694..669c789d 100644
--- a/src/server/faceless.ts
+++ b/src/server/faceless.ts
@@ -85,6 +85,7 @@ import {
} from "@/lib/catalog/faceless";
import { routesFor } from "@/lib/catalog/plan";
import { pricingAt } from "@/lib/catalog/promo";
+import { REGEN_OFFERED } from "@/lib/catalog/regenerate";
import type { Engine, Generation, GenerationRequest } from "@/lib/catalog/types";
import { DocxError, docxText } from "./assist/docx";
import { PdfError, pdfText } from "./assist/pdf";
@@ -1144,7 +1145,8 @@ export function upscaleEpisode(id: string): FacelessEpisode {
/** "Regenerate to 1080p" on this episode: offered on the open engine once the film is done (null otherwise). */
function regenerateOffer(ep: FacelessEpisode, scenes: number): EpisodeView["regenerate"] {
const modelId = ENGINE_MODELS[ep.settings.engine].regenerate;
- if (!modelId || !getModel(modelId)) return null;
+ // Open-H3 Regenerate is held until it has run on a card that fits it (REGEN_OFFERED).
+ if (!REGEN_OFFERED || !modelId || !getModel(modelId)) return null;
let demo = false;
try {
demo = runsAsDemo(modelId, "upscale-video");
diff --git a/tests/faceless-api.test.ts b/tests/faceless-api.test.ts
index b02ac44d..1e4a38b6 100644
--- a/tests/faceless-api.test.ts
+++ b/tests/faceless-api.test.ts
@@ -12,6 +12,7 @@ const { setSetting } = await import("@/server/settings");
const { db } = await import("@/server/db");
const gens = await import("@/server/generations");
const faceless = await import("@/server/faceless");
+const { REGEN_OFFERED } = await import("@/lib/catalog/regenerate");
const channelsRoute = await import("@/app/api/faceless/channels/route");
const channelRoute = await import("@/app/api/faceless/channels/[id]/route");
const topicsRoute = await import("@/app/api/faceless/topics/route");
@@ -256,7 +257,8 @@ describe("Episodes", () => {
// Regenerate to 1080p (open engine only): every scene redrawn by Open-H3 Regenerate, joined and mixed again with the
// episode's own narration and subtitles timing; the cloud shows no Regenerate.
expect(doneCloud.regenerate).toBeNull();
- expect(doneOpen.regenerate).toEqual({ scenes: 6, demo: true });
+ // Offered on the open engine while Regenerate is (REGEN_OFFERED, held for now); the action itself runs either way.
+ expect(doneOpen.regenerate).toEqual(REGEN_OFFERED ? { scenes: 6, demo: true } : null);
expect((await actionRoute.POST(json("POST"), params({ id: cloudId, action: "regenerate" }))).status).toBe(422);
const regenOpen: EpisodeView = await (await actionRoute.POST(json("POST"), params({ id: openId, action: "regenerate" }))).json();
const rIds = regenOpen.episode.plan!.regenerated!.ids;
diff --git a/tests/regenerate-more-api.test.ts b/tests/regenerate-more-api.test.ts
index e8775732..9b216785 100644
--- a/tests/regenerate-more-api.test.ts
+++ b/tests/regenerate-more-api.test.ts
@@ -8,6 +8,9 @@ import type { Generation, GenerationRequest, GenInput } from "@/lib/catalog/type
// GPU (a 768p draft that keeps its latent, then the 2K finish from it), Finish in 2K on a take, Cinema's tiers, Edit video's
// Enhance with RIFE first for a 16 fps clip, and what an account may read.
vi.setConfig({ testTimeout: 120_000 });
+// Regenerate is switched off for now (REGEN_OFFERED); these tests check it as it runs once switched on.
+// tests/regenerate-offered.test.ts checks that nothing offers it while it is off.
+vi.mock("@/lib/catalog/regenerate", async (importOriginal) => ({ ...(await importOriginal<typeof import("@/lib/catalog/regenerate")>()), REGEN_OFFERED: true }));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-regen-more-"));
process.env.FUOBE_DATA_DIR = dir;
diff --git a/tests/regenerate-more-hosted.test.ts b/tests/regenerate-more-hosted.test.ts
index c9a58d19..c946a2d8 100644
--- a/tests/regenerate-more-hosted.test.ts
+++ b/tests/regenerate-more-hosted.test.ts
@@ -2,13 +2,16 @@ import fs from "node:fs";
import http from "node:http";
import os from "node:os";
import path from "node:path";
-import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
+import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { listenInRange, startFakeBilling, type FakeBilling } from "./helpers/fake-billing";
import { startFakeComfy, type FakeComfy } from "./helpers/fake-comfy-runner";
// MiniMax H3 at 2K with hosted runs on (review 6 of package n7-10): an account's 2K run on this install's GPUs is planned
// and priced with each take's Open-H3 Regenerate finish beside its 768p draft, and a policy that keeps the finish's model
// off those GPUs keeps the whole run off, priced or run.
+// Regenerate is switched off for now (REGEN_OFFERED); these tests check it as it runs once switched on.
+// tests/regenerate-offered.test.ts checks that nothing offers it while it is off.
+vi.mock("@/lib/catalog/regenerate", async (importOriginal) => ({ ...(await importOriginal<typeof import("@/lib/catalog/regenerate")>()), REGEN_OFFERED: true }));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-regen-hosted-"));
process.env.FUOBE_DATA_DIR = dir;
process.env.FUOBE_PUBLIC_SIGNUP = "1";