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
Camera motions and effects: a preset with a cloud route stays in the cloud engine's pickers
Adarshdca05072a3bb
diff --git a/docs/public-signup.md b/docs/public-signup.mdindex b83d4035..79bbc9d1 100644--- a/docs/public-signup.md+++ b/docs/public-signup.md@@ -421,8 +421,9 @@ With it on:or one on the studio's GPUs ends.- For a visitor with no GPU of its own, `GET /api/status` says what the studio's GPUs keep off (`viewer.pool`: thepolicy's model and app lists, and its kinds). The app lists also hold every preset whose open model, or the kind it- makes, is kept off. The model, camera motion and effect pickers and the preset galleries leave those out. Preset cards- that run on the studio's GPUs for the viewer say "Try free".+ makes, is kept off. The model, camera motion and effect pickers and the preset galleries leave those out. A preset+ with a cloud route stays in the galleries, and in the pickers while the composer is on the cloud engine (an account's+ own key runs it there). Preset cards that run on the studio's GPUs for the viewer say "Try free".- A guest can attach files (pictures, clips and sound) in a studio before signing up: they stay in the browser andare not uploaded. A voice recording, and a drawing or painted area on a kept picture, are uploaded as they are made,so those ask the guest to sign up first. The whole draft (words, model, settings, preset and files) is kept for thediff --git a/src/components/preset-gallery.tsx b/src/components/preset-gallery.tsxindex 08e312a1..5afc2e33 100644--- a/src/components/preset-gallery.tsx+++ b/src/components/preset-gallery.tsx@@ -12,7 +12,7 @@ import { useProgressive } from "@/components/use-progressive";import { CardChip, badgeKey, parseBadgeKey } from "@/components/gpu/readiness-chip";import { useGpuBadges } from "@/hooks/use-gpu";import { usePoolRules, useTryFree } from "@/hooks/use-pool-rules";-import { poolRunsPreset } from "@/lib/pool-rules";+import { presetOffered } from "@/lib/pool-rules";import { useEngineMode, useViewer } from "@/lib/api";import { categoryFrom, skippedInAll } from "@/lib/gallery-category";import { matchesSearch, previewFlip, readMoreTap, searchText, TAP_TO_READ, type PresetCardData } from "@/lib/preset-cards";@@ -264,7 +264,7 @@ export function PresetGallery({// For a viewer with no GPU of its own (hosted runs), a preset only this studio's GPUs could run, and which they keep// off, is left out (src/lib/pool-rules.ts): nothing here fails at Run for it.const rules = usePoolRules();- const offered = useMemo(() => (rules ? presets.filter((p) => !p.open || p.cloud || poolRunsPreset(rules, p.id)) : presets), [presets, rules]);+ const offered = useMemo(() => (rules ? presets.filter((p) => presetOffered(rules, p)) : presets), [presets, rules]);// "both" until hydrated, so the server HTML and the first client render agree.const mode = useEngineMode();const locked = mode === "both" ? undefined : mode;diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex 942f3710..28f819c5 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -1245,6 +1245,7 @@ export function Composer({ docked }: { docked: boolean }) {mix={draft.mix}onPreset={pickPreset}onMix={(patch) => setDraft(patch)}+ engine={engine}/>)}{config.signature && (diff --git a/src/components/studio/preset-chips.tsx b/src/components/studio/preset-chips.tsxindex 413d0f2a..34400fc7 100644--- a/src/components/studio/preset-chips.tsx+++ b/src/components/studio/preset-chips.tsx@@ -12,7 +12,7 @@ import { onAttr, TAB_PILL, TabRow } from "@/components/ui/tab-row";import { CoverScrollBox, CoverTile, usePickerPlayback } from "@/components/cover-tile";import { PRESET_ICONS } from "@/components/preset-icons";import { usePoolRules } from "@/hooks/use-pool-rules";-import { poolRunsPreset } from "@/lib/pool-rules";+import { presetOffered } from "@/lib/pool-rules";import { loadFullCatalog, useCatalog } from "./catalog";import { Chip, ClearableChip } from "./chip";@@ -118,14 +118,15 @@ function usePickerSide() {return { chip, side, measure };}-export function PresetChip({ type, value, onChange }: { type: "motion" | "effect"; value?: string; onChange: (id?: string) => void }) {+export function PresetChip({ type, value, onChange, engine }: { type: "motion" | "effect"; value?: string; onChange: (id?: string) => void; engine?: "open" | "cloud" }) {const [open, setOpen] = useState(false);const { chip, side, measure } = usePickerSide();const catalog = useCatalog();- // For a viewer with no GPU of its own, what this studio's GPUs keep off is left out (src/lib/pool-rules.ts).+ // For a viewer with no GPU of its own, what this studio's GPUs keep off is left out (src/lib/pool-rules.ts), unless+ // the preset has a cloud route and the composer isn't on the open engine (the gallery keeps those too).const rules = usePoolRules();const all = catalog.presets?.[type] ?? null;- const list = useMemo(() => (all && rules ? all.filter((p) => poolRunsPreset(rules, p.id)) : all), [all, rules]);+ const list = useMemo(() => (all && rules ? all.filter((p) => presetOffered(rules, p, engine)) : all), [all, rules, engine]);const selected = value ? catalog.getPreset(value) : undefined;// The picked preset's poster in place of its icon, as the Look chip shows its look.const cover = selected && presetCover(selected.id);@@ -177,6 +178,7 @@ export function MixChip({strengthOn,mix,onChange,+ engine,}: {primary: Preset;strength: number;@@ -184,6 +186,8 @@ export function MixChip({strengthOn?: string;mix?: { presetId: string; strength: number };onChange: (patch: { presetStrength?: number; mix?: { presetId: string; strength: number } | undefined }) => void;+ /** The composer's engine: a preset with a cloud route stays on the cloud engine whatever this studio's GPUs run. */+ engine?: "open" | "cloud";}) {const [open, setOpen] = useState(false);const { chip, side, measure } = usePickerSide();@@ -194,8 +198,8 @@ export function MixChip({const presets = catalog.presets;const rules = usePoolRules();const mixable = useMemo(- () => (presets ? [...presets.motion, ...presets.effect].filter((p) => p.id !== primary.id && !p.inputs.some((i) => i.key === "endImage") && poolRunsPreset(rules, p.id)) : null),- [presets, primary.id, rules],+ () => (presets ? [...presets.motion, ...presets.effect].filter((p) => p.id !== primary.id && !p.inputs.some((i) => i.key === "endImage") && presetOffered(rules, p, engine)) : null),+ [presets, primary.id, rules, engine],);return (<ClearableChip active={!!mix} onClear={() => onChange({ mix: undefined })} clearLabel="Remove the mix">@@ -263,6 +267,7 @@ export default function PresetChips({mix,onPreset,onMix,+ engine,}: {picker?: "motion" | "effect";preset?: Preset;@@ -274,11 +279,13 @@ export default function PresetChips({mix?: { presetId: string; strength: number };onPreset: (id?: string) => void;onMix: (patch: { presetStrength?: number; mix?: { presetId: string; strength: number } | undefined }) => void;+ /** The composer's engine (the pickers keep a preset with a cloud route off the open engine only). */+ engine?: "open" | "cloud";}) {return (<>- {picker && <PresetChip type={picker} value={presetId} onChange={onPreset} />}- {preset && (preset.type === "motion" || preset.type === "effect") && <MixChip primary={preset} strength={strength} takesStrength={takesStrength} strengthOn={strengthOn} mix={mix} onChange={onMix} />}+ {picker && <PresetChip type={picker} value={presetId} onChange={onPreset} engine={engine} />}+ {preset && (preset.type === "motion" || preset.type === "effect") && <MixChip primary={preset} strength={strength} takesStrength={takesStrength} strengthOn={strengthOn} mix={mix} onChange={onMix} engine={engine} />}</>);}diff --git a/src/lib/pool-rules.ts b/src/lib/pool-rules.tsindex 162abae9..bcc43206 100644--- a/src/lib/pool-rules.ts+++ b/src/lib/pool-rules.ts@@ -70,6 +70,17 @@ export function poolRunsPreset(rules: PoolRules | undefined, presetId: string):return !apps.allow || apps.allow.includes(presetId);}+/**+ * Does a picker or gallery offer this preset to a viewer under the rules (no rules: every preset)? A preset with no open+ * route, or with a cloud route while the picker's engine isn't the open one (`engine` undefined: either engine), never+ * needs this studio's GPUs, so the rules don't leave it out; one only they could run is offered when they run it.+ */+export function presetOffered(rules: PoolRules | undefined, p: { id: string; open: unknown; cloud: unknown }, engine?: "open" | "cloud"): boolean {+ if (!rules || !p.open) return true;+ if (p.cloud && engine !== "open") return true;+ return poolRunsPreset(rules, p.id);+}+/*** "Try free" on preset cards: with hosted runs on, a card whose preset runs on this studio's GPUs for this viewer (a* guest, an account with no GPU of its own, or one whose runs go to this studio's GPUs first) says it can be tried there.diff --git a/tests/hosted-pickers.test.ts b/tests/hosted-pickers.test.tsindex 60e0e2da..4df69732 100644--- a/tests/hosted-pickers.test.ts+++ b/tests/hosted-pickers.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from "vitest";-import { poolRulesOf, poolRunsModel, poolRunsPreset, tryFreeFor } from "@/lib/pool-rules";+import { poolRulesOf, poolRunsModel, poolRunsPreset, presetOffered, tryFreeFor } from "@/lib/pool-rules";/** For a visitor with no GPU of its own (hosted runs), pickers leave out what this studio's GPUs keep off (the policy's@@ -33,6 +33,25 @@ describe("what pickers leave out for a visitor with no GPU of its own", () => {expect(poolRunsPreset({ apps: { allow: ["app-y"] } }, "app-y")).toBe(true);expect(poolRunsPreset({ deny: ["m"] }, "app-x")).toBe(true);});+ it("a camera motion or effect with a cloud route stays in the pickers of the cloud engine, whatever this studio's GPUs run", () => {+ // Videos kept off this studio's GPUs: every motion and effect on an open model is in the rules' deny list.+ const rules = { apps: { deny: ["motion-both", "motion-open"] }, kinds: { video: false } };+ const both = { id: "motion-both", open: { modelId: "oss-clip" }, cloud: { modelId: "cloud-clip" } };+ const openOnly = { id: "motion-open", open: { modelId: "oss-clip" }, cloud: null };+ const cloudOnly = { id: "motion-cloud", open: null, cloud: { modelId: "cloud-clip" } };+ // On the cloud engine (an account with its own key): the ones with a cloud route.+ expect(presetOffered(rules, both, "cloud")).toBe(true);+ expect(presetOffered(rules, cloudOnly, "cloud")).toBe(true);+ // On the open engine: only what this studio's GPUs run.+ expect(presetOffered(rules, both, "open")).toBe(false);+ expect(presetOffered(rules, openOnly, "open")).toBe(false);+ expect(presetOffered(rules, cloudOnly, "open")).toBe(true);+ // A gallery (either engine) keeps every card that has a cloud route, as before.+ expect(presetOffered(rules, both)).toBe(true);+ expect(presetOffered(rules, openOnly)).toBe(false);+ // No rules: every preset.+ expect(presetOffered(undefined, openOnly, "open")).toBe(true);+ });it("agree with the server's own check of every run", async () => {const { poolAllows } = await import("@/server/hosted");const policies = [{}, { allow: ["m"] }, { deny: ["m"] }, { allow: ["n"] }, { apps: { deny: ["app-x"] } }, { apps: { allow: ["app-y"] } }];