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
Studios: no error toast on top of a refusal's card in the other runs and uploads
Adarsh1333808a853b
diff --git a/src/components/assist/composer.tsx b/src/components/assist/composer.tsxindex a532000b..da956662 100644--- a/src/components/assist/composer.tsx+++ b/src/components/assist/composer.tsx@@ -12,6 +12,7 @@ import { uploadFile } from "@/lib/api";import { insertSlash, pickSlash, slashQuery, slashSkills, type SkillSummary } from "@/lib/assist";import type { MediaKind } from "@/lib/catalog/types";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { useEdgeFade } from "@/components/studio/use-edge-fade";import { SkillIcon } from "./skill-icon";@@ -103,7 +104,7 @@ export function AssistComposer({setTimeout(() => release(blob), 1500);}).catch((e) => {- toast.error((e as Error).message);+ toastError(e);setFiles((xs) => xs.filter((x) => x.id !== id));release(blob);});diff --git a/src/components/assist/transcript.tsx b/src/components/assist/transcript.tsxindex a9eee534..d5701303 100644--- a/src/components/assist/transcript.tsx+++ b/src/components/assist/transcript.tsx@@ -11,6 +11,7 @@ import { memoryCardLine, planRunnable, type AssistItem, type AssistThread, typeimport type { Generation } from "@/lib/catalog/types";import { formatCost } from "@/lib/format";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { PlanJobs } from "./plan-jobs";import { SkillIcon } from "./skill-icon";@@ -173,7 +174,7 @@ export function GenerationCards({ ids, all, storyboard, onOpen }: { ids: string[});}if (g.status === "failed" || g.status === "canceled") {- return [<FailedTile key={g.id} g={g} ratio={ratio} onRetry={() => create.mutate(g.request, { onError: (e) => toast.error((e as Error).message) })} />];+ return [<FailedTile key={g.id} g={g} ratio={ratio} onRetry={() => create.mutate(g.request, { onError: (e) => toastError(e) })} />];}return Array.from({ length: Math.max(1, g.request.params?.numOutputs ?? 1) }, (_, i) => <PendingTile key={`${g.id}-${i}`} g={g} ratio={ratio} />);});diff --git a/src/components/av/trim-tool.tsx b/src/components/av/trim-tool.tsxindex d7e9f09d..a0815fe0 100644--- a/src/components/av/trim-tool.tsx+++ b/src/components/av/trim-tool.tsx@@ -11,6 +11,7 @@ import { useCreateGeneration, useEngine, useGenerations } from "@/lib/api";import { formatCueTime, parseCueTime } from "@/lib/av/cue-edit";import { probeBlob, probeUrl } from "@/lib/media-probe";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { MediaDrop } from "./media-drop";import { useDraft } from "./use-draft";import { Panel, ToolHero, ToolShell } from "./tool-shell";@@ -80,7 +81,7 @@ export function TrimTool({ tabs }: { tabs?: React.ReactNode }) {params: { startTime: Math.round(range.startTime * 100) / 100, endTime: Math.round(range.endTime * 100) / 100 },title: `Trim · ${formatCueTime(range.startTime)}–${formatCueTime(range.endTime)}`,},- { onSuccess: () => toast.success("Trimming"), onError: (e) => toast.error((e as Error).message) },+ { onSuccess: () => toast.success("Trimming"), onError: (e) => toastError(e) },);};const typed = !!unread && unread.length == null;diff --git a/src/components/brand/image-list.tsx b/src/components/brand/image-list.tsxindex 8b3d2677..09f0127e 100644--- a/src/components/brand/image-list.tsx+++ b/src/components/brand/image-list.tsx@@ -7,6 +7,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popoverimport { LibraryGrid } from "@/components/studio/media-slot";import { uploadFile } from "@/lib/api";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";/** Upload files as images; resolves the /api/files URLs (bad files are skipped with a toast). */export async function uploadImages(files: File[]): Promise<string[]> {@@ -23,7 +24,7 @@ export async function uploadImages(files: File[]): Promise<string[]> {try {out.push((await uploadFile(f)).url);} catch (e) {- toast.error((e as Error).message);+ toastError(e);}}return out;diff --git a/src/components/captions/captions-studio.tsx b/src/components/captions/captions-studio.tsxindex 72120df7..2f5066d7 100644--- a/src/components/captions/captions-studio.tsx+++ b/src/components/captions/captions-studio.tsx@@ -36,6 +36,7 @@ import {} from "@/lib/av/captions";import { parseCues, toSrt, toVtt, type Cue } from "@/lib/cues";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";const STORE = "fuobe.captions";@@ -183,7 +184,7 @@ function Editor({ video, restored, onReplace }: { video: SlotValue; restored: Saloaded.current = null;setTranscriptId(items[0].id);},- onError: (e) => toast.error((e as Error).message),+ onError: (e) => toastError(e),});const importFile = useRef<HTMLInputElement>(null);@@ -198,7 +199,7 @@ function Editor({ video, restored, onReplace }: { video: SlotValue; restored: Sa}create.mutate(req, {onSuccess: () => toast.success("Burning captions — it'll show under Captioned videos"),- onError: (e) => toast.error((e as Error).message),+ onError: (e) => toastError(e),});};const transcribing = t && (t.status === "queued" || t.status === "running");diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsxindex eb74f68a..6fa4899f 100644--- a/src/components/cinema/prompt-bar.tsx+++ b/src/components/cinema/prompt-bar.tsx@@ -67,6 +67,7 @@ import type { Engine, MediaKind } from "@/lib/catalog/types";import { formatCost } from "@/lib/format";import { modKey } from "@/lib/keys";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { MoveChips, MovePicker } from "./camera-moves";import { CameraChip, EmotionChip, FilmSetupChip, LightingChip, PaletteChip } from "./director-panel";import { directorPicks, draftToInput, type BarAction, type CinemaDraft, type RefItem } from "./draft";@@ -234,7 +235,7 @@ export function useAddRefs(setDraft: (fn: (d: CinemaDraft) => Partial<CinemaDraf.then((a) => setDraft((d) => ({ refs: d.refs.map((r) => (r.id === id ? { ...r, ref: a.url, preview: a.url, uploading: false } : r)) }))).catch((e) => {setDraft((d) => ({ refs: d.refs.filter((r) => r.id !== id) }));- toast.error((e as Error).message || "Upload failed. Please try again.");+ toastError(e, "Upload failed. Please try again.");});}};diff --git a/src/components/content-factory/home.tsx b/src/components/content-factory/home.tsxindex d9841cd4..050d208c 100644--- a/src/components/content-factory/home.tsx+++ b/src/components/content-factory/home.tsx@@ -30,6 +30,7 @@ import {} from "@/lib/catalog/content-factory";import { GENRES, type EpisodeAspect, type FacelessGenre, type NarratorVoice, type PickerData } from "@/lib/catalog/faceless";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { ApiError, discardDraft, useCreateSeries, useGenerateSeries, useRereadSeries, useSeries, useSeriesEstimate, useSeriesList, useUpdateSeries, type SeriesAsk } from "./hooks";import { BriefCard, ClaudeDialog, PresetGrid, ReferenceCard, SeriesPriceLine } from "./parts";@@ -163,7 +164,7 @@ export function ContentFactoryHome({ voices }: { voices: PickerData["voices"] })const asset = await uploadFile(f);await startSeries({ kind: "upload", url: asset.url, title: f.name });} catch (e) {- toast.error((e as Error).message);+ toastError(e);} finally {setUploading(false);}diff --git a/src/components/layers/layers-panel.tsx b/src/components/layers/layers-panel.tsxindex 57e3e8a0..c00adcbf 100644--- a/src/components/layers/layers-panel.tsx+++ b/src/components/layers/layers-panel.tsx@@ -62,6 +62,7 @@ import {type LayerRevision,} from "@/lib/layers";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { Field } from "./bits";import { costLabel, modelsFor, TOOL_FOR_JOB, useEditor } from "./editor-context";import { useKeepAlpha } from "./keep-alpha";@@ -148,7 +149,7 @@ function AddLayer() {const a = await uploadFile(f);await add(a.url, f.name.replace(/\.[^.]+$/, "") || "Uploaded layer");} catch (err) {- toast.error((err as Error).message);+ toastError(err);}}}/>@@ -273,7 +274,7 @@ export function RefPicker({ value, onChange }: { value: string | null; onChange:try {onChange((await uploadFile(f)).url);} catch (err) {- toast.error((err as Error).message);+ toastError(err);} finally {setUploading(false);}diff --git a/src/components/layers/projects-view.tsx b/src/components/layers/projects-view.tsxindex b990d535..65317ddf 100644--- a/src/components/layers/projects-view.tsx+++ b/src/components/layers/projects-view.tsx@@ -19,6 +19,7 @@ import { uploadFile, useHydrated } from "@/lib/api";import { timeAgo } from "@/lib/format";import type { LayerProject } from "@/lib/layers";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { loadImage, sizeOf } from "./render";import { useLayerActions, useLayerProjects } from "./use-layers";@@ -85,7 +86,7 @@ function useOpenImage(onLeft?: () => void) {const asset = await uploadFile(file);await open(asset.url, { name: file.name.replace(/\.[^.]+$/, "").slice(0, 80) });} catch (e) {- toast.error((e as Error).message);+ toastError(e);setBusy(null);}},diff --git a/src/components/library-view.tsx b/src/components/library-view.tsxindex 4c855e4b..e869ae40 100644--- a/src/components/library-view.tsx+++ b/src/components/library-view.tsx@@ -46,6 +46,7 @@ import { buildEntries, folderAndDescendants, reviewInfo, splitByDate, toggleAll,import { isLayered, shownOutputs } from "@/lib/output-actions";import { isExpired } from "@/lib/share";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";type TabId = "all" | "images" | "videos" | "audio" | "text" | "3d" | "favorites" | "uploads" | "shared" | "trash";@@ -356,7 +357,7 @@ function Inner() {const { selected } = latest.current;return list.every((id) => selected.has(id)) ? [...selected] : list;},- retry: (g) => create.mutate(g.request, { onError: (e) => toast.error((e as Error).message) }),+ retry: (g) => create.mutate(g.request, { onError: (e) => toastError(e) }),runner: { onOpen: (g, index) => setOpen({ id: g.id, index }) },}),// eslint-disable-next-line react-hooks/exhaustive-depsdiff --git a/src/components/model3d/model3d-studio.tsx b/src/components/model3d/model3d-studio.tsxindex e6ab23cc..7f60973b 100644--- a/src/components/model3d/model3d-studio.tsx+++ b/src/components/model3d/model3d-studio.tsx@@ -36,6 +36,7 @@ import {import type { Engine, Generation, GenerationRequest } from "@/lib/catalog/types";import { keepOffered, offered } from "@/lib/model-access";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { priceLine, useRunPreview } from "./hooks";import { ModelCard } from "./model-card";@@ -161,7 +162,7 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {if (blocker) return void toast(blocker, { id: "3d-blocker" });create.mutate(model3dRequest(input), {onSuccess: () => toast.success(mode === "splat" ? "Making your splat" : mode === "text" && engine === "open" ? "Drawing the object, then building it in 3D" : "Building your 3D model"),- onError: (e) => toast.error((e as Error).message),+ onError: (e) => toastError(e),});};const licence = modelId ? info[modelId]?.licence : undefined;@@ -358,6 +359,6 @@ function retryOf(g: Generation): GenerationRequest {function ResultCard({ g, info, cloudAllowed }: { g: Generation; info: Record<string, Model3dInfo>; cloudAllowed: boolean }) {const create = useCreateGeneration();if (g.status === "queued" || g.status === "running") return <PendingTile g={g} ratio={4 / 3} />;- if (g.status !== "succeeded") return <FailedTile g={g} ratio={4 / 3} onRetry={() => create.mutate(retryOf(g), { onError: (e) => toast.error((e as Error).message) })} />;+ if (g.status !== "succeeded") return <FailedTile g={g} ratio={4 / 3} onRetry={() => create.mutate(retryOf(g), { onError: (e) => toastError(e) })} />;return <ModelCard g={g} info={info} cloudAllowed={cloudAllowed} />;}diff --git a/src/components/model3d/rig-dialog.tsx b/src/components/model3d/rig-dialog.tsxindex 4aa5f29d..d37874e3 100644--- a/src/components/model3d/rig-dialog.tsx+++ b/src/components/model3d/rig-dialog.tsx@@ -10,6 +10,7 @@ import { Label } from "@/components/ui/label";import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "@/components/ui/select";import { useCreateGeneration } from "@/lib/api";import { ANIMATION_LIBRARY_URL, ANIMATION_MAX, ANIMATION_PRESETS, animationId, rigRequest } from "@/lib/av/model3d";+import { toastError } from "@/lib/refusals";import { priceLine, useRunPreview } from "./hooks";const NONE = "none";@@ -35,7 +36,7 @@ export function RigDialog({ glb, open, onOpenChange, cloudAllowed }: { glb: stritoast.success(animation === null ? "Rigging your character" : "Rigging and animating your character");onOpenChange(false);},- onError: (e) => toast.error((e as Error).message),+ onError: (e) => toastError(e),});};return (diff --git a/src/components/moodboards/create-moodboard.tsx b/src/components/moodboards/create-moodboard.tsxindex 3a4f68a5..0069b5ba 100644--- a/src/components/moodboards/create-moodboard.tsx+++ b/src/components/moodboards/create-moodboard.tsx@@ -12,6 +12,7 @@ import { LibraryGrid } from "@/components/studio/media-slot";import { uploadFile, useEngine, useStatus } from "@/lib/api";import type { RGB } from "@/lib/catalog/palettes";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { useMoodboardActions } from "./hooks";import { loadImage, pixelsOf, renderCollages } from "./images";import { colorFeature, COPY, imageProblem, moodboardError, MOODBOARD_LIMITS, representativeOrder, suggestMoodboardName, type Moodboard } from "./logic";@@ -93,7 +94,7 @@ export function CreateMoodboardDialog({ open, onOpenChange, onCreated }: { open:} catch (e) {keys.current.delete(src.key);setItems((xs) => xs.filter((x) => x.id !== id));- toast.error((e as Error).message || "Upload failed");+ toastError(e, "Upload failed");}};const addFiles = (files: Iterable<File>) => {diff --git a/src/components/shorts/custom-preset-dialog.tsx b/src/components/shorts/custom-preset-dialog.tsxindex cc3e6f5b..aa57d734 100644--- a/src/components/shorts/custom-preset-dialog.tsx+++ b/src/components/shorts/custom-preset-dialog.tsx@@ -8,6 +8,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, Dimport { uploadFile } from "@/lib/api";import { SHORTS, type ShortsCustomPreset } from "@/lib/catalog/shorts";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { usePresetActions } from "./hooks";interface Ref {@@ -70,7 +71,7 @@ export function CustomPresetDialog({uploadFile(f).then((a) => setRefs((xs) => xs.map((r) => (r.id === id ? { ...r, url: a.url, uploading: false } : r)))).catch((e) => {- toast.error((e as Error).message);+ toastError(e);setRefs((xs) => xs.filter((r) => r.id !== id));});}diff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsxindex a665f1c5..72715b20 100644--- a/src/components/storyboard-view.tsx+++ b/src/components/storyboard-view.tsx@@ -25,6 +25,7 @@ import type { Engine, Generation } from "@/lib/catalog/types";import { timeAgo } from "@/lib/format";import { BOARD_TITLES_KEY, boardTitle, filmReady, rememberTitle } from "@/lib/storyboard-board";import { cn } from "@/lib/utils";+import { responseError, toastError } from "@/lib/refusals";const ASPECTS: readonly string[] = STORYBOARD_ASPECTS;@@ -128,7 +129,7 @@ function FilmStrip({ items, ratio, onOpen }: { items: Generation[]; ratio: numbe<MediaThumb output={g.outputs[0]} autoPlay={g === film} /></button>) : g.status === "failed" || g.status === "canceled" ? (- <FailedTile g={g} ratio={ratio} onRetry={() => create.mutate(g.request, { onError: (e) => toast.error((e as Error).message) })} />+ <FailedTile g={g} ratio={ratio} onRetry={() => create.mutate(g.request, { onError: (e) => toastError(e) })} />) : (<PendingTile g={g} ratio={ratio} />);@@ -174,7 +175,7 @@ function FrameTile({ g, index, ratio, onOpen }: { g: Generation; index: number;</span></>) : g.status === "failed" || g.status === "canceled" ? (- <FailedTile g={g} ratio={ratio} onRetry={() => create.mutate(g.request, { onError: (e) => toast.error((e as Error).message) })} />+ <FailedTile g={g} ratio={ratio} onRetry={() => create.mutate(g.request, { onError: (e) => toastError(e) })} />) : (<PendingTile g={g} ratio={ratio} />)}@@ -211,14 +212,14 @@ function Board({mutationFn: async () => {const res = await fetch(`/api/storyboards/${first.batchId}/film`, { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });const body = await res.json();- if (!res.ok) throw new Error(body.error);+ if (!res.ok) throw responseError(res, body.error);return body as { items: Generation[] };},onSuccess: (b) => {toast.success(`Animating ${b.items.length - 1} shots, then joining them into one film`);void qc.invalidateQueries({ queryKey: ["generations"] });},- onError: (e) => toast.error((e as Error).message),+ onError: (e) => toastError(e),});const filmButton = (<Button variant="secondary" size="sm" disabled={!ready || makeFilm.isPending} onClick={() => makeFilm.mutate()} className="whitespace-nowrap">@@ -345,7 +346,7 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the sbody: JSON.stringify({ ...boardBody, references: refs.filter((r) => r.ref).map((r) => r.ref) }),});const body = await res.json();- if (!res.ok) throw new Error(body.error);+ if (!res.ok) throw responseError(res, body.error);return body as { scenes: string[]; batchId?: string };},onSuccess: (b) => {@@ -354,7 +355,7 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the stoast.success(`${b.scenes.length} frames on the way — each one builds on the last`);void qc.invalidateQueries({ queryKey: ["generations"] });},- onError: (e) => toast.error((e as Error).message),+ onError: (e) => toastError(e),});const ready = (mode === "auto" ? story.trim().length > 3 : scenes.some((s) => s.trim())) && !refs.some((r) => r.uploading);diff --git a/src/components/studio/feed.tsx b/src/components/studio/feed.tsxindex 7b61570c..67ba9ded 100644--- a/src/components/studio/feed.tsx+++ b/src/components/studio/feed.tsx@@ -21,6 +21,7 @@ import { downloadHref, downloadName, userTitle } from "@/lib/library";import { isLayered, nextSteps, shownOutputs } from "@/lib/output-actions";import { cn } from "@/lib/utils";import { copyWithToast } from "@/lib/clipboard";+import { toastError } from "@/lib/refusals";import { ACTION_ICONS, TileActions, useCanHover, type RunnerOptions } from "./result-actions";import { LayersStack, MediaThumb } from "./result-media";import { useNow } from "./use-now";@@ -129,7 +130,7 @@ export function useFinalizeDraft() {return (g: Generation, draftId: string) =>create.mutate({ feature: g.feature, modelId: g.modelId, op: "finalize", prompt: g.request.prompt, params: { draftId, resolution: "1080p", duration: g.request.params?.duration } },- { onSuccess: () => toast.success("Rendering the final 1080p version"), onError: (e) => toast.error((e as Error).message) },+ { onSuccess: () => toast.success("Rendering the final 1080p version"), onError: (e) => toastError(e) },);}@@ -396,7 +397,7 @@ export function Feed({const api = useMemo<FeedApi>(() => ({open: openAt,- retry: (g) => createRef.current.mutate(g.request, { onError: (e) => toast.error((e as Error).message) }),+ retry: (g) => createRef.current.mutate(g.request, { onError: (e) => toastError(e) }),reuse: hasReuse ? (g) => reuseRef.current?.(g) : undefined,runner: { onOpen: openAt, onReuse: hasReuse ? (g) => reuseRef.current?.(g) : undefined },}),diff --git a/src/components/studio/result-actions.tsx b/src/components/studio/result-actions.tsxindex 8df4770b..18b36e73 100644--- a/src/components/studio/result-actions.tsx+++ b/src/components/studio/result-actions.tsx@@ -71,6 +71,7 @@ import { toSrt, toVtt } from "@/lib/cues";import { cuesOf, outputActions, textOf, type ActionContext, type OutputAction, type OutputActionId } from "@/lib/output-actions";import { cn } from "@/lib/utils";import { copyWithToast } from "@/lib/clipboard";+import { toastError } from "@/lib/refusals";export const ACTION_ICONS: Record<OutputActionId, LucideIcon> = {animate: Clapperboard,@@ -230,7 +231,7 @@ export function useActionRunner(opts: RunnerOptions = {}) {case "finalize":return create.mutate({ feature: g.feature, modelId: g.modelId, op: "finalize", prompt: g.request.prompt, params: { draftId: o.draftId, resolution: "1080p", duration: g.request.params?.duration } },- { onSuccess: () => toast.success("Rendering the final 1080p version"), onError: (e) => toast.error((e as Error).message) },+ { onSuccess: () => toast.success("Rendering the final 1080p version"), onError: (e) => toastError(e) },);case "reuse":return opts.onReuse?.(g);@@ -281,7 +282,7 @@ export function SaveElementForm({ g, o, onDone }: { g: Generation; o: OutputFileonDone();toast.success(`Saved as @${el.handle}`, { action: { label: "Open", onClick: () => router.push(`/elements/${el.id}`) } });},- onError: (e) => toast.error((e as Error).message),+ onError: (e) => toastError(e),},);return (diff --git a/src/components/studio/voice-recorder.tsx b/src/components/studio/voice-recorder.tsxindex 4f4e34f9..be9011bb 100644--- a/src/components/studio/voice-recorder.tsx+++ b/src/components/studio/voice-recorder.tsx@@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from "react";import { toast } from "sonner";import { uploadFile } from "@/lib/api";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import type { SlotValue } from "./media-slot";/** Decode any recording the browser made and re-encode it as 16-bit mono WAV — every voice API takes WAV. */@@ -77,7 +78,7 @@ export function VoiceRecorder({ onRecorded, max = 60, className }: { onRecorded:const asset = await uploadFile(file);onRecorded({ ref: asset.url, preview: asset.url, kind: "audio", name: "Recording" });} catch (e) {- toast.error((e as Error).message || "Couldn't save the recording");+ toastError(e, "Couldn't save the recording");} finally {setState("idle");}diff --git a/src/components/swap-studio/stage-anchors.tsx b/src/components/swap-studio/stage-anchors.tsxindex 2a2ead79..04cbdebc 100644--- a/src/components/swap-studio/stage-anchors.tsx+++ b/src/components/swap-studio/stage-anchors.tsx@@ -13,6 +13,7 @@ import { jobState, SWAP_STUDIO, type AnchorVariant, type GenSummary, type SwapSeimport { anchorWords } from "@/lib/catalog/swap-studio-plan";import type { Engine } from "@/lib/catalog/types";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { useMakeAnchor, useStopJob, useSwapEdit } from "./hooks";import { GenChip, JobError, Note, priceText, SavedText } from "./parts";import type { StageProps } from "./workbench";@@ -37,7 +38,7 @@ export function AnchorMaker({ id, project, clip, shotId, segment, estimate }: Piawait importer.mutateAsync({ type: "anchor-import", clipId: clip.id, shotId, ...(segment ? { segmentId: segment.id } : {}), url: a.url });toast(`Imported the ${which}`);} catch (e) {- toast.error((e as Error).message);+ toastError(e);} finally {setImporting(false);}diff --git a/src/components/swap-studio/workbench.tsx b/src/components/swap-studio/workbench.tsxindex 49a78d54..9ae01614 100644--- a/src/components/swap-studio/workbench.tsx+++ b/src/components/swap-studio/workbench.tsx@@ -13,6 +13,7 @@ import { EngineSwitch } from "@/components/studio/engine-switch";import { uploadFile } from "@/lib/api";import { clipExtension, clipNeedsPreview, clipProblem, jobState, MODE_LABELS, pageClip, secondsLabel, SWAP_STUDIO, type GenSummary, type StudioEstimate, type SwapClip, type SwapProject, type SwapShot } from "@/lib/catalog/swap-studio";import { cn } from "@/lib/utils";+import { toastError } from "@/lib/refusals";import { decisionsHref, useAddClip, usePrepareClip, useSwapEdit, useSwapEstimate, useSwapProject, type EditInput } from "./hooks";import { GenChip, JobError, Note, priceText, SavedText } from "./parts";import { AnchorsStage } from "./stage-anchors";@@ -261,7 +262,7 @@ function CharacterPanel({ project, edit }: { project: SwapProject; edit: StagePrconst a = await uploadFile(file);await edit({ type: "character", image: a.url });} catch (e) {- toast.error((e as Error).message);+ toastError(e);} finally {setBusy(false);}diff --git a/tests/guest-prompt.test.ts b/tests/guest-prompt.test.tsindex 258ab5c1..d2d1fd27 100644--- a/tests/guest-prompt.test.ts+++ b/tests/guest-prompt.test.ts@@ -9,7 +9,7 @@ vi.mock("sonner", () => ({ toast: Object.assign(() => {}, { error: (m: string) =import { fileToSlot, type SlotValue } from "@/components/studio/media-slot";import { assetUsage, CONNECT_GPU_EVENT, enhance, GUEST_PROMPT_EVENT, refusalCard, signInHref, watchGuestRefusals } from "@/lib/api";import { CONNECT_GPU_HEADER, CONNECT_GPU_MESSAGE, GUEST_HEADER, GUEST_LIBRARY_MESSAGE, GUEST_RUN_MESSAGE } from "@/lib/guest-access";-import { refusalShown } from "@/lib/refusals";+import { refusalShown, toastError } from "@/lib/refusals";const answer = (status: number, body: Record<string, unknown>, headers: Record<string, string> = {}) =>new Response(JSON.stringify(body), { status, headers: { "Content-Type": "application/json", ...headers } });@@ -98,6 +98,17 @@ describe("a guest's refused run", () => {expect(refusalShown(null)).toBe(false);expect(refusalShown("text")).toBe(false);});++ it("a studio's error toast stays quiet for it, and says any other failure", async () => {+ page("/storyboard");+ server = () => guestRefusal();+ toastError(await enhance("a red coat", "image", "t2i").catch((err: unknown) => err));+ expect(events).toEqual([GUEST_PROMPT_EVENT]);+ expect(toasts.error).toEqual([]);+ toastError(new Error("Couldn't start the film"));+ toastError(new Error(""), "Upload failed");+ expect(toasts.error).toEqual(["Couldn't start the film", "Upload failed"]);+ });});describe("the sign-in page", () => {