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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Faceless Studio: an account's episodes offer Regenerate to 1080p, on its own GPU
Adarsh6f3fddcd7a62
diff --git a/src/app/api/faceless/episodes/[id]/[action]/route.ts b/src/app/api/faceless/episodes/[id]/[action]/route.tsindex 88ff1e10..43a82e28 100644--- a/src/app/api/faceless/episodes/[id]/[action]/route.ts+++ b/src/app/api/faceless/episodes/[id]/[action]/route.ts@@ -1,6 +1,6 @@import type { GenerationRequest } from "@/lib/catalog/types";import { asViewer, guestRun, runAccountTool, toolViewer } from "@/server/account-tool-run";-import { episodeView, graphFiles, graphToolSteps, handle, regenerateEpisode, renderEpisode, renderGraph, retryEpisode, retryGraph, rewriteEpisode, undoChange, upscaleEpisode, upscaleToolSteps } from "@/server/faceless";+import { episodeView, graphFiles, graphToolSteps, handle, regenerateEpisode, regenerateToolSteps, renderEpisode, renderGraph, retryEpisode, retryGraph, rewriteEpisode, undoChange, upscaleEpisode, upscaleToolSteps } from "@/server/faceless";import { planned } from "@/server/faceless-account";const ACTIONS = {@@ -32,11 +32,13 @@ const RUNS: Partial<Record<Action, (id: string) => Work>> = {return { steps: graphToolSteps(g), files: graphFiles(g) };},upscale: (id) => ({ steps: upscaleToolSteps(id), files: [] }),+ // Its steps read the episode's own results (chained), never a file of their own.+ regenerate: (id) => ({ steps: regenerateToolSteps(id), files: [] }),};/**- * An episode's action. A signed-in account's, on its own episode: a render, a retry and an upscale run on its own GPU or- * key after the checks a studio run gets (src/server/account-tool-run.ts); a guest signs up first.+ * An episode's action. A signed-in account's, on its own episode: a render, a retry, an upscale and Regenerate to 1080p+ * run on its own GPU or key after the checks a studio run gets (src/server/account-tool-run.ts); a guest signs up first.*/export async function POST(request: Request, ctx: RouteContext<"/api/faceless/episodes/[id]/[action]">) {const viewer = toolViewer(request);diff --git a/src/lib/guest-access.ts b/src/lib/guest-access.tsindex 5b73e85b..25195410 100644--- a/src/lib/guest-access.ts+++ b/src/lib/guest-access.ts@@ -346,7 +346,7 @@ export const ACCOUNT_PROJECT_ROUTES: RegExp[] = [// checked by the route on its own GPU or key (src/server/faceless.ts, content-factory.ts). "Generate in Claude" isn't// here (it hands the brief to the studio's own MCP server), nor "Regenerate to 1080p" (held with Open-H3 Regenerate),// nor reading a link (the server never fetches a link for an account: it uploads the file or pastes the words).- /^\/api\/faceless\/(channels(\/[^/]+(\/avatar)?)?|episodes(\/[^/]+(\/(render|retry|rewrite|undo|upscale|change))?)?|topics|voices\/preview)$/,+ /^\/api\/faceless\/(channels(\/[^/]+(\/avatar)?)?|episodes(\/[^/]+(\/(render|retry|rewrite|undo|upscale|regenerate|change))?)?|topics|voices\/preview)$/,/^\/api\/explainer(\/document)?$/,/^\/api\/content-factory\/series(\/[^/]+(\/(episodes|generate|read))?)?$/,/^\/api\/starters\/faceless\.[^/]+$/,diff --git a/src/server/faceless.ts b/src/server/faceless.tsindex 13dd4e75..317007c2 100644--- a/src/server/faceless.ts+++ b/src/server/faceless.ts@@ -1377,9 +1377,8 @@ export function upscaleToolSteps(id: string): { request: GenerationRequest; depsfunction regenerateOffer(ep: FacelessEpisode, scenes: number): EpisodeView["regenerate"] {const modelId = ENGINE_MODELS[ep.settings.engine].regenerate;// Open-H3 Regenerate needs a 48 GB card: offered with its label (own-setup.ts "regenerate:faceless"); a run goes to- // the owner's GPU only once it is offered (regenerateEpisode). An account's episodes don't have it yet: its route- // isn't one of an account's tool runs (src/lib/guest-access.ts).- if (!modelId || !getModel(modelId) || tenantAccount()) return null;+ // the owner's GPU only once it is offered, and to an account's own GPU when that GPU fits it (regenerateEpisode).+ if (!modelId || !getModel(modelId)) return null;let demo = false;try {demo = runsAsDemo(modelId, "upscale-video");@@ -1389,6 +1388,24 @@ function regenerateOffer(ep: FacelessEpisode, scenes: number): EpisodeView["regereturn { scenes, demo };}+/**+ * What "Regenerate to 1080p" would run on this episode (an account's run is checked with it first): none when it can't+ * run yet, or its film is made or making already (regenerateEpisode then says why, or does nothing).+ */+export function regenerateToolSteps(id: string): { request: GenerationRequest; deps: number }[] {+ const ep = mustEpisode(id);+ if (!ep.plan || !finalOf(ep) || !ENGINE_MODELS[ep.settings.engine].regenerate) return [];+ const had = ep.plan.regenerated ? getGeneration(ep.plan.regenerated.final) : null;+ if (had && had.status !== "failed" && had.status !== "canceled") return [];+ const models = resolveModels(withOfferedVideo(ep.settings), narrationText(ep.script.blocks).length, getModel);+ try {+ const plan = regeneratePlan(currentGraph(ep), { engine: ep.settings.engine, joinMax: models.joinMax, lookup: getModel });+ return plan.steps.map((s) => ({ request: { ...s.request, ...(s.chain && { chain: s.chain }) }, deps: s.after?.length ?? 0 }));+ } catch {+ return [];+ }+}+/*** "Regenerate to 1080p": every scene redrawn by Open-H3 Regenerate (RIFE first for a 16 fps clip), joined at 1080p, with* the episode's own narration, music bed and subtitles put back on (regeneratePlan). Runs on your GPU only; the finisheddiff --git a/tests/account-content.test.ts b/tests/account-content.test.tsindex 5dd26032..a274284b 100644--- a/tests/account-content.test.ts+++ b/tests/account-content.test.ts@@ -266,10 +266,8 @@ describe("the proxy opens the three tools to accounts, and keeps the sign-up carexpect(link.status, who).toBe(403);expect((await link.json()).code).toBe("own-gpu-tool");}- // "Regenerate to 1080p" stays held with Open-H3 Regenerate, for everyone.- const regen = viaProxy("/api/faceless/episodes/ep1/regenerate", "POST", "a");- expect(regen.status).toBe(403);- expect((await regen.json()).code).toBe("own-gpu-tool");+ // "Regenerate to 1080p" goes to its route, which runs it on the account's own GPU when that GPU fits it.+ expect(passed(viaProxy("/api/faceless/episodes/ep1/regenerate", "POST", "a"))).toBe(true);});it("the routes refuse a guest themselves", async () => {@@ -480,6 +478,22 @@ describe("Faceless Studio: an account's channels and episodes are its own", () =expect(recordFor({ kind: "channel", ids: [channel] }, h("owner"))).toBe(false);});+ it("offers Regenerate to 1080p, and runs it on its own GPU after the checks a render gets", async () => {+ const before = (await (await readEpisode(episode, "a")).json()) as { regenerate?: { scenes: number } | null };+ expect(before.regenerate).toBeTruthy();+ fake.log.length = 0;+ fetched.length = 0;+ const r = await run(() => actionRoute.POST(json(`/api/faceless/episodes/${episode}/regenerate`, "POST", undefined, "a"), params({ id: episode, action: "regenerate" })));+ expect(r.status, await r.clone().text()).toBe(200);+ const v = (await r.json()) as { episode: { plan: { regenerated?: { ids: Record<string, string> } } | null } };+ const made = Object.values(v.episode.plan?.regenerated?.ids ?? {});+ expect(made.length).toBeGreaterThan(0);+ for (const g of made) expect(accountOf(g)).toBe(a);+ expect(reachedOwner()).toEqual([]);+ // Another account can't run it on this episode.+ expect((await actionRoute.POST(json(`/api/faceless/episodes/${episode}/regenerate`, "POST", undefined, "b"), params({ id: episode, action: "regenerate" }))).status).toBe(404);+ });+it("another account and the owner never see, change or add to its channel", async () => {for (const who of ["b", "owner"]) {const list = (await (await channelsRoute.GET(json("/api/faceless/channels", "GET", undefined, who))).json()) as { items: { id: string }[] };diff --git a/tests/public-signup.test.ts b/tests/public-signup.test.tsindex e1416944..52dbfbad 100644--- a/tests/public-signup.test.ts+++ b/tests/public-signup.test.ts@@ -232,8 +232,8 @@ describe("accounts never run on the owner's keys or GPU", () => {"/api/restore/prompt",// Plan layout plans with the studio's own AI helper."/api/layout/plan",- // Regenerate in Faceless and Shorts segments (n7-10): studio jobs, like their renders.- "/api/faceless/episodes/e1/regenerate",+ // Regenerate in Shorts segments (n7-10): studio jobs, like their renders. (Faceless's Regenerate to 1080p goes to+ // its route, which runs it on the account's own GPU: tests/account-content.test.ts.)"/api/shorts/sessions/s1/segments/0/enhance",]) {const r = proxy(req(p, { method: "POST", cookie }));