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.

Assist UI: "Open in <Studio>" cards for studio jobs; dub and captions links open the job

Claudef63e0ec0228e
diff --git a/src/components/assist/transcript.tsx b/src/components/assist/transcript.tsx
index d4b24bb7..26eb6266 100644
--- a/src/components/assist/transcript.tsx
+++ b/src/components/assist/transcript.tsx
@@ -1,6 +1,6 @@
"use client";
-import { ArrowUpRight, AudioLines, Box, Brain, Check, CircleAlert, Clapperboard, FileText, ImageIcon, Loader2, Search, Sparkles, Video } from "lucide-react";
+import { AppWindow, ArrowUpRight, AudioLines, Box, Brain, Captions, Check, CircleAlert, Clapperboard, Film, FileText, ImageIcon, Info, Languages, Layers, Loader2, Megaphone, Scissors, Search, Sparkles, Video } from "lucide-react";
import Link from "next/link";
import { useState } from "react";
import { toast } from "sonner";
@@ -125,6 +125,20 @@ export function ApprovalCard({ item, live, onAnswer }: { item: Extract<AssistIte
);
})}
</ul>
+ {!!(item.opens?.length || item.notes?.length) && (
+ <div className="space-y-1 border-t px-4 py-2.5 text-[12px] text-muted-foreground">
+ {item.opens?.length ? (
+ <p className="flex items-start gap-1.5">
+ <AppWindow className="mt-0.5 size-3.5 shrink-0" /> Opens in {item.opens.join(" and ")}, where you can keep working on it
+ </p>
+ ) : null}
+ {item.notes?.map((n) => (
+ <p key={n} className="flex items-start gap-1.5">
+ <Info className="mt-0.5 size-3.5 shrink-0" /> {n}
+ </p>
+ ))}
+ </div>
+ )}
{item.jobs.length > 6 && (
<button onClick={() => setAll((v) => !v)} className="w-full border-t px-4 py-2 text-left text-[12px] font-medium text-brand-text hover:bg-accent">
{all ? "Show fewer steps" : `Show all ${item.jobs.length} steps`}
@@ -147,6 +161,31 @@ export function ApprovalCard({ item, live, onAnswer }: { item: Extract<AssistIte
);
}
+const STUDIO_ICON: Record<string, typeof ImageIcon> = { Layers, "Shorts Studio": Clapperboard, "Translate & dub": Languages, "Faceless Studio": Film, "Ads Studio": Megaphone, Captions, Katana: Scissors };
+
+/** A job a studio took: where it lives, and the way there. */
+function StudioCard({ text, studio, href }: { text: string; studio: string; href: string }) {
+ const Icon = STUDIO_ICON[studio] ?? AppWindow;
+ return (
+ <div className="flex animate-fade-up flex-col gap-3 rounded-2xl border bg-background px-4 py-3 shadow-soft sm:flex-row sm:items-center">
+ <div className="flex min-w-0 flex-1 items-center gap-3">
+ <span className="grid size-8 shrink-0 place-items-center rounded-lg bg-brand-faint text-brand-text">
+ <Icon className="size-4" />
+ </span>
+ <div className="min-w-0">
+ <p className="text-[13px] font-medium break-words">{text}</p>
+ <p className="text-[12px] text-muted-foreground">Follow it and keep editing in {studio}.</p>
+ </div>
+ </div>
+ <Button asChild size="sm" variant="outline" className="w-full rounded-full sm:w-auto">
+ <Link href={href}>
+ Open in {studio} <ArrowUpRight />
+ </Link>
+ </Button>
+ </div>
+ );
+}
+
export function GenerationCards({ ids, all, storyboard, onOpen }: { ids: string[]; all: Map<string, Generation>; storyboard?: boolean; onOpen: (g: Generation, i: number) => void }) {
const create = useCreateGeneration();
const gens = ids.map((id) => all.get(id)).filter((g): g is Generation => !!g);
@@ -227,6 +266,7 @@ export function Transcript({
</div>
);
case "tool":
+ if (item.studio && item.href) return <StudioCard key={item.id} text={item.text} studio={item.studio} href={item.href} />;
return item.href ? (
<Link key={item.id} href={item.href} className="flex w-fit items-center gap-1.5 text-[12px] text-muted-foreground hover:text-foreground">
<Search className="size-3" /> {item.text} <ArrowUpRight className="size-3" />
diff --git a/src/components/captions/captions-studio.tsx b/src/components/captions/captions-studio.tsx
index b65b1918..071ef94e 100644
--- a/src/components/captions/captions-studio.tsx
+++ b/src/components/captions/captions-studio.tsx
@@ -57,6 +57,30 @@ function load(): Saved | null {
const DEFAULT_LOOK: CaptionLook = { style: "clean", size: "M", position: "bottom" };
+/**
+ * A hand-off: /video-tools/captions?video=<file>&transcript=<generation id> opens the editor on that
+ * video and fills the lines from the transcript when it's done (Assist and MCP link the captions they
+ * burn). Lines already edited in this browser for the same video and transcript are kept.
+ */
+function handoff(): Saved | null {
+ const p = new URLSearchParams(window.location.search);
+ const video = p.get("video");
+ if (!video?.startsWith("/api/files/")) return null;
+ const transcriptId = p.get("transcript") || undefined;
+ const local = load();
+ if (local?.video.ref === video && (!transcriptId || local.transcriptId === transcriptId)) return local;
+ return { video: { ref: video, preview: video, kind: "video", name: video.split("/").pop() }, cues: [], look: DEFAULT_LOOK, ...(transcriptId && { transcriptId }) };
+}
+
+/** Leaving the handed-off video: a reload then shows this browser's own project. */
+function dropHandoff() {
+ const url = new URL(window.location.href);
+ if (!url.searchParams.has("video") && !url.searchParams.has("transcript")) return;
+ url.searchParams.delete("video");
+ url.searchParams.delete("transcript");
+ window.history.replaceState(null, "", url);
+}
+
function download(name: string, text: string, type: string) {
const url = URL.createObjectURL(new Blob([text], { type }));
const a = document.createElement("a");
@@ -68,9 +92,9 @@ function download(name: string, text: string, type: string) {
/** Captions (Video tools → Captions): transcribe, fix every line, style, burn in — or export .srt / .vtt. */
export function CaptionsStudio({ tabs }: { tabs?: React.ReactNode }) {
- // The last project comes back after a reload (this browser only), once hydrated.
+ // The last project comes back after a reload (this browser only), once hydrated; a hand-off link wins.
const hydrated = useHydrated();
- const saved = useMemo(() => (hydrated ? load() : undefined), [hydrated]);
+ const saved = useMemo(() => (hydrated ? (handoff() ?? load()) : undefined), [hydrated]);
const [picked, setVideo] = useState<SlotValue | null | undefined>(undefined);
const video = picked === undefined ? (saved?.video ?? null) : picked;
const results = useGenerations({ features: ["captions"], kinds: ["video"], limit: 24 });
@@ -83,6 +107,7 @@ export function CaptionsStudio({ tabs }: { tabs?: React.ReactNode }) {
restored={saved?.video.ref === video.ref ? saved : null}
onReplace={(v) => {
setVideo(v);
+ dropHandoff();
try {
localStorage.removeItem(STORE);
} catch {}
diff --git a/src/components/dub/dub-studio.tsx b/src/components/dub/dub-studio.tsx
index 05ff3974..ee09453a 100644
--- a/src/components/dub/dub-studio.tsx
+++ b/src/components/dub/dub-studio.tsx
@@ -52,16 +52,35 @@ function StageBadge({ stage }: { stage: DubStage }) {
export function DubStudio({ tabs }: { tabs?: React.ReactNode }) {
const sessions = useDubSessions();
const [openId, setOpenId] = useState<string | null>(null);
+ // Hand-off: /audio/translate?dub=<id> opens that dub (Assist and MCP link the dubs they start).
+ useEffect(() => {
+ const id = new URLSearchParams(window.location.search).get("dub");
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- read once after hydration (no Suspense boundary needed)
+ if (id) setOpenId(id);
+ }, []);
+ // The open dub is in the address, so a reload or a shared link comes back to it.
+ const show = (id: string | null) => {
+ setOpenId(id);
+ const url = new URL(window.location.href);
+ if (id) url.searchParams.set("dub", id);
+ else url.searchParams.delete("dub");
+ window.history.replaceState(null, "", url);
+ };
// A dub removed elsewhere (another tab) just closes.
const open = sessions.data?.find((s) => s.id === openId);
return (
<ToolShell title="Audio" tabs={tabs}>
{open ? (
- <SessionView key={open.id} s={open} onBack={() => setOpenId(null)} />
+ <SessionView key={open.id} s={open} onBack={() => show(null)} />
+ ) : openId && sessions.isLoading ? (
+ <div className="mx-auto max-w-[760px] space-y-3 pt-4" aria-label="Opening the dub">
+ <Skeleton className="h-8 w-48" />
+ <Skeleton className="aspect-video w-full rounded-2xl" />
+ </div>
) : (
<>
- <NewDub onStarted={(id) => setOpenId(id)} />
- <RecentDubs sessions={sessions.data} loading={sessions.isLoading} onOpen={setOpenId} />
+ <NewDub onStarted={show} />
+ <RecentDubs sessions={sessions.data} loading={sessions.isLoading} onOpen={show} />
</>
)}
</ToolShell>