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.

Merge branch 'r4/content-factory' into claude/fuobe-parity-4

Claude2ed1746b8b2d
diff --cc src/components/nav-items.ts
index cfe09608,00000000..fc8ac3ee
mode 100644,000000..100644
--- a/src/components/nav-items.ts
+++ b/src/components/nav-items.ts
@@@ -1,137 -1,0 +1,139 @@@
+import {
+ AtSign,
+ AudioLines,
+ Boxes,
+ Box,
+ Brush,
+ Camera,
+ Clapperboard,
+ Crop,
++ Factory,
+ FastForward,
+ Film,
+ GalleryHorizontal,
+ Home,
+ ImageIcon,
+ Images,
+ Layers,
+ Layers2,
+ LayoutGrid,
+ Library,
+ ListChecks,
+ Megaphone,
+ MessageCircle,
+ Mic2,
+ Network,
+ PersonStanding,
+ Presentation,
+ Scissors,
+ Settings,
+ Shapes,
+ Shirt,
+ SlidersHorizontal,
+ Smartphone,
+ Sparkles,
+ Star,
+ Swords,
+ Target,
+ TrendingUp,
+ Tv,
+ UserRoundCog,
+ Video,
+ Wand2,
+ WandSparkles,
+ Workflow,
+ ZoomIn,
+ type LucideIcon,
+} from "lucide-react";
+
+export interface NavItem {
+ href: string;
+ label: string;
+ icon: LucideIcon;
+ /** Shorter label for compact groups (the full one is the tooltip). */
+ short?: string;
+ /** Prefetched as soon as it's on screen (the rows most visits start from); the others wait for a hover or touch. */
+ eager?: boolean;
+ /** More words the ⌘K palette matches ("tts" finds Audio). */
+ keywords?: string;
+}
+
+export interface NavGroupDef {
+ label: string;
+ items: NavItem[];
+ /** Can be folded away; the choice is remembered (Studios and Engine start folded, see DEFAULT_NAV_CLOSED). */
+ collapsible?: boolean;
+ /** Two small items per row. */
+ compact?: boolean;
+}
+
+/** The sidebar, and the destinations of the ⌘K palette. Add a destination with one line in the right group. */
+export const NAV: NavGroupDef[] = [
+ {
+ label: "Create",
+ items: [
+ { href: "/", label: "Home", icon: Home, eager: true, keywords: "start new creation" },
+ { href: "/assist", label: "Assist", icon: MessageCircle, eager: true, keywords: "agent chat plan" },
+ { href: "/image", label: "Image", icon: ImageIcon, eager: true, keywords: "text to image picture photo" },
+ { href: "/video", label: "Video", icon: Video, eager: true, keywords: "text to video image to video animate" },
+ { href: "/edit", label: "Edit", icon: Wand2, keywords: "edit image change" },
+ { href: "/layers", label: "Layers", icon: Layers2, keywords: "layered psd split" },
+ { href: "/inpaint", label: "Inpaint", icon: Brush, keywords: "mask fill remove" },
+ { href: "/color-grade", label: "Color grading", icon: SlidersHorizontal, keywords: "grade lut colour" },
+ { href: "/motions", label: "Camera motions", icon: Film, keywords: "camera moves presets" },
+ { href: "/effects", label: "Effects", icon: Sparkles, keywords: "vfx presets" },
+ { href: "/storyboard", label: "Storyboard", icon: GalleryHorizontal, keywords: "frames story" },
+ { href: "/canvas", label: "Canvas", icon: Network, keywords: "nodes flow workflow" },
+ { href: "/apps", label: "Apps", icon: LayoutGrid, keywords: "one-click tools" },
+ ],
+ },
+ {
+ label: "Library",
+ items: [
+ { href: "/library", label: "All creations", icon: Library, eager: true, keywords: "library history results" },
+ { href: "/library?tab=favorites", label: "Favorites", icon: Star, keywords: "starred liked" },
+ ],
+ },
+ {
+ label: "Studios",
+ items: [
+ { href: "/cinema", label: "Cinema Studio", icon: Clapperboard, keywords: "film director shots" },
+ { href: "/shorts", label: "Shorts Studio", icon: Smartphone, keywords: "vertical reels tiktok" },
+ { href: "/mixed-media", label: "Mixed Media", icon: Shapes, keywords: "collage" },
+ { href: "/marketing", label: "Marketing Studio", icon: Megaphone, keywords: "ugc product ads" },
+ { href: "/ads", label: "Ads Studio", icon: Target, keywords: "brand campaign" },
+ { href: "/moodboards", label: "Moodboards", icon: Images, keywords: "style references" },
+ { href: "/photodump", label: "Photodump", icon: Camera, keywords: "photo pack character" },
+ { href: "/fashion-factory", label: "Fashion Factory", icon: Shirt, keywords: "outfits try-on lookbook" },
+ { href: "/character-sheet", label: "Character Sheet", icon: UserRoundCog, keywords: "turnaround" },
+ { href: "/faceless", label: "Faceless Studio", icon: Tv, keywords: "youtube channel episodes" },
++ { href: "/content-factory", label: "Content Factory", icon: Factory, keywords: "series reference brief episodes" },
+ { href: "/explainer", label: "Explainer", icon: Presentation, keywords: "slides pdf video" },
+ { href: "/lipsync", label: "Lipsync & avatars", icon: Mic2, keywords: "talking avatar" },
+ { href: "/genjutsu", label: "Genjutsu", icon: WandSparkles, keywords: "swap insert character motion transfer" },
+ { href: "/motion-control", label: "Motion control", icon: PersonStanding, keywords: "pose dance transfer" },
+ { href: "/video-edit", label: "Edit video", icon: Scissors, keywords: "video edit restyle" },
+ { href: "/extend", label: "Extend video", icon: FastForward, keywords: "longer continue" },
+ { href: "/reframe", label: "Reframe", icon: Crop, keywords: "aspect ratio outpaint" },
+ { href: "/video-tools", label: "Video tools", icon: Layers, keywords: "join trim matte depth captions" },
+ { href: "/elements", label: "Elements", icon: AtSign, keywords: "characters places props" },
+ { href: "/upscale", label: "Upscale", icon: ZoomIn, keywords: "enhance resolution 4k" },
+ { href: "/audio", label: "Audio", icon: AudioLines, keywords: "voice tts music sfx dub transcribe" },
+ { href: "/katana", label: "Katana", icon: Swords, keywords: "cut edit clips" },
+ { href: "/image-to-3d", label: "Image to 3D", icon: Box, keywords: "3d mesh glb" },
+ { href: "/virality", label: "Virality predictor", icon: TrendingUp, keywords: "hook score" },
+ ],
+ collapsible: true,
+ },
+ {
+ label: "Engine",
+ items: [
+ { href: "/models", label: "Models", icon: Boxes, keywords: "catalog prices" },
+ { href: "/workflows", label: "ComfyUI workflows", short: "Workflows", icon: Workflow, keywords: "open source graphs" },
+ { href: "/settings", label: "Settings", icon: Settings, keywords: "keys preferences" },
+ { href: "/status", label: "Project status", short: "Status", icon: ListChecks, keywords: "parity progress" },
+ ],
+ collapsible: true,
+ compact: true,
+ },
+];
diff --cc src/server/db.ts
index a9a16876,9b116ebe..cd50b504
--- a/src/server/db.ts
+++ b/src/server/db.ts
@@@ -438,27 -438,16 +438,37 @@@ const MIGRATIONS: string[] =
sent_json TEXT
);
CREATE INDEX IF NOT EXISTS assist_thread_state_project ON assist_thread_state(project_id);`,
+ // round 4 (r4/library-plus): nested library folders (a parent), pins on folders and results, and a review status on results.
+ `ALTER TABLE folders ADD COLUMN parent_id TEXT;
+ ALTER TABLE folders ADD COLUMN pinned_at INTEGER;
+ CREATE INDEX IF NOT EXISTS folders_parent ON folders(parent_id);
+ ALTER TABLE generations ADD COLUMN pinned_at INTEGER;
+ ALTER TABLE generations ADD COLUMN review TEXT;
+ CREATE INDEX IF NOT EXISTS generations_pinned ON generations(pinned_at) WHERE pinned_at IS NOT NULL;`,
+ // originals (o/lora-plumbing): every LoRA copy Fuobe made — a download into ComfyUI's loras folder or a mirror on
+ // fal / Replicate storage — with its pinned source, hash, size and the licence / civitai permissions it was made under.
+ `CREATE TABLE IF NOT EXISTS lora_mirrors (
+ file TEXT NOT NULL,
+ target TEXT NOT NULL,
+ source_url TEXT NOT NULL,
+ version TEXT,
+ hosted_url TEXT,
+ sha256 TEXT,
+ size_bytes INTEGER,
+ licence_json TEXT,
+ created_at INTEGER NOT NULL,
+ PRIMARY KEY (file, target)
+ );`,
+ // round 4 (r4/content-factory): Content Factory series — the reference clip, its style brief, the planned
+ // episodes and the settings; the episodes themselves are Faceless episodes in the series' channel.
+ `CREATE TABLE IF NOT EXISTS content_series (
+ id TEXT PRIMARY KEY,
+ channel_id TEXT,
+ data_json TEXT NOT NULL,
+ created_at INTEGER NOT NULL,
+ updated_at INTEGER NOT NULL
+ );
+ CREATE INDEX IF NOT EXISTS content_series_updated ON content_series(updated_at DESC);`,
];
declare global {
diff --cc src/server/faceless.ts
index 2c8b9c52,408510d8..815cc116
--- a/src/server/faceless.ts
+++ b/src/server/faceless.ts
@@@ -348,7 -346,7 +348,8 @@@ export async function createChannel(inp
if (name) db().prepare("UPDATE faceless_channels SET name = ? WHERE id = ? AND name = ?").run(name, row.id, row.name);
}
try {
- // avatar: false (Assist's channel) leaves the initials and the "Draw an avatar" button.
- // Content Factory series show their reference instead (no picture to pay for).
++ // avatar: false (Assist's channel) leaves the initials and the "Draw an avatar" button; Content Factory
++ // series show their reference instead (no picture to pay for).
if (input.avatar !== false && channelRow(row.id)) makeAvatar(row.id);
} catch {
// No picture model can run right now: the channel shows its initials, and "Draw an avatar" is there.
@@@ -450,8 -448,8 +451,10 @@@ export interface EpisodeInput
autoRender?: boolean;
/** Save this episode's look and sound as the channel's (default: only for a channel's first episode). */
saveLook?: boolean;
+ /** A script that's written already, with its pictures (Assist): no writer runs; it's ready to review, or renders at once with autoRender. */
+ blocks?: Partial<ScriptBlock>[];
+ /** The title before the script names it (a series' planned episode title). */
+ title?: string;
}
function cleanSettings(s: EpisodeSettings): EpisodeSettings {
@@@ -480,7 -476,7 +483,7 @@@ export function createEpisode(input: Ep
const sources = (input.sources ?? []).slice(0, MAX_SOURCES);
settings.sourceImages = sources.filter((s): s is Extract<ExplainerSource, { kind: "image" }> => s.kind === "image").map((s) => s.url);
const now = Date.now();
- const title = (topic || pasted || written?.[0]?.narration || "").replace(/\s+/g, " ").slice(0, 80) || "Untitled episode";
- const title = (input.title?.trim() || topic || pasted).replace(/\s+/g, " ").slice(0, input.title ? 120 : 80) || "Untitled episode";
++ const title = (input.title?.trim() || topic || pasted || written?.[0]?.narration || "").replace(/\s+/g, " ").slice(0, input.title ? 120 : 80) || "Untitled episode";
const row: EpisodeRow = {
id: nanoid(10),
channel_id: channel?.id ?? null,
@@@ -503,19 -499,20 +506,30 @@@
.run(row);
if (channel && (input.saveLook ?? first)) {
void updateChannel(channel.id, {
- settings: { engine: settings.engine, styleId: settings.styleId, styleRefs: settings.styleRefs, voice: settings.voice, aspect: settings.aspect, subtitles: settings.subtitles, music: settings.music, animation: settings.animation, length: settings.length },
+ settings: {
+ engine: settings.engine,
+ styleId: settings.styleId,
+ styleRefs: settings.styleRefs,
+ voice: settings.voice,
+ aspect: settings.aspect,
+ subtitles: settings.subtitles,
+ music: settings.music,
+ animation: settings.animation,
+ length: settings.length,
+ ...(settings.brief && { brief: settings.brief }),
+ },
});
}
+ if (written) {
+ if (!input.autoRender) return toEpisode(row);
+ try {
+ return renderEpisode(row.id);
+ } catch (e) {
+ // The script is there: show it with what's in the way, as a written script that can't render does.
+ updateEpisodeRow(row.id, { status: "review", error: (e as Error).message });
+ return mustEpisode(row.id);
+ }
+ }
startWriting(row.id, pasted, !!input.autoRender);
return toEpisode(row);
}
diff --cc src/server/generations.ts
index 2bc0160b,d0e642da..d5dce108
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@@ -231,103 -195,46 +231,105 @@@ export function setFavorite(id: string
update(id, { favorite: favorite ? 1 : 0 });
}
+export interface AssetRef {
+ table: string;
+ cols: string[];
+ /** A column whose row belongs to the generation being purged (its own row and Cinema membership don't keep its files). */
+ except?: string;
+ /** What a row is, for "where is it used" ("element", "Cinema project"). */
+ what: string;
+ /** SQL that names the row, and the key that tells rows apart (default `id`; a Cinema take and its project are one project). */
+ name?: string;
+ key?: string;
+}
+
/**
* Everywhere a stored file can still be in use, by URL (which ends in the asset id, …/<id>.png) or
- * by id: other jobs' inputs and outputs, elements, Assist chats (attachments, results), Cinema
- * covers, palettes and takes, canvas nodes. `except` names a column whose row belongs to the
- * generation being purged (its own row and Cinema membership don't keep its files).
+ * by id: other jobs' inputs and outputs (an upload a request still names keeps Retry and Reuse
+ * working), elements, Assist chats and projects, every studio's sessions, projects and presets.
+ * When a table starts storing file URLs, add it here (tests/library.test.ts checks every `_json` /
+ * `_url` column is either here or in ASSET_FREE).
*/
-const ASSET_REFS: { table: string; cols: string[]; except?: string }[] = [
- { table: "generations", cols: ["request_json", "outputs_json"], except: "id" },
- { table: "characters", cols: ["reference_asset_ids_json", "loras_json", "lora_file"] },
- { table: "trainings", cols: ["meta_json"] },
- { table: "assist_threads", cols: ["messages_json", "items_json", "pending_json"] },
- { table: "cinema_projects", cols: ["cover_url", "palettes_json", "director_json", "chat_json", "brief_body"] },
- { table: "cinema_items", cols: ["meta_json"], except: "generation_id" },
- { table: "canvases", cols: ["graph_json"] },
- { table: "layer_projects", cols: ["source_url", "cover_url"] },
- { table: "layer_versions", cols: ["doc_json"] },
- { table: "shorts_sessions", cols: ["source_json", "look_json"] },
- { table: "shorts_presets", cols: ["references_json"] },
- { table: "brand_kits", cols: ["kit_json", "chat_json"] },
- { table: "products", cols: ["images_json"] },
- { table: "ad_creatives", cols: ["meta_json"] },
- { table: "marketing_runs", cols: ["meta_json"] },
+export const ASSET_REFS: AssetRef[] = [
+ { table: "generations", cols: ["request_json", "outputs_json"], except: "id", what: "result" },
+ { table: "characters", cols: ["reference_asset_ids_json", "loras_json", "lora_file"], what: "element", name: "name" },
+ { table: "trainings", cols: ["meta_json"], what: "element", key: "element_id", name: "(SELECT name FROM characters WHERE id = element_id)" },
+ { table: "assist_threads", cols: ["messages_json", "items_json", "pending_json"], what: "Assist chat", name: "title" },
+ // A chat's frozen context names its project's sources; a project's file sources are uploads.
+ { table: "assist_thread_state", cols: ["context", "sent_json"], what: "Assist chat", key: "thread_id", name: "(SELECT title FROM assist_threads WHERE id = thread_id)" },
+ { table: "assist_project_sources", cols: ["url", "content"], what: "Assist project", key: "project_id", name: "(SELECT name FROM assist_projects WHERE id = project_id)" },
+ { table: "cinema_projects", cols: ["cover_url", "palettes_json", "director_json", "chat_json", "brief_body"], what: "Cinema project", name: "name" },
+ { table: "cinema_items", cols: ["meta_json"], except: "generation_id", what: "Cinema project", key: "project_id", name: "(SELECT name FROM cinema_projects WHERE id = project_id)" },
+ { table: "canvases", cols: ["graph_json", "runs_json"], what: "canvas", name: "name" },
+ // A Layers project's source, cover, its tools' inputs (a picked image) and every saved version.
+ { table: "layer_projects", cols: ["source_url", "cover_url", "jobs_json"], what: "Layers project", name: "name" },
+ { table: "layer_versions", cols: ["doc_json"], what: "Layers project", key: "project_id", name: "(SELECT name FROM layer_projects WHERE id = project_id)" },
+ { table: "shorts_sessions", cols: ["source_json", "look_json"], what: "Shorts session", name: "title" },
+ { table: "shorts_presets", cols: ["references_json"], what: "Shorts preset", name: "name" },
+ { table: "brand_kits", cols: ["kit_json", "chat_json"], what: "brand kit", name: "name" },
+ { table: "products", cols: ["images_json"], what: "product", name: "name" },
+ { table: "ad_creatives", cols: ["meta_json"], what: "ad", name: "headline" },
+ { table: "marketing_runs", cols: ["meta_json"], what: "marketing run", name: "title" },
// Image studios: a palette's thumbnail, a moodboard's images, collages and cover, an Instadump pack's photos.
- { table: "palettes", cols: ["thumb_url"] },
- { table: "moodboards", cols: ["images_json", "collages_json", "cover_url"] },
- { table: "photodump_packs", cols: ["refs_json"] },
- // Faceless / Explainer: a channel's avatar, style references and voice samples, episode sources.
- { table: "faceless_channels", cols: ["avatar_url", "reference_json", "settings_json"] },
- { table: "faceless_episodes", cols: ["settings_json", "sources_json"] },
+ { table: "palettes", cols: ["thumb_url"], what: "palette", name: "name" },
+ { table: "moodboards", cols: ["images_json", "collages_json", "cover_url"], what: "moodboard", name: "name" },
+ { table: "photodump_packs", cols: ["refs_json"], what: "photo pack", name: "name" },
+ // Faceless / Explainer: a channel's avatar, style references and voice samples; an episode's sources, script and picture edits.
+ { table: "faceless_channels", cols: ["avatar_url", "reference_json", "settings_json"], what: "Faceless channel", name: "name" },
+ { table: "faceless_episodes", cols: ["settings_json", "sources_json", "script_json", "plan_json"], what: "episode", name: "title" },
+ // Translate & dub sessions and Katana jobs: the source video, the subject picture and each step's files.
+ { table: "dub_sessions", cols: ["data_json"], what: "dub", name: "json_extract(data_json, '$.title')" },
+ { table: "katana_jobs", cols: ["data_json"], what: "Katana job", name: "json_extract(data_json, '$.title')" },
+ // Content Factory: a series' reference clip and its thumbnail.
- { table: "content_series", cols: ["data_json"] },
++ { table: "content_series", cols: ["data_json"], what: "Content Factory series", name: "COALESCE(json_extract(data_json, '$.name'), json_extract(data_json, '$.reference.title'))" },
];
-/** Whether anything still refers to this stored file (see ASSET_REFS). */
-export function assetInUse(assetId: string, exceptGeneration = ""): boolean {
+/**
+ * Columns that look like they could hold a file (`_json`, `_url`) but never hold one of Fuobe's
+ * stored files, with the reason. The ASSET_REFS coverage test reads this list.
+ */
+export const ASSET_FREE: Record<string, string> = {
+ "generations.provider_input_json": "what a provider was sent: its own upload URLs or file names, never ours",
+ "generations.external_meta_json": "the provider's job handles",
+ "shorts_sessions.range_json": "start and end times",
+ "shorts_sessions.settings_json": "ratio, language, model and resolution",
+ "shorts_sessions.segments_json": "generation ids of each take",
+ "shorts_sessions.stitches_json": "generation ids of each stitch",
+ "brand_kits.progress_json": "research progress labels",
+ "products.selling_points_json": "words",
+ "products.url": "the product's own web page",
+ "marketing_runs.final_ids_json": "generation ids",
+ "palettes.colors_json": "hex colours",
+ "assist_projects.skills_json": "skill names",
+ "assist_thread_state.skills_json": "skill names",
+ "skills.meta_json": "SKILL.md front matter",
+ "skills.files_json": "a skill's own text files, stored inline",
+ "lora_mirrors.source_url": "where a LoRA file downloads from (civitai, Hugging Face), without the key",
+ "lora_mirrors.hosted_url": "the provider's copy of a LoRA file (fal or Replicate storage), never ours",
+ "lora_mirrors.licence_json": "the licence and civitai permissions a LoRA copy was made under",
+};
+
+/** The query that finds the rows of one ASSET_REFS table naming a file (@id), except the purged generation's own (@g). */
+export function assetRefSql(r: AssetRef): string {
+ const where = r.cols.map((c) => `instr(COALESCE(${c}, ''), @id) > 0`).join(" OR ");
+ const except = r.except ? ` AND ${r.except} != @g` : "";
+ const trashed = r.table === "generations" ? ", EXISTS (SELECT 1 FROM generation_trash t WHERE t.generation_id = generations.id) AS trashed" : "";
+ return `SELECT ${r.key ?? "id"} AS k, ${r.name ?? "NULL"} AS n${trashed} FROM ${r.table} WHERE (${where})${except} LIMIT @max`;
+}
+
+/**
+ * Where a stored file is still used (see ASSET_REFS), at most `max` rows: enough to say where
+ * ("2 results and the element “Maya”", describeUses in src/lib/library.ts) or, with max 1, whether.
+ */
+export function assetUses(assetId: string, opts: { exceptGeneration?: string; max?: number } = {}): AssetUse[] {
+ const max = opts.max ?? 50;
+ const out: AssetUse[] = [];
for (const r of ASSET_REFS) {
- const where = r.cols.map((c) => `instr(COALESCE(${c}, ''), @id) > 0`).join(" OR ");
- const except = r.except ? ` AND ${r.except} != @g` : "";
try {
- if (db().prepare(`SELECT 1 FROM ${r.table} WHERE (${where})${except} LIMIT 1`).get({ id: assetId, g: exceptGeneration })) return true;
+ const rows = db()
+ .prepare(assetRefSql(r))
+ .all({ id: assetId, g: opts.exceptGeneration ?? "", max: max - out.length }) as { k: string; n: string | null; trashed?: number }[];
+ for (const row of rows) out.push({ what: r.what, key: String(row.k), name: row.n ?? null, ...(row.trashed ? { trashed: true } : {}) });
} catch {
// A table or column this install doesn't have yet: nothing there to keep the file for.
}