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.

Faceless UI: autosave that survives leaving, scene split shown, rewrite confirm, radio keys, touch multi-select, upscale

Claude81cc1f9cad4a
diff --git a/src/components/explainer/explainer-studio.tsx b/src/components/explainer/explainer-studio.tsx
index 0b8f602f..4ae6344c 100644
--- a/src/components/explainer/explainer-studio.tsx
+++ b/src/components/explainer/explainer-studio.tsx
@@ -192,8 +192,10 @@ export function ExplainerStudio({ picker }: { picker: PickerData }) {
}
room--;
setSources((xs) => [...xs, { kind: "text", name: f.name, text }]);
+ } else if (/\.(pdf|docx?|odt|rtf|pages|pptx?|key)$/i.test(f.name) || /pdf|word|officedocument|opendocument|rtf/.test(f.type)) {
+ toast.error(`${f.name}: PDF and Word files aren't read yet — save it as .txt, or paste the text into the prompt`);
} else {
- toast.error(`${f.name}: only images and documents are supported`);
+ toast.error(`${f.name}: add an image (PNG, JPEG, WebP) or a text document (.txt, .md, .csv)`);
}
}
};
@@ -337,9 +339,12 @@ export function ExplainerStudio({ picker }: { picker: PickerData }) {
<div className="space-y-2">
<p className="text-[11px] font-semibold tracking-wide text-muted-foreground uppercase">Animation</p>
<Segmented label="Animation" value={settings.animation} options={ANIMATION_MODES.map((m) => ({ value: m.id, label: m.label }))} onChange={(animation) => set({ animation, resolution: undefined })} />
- <p className="text-[12px] text-muted-foreground">{ANIMATION_MODES.find((m) => m.id === settings.animation)?.copy}</p>
+ <p className="text-[12px] text-muted-foreground">{(() => {
+ const m = ANIMATION_MODES.find((x) => x.id === settings.animation);
+ return engine === "open" ? m?.openCopy : m?.copy;
+ })()}</p>
</div>
- <ToggleRow label="Background music" hint={engine === "cloud" ? "Mixed under the voice by ComfyUI (the cloud mixer takes one track)" : "An ACE-Step instrumental bed"} checked={settings.music} onChange={(music) => set({ music })} />
+ <ToggleRow label="Background music" hint={engine === "cloud" ? "A Sonilo instrumental bed under the voice, as long as the film" : "An ACE-Step instrumental bed (up to 4 minutes)"} checked={settings.music} onChange={(music) => set({ music })} />
<ToggleRow label="Review the script first" hint="Edit the scenes before anything renders" checked={review} onChange={setReview} />
</PopoverContent>
</Popover>
diff --git a/src/components/faceless/cards.tsx b/src/components/faceless/cards.tsx
index 9f876270..b273c600 100644
--- a/src/components/faceless/cards.tsx
+++ b/src/components/faceless/cards.tsx
@@ -39,12 +39,27 @@ export function ChannelAvatar({ channel, className }: { channel: Pick<FacelessCh
);
}
+/** A style for the card: the first style reference (your own style), or the preset's art. */
+function StylePicture({ styleId, styleRef, className }: { styleId: string; styleRef?: string | null; className?: string }) {
+ // eslint-disable-next-line @next/next/no-img-element
+ if (styleRef) return <img src={styleRef} alt="" className={cn("size-full object-cover", className)} />;
+ return <StyleArt styleId={styleId} className={className} />;
+}
+
+/** "Your own style" when the look comes from style references. */
+const styleName = (styleId: string, ownStyle: boolean) => (ownStyle ? "Your own style" : getStyle(styleId).name);
+
export function ChannelCard({ channel }: { channel: FacelessChannel }) {
const cover = channel.cover?.outputs.find((o) => o.kind === "image");
+ const refs = channel.settings.styleRefs ?? [];
return (
<Link href={`/faceless/${channel.id}`} className="group/card block animate-fade-up rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring">
<div className="relative aspect-video overflow-hidden rounded-xl bg-muted">
- {cover ? <MediaThumb output={cover} className="transition-transform duration-300 ease-move group-hover/card:scale-[1.02]" /> : <StyleArt styleId={channel.settings.styleId} className="opacity-90" />}
+ {cover ? (
+ <MediaThumb output={cover} className="transition-transform duration-300 ease-move group-hover/card:scale-[1.02]" />
+ ) : (
+ <StylePicture styleId={channel.settings.styleId} styleRef={refs[0]} className="opacity-90" />
+ )}
<span className="absolute bottom-2 left-2 rounded-full bg-black/45 px-2 py-0.5 text-[11px] font-medium text-white backdrop-blur">{genreInfo(channel.genre).label}</span>
</div>
<div className="mt-2.5 flex min-w-0 items-center gap-2.5 px-0.5">
@@ -52,7 +67,7 @@ export function ChannelCard({ channel }: { channel: FacelessChannel }) {
<div className="min-w-0">
<h3 className="truncate text-[15px] font-medium">{channel.name}</h3>
<p className="truncate text-[12px] text-muted-foreground">
- {channel.episodes ?? 0} episode{channel.episodes === 1 ? "" : "s"} · {getStyle(channel.settings.styleId).name}
+ {channel.episodes ?? 0} episode{channel.episodes === 1 ? "" : "s"} · {styleName(channel.settings.styleId, refs.length > 0)}
</p>
</div>
</div>
@@ -84,7 +99,7 @@ export function EpisodeTile({ ep, href, onLike }: { ep: Card; href: string; onLi
) : film ? (
<MediaThumb output={film} />
) : (
- <StyleArt styleId={ep.styleId} className="opacity-80" />
+ <StylePicture styleId={ep.styleId} styleRef={ep.styleRef} className="opacity-80" />
)}
{ep.status !== "done" && (
<div className="absolute inset-x-0 bottom-0 flex items-center gap-1.5 bg-gradient-to-t from-black/70 to-transparent p-2.5 pt-8 text-[12px] font-medium text-white">
@@ -109,7 +124,7 @@ export function EpisodeTile({ ep, href, onLike }: { ep: Card; href: string; onLi
<div className="mt-2 min-w-0 px-0.5">
<h3 className="line-clamp-2 text-[14px] leading-snug font-medium">{ep.title}</h3>
<p className="mt-0.5 truncate text-[12px] text-muted-foreground">
- {getStyle(ep.styleId).name} · {timeAgo(ep.createdAt)}
+ {styleName(ep.styleId, ep.ownStyle)} · {timeAgo(ep.createdAt)}
</p>
</div>
</Link>
diff --git a/src/components/faceless/channel-view.tsx b/src/components/faceless/channel-view.tsx
index a33d025f..60372580 100644
--- a/src/components/faceless/channel-view.tsx
+++ b/src/components/faceless/channel-view.tsx
@@ -3,6 +3,7 @@
import { ArrowLeft, Check, ImagePlus, Link2, Loader2, MoreHorizontal, Pencil, Plus, Settings2, Trash2, Tv } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
+import { useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { toast } from "sonner";
import {
@@ -25,7 +26,7 @@ import { FACELESS_STYLE_IDS, genreInfo, getStyle, type ChannelSettings, type Fac
import { cn } from "@/lib/utils";
import { ChannelAvatar, EpisodeTile } from "./cards";
import { Section, Segmented, ToggleRow } from "./controls";
-import { makeAvatar, useChannel, useDeleteChannel, useLikeEpisode, useUpdateChannel, waitFor } from "./hooks";
+import { makeAvatar, useChannel, useDeleteChannel, useLikeEpisode, useUpdateChannel } from "./hooks";
import { NarratorList, voiceLabel } from "./narrator";
import { StyleArt, StyleGrid } from "./style-art";
@@ -113,23 +114,24 @@ export function ChannelView({ id, picker }: { id: string; picker: PickerData })
const [name, setName] = useState("");
const [settingsOpen, setSettingsOpen] = useState(false);
const [confirm, setConfirm] = useState(false);
- const [avatarBusy, setAvatarBusy] = useState(false);
+ const [asking, setAsking] = useState(false);
+ const qc = useQueryClient();
if (error && /not found/i.test((error as Error).message)) return <NotFoundState title="This channel doesn't exist">It may have been deleted. Your episodes&apos; videos are still in your library.</NotFoundState>;
const channel = data?.channel;
+ // The server attaches the avatar when it's drawn, whether or not this page is still open.
+ const avatarBusy = asking || !!channel?.avatarJob;
const drawAvatar = async () => {
- setAvatarBusy(true);
+ setAsking(true);
try {
- const g = await waitFor((await makeAvatar(id)).id);
- const url = g.outputs.find((o) => o.kind === "image")?.url;
- if (g.status !== "succeeded" || !url) throw new Error(g.error ?? "Couldn't draw the avatar");
- await update.mutateAsync({ avatarUrl: url });
- toast.success("Avatar updated");
+ await makeAvatar(id);
+ await qc.invalidateQueries({ queryKey: ["faceless", "channel", id] });
+ toast("Drawing a new avatar", { description: "It appears here when it's done — you can leave this page." });
} catch (e) {
toast.error((e as Error).message);
} finally {
- setAvatarBusy(false);
+ setAsking(false);
}
};
@@ -213,7 +215,12 @@ export function ChannelView({ id, picker }: { id: string; picker: PickerData })
<div className="mt-3 flex flex-wrap gap-1.5">
<Chip>
<span className="h-4 w-6 overflow-hidden rounded-sm">
- <StyleArt styleId={channel.settings.styleId} />
+ {channel.settings.styleRefs.length ? (
+ // eslint-disable-next-line @next/next/no-img-element
+ <img src={channel.settings.styleRefs[0]} alt="" className="size-full object-cover" />
+ ) : (
+ <StyleArt styleId={channel.settings.styleId} />
+ )}
</span>
{channel.settings.styleRefs.length ? "Your own style" : getStyle(channel.settings.styleId).name}
</Chip>
@@ -288,7 +295,7 @@ export function ChannelView({ id, picker }: { id: string; picker: PickerData })
<AlertDialogHeader>
<AlertDialogTitle>Delete “{channel.name}”?</AlertDialogTitle>
<AlertDialogDescription>
- The channel and its {data.episodes.length} episode{data.episodes.length === 1 ? "" : "s"} are removed from Faceless Studio. Their videos stay in your Library.
+ The channel and its {data.episodes.length} episode{data.episodes.length === 1 ? "" : "s"} are removed from Faceless Studio, and anything still rendering stops. Finished videos stay in your Library.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
diff --git a/src/components/faceless/controls.tsx b/src/components/faceless/controls.tsx
index 19975114..1e1215d7 100644
--- a/src/components/faceless/controls.tsx
+++ b/src/components/faceless/controls.tsx
@@ -114,6 +114,13 @@ export function EstimateLine({ data, loading, engine, className }: { data: Estim
<span className="min-w-0">{data.error}</span>
</span>
)}
+ {!data.error &&
+ data.notes?.map((n) => (
+ <span key={n} className="inline-flex min-w-0 items-start gap-1 text-[12px] text-muted-foreground">
+ <Info className="mt-0.5 size-3 shrink-0" />
+ <span className="min-w-0">{n}</span>
+ </span>
+ ))}
</div>
);
}
diff --git a/src/components/faceless/episode-view.tsx b/src/components/faceless/episode-view.tsx
index 4407b8f3..b50d0855 100644
--- a/src/components/faceless/episode-view.tsx
+++ b/src/components/faceless/episode-view.tsx
@@ -11,7 +11,9 @@ import {
Film,
Heart,
History,
+ ListChecks,
Loader2,
+ MonitorUp,
MoreHorizontal,
Music,
Pencil,
@@ -43,7 +45,6 @@ import { NotFoundState } from "@/components/empty-state";
import { MediaThumb } from "@/components/studio/feed";
import { Viewer } from "@/components/studio/viewer";
import {
- blockTimes,
formatLength,
getStyle,
PART_LABELS,
@@ -313,7 +314,7 @@ function SceneEditor({ view, scenes, onClose, onOpen }: { view: View; scenes: Sc
{tooLong(lines[i]) && <span className="text-[12px] text-warning">Longer than the scene: the voice runs over into the next one.</span>}
</label>
))}
- <p className="text-[12px] text-muted-foreground">The whole voice-over is read again, so it stays one natural take.</p>
+ <p className="text-[12px] text-muted-foreground">The whole voice-over is read again, so it stays one natural take; then the scenes are cut to the new lines, and a scene that moves by more than a second is animated again.</p>
</div>
) : (
<textarea
@@ -339,7 +340,7 @@ function SceneEditor({ view, scenes, onClose, onOpen }: { view: View; scenes: Sc
: preview.isError
? (preview.error as Error).message
: preview.data
- ? `Re-renders ${preview.data.labels.length} step${preview.data.labels.length === 1 ? "" : "s"} (${stepWords(preview.data.labels)}) · ${preview.data.demo ? "Demo · free" : ep.settings.engine === "open" ? "Free · your GPU" : preview.data.costUsd === null ? "price unknown" : `≈ ${usd(preview.data.costUsd)}`}`
+ ? `Re-renders ${preview.data.labels.length} step${preview.data.labels.length === 1 ? "" : "s"} (${stepWords(preview.data.labels)})${preview.data.retime ? ", plus any scene whose timing moves" : ""} · ${preview.data.demo ? "Demo · free" : ep.settings.engine === "open" ? "Free · your GPU" : preview.data.costUsd === null ? "price unknown" : `≈ ${usd(preview.data.costUsd)}${preview.data.retime ? "+" : ""}`}`
: "Pricing…"}
</p>
<Button variant="ghost" onClick={discard} disabled={!draft}>
@@ -359,18 +360,21 @@ function Timeline({ view, onOpen }: { view: View; onOpen: (g: Generation) => voi
const ep = view.episode;
const [selected, setSelected] = useState<string[]>([]);
const [anchor, setAnchor] = useState<number | null>(null);
+ // Touch screens have no Shift or ⌘: "Select several" makes a tap add or remove a scene.
+ const [several, setSeveral] = useState(false);
const scenes = useMemo<SceneRow[]>(() => {
- const times = blockTimes(ep.script.blocks);
+ // Where each scene sits in the film (cut to the narration once it's timed), from the server.
+ const times = new Map(view.scenes.map((s) => [s.id, s]));
return ep.script.blocks.map((b, i) => ({
id: b.id,
index: i,
narration: b.narration,
- seconds: b.seconds,
- start: times[i].start,
+ seconds: times.get(b.id)?.seconds ?? b.seconds,
+ start: times.get(b.id)?.start ?? 0,
still: view.steps.find((s) => s.key === `still-${b.id}`),
clips: view.steps.filter((s) => s.part === "clip" && s.key.startsWith(`clip-${b.id}-`)),
}));
- }, [ep.script.blocks, view.steps]);
+ }, [ep.script.blocks, view.steps, view.scenes]);
const pick = (i: number, e: React.MouseEvent) => {
const id = scenes[i].id;
if (e.shiftKey && anchor !== null) {
@@ -378,7 +382,7 @@ function Timeline({ view, onOpen }: { view: View; onOpen: (g: Generation) => voi
setSelected(scenes.slice(a, b + 1).map((s) => s.id).slice(0, 12));
return;
}
- if (e.metaKey || e.ctrlKey) {
+ if (several || e.metaKey || e.ctrlKey) {
setSelected((s) => (s.includes(id) ? s.filter((x) => x !== id) : [...s, id].slice(0, 12)));
setAnchor(i);
return;
@@ -389,11 +393,27 @@ function Timeline({ view, onOpen }: { view: View; onOpen: (g: Generation) => voi
const chosen = scenes.filter((s) => selected.includes(s.id));
return (
<section aria-labelledby="timeline-title" className="space-y-3">
- <div className="flex flex-wrap items-baseline justify-between gap-2">
+ <div className="flex flex-wrap items-center justify-between gap-2">
<h2 id="timeline-title" className="font-heading text-[22px]">
Timeline
</h2>
- <p className="text-[12px] text-muted-foreground">Pick a scene to change it · Shift for a run, ⌘/Ctrl for several</p>
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
+ <p className="text-[12px] text-muted-foreground">
+ {view.timing === "narration" ? "Each scene is cut to its lines · " : ""}Pick a scene to change it<span className="pointer-coarse:hidden"> · Shift for a run, ⌘/Ctrl for several</span>
+ </p>
+ <Button
+ variant="ghost"
+ size="sm"
+ aria-pressed={several}
+ onClick={() => {
+ setSeveral((v) => !v);
+ if (several) setSelected((s) => s.slice(0, 1));
+ }}
+ className={cn("h-7 rounded-full px-2.5 text-[12px]", several && "bg-brand-faint text-brand-text hover:bg-brand-faint-hover")}
+ >
+ <ListChecks /> Select several
+ </Button>
+ </div>
</div>
<div className="scrollbar-none -mx-3 flex gap-2 overflow-x-auto px-3 pb-1 sm:-mx-0 sm:px-0" role="group" aria-label="Scenes">
{scenes.map((s) => (
@@ -417,11 +437,12 @@ function Changes({ view }: { view: View }) {
</summary>
<ul className="mt-2 space-y-1.5">
{[...changes].reverse().map((c) => (
- <li key={c.at} className="flex flex-wrap items-baseline gap-x-2 text-[12px]">
- <span className="font-medium">
+ <li key={c.at} className={cn("flex flex-wrap items-baseline gap-x-2 text-[12px]", c.undone && "text-muted-foreground")}>
+ <span className={cn("font-medium", c.undone && "line-through")}>
Scene {c.blocks.map((b) => blocks.findIndex((x) => x.id === b) + 1 || "?").join(", ")} · {c.part}
</span>
- <span className="min-w-0 truncate text-muted-foreground">{c.instruction}</span>
+ <span className={cn("min-w-0 truncate text-muted-foreground", c.undone && "line-through")}>{c.instruction}</span>
+ {c.undone && <span className="text-[11px] font-medium">Undone</span>}
<span className="ml-auto font-mono text-muted-foreground tabular-nums">
{c.costUsd != null ? `≈ ${usd(c.costUsd)} · ` : ""}
{timeAgo(c.at)}
@@ -447,9 +468,12 @@ export function EpisodeView({ id, backHref, backLabel }: { id: string; backHref:
if (error && /not found/i.test((error as Error).message)) return <NotFoundState title="This episode doesn't exist">It may have been deleted. Its videos are still in your library.</NotFoundState>;
const ep = view?.episode;
- const film = view?.final;
+ // The download is the 1080p copy once it's made, else the film.
+ const upscaled = view?.upscaled?.status === "succeeded" ? view.upscaled : null;
+ const upscaling = !!view?.upscaled && active(view.upscaled);
+ const film = upscaled ?? view?.final;
const filmOut = film?.outputs.find((o) => o.kind === "video");
- const run = (a: "retry" | "rewrite" | "undo", ok?: string) => action.mutate(a, { onSuccess: () => ok && toast.success(ok), onError: (e) => toast.error((e as Error).message) });
+ const run = (a: "retry" | "rewrite" | "undo" | "upscale", ok?: string) => action.mutate(a, { onSuccess: () => ok && toast.success(ok), onError: (e) => toast.error((e as Error).message) });
return (
<div className="flex min-h-svh min-w-0 flex-col">
@@ -461,10 +485,15 @@ export function EpisodeView({ id, backHref, backLabel }: { id: string; backHref:
</Link>
{ep && (
<div className="ml-auto flex shrink-0 items-center gap-1">
+ {upscaling && (
+ <span className="hidden items-center gap-1.5 text-[12px] text-muted-foreground sm:inline-flex" aria-live="polite">
+ <Loader2 className="size-3 animate-spin" /> Upscaling to 1080p
+ </span>
+ )}
{filmOut && film && (
<Button asChild variant="outline" size="sm">
- <a href={downloadHref(filmOut.url, downloadName(film, filmOut, 0))} download>
- <Download /> <span className="hidden sm:inline">Download</span>
+ <a href={downloadHref(filmOut.url, downloadName(film, filmOut, 0))} download aria-label={upscaled ? "Download (1080p)" : "Download"}>
+ <Download /> <span className="hidden sm:inline">{upscaled ? "Download 1080p" : "Download"}</span>
</a>
</Button>
)}
@@ -491,6 +520,14 @@ export function EpisodeView({ id, backHref, backLabel }: { id: string; backHref:
<Undo2 /> Undo the last change
</DropdownMenuItem>
)}
+ {view?.upscale && !upscaled && (
+ <DropdownMenuItem disabled={upscaling || action.isPending} onClick={() => run("upscale", "Upscaling to 1080p — the download switches to it when it's done")}>
+ <MonitorUp /> {upscaling ? "Upscaling to 1080p…" : "Upscale to 1080p"}
+ <span className="ml-auto pl-3 font-mono text-[11px] text-muted-foreground tabular-nums">
+ {view.upscale.demo ? "Demo" : view.upscale.costUsd === null ? "" : `≈ ${usd(view.upscale.costUsd)}`}
+ </span>
+ </DropdownMenuItem>
+ )}
<DropdownMenuItem variant="destructive" onClick={() => setTimeout(() => setConfirm(true))}>
<Trash2 /> Delete episode
</DropdownMenuItem>
@@ -534,8 +571,9 @@ export function EpisodeView({ id, backHref, backLabel }: { id: string; backHref:
<h1 className="font-heading text-[30px] leading-tight text-balance">{ep.title}</h1>
)}
<p className="mt-1 text-[13px] text-muted-foreground">
- {getStyle(ep.settings.styleId).name} · {ep.settings.aspect === "9:16" ? "Vertical" : "Horizontal"} · {ep.settings.animation === "frames" ? "Frame by frame" : "Fully animated"}
- {ep.script.blocks.length > 0 && ` · ${formatLength(ep.script.blocks.reduce((n, b) => n + b.seconds, 0))}`}
+ {ep.settings.styleRefs.length ? "Your own style" : getStyle(ep.settings.styleId).name} · {ep.settings.aspect === "9:16" ? "Vertical" : "Horizontal"} ·{" "}
+ {ep.settings.animation === "frames" ? "Frame by frame" : "Fully animated"}
+ {ep.script.blocks.length > 0 && ` · ${formatLength(view.scenes.length ? view.scenes.reduce((n, s) => n + s.seconds, 0) : ep.script.blocks.reduce((n, b) => n + b.seconds, 0))}`}
{view.spentUsd > 0 && <span className="font-mono"> · ≈ {usd(view.spentUsd)} spent</span>}
</p>
</div>
@@ -584,7 +622,9 @@ export function EpisodeView({ id, backHref, backLabel }: { id: string; backHref:
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete this episode?</AlertDialogTitle>
- <AlertDialogDescription>It&apos;s removed from {view?.channel ? "the channel" : "your explainers"}. Its pictures, clips and video stay in your Library.</AlertDialogDescription>
+ <AlertDialogDescription>
+ It&apos;s removed from {view?.channel ? "the channel" : "your explainers"}{ep?.status === "rendering" ? ", and what's still rendering stops" : ""}. Its finished pictures, clips and video stay in your Library.
+ </AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
diff --git a/src/components/faceless/episode-wizard.tsx b/src/components/faceless/episode-wizard.tsx
index 777eee84..e4e641ff 100644
--- a/src/components/faceless/episode-wizard.tsx
+++ b/src/components/faceless/episode-wizard.tsx
@@ -10,6 +10,7 @@ import { SidebarTrigger } from "@/components/ui/sidebar";
import { Skeleton } from "@/components/ui/skeleton";
import { NotFoundState } from "@/components/empty-state";
import { EngineSwitch } from "@/components/studio/engine-switch";
+import { radioKeys, radioTab } from "@/components/studio/radio-keys";
import { useEngine } from "@/lib/api";
import {
defaultVoice,
@@ -25,7 +26,7 @@ import {
} from "@/lib/catalog/faceless";
import { cn } from "@/lib/utils";
import { ChannelAvatar } from "./cards";
-import { EstimateLine, Section, Segmented } from "./controls";
+import { EstimateLine, Section, Segmented, ToggleRow } from "./controls";
import { pendingScriptKey } from "./faceless-home";
import { suggestTopics, useChannel, useCreateEpisode, useEstimate } from "./hooks";
import { EpisodeSettingsForm } from "./settings-form";
@@ -72,6 +73,9 @@ export function EpisodeWizard({ channelId, picker }: { channelId: string; picker
const [scriptMode, setScriptMode] = useState<"ai" | "pasted">("ai");
const [script, setScript] = useState("");
const [draft, setDraft] = useState<EpisodeSettings | null>(null);
+ // The first episode sets the channel's look; later ones only when ticked.
+ const [saveLook, setSaveLook] = useState<boolean | null>(null);
+ const keepLook = saveLook ?? data?.episodes.length === 0;
const file = useRef<HTMLInputElement>(null);
const ownId = useId();
const scriptId = useId();
@@ -107,10 +111,13 @@ export function EpisodeWizard({ channelId, picker }: { channelId: string; picker
return { ...draft, engine, voice, videoModel: draft.engine === engine ? draft.videoModel : undefined, resolution: draft.engine === engine ? draft.resolution : undefined };
}, [draft, engine, genre]);
- const loadTopics = async (r: number, avoid: string[] = []) => {
+ // Every topic shown so far: "Generate new" asks for others.
+ const shown = useRef<string[]>([]);
+ const loadTopics = async (r: number) => {
setLoadingTopics(true);
try {
- const res = await suggestTopics({ channelId, engine, round: r, avoid });
+ const res = await suggestTopics({ channelId, engine, round: r, avoid: shown.current.slice(-30) });
+ shown.current = [...new Set([...shown.current, ...res.topics.map((t) => t.title)])];
setTopics(res.topics);
setOffline(res.offline);
setPicked(null);
@@ -146,7 +153,7 @@ export function EpisodeWizard({ channelId, picker }: { channelId: string; picker
if (scriptMode === "pasted" && !script.trim()) return void toast("Paste your script, or let it be written for you", { id: "faceless-blocker" });
if (settings.engine === "open" && settings.voice?.kind !== "sample" && estimate.data?.error) return void toast(estimate.data.error, { id: "faceless-blocker" });
create.mutate(
- { channelId, topic: topic || script.trim().slice(0, 120), script: scriptMode === "pasted" ? script : undefined, settings },
+ { channelId, topic: topic || script.trim().slice(0, 120), script: scriptMode === "pasted" ? script : undefined, settings, saveLook: keepLook },
{
onSuccess: (ep) => router.push(`/faceless/${channelId}/${ep.id}`),
onError: (e) => toast.error((e as Error).message),
@@ -201,23 +208,25 @@ export function EpisodeWizard({ channelId, picker }: { channelId: string; picker
onClick={() => {
const r = round + 1;
setRound(r);
- void loadTopics(r, topics?.map((t) => t.title));
+ void loadTopics(r);
}}
>
<RefreshCw className={cn(loadingTopics && "animate-spin")} /> Generate new topic suggestions
</Button>
</div>
- <div role="radiogroup" aria-label="Suggested topics" className="grid gap-2.5 sm:grid-cols-2">
+ <div role="radiogroup" aria-label="Suggested topics" onKeyDown={radioKeys} className="grid gap-2.5 sm:grid-cols-2">
{loadingTopics && !topics
? Array.from({ length: 4 }, (_, i) => <Skeleton key={i} className="h-[76px] rounded-xl" />)
- : topics?.map((t) => {
+ : topics?.map((t, i) => {
const on = picked === t.title && !own.trim();
+ const anyOn = !!picked && !own.trim() && topics.some((x) => x.title === picked);
return (
<button
key={t.title}
type="button"
role="radio"
aria-checked={on}
+ tabIndex={radioTab(anyOn ? on : i === 0)}
onClick={() => {
setPicked(t.title);
setOwn("");
@@ -318,6 +327,15 @@ export function EpisodeWizard({ channelId, picker }: { channelId: string; picker
</Section>
<EpisodeSettingsForm kind="faceless" value={settings} onChange={(p) => setDraft((d) => ({ ...d!, ...p, engine }))} picker={picker} styleIds={FACELESS_STYLE_IDS} />
+
+ <div className="rounded-xl border p-3">
+ <ToggleRow
+ label="Save as the channel's look"
+ hint="New episodes start with this style, narrator, format and music. Leave it off to try something just for this episode."
+ checked={keepLook}
+ onChange={setSaveLook}
+ />
+ </div>
</div>
)}
</main>
diff --git a/src/components/faceless/hooks.ts b/src/components/faceless/hooks.ts
index 6fca0d84..4c58e5f1 100644
--- a/src/components/faceless/hooks.ts
+++ b/src/components/faceless/hooks.ts
@@ -50,7 +50,13 @@ export function useChannel(id: string) {
queryKey: ["faceless", "channel", id],
queryFn: async () => json<{ channel: FacelessChannel; episodes: EpisodeCard[] }>(await fetch(`/api/faceless/channels/${id}`)),
retry: (n, e) => !/not found/i.test((e as Error).message) && n < 1,
- refetchInterval: (q) => (q.state.data?.episodes.some((e) => inFlight(e.status)) ? 3000 : false),
+ refetchInterval: (q) => {
+ const d = q.state.data;
+ if (!d) return false;
+ // An avatar being drawn, or a new channel's name on its way from the LLM.
+ if (d.channel.avatarJob || Date.now() - d.channel.createdAt < 20_000) return 2500;
+ return d.episodes.some((e) => inFlight(e.status)) ? 3000 : false;
+ },
});
}
@@ -90,7 +96,7 @@ export const suggestTopics = (b: { channelId?: string; idea?: string; genre?: Fa
export function useCreateEpisode() {
const qc = useQueryClient();
return useMutation({
- mutationFn: (b: { channelId: string; topic: string; script?: string; settings: EpisodeSettings }) => send<FacelessEpisode>("/api/faceless/episodes", "POST", b),
+ mutationFn: (b: { channelId: string; topic: string; script?: string; settings: EpisodeSettings; saveLook?: boolean }) => send<FacelessEpisode>("/api/faceless/episodes", "POST", b),
onSuccess: () => void qc.invalidateQueries({ queryKey: ["faceless"] }),
});
}
@@ -119,12 +125,15 @@ export function useEpisode(id: string) {
retry: (n, e) => !/not found/i.test((e as Error).message) && n < 1,
refetchInterval: (q) => {
const s = q.state.data?.episode.status;
+ const up = q.state.data?.upscaled?.status;
+ if (up === "queued" || up === "running") return connected ? 8000 : 2000;
if (!s || !inFlight(s)) return false;
return s === "writing" ? 1500 : connected ? 8000 : 2000;
},
});
useEffect(() => {
- ids.current = new Set(Object.values(q.data?.episode.plan?.ids ?? {}));
+ const plan = q.data?.episode.plan;
+ ids.current = new Set([...Object.values(plan?.ids ?? {}), ...(plan?.upscaled ? [plan.upscaled] : [])]);
}, [q.data]);
return q;
}
@@ -148,7 +157,7 @@ export function useUpdateEpisode(id: string) {
}
export function useEpisodeAction(id: string) {
- return useEpisodeMutation(id, (action: "render" | "retry" | "rewrite" | "undo") => send<EpisodeView>(`/api/faceless/episodes/${id}/${action}`, "POST"));
+ return useEpisodeMutation(id, (action: "render" | "retry" | "rewrite" | "undo" | "upscale") => send<EpisodeView>(`/api/faceless/episodes/${id}/${action}`, "POST"));
}
export interface ChangeDraft {
diff --git a/src/components/faceless/narrator.tsx b/src/components/faceless/narrator.tsx
index 28534dba..3349f223 100644
--- a/src/components/faceless/narrator.tsx
+++ b/src/components/faceless/narrator.tsx
@@ -6,6 +6,7 @@ import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { fileToSlot } from "@/components/studio/media-slot";
+import { radioKeys, radioTab } from "@/components/studio/radio-keys";
import { VoiceRecorder } from "@/components/studio/voice-recorder";
import { useElements } from "@/lib/api";
import type { NarratorVoice, PickerData } from "@/lib/catalog/faceless";
@@ -96,9 +97,17 @@ export function NarratorList({ engine, voices, value, onChange }: { engine: Engi
const p = usePlayer();
const list = voices.filter((v) => !q || `${v.name} ${v.hint ?? ""}`.toLowerCase().includes(q.toLowerCase()));
const own = value?.kind === "sample" && !saved.some((e) => e.references[0] === value.url) ? value : null;
+ // One Tab stop for the whole list: the picked voice, else the first one shown.
+ const shown: NarratorVoice[] = [
+ ...(engine === "cloud" ? list.map((v): NarratorVoice => ({ kind: "preset", id: v.id })) : []),
+ ...saved.map((e): NarratorVoice => ({ kind: "sample", url: e.references[0] })),
+ ...(own ? [own] : []),
+ ];
+ const picked = shown.some((v) => sameVoice(value, v));
const row = (key: string, v: NarratorVoice, name: string, hint: string | undefined, sample: () => Promise<string | null>) => {
const active = sameVoice(value, v);
+ const stop = active || (!picked && !!shown[0] && sameVoice(shown[0], v));
return (
<div key={key} className={cn("flex items-center gap-1.5 rounded-lg pl-1.5 transition-colors hover:bg-accent", active && "bg-brand-faint hover:bg-brand-faint-hover")}>
<PlayButton active={p.playing === key} loading={p.loading === key} onClick={() => void p.toggle(key, sample)} label={name} />
@@ -106,6 +115,7 @@ export function NarratorList({ engine, voices, value, onChange }: { engine: Engi
type="button"
role="radio"
aria-checked={active}
+ tabIndex={radioTab(stop)}
onClick={() => onChange(v)}
className="flex min-w-0 flex-1 items-center gap-2 rounded-lg py-1.5 pr-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
@@ -120,7 +130,13 @@ export function NarratorList({ engine, voices, value, onChange }: { engine: Engi
};
return (
- <div className="space-y-3" role="radiogroup" aria-label="Narrator voice">
+ <div
+ className="space-y-3"
+ role="radiogroup"
+ aria-label="Narrator voice"
+ // The arrow keys move between voices, except while typing in the search box.
+ onKeyDown={(e) => !(e.target as HTMLElement).closest("input, textarea") && radioKeys(e)}
+ >
{engine === "cloud" && (
<div>
<div className="flex items-center justify-between gap-2 px-1 pb-1.5">
diff --git a/src/components/faceless/script-review.tsx b/src/components/faceless/script-review.tsx
index 361302ea..86aa5dc9 100644
--- a/src/components/faceless/script-review.tsx
+++ b/src/components/faceless/script-review.tsx
@@ -1,16 +1,35 @@
"use client";
import { AlertTriangle, ArrowDown, ArrowUp, Check, Info, Loader2, Plus, Trash2, Wand2 } from "lucide-react";
-import { useEffect, useRef, useState } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import { toast } from "sonner";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
-import { blockId, formatLength, secondsFor, tooLong, totalSeconds, wordCount, type EpisodeView, type ScriptBlock } from "@/lib/catalog/faceless";
+import { blockId, formatLength, secondsFor, splitScript, tooLong, totalSeconds, wordCount, type EpisodeView, type ScriptBlock } from "@/lib/catalog/faceless";
import { cn } from "@/lib/utils";
import { EstimateLine } from "./controls";
import { useEpisodeAction, useEstimate, useUpdateEpisode } from "./hooks";
const field = "w-full resize-none rounded-lg border bg-background px-2.5 py-2 text-[14px] leading-relaxed outline-none transition-colors [field-sizing:content] focus:border-primary placeholder:text-subtle-foreground";
+/** A save waits this long after the last keystroke. */
+const SAVE_MS = 900;
+/** Browsers send a request as the page goes away (keepalive) only when its body is under 64 KB. */
+const KEEPALIVE_MAX = 60_000;
+
+const payload = (bs: ScriptBlock[]) => ({ blocks: bs.map(({ id, narration, visual, motion }) => ({ id, narration, visual, motion })) });
+/** What the server may change on save: lines too long for one scene become several. */
+const shape = (bs: Pick<ScriptBlock, "id" | "narration">[]) => bs.map((b) => `${b.id}:${b.narration.trim().replace(/\s+/g, " ")}`).join("|");
+
function SceneCard({
block,
index,
@@ -30,6 +49,7 @@ function SceneCard({
}) {
const long = tooLong(block.narration);
const secs = secondsFor(block.narration);
+ const pieces = long ? splitScript(block.narration).length : 1;
return (
<li className="group/scene rounded-2xl border bg-background p-3 sm:p-4">
<div className="flex items-center gap-2">
@@ -58,7 +78,7 @@ function SceneCard({
<textarea value={block.narration} onChange={(e) => onChange({ narration: e.target.value })} rows={3} maxLength={2000} className={field} placeholder="What the narrator says over this scene" />
{long && (
<span className="flex items-center gap-1 text-[12px] text-warning">
- <AlertTriangle className="size-3" /> More than 10 seconds — it&apos;ll be split into two scenes.
+ <AlertTriangle className="size-3" /> More than 10 seconds — it&apos;ll be split into {pieces} scenes.
</span>
)}
</label>
@@ -79,16 +99,23 @@ function SceneCard({
/**
* Review the script before anything renders: every scene's narration, picture and movement, editable,
- * reorderable; saved as you type. Render starts the whole episode.
+ * reorderable; saved as you type (and on the way out of the page). Render starts the whole episode.
*/
export function ScriptReview({ view }: { view: EpisodeView }) {
const ep = view.episode;
const [blocks, setBlocks] = useState<ScriptBlock[]>(ep.script.blocks);
const [dirty, setDirty] = useState(false);
+ const [confirmRewrite, setConfirmRewrite] = useState(false);
const update = useUpdateEpisode(ep.id);
const action = useEpisodeAction(ep.id);
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
const latest = useRef(blocks);
+ /** An edit not sent yet, and a counter of edits (a save only applies the server's split when none came after it). */
+ const pending = useRef(false);
+ const edits = useRef(0);
+ /** The server split a scene while one was being typed in: shown once the list loses focus. */
+ const deferred = useRef<{ blocks: ScriptBlock[]; at: number } | null>(null);
+ const list = useRef<HTMLOListElement>(null);
const estimate = useEstimate({ kind: ep.kind, settings: ep.settings, blocks });
// A rewrite brings a new script.
@@ -98,25 +125,62 @@ export function ScriptReview({ view }: { view: EpisodeView }) {
if (seen.current === scriptKey || dirty) return;
seen.current = scriptKey;
setBlocks(ep.script.blocks);
+ latest.current = ep.script.blocks;
}, [scriptKey, dirty, ep.script.blocks]);
+ const show = (bs: ScriptBlock[]) => {
+ setBlocks(bs);
+ latest.current = bs;
+ };
+
const save = async (bs = latest.current) => {
if (timer.current) clearTimeout(timer.current);
timer.current = null;
- const v = await update.mutateAsync({ blocks: bs.map(({ id, narration, visual, motion }) => ({ id, narration, visual, motion })) });
- seen.current = v.episode.script.blocks.map((b) => b.id).join("|");
- setDirty(false);
+ pending.current = false;
+ const at = edits.current;
+ const v = await update.mutateAsync(payload(bs));
+ const saved = v.episode.script.blocks;
+ seen.current = saved.map((b) => b.id).join("|");
+ if (edits.current === at) {
+ setDirty(false);
+ // Show what the server made of it (a long line split into scenes), unless a scene is being typed in.
+ if (shape(saved) !== shape(bs)) {
+ if (list.current?.contains(document.activeElement)) deferred.current = { blocks: saved, at };
+ else show(saved);
+ }
+ }
return v;
};
const edit = (next: ScriptBlock[]) => {
- setBlocks(next);
- latest.current = next;
+ show(next);
setDirty(true);
+ pending.current = true;
+ edits.current++;
+ deferred.current = null;
if (timer.current) clearTimeout(timer.current);
- timer.current = setTimeout(() => void save().catch((e) => toast.error((e as Error).message)), 900);
+ timer.current = setTimeout(() => void save().catch((e) => toast.error((e as Error).message)), SAVE_MS);
};
- useEffect(() => () => void (timer.current && clearTimeout(timer.current)), []);
+
+ // Leaving with an edit not saved yet (Back, another page, closing the tab): send it now, in a request that outlives the page.
+ const flush = useCallback(() => {
+ if (!pending.current) return;
+ if (timer.current) clearTimeout(timer.current);
+ timer.current = null;
+ pending.current = false;
+ const body = JSON.stringify(payload(latest.current));
+ void fetch(`/api/faceless/episodes/${ep.id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body, keepalive: body.length < KEEPALIVE_MAX }).catch(() => {});
+ }, [ep.id]);
+ useEffect(() => {
+ const hidden = () => document.visibilityState === "hidden" && flush();
+ window.addEventListener("pagehide", flush);
+ document.addEventListener("visibilitychange", hidden);
+ return () => {
+ window.removeEventListener("pagehide", flush);
+ document.removeEventListener("visibilitychange", hidden);
+ flush();
+ };
+ }, [flush]);
const change = (i: number, p: Partial<ScriptBlock>) => edit(blocks.map((b, j) => (j === i ? { ...b, ...p, ...(p.narration !== undefined && { seconds: secondsFor(p.narration) }) } : b)));
const move = (i: number, d: -1 | 1) => {
@@ -127,16 +191,22 @@ export function ScriptReview({ view }: { view: EpisodeView }) {
const render = async () => {
try {
- if (dirty) {
- const v = await save();
- setBlocks(v.episode.script.blocks);
- }
+ if (dirty) show((await save()).episode.script.blocks);
await action.mutateAsync("render");
} catch (e) {
toast.error((e as Error).message);
}
};
+ const rewrite = () => {
+ // Nothing waiting to save would come back over the new script.
+ if (timer.current) clearTimeout(timer.current);
+ timer.current = null;
+ pending.current = false;
+ setDirty(false);
+ action.mutate("rewrite", { onError: (e) => toast.error((e as Error).message) });
+ };
+
const seconds = totalSeconds(blocks.map((b) => ({ seconds: secondsFor(b.narration) })));
return (
<div className="space-y-5">
@@ -145,7 +215,7 @@ export function ScriptReview({ view }: { view: EpisodeView }) {
<h2 className="font-heading text-[26px] leading-tight">Review the script</h2>
<p className="text-[13px] text-muted-foreground">Edit any scene before it renders. Each scene is about 10 seconds of narration with its own picture.</p>
</div>
- <Button variant="outline" size="sm" disabled={action.isPending} onClick={() => action.mutate("rewrite", { onError: (e) => toast.error((e as Error).message) })}>
+ <Button variant="outline" size="sm" disabled={action.isPending} onClick={() => setConfirmRewrite(true)}>
<Wand2 /> Write it again
</Button>
</div>
@@ -159,7 +229,18 @@ export function ScriptReview({ view }: { view: EpisodeView }) {
<AlertTriangle className="mt-0.5 size-4 shrink-0 text-warning" /> {ep.error}
</p>
)}
- <ol className="space-y-3" aria-label="Scenes">
+ <ol
+ ref={list}
+ className="space-y-3"
+ aria-label="Scenes"
+ onBlur={(e) => {
+ // Typing is over: show the split the last save made.
+ const d = deferred.current;
+ if (!d || list.current?.contains(e.relatedTarget as Node | null)) return;
+ deferred.current = null;
+ if (d.at === edits.current) show(d.blocks);
+ }}
+ >
{blocks.map((b, i) => (
<SceneCard
key={b.id}
@@ -186,6 +267,18 @@ export function ScriptReview({ view }: { view: EpisodeView }) {
</Button>
</div>
</div>
+ <AlertDialog open={confirmRewrite} onOpenChange={setConfirmRewrite}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Write the script again?</AlertDialogTitle>
+ <AlertDialogDescription>A new script replaces this one, with your edits to it. This can&apos;t be undone.</AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Keep this script</AlertDialogCancel>
+ <AlertDialogAction onClick={rewrite}>Write it again</AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</div>
);
}
diff --git a/src/components/faceless/settings-form.tsx b/src/components/faceless/settings-form.tsx
index 991c1f37..21f6480a 100644
--- a/src/components/faceless/settings-form.tsx
+++ b/src/components/faceless/settings-form.tsx
@@ -5,6 +5,7 @@ import Link from "next/link";
import { useEffect, useState } from "react";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { fileToList, SlotPreview, type SlotValue } from "@/components/studio/media-slot";
+import { radioKeys, radioTab } from "@/components/studio/radio-keys";
import { useElements } from "@/lib/api";
import {
ANIMATION_MODES,
@@ -20,8 +21,8 @@ import { Section, Segmented, ToggleRow } from "./controls";
import { NarratorList } from "./narrator";
import { StyleGrid } from "./style-art";
-/** Up to 3 style reference images (they replace the preset). */
-export function StyleRefs({ value, onChange }: { value: string[]; onChange: (urls: string[]) => void }) {
+/** Up to 3 style reference images (they replace the preset); `max` is what the engine's picture model reads. */
+export function StyleRefs({ value, onChange, max = MAX_STYLE_REFS }: { value: string[]; onChange: (urls: string[]) => void; max?: number }) {
const [list, setList] = useState<SlotValue[]>(() => value.map((url) => ({ ref: url, preview: url, kind: "image" })));
const sync = setList;
// Finished uploads become the settings' references.
@@ -47,7 +48,7 @@ export function StyleRefs({ value, onChange }: { value: string[]; onChange: (url
</button>
</div>
))}
- {list.length < MAX_STYLE_REFS && (
+ {list.length < max && (
<label className="flex size-20 cursor-pointer flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border-strong text-[11px] font-medium text-muted-foreground transition-colors hover:border-primary hover:bg-brand-faint hover:text-brand-text focus-within:ring-2 focus-within:ring-ring">
<Plus className="size-4" />
Add image
@@ -57,7 +58,7 @@ export function StyleRefs({ value, onChange }: { value: string[]; onChange: (url
multiple
className="sr-only"
onChange={(e) => {
- const files = [...(e.target.files ?? [])].slice(0, MAX_STYLE_REFS - list.length);
+ const files = [...(e.target.files ?? [])].slice(0, max - list.length);
e.target.value = "";
for (const f of files) fileToList(f, sync, "image");
}}
@@ -124,6 +125,7 @@ export function EpisodeSettingsForm({
styleIds: string[];
}) {
const [own, setOwn] = useState(value.styleRefs.length > 0);
+ const maxRefs = picker.maxStyleRefs?.[value.engine] ?? MAX_STYLE_REFS;
const videos = picker.videoModels.filter((m) => m.engine === value.engine);
const video = videos.find((m) => m.id === value.videoModel) ?? videos.find((m) => m.id === ENGINE_MODELS[value.engine].video) ?? videos[0];
const resolution = value.resolution && video?.resolutions.includes(value.resolution) ? value.resolution : (DEFAULT_RESOLUTION[video?.id ?? ""]?.[value.animation] ?? video?.resolutions[0]);
@@ -136,7 +138,7 @@ export function EpisodeSettingsForm({
)}
<Section title="Animation">
- <div role="radiogroup" aria-label="Animation" className="grid gap-2 sm:grid-cols-2">
+ <div role="radiogroup" aria-label="Animation" onKeyDown={radioKeys} className="grid gap-2 sm:grid-cols-2">
{ANIMATION_MODES.map((m) => {
const on = value.animation === m.id;
return (
@@ -145,6 +147,7 @@ export function EpisodeSettingsForm({
type="button"
role="radio"
aria-checked={on}
+ tabIndex={radioTab(on)}
onClick={() => onChange({ animation: m.id, resolution: undefined })}
className={cn(
"flex items-start gap-3 rounded-xl border p-3 text-left transition-[border-color,box-shadow] outline-none focus-visible:ring-2 focus-visible:ring-ring",
@@ -156,7 +159,7 @@ export function EpisodeSettingsForm({
</span>
<span className="min-w-0">
<span className="block text-[14px] font-medium">{m.label}</span>
- <span className="block text-[12px] leading-snug text-muted-foreground">{m.copy}</span>
+ <span className="block text-[12px] leading-snug text-muted-foreground">{value.engine === "open" ? m.openCopy : m.copy}</span>
</span>
</button>
);
@@ -180,7 +183,7 @@ export function EpisodeSettingsForm({
<ToggleRow label="Subtitles" hint="Burned into the video, timed to the voice" checked={value.subtitles} onChange={(subtitles) => onChange({ subtitles })} />
<ToggleRow
label="Background music"
- hint={value.engine === "cloud" ? "An instrumental bed under the voice (mixed by ComfyUI: the cloud mixer takes one track)" : "An instrumental bed under the voice (ACE-Step)"}
+ hint={value.engine === "cloud" ? "An instrumental bed under the voice, as long as the film (Sonilo)" : "An instrumental bed under the voice (ACE-Step, up to 4 minutes)"}
checked={value.music}
onChange={(music) => onChange({ music })}
/>
@@ -202,8 +205,11 @@ export function EpisodeSettingsForm({
/>
{own ? (
<div className="space-y-2">
- <StyleRefs value={value.styleRefs} onChange={(styleRefs) => onChange({ styleRefs })} />
- <p className="text-[12px] text-muted-foreground">Up to 3 images in the look you want: palette, technique and texture are matched, nothing is copied.</p>
+ <StyleRefs key={value.engine} value={value.styleRefs.slice(0, maxRefs)} onChange={(styleRefs) => onChange({ styleRefs })} max={maxRefs} />
+ <p className="text-[12px] text-muted-foreground">
+ Up to {maxRefs} images in the look you want: palette, technique and texture are matched, nothing is copied.
+ {value.engine === "open" && maxRefs < MAX_STYLE_REFS && " (The open-source picture model reads two.)"}
+ </p>
</div>
) : (
<StyleGrid ids={styleIds} value={value.styleId} onChange={(styleId) => onChange({ styleId })} />
@@ -237,8 +243,9 @@ export function EpisodeSettingsForm({
)}
<p className="text-[12px] text-muted-foreground">
{value.engine === "cloud"
- ? `Pictures: Nano Banana Pro · Video: ${video?.name ?? "Gemini Omni Flash"} · Voice: ElevenLabs v4 (Chatterbox for your own voice) · Subtitles: Auto Subtitle`
- : "Pictures: Z-Image Turbo · Video: Wan 2.2 Lightning · Voice: Chatterbox · Music: ACE-Step · Subtitles: Qwen3-ASR + burn-in"}
+ ? `Pictures: Nano Banana Pro · Video: ${video?.name ?? "Gemini Omni Flash"} · Voice: ElevenLabs v4 (Chatterbox for your own voice), timed word by word by ElevenLabs forced alignment · Music: Sonilo · Subtitles: Auto Subtitle`
+ : "Pictures: Z-Image Turbo (Qwen-Image-Edit with your images) · Video: Wan 2.2 Lightning · Voice: Chatterbox, timed by Qwen3-ASR · Music: ACE-Step · Subtitles: Qwen3-ASR + burn-in"}
+ {" "}Each scene is cut to where its lines are spoken.
</p>
</CollapsibleContent>
</Collapsible>
diff --git a/src/components/faceless/style-art.tsx b/src/components/faceless/style-art.tsx
index d2eb1946..dbe6ad5e 100644
--- a/src/components/faceless/style-art.tsx
+++ b/src/components/faceless/style-art.tsx
@@ -2,6 +2,7 @@
import { Check } from "lucide-react";
import { memo, useId } from "react";
+import { radioKeys, radioTab } from "@/components/studio/radio-keys";
import { getStyle, type VisualStyle } from "@/lib/catalog/faceless";
import { cn } from "@/lib/utils";
@@ -285,13 +286,14 @@ export const StyleArt = memo(function StyleArt({ styleId, className }: { styleId
});
/** A selectable style card (radio). */
-export function StyleCard({ styleId, selected, onSelect, compact }: { styleId: string; selected: boolean; onSelect: () => void; compact?: boolean }) {
+export function StyleCard({ styleId, selected, onSelect, compact, tabStop }: { styleId: string; selected: boolean; onSelect: () => void; compact?: boolean; tabStop?: boolean }) {
const s = getStyle(styleId);
return (
<button
type="button"
role="radio"
aria-checked={selected}
+ tabIndex={radioTab(tabStop ?? selected)}
onClick={onSelect}
className={cn(
"group/style relative min-w-0 overflow-hidden rounded-xl border bg-background text-left transition-[box-shadow,border-color] outline-none focus-visible:ring-2 focus-visible:ring-ring",
@@ -314,12 +316,13 @@ export function StyleCard({ styleId, selected, onSelect, compact }: { styleId: s
);
}
-/** The style grid (12 Faceless or 22 Explainer styles), a radio group. */
+/** The style grid (12 Faceless or 22 Explainer styles), a radio group: one Tab stop, the arrow keys pick. */
export function StyleGrid({ ids, value, onChange, compact, className }: { ids: string[]; value: string; onChange: (id: string) => void; compact?: boolean; className?: string }) {
+ const picked = ids.includes(value);
return (
- <div role="radiogroup" aria-label="Visual style" className={cn("grid grid-cols-2 gap-2.5 sm:grid-cols-3 lg:grid-cols-4", className)}>
- {ids.map((id) => (
- <StyleCard key={id} styleId={id} selected={value === id} onSelect={() => onChange(id)} compact={compact} />
+ <div role="radiogroup" aria-label="Visual style" onKeyDown={radioKeys} className={cn("grid grid-cols-2 gap-2.5 sm:grid-cols-3 lg:grid-cols-4", className)}>
+ {ids.map((id, i) => (
+ <StyleCard key={id} styleId={id} selected={value === id} tabStop={picked ? value === id : i === 0} onSelect={() => onChange(id)} compact={compact} />
))}
</div>
);
diff --git a/src/lib/catalog/faceless.ts b/src/lib/catalog/faceless.ts
index 1fc50d43..0ab8aeeb 100644
--- a/src/lib/catalog/faceless.ts
+++ b/src/lib/catalog/faceless.ts
@@ -1675,7 +1675,8 @@ export function defaultSettings(engine: Engine, genre: GenreInfo, o: { explainer
animation: "animated",
aspect: "16:9",
subtitles: true,
- music: engine === "open",
+ // A music bed is on by default, as on Higgsfield (both engines mix it under the voice).
+ music: true,
styleId: genre.style,
styleRefs: [],
voice: defaultVoice(engine, genre, o.explainer),
@@ -1849,8 +1850,9 @@ export interface EpisodeCard {
title: string;
status: EpisodeStatus;
styleId: string;
- /** Made with the user's own style references (not a preset). */
+ /** Made with the user's own style references (not a preset), and the first of them. */
ownStyle: boolean;
+ styleRef: string | null;
aspect: EpisodeAspect;
seconds: number;
favorite: boolean;
diff --git a/src/server/faceless.ts b/src/server/faceless.ts
index 12eba60e..39559e17 100644
--- a/src/server/faceless.ts
+++ b/src/server/faceless.ts
@@ -1166,6 +1166,7 @@ function toCard(r: EpisodeRow): EpisodeCard {
status: ep.status,
styleId: ep.settings.styleId,
ownStyle: ep.settings.styleRefs.length > 0,
+ styleRef: ep.settings.styleRefs[0] ?? null,
aspect: ep.settings.aspect,
seconds: (timed ? Object.values(timed).reduce((a, b) => a + b, 0) : totalSeconds(ep.script.blocks)) || ep.settings.length,
favorite: ep.favorite,