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
Assist: the Schedule dialog runs A request or A skill, with each file input a picked file or the newest upload
Claude4f9405affa96
diff --git a/src/components/assist/hooks.ts b/src/components/assist/hooks.tsindex dfac1cac..9c7a985f 100644--- a/src/components/assist/hooks.ts+++ b/src/components/assist/hooks.ts@@ -18,7 +18,7 @@ import type {SkillSummary,} from "@/lib/assist";import type { ConnectorView } from "@/lib/assist-connectors";-import type { ScheduleRule, ScheduleView } from "@/lib/assist-schedule";+import type { ScheduleRule, ScheduleSkill, ScheduleView } from "@/lib/assist-schedule";import type { Engine, Generation } from "@/lib/catalog/types";import type { RecipeEstimate, RecipeRun, RecipeView, VerifyResult } from "@/lib/recipe";import type { DraftRefusal, Naming, SkillDraft } from "@/lib/recipe-builder";@@ -434,6 +434,8 @@ export interface ScheduleForm {engine: Engine;mode?: AssistModeChoice | null;connectors?: boolean;+ /** Run a saved skill instead of a request (null: back to a request). */+ skill?: ScheduleSkill | null;paused?: boolean;}diff --git a/src/components/assist/run-skill-dialog.tsx b/src/components/assist/run-skill-dialog.tsxindex 33d6b5ba..073a9aa9 100644--- a/src/components/assist/run-skill-dialog.tsx+++ b/src/components/assist/run-skill-dialog.tsx@@ -265,7 +265,7 @@ function Loaded({ view, onClose, examples, intro }: { view: RecipeView; onClose:<div className="space-y-4">{recipe.params.length === 0 && <p className="text-[13px] text-muted-foreground">This skill takes no inputs: it runs the same steps each time.</p>}{recipe.params.map((p) => (- <Field+ <RecipeFieldkey={p.id}p={p}value={values[p.id]}@@ -351,8 +351,8 @@ function Notice({ tone, children, action }: { tone: "warn" | "info"; children: R);}-/** One input of the form, by its type. */-function Field({+/** One input of the form, by its type (the schedule dialog's skill mode uses it too). */+export function RecipeField({p,value,onChange,diff --git a/src/components/assist/schedule-dialog.tsx b/src/components/assist/schedule-dialog.tsxindex e5bf149e..2346d82b 100644--- a/src/components/assist/schedule-dialog.tsx+++ b/src/components/assist/schedule-dialog.tsx@@ -34,19 +34,26 @@ import {import type { Engine } from "@/lib/catalog/types";import { cn } from "@/lib/utils";import { toastError } from "@/lib/refusals";-import { useChats, useConnectors, useProjects, useScheduleActions, type ScheduleRuleInput } from "./hooks";+import { useChats, useConnectors, useProjects, useRecipe, useScheduleActions, useSkills, type ScheduleRuleInput } from "./hooks";import { ModePicker } from "./mode-picker";import { ProjectDot } from "./project-dot";+import { inputsFrom, SkillTaskFields, skillTask, type SkillInputs } from "./schedule-skill";-/** What a new task starts from: a chat's request, a project. */+/** What a new task starts from: a chat's request, a project, or a skill that runs by itself. */export interface ScheduleSeed {prompt?: string;attachments?: string[];projectId?: string | null;engine?: Engine;mode?: AssistModeChoice | null;+ skill?: string;}+const WHAT = [+ { id: "request", label: "A request" },+ { id: "skill", label: "A skill" },+] as const;+const KINDS: { id: ScheduleRule["kind"]; label: string }[] = [{ id: "daily", label: "Daily" },{ id: "weekly", label: "Weekly" },@@ -113,6 +120,25 @@ function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: Sche// Off unless the task opts in: connector tools run inside Claude's reply, where no approval reaches them.const [connectors, setConnectors] = useState(schedule?.connectors ?? false);const connectorNames = (useConnectors().data ?? []).filter((c) => c.enabled).map((c) => c.name);+ // What runs: a request Assist plans each time, or a saved skill's steps with fixed inputs (no model plans it).+ const [what, setWhat] = useState<"request" | "skill">(schedule?.skill || seed?.skill ? "skill" : "request");+ const [skillName, setSkillName] = useState<string | null>(schedule?.skill?.name ?? seed?.skill ?? null);+ const [inputs, setInputs] = useState<SkillInputs>(() => inputsFrom(schedule?.skill));+ const [tried, setTried] = useState(false);+ const allSkills = useSkills().data;+ const runnable = allSkills ? allSkills.filter((s) => s.recipe && s.enabled) : null;+ const recipe = useRecipe(what === "skill" ? skillName : null);+ const skill = what === "skill" && recipe.data && runnable?.some((s) => s.name === recipe.data.name) ? recipe.data : undefined;+ const task = skill ? skillTask(skill, inputs) : null;+ // A skill runs only on the engines its steps run on: the task takes the one it was checked on.+ const runEngine: Engine = skill?.engines.length && !skill.engines.includes(engine) ? (skill.ready.find((e) => skill.engines.includes(e)) ?? skill.engines[0]) : engine;+ const pickSkill = (name: string) => {+ setSkillName(name);+ setInputs(inputsFrom(null));+ setTried(false);+ const picked = runnable?.find((s) => s.name === name)?.title;+ if (!titleTouched && picked) setTitle(picked);+ };const [busy, setBusy] = useState(false);const zones = useMemo(() => {const list = allZones();@@ -130,25 +156,23 @@ function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: Scheconst save = async (e: React.FormEvent) => {e.preventDefault();- if (!prompt.trim()) return void toast.error("Write what Assist should do each time");+ if (what === "request" && !prompt.trim()) return void toast.error("Write what Assist should do each time");+ if (what === "skill") {+ setTried(true);+ if (!skill || !task) return void toast.error("Pick a skill to run");+ if (!task.ok) return void toast.error(task.uploading ? "Wait for the upload to finish" : (Object.values(task.errors)[0] ?? "Check the skill's inputs"));+ }if (problem) return void toast.error(problem);if (!next) return void toast.error(kind === "once" ? "That time has passed — pick a later one" : "This schedule never runs");if (capBad) return void toast.error(`Set a cap between $0 and $${MAX_SCHEDULE_CAP_USD}`);setBusy(true);try {- const body = {- title: title.trim() || threadTitle(prompt),- prompt: prompt.trim(),- attachments,- projectId,- rule,- tz,- approval,- capUsd: approval === "auto" ? capUsd : null,- engine,- mode,- connectors,- };+ const when = { projectId, rule, tz, approval, capUsd: approval === "auto" ? capUsd : null };+ // A skill task has no prompt, mode or connectors: no model plans its runs.+ const body =+ skill && task+ ? { ...when, title: title.trim() || skill.title, prompt: "", attachments: [], engine: runEngine, mode: null, connectors: false, skill: task.task }+ : { ...when, title: title.trim() || threadTitle(prompt), prompt: prompt.trim(), attachments, engine, mode, connectors, skill: null };const s = schedule ? await actions.update(schedule.id, body) : await actions.create(body);toast.success(schedule ? "Schedule saved" : "Scheduled", { description: s.nextRunAt ? `Next run ${formatWhen(s.nextRunAt, s.tz)}` : undefined, duration: 2500 });onDone();@@ -173,34 +197,72 @@ function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: Sche{onComputer && <p className="text-[13px] text-muted-foreground">Runs on your computer: keep Fuobe open there at that time.</p>}</DialogHeader><div className="min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-5">- <div className="space-y-2">- <Label htmlFor={ids.prompt}>What should Assist do each time?</Label>- <Textarea- id={ids.prompt}- value={prompt}- onChange={(e) => {- setPrompt(e.target.value);- if (!titleTouched) setTitle(e.target.value.trim() ? threadTitle(e.target.value) : "");- }}- maxLength={MAX_SCHEDULE_PROMPT}- rows={4}- autoFocus={!schedule && !initialPrompt}- placeholder="e.g. “Make 3 new ad variations for my sneaker, vertical 9:16, in today's light”"- className="min-h-24 text-[14px]"- />- {attachments.length > 0 && (- <ul className="flex flex-wrap gap-1.5" aria-label="Files each run uses">- {attachments.map((a, i) => (- <li key={a} className="inline-flex h-7 items-center gap-1 rounded-full bg-muted pr-1 pl-2.5 text-[12px]">- File {i + 1}- <button type="button" onClick={() => setAttachments((xs) => xs.filter((x) => x !== a))} className="grid size-5 place-items-center rounded-full hover:bg-background" aria-label={`Don't use file ${i + 1}`}>- <X className="size-3" />- </button>- </li>- ))}- </ul>+ <fieldset className="space-y-3">+ <legend className="text-sm font-medium">What to run</legend>+ <div role="radiogroup" aria-label="What to run" onKeyDown={radioKeys} className="flex flex-wrap gap-1.5">+ {WHAT.map((w) => (+ <button+ key={w.id}+ type="button"+ role="radio"+ aria-checked={what === w.id}+ tabIndex={radioTab(what === w.id)}+ onClick={() => setWhat(w.id)}+ className={cn(+ "inline-flex h-8 items-center rounded-full px-3 text-[13px] font-medium transition-colors",+ what === w.id ? "bg-brand-faint text-brand-text hover:bg-brand-faint-hover" : "bg-secondary text-secondary-foreground hover:bg-accent",+ )}+ >+ {w.label}+ </button>+ ))}+ </div>+ {what === "skill" && (+ <SkillTaskFields+ skills={runnable}+ name={skillName}+ onName={pickSkill}+ view={skill}+ failed={recipe.isError ? (recipe.error as Error).message : undefined}+ inputs={inputs}+ onInputs={setInputs}+ engine={runEngine}+ onEngine={setEngine}+ tried={tried}+ />)}- </div>+ </fieldset>++ {what === "request" && (+ <div className="space-y-2">+ <Label htmlFor={ids.prompt}>What should Assist do each time?</Label>+ <Textarea+ id={ids.prompt}+ value={prompt}+ onChange={(e) => {+ setPrompt(e.target.value);+ if (!titleTouched) setTitle(e.target.value.trim() ? threadTitle(e.target.value) : "");+ }}+ maxLength={MAX_SCHEDULE_PROMPT}+ rows={4}+ autoFocus={!schedule && !initialPrompt}+ placeholder="e.g. “Make 3 new ad variations for my sneaker, vertical 9:16, in today's light”"+ className="min-h-24 text-[14px]"+ />+ {attachments.length > 0 && (+ <ul className="flex flex-wrap gap-1.5" aria-label="Files each run uses">+ {attachments.map((a, i) => (+ <li key={a} className="inline-flex h-7 items-center gap-1 rounded-full bg-muted pr-1 pl-2.5 text-[12px]">+ File {i + 1}+ <button type="button" onClick={() => setAttachments((xs) => xs.filter((x) => x !== a))} className="grid size-5 place-items-center rounded-full hover:bg-background" aria-label={`Don't use file ${i + 1}`}>+ <X className="size-3" />+ </button>+ </li>+ ))}+ </ul>+ )}+ </div>+ )}<div className="grid grid-cols-[minmax(0,1fr)] gap-4 sm:grid-cols-2"><div className="space-y-2">@@ -333,16 +395,18 @@ function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: Sche</p></fieldset>- <fieldset className="space-y-2">- <legend className="text-sm font-medium">Assistant</legend>- <div className="flex flex-wrap items-center gap-1.5">- <ModePicker value={mode} onChange={setMode} availability={can} />- <EngineSwitch value={engine} onChange={setEngine} size="sm" compact />- </div>- <p className="text-[12px] text-muted-foreground">- {engine === "open" ? "Open-source models run free on your GPU." : "Paid models cost what the approval card shows."} Smart plans with the best model you've connected (a paid one bills each run); Free uses free models, then the offline planner.- </p>- </fieldset>+ {what === "request" && (+ <fieldset className="space-y-2">+ <legend className="text-sm font-medium">Assistant</legend>+ <div className="flex flex-wrap items-center gap-1.5">+ <ModePicker value={mode} onChange={setMode} availability={can} />+ <EngineSwitch value={engine} onChange={setEngine} size="sm" compact />+ </div>+ <p className="text-[12px] text-muted-foreground">+ {engine === "open" ? "Open-source models run free on your GPU." : "Paid models cost what the approval card shows."} Smart plans with the best model you've connected (a paid one bills each run); Free uses free models, then the offline planner.+ </p>+ </fieldset>+ )}<fieldset className="space-y-2"><legend className="text-sm font-medium">Before anything runs</legend>@@ -352,9 +416,19 @@ function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: Sche{id: "ask",title: "Ask me first",- body: "Each run plans the job, then waits in its chat for your OK — nothing is generated until you approve. A run on a paid model uses that provider's key to plan.",+ body:+ what === "skill"+ ? "Each run puts the skill's priced steps in its chat and waits for your OK — nothing is generated until you approve."+ : "Each run plans the job, then waits in its chat for your OK — nothing is generated until you approve. A run on a paid model uses that provider's key to plan.",+ },+ {+ id: "auto",+ title: "Run on its own, within a cap",+ body:+ what === "skill"+ ? "The skill starts without asking when its price fits the cap. If it would pass the cap, or its price isn't known, it waits for you."+ : "Plans start without asking while they fit the cap. A plan that would pass it, or has no known price, waits for you.",},- { id: "auto", title: "Run on its own, within a cap", body: "Plans start without asking while they fit the cap. A plan that would pass it, or has no known price, waits for you." },] as const).map((o) => (<button@@ -385,7 +459,7 @@ function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: Sche)}</fieldset>- {(connectorNames.length > 0 || connectors) && (+ {what === "request" && (connectorNames.length > 0 || connectors) && (<fieldset className="space-y-2"><legend className="text-sm font-medium">Connectors</legend><label className="flex items-start gap-2.5 rounded-xl border px-3.5 py-2.5">@@ -405,7 +479,7 @@ function Form({ schedule, seed, onDone }: { schedule?: ScheduleView; seed?: Sche<Button type="button" variant="ghost" onClick={onDone}>Cancel</Button>- <Button type="submit" disabled={busy || !prompt.trim() || !!problem || !next || capBad}>+ <Button type="submit" disabled={busy || (what === "request" ? !prompt.trim() : !skill) || !!problem || !next || capBad}>{busy && <Loader2 className="animate-spin" />} {schedule ? "Save" : "Schedule"}</Button></DialogFooter>diff --git a/src/components/assist/schedule-skill.tsx b/src/components/assist/schedule-skill.tsxnew file mode 100644index 00000000..470035da--- /dev/null+++ b/src/components/assist/schedule-skill.tsx@@ -0,0 +1,290 @@+"use client";++import { keepPreviousData, useQuery } from "@tanstack/react-query";+import { AlertTriangle, Cloud, Cpu } from "lucide-react";+import Link from "next/link";+import { useEffect, useId, useState } from "react";+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";+import { Skeleton } from "@/components/ui/skeleton";+import { EngineSwitch } from "@/components/studio/engine-switch";+import { MediaSlot, type SlotValue } from "@/components/studio/media-slot";+import { radioKeys, radioTab } from "@/components/studio/radio-keys";+import type { SkillSummary } from "@/lib/assist";+import { newestWords, type ScheduleSkill } from "@/lib/assist-schedule";+import type { Engine } from "@/lib/catalog/types";+import { formatCost } from "@/lib/format";+import { checkValues, isMediaType, type RecipeEstimate, type RecipeParam, type RecipeView } from "@/lib/recipe";+import { cn } from "@/lib/utils";+import { useRecipeActions } from "./hooks";+import { RecipeField } from "./run-skill-dialog";+import { SkillIcon } from "./skill-icon";++/**+ * The schedule dialog's "A skill" (Skills W4): a skill that runs by itself, one set of values from its Run form, and+ * for each file input a picked file or the newest upload of that kind, read when the run starts.+ */++/** What the form holds: values as typed (a picked file's URL too), the file slots, and where each file input comes from. */+export interface SkillInputs {+ values: Record<string, string | number | undefined>;+ slots: Record<string, SlotValue | null>;+ sources: Record<string, "newest" | "file">;+}++/** The form for a saved task's skill, or an empty one. */+export const inputsFrom = (skill?: ScheduleSkill | null): SkillInputs => ({+ values: { ...(skill?.values ?? {}) },+ slots: {},+ sources: Object.fromEntries(Object.keys(skill?.sources ?? {}).map((id) => [id, "newest" as const])),+});++type FileParam = RecipeParam & { type: "image" | "video" | "audio" };++/** A file input with nothing picked takes the newest upload; one that holds a file keeps it. */+const sourceOf = (p: RecipeParam, inputs: SkillInputs) => inputs.sources[p.id] ?? (typeof inputs.values[p.id] === "string" && inputs.values[p.id] ? "file" : "newest");++const slotOf = (p: FileParam, inputs: SkillInputs): SlotValue | null => {+ if (p.id in inputs.slots) return inputs.slots[p.id];+ const v = inputs.values[p.id];+ return typeof v === "string" && v ? { ref: v, preview: v, kind: p.type } : null;+};++/** Stands in for a newest upload while the form is checked and priced (the real file is read when it runs). */+const NEWEST = { image: "/api/files/uploads/estimate/newest.png", video: "/api/files/uploads/estimate/newest.mp4", audio: "/api/files/uploads/estimate/newest.wav" } as const;++/** The task as it's saved, what's wrong with it per input, and the values it's priced with. */+export function skillTask(view: RecipeView, inputs: SkillInputs): { task: ScheduleSkill; errors: Record<string, string>; ok: boolean; uploading: boolean; priced: Record<string, string> } {+ const values: Record<string, string> = {};+ const sources: Record<string, "newest"> = {};+ const priced: Record<string, string> = {};+ let uploading = false;+ for (const p of view.recipe.params) {+ if (isMediaType(p.type)) {+ if (sourceOf(p, inputs) === "newest") {+ sources[p.id] = "newest";+ priced[p.id] = NEWEST[p.type];+ continue;+ }+ const slot = slotOf(p as FileParam, inputs);+ if (slot?.uploading) uploading = true;+ else if (slot?.ref) values[p.id] = priced[p.id] = slot.ref;+ continue;+ }+ const v = inputs.values[p.id];+ if (v !== undefined && String(v).trim() !== "") values[p.id] = priced[p.id] = String(v);+ }+ const checked = checkValues(view.recipe, priced);+ return { task: { name: view.name, values, ...(Object.keys(sources).length && { sources }) }, errors: checked.errors, ok: !!checked.values && !uploading, uploading, priced };+}++function useDebounced<T>(value: T, ms: number): T {+ const [v, setV] = useState(value);+ useEffect(() => {+ const t = setTimeout(() => setV(value), ms);+ return () => clearTimeout(t);+ }, [value, ms]);+ return v;+}++/** "About $0.62 a run on Cloud", "Free on your GPU", "Free: a demo run". */+function priceText(e: RecipeEstimate): string {+ if (e.demo) return "Free: a demo run, since nothing is connected for these steps yet";+ if (e.total === null) return "Some prices vary";+ const where = e.engine === "open" ? "on your GPU" : "on Cloud";+ return e.total === 0 ? `Free ${where}` : `About ${formatCost(e.total)} a run ${where}`;+}++export function SkillTaskFields({+ skills,+ name,+ onName,+ view,+ failed,+ inputs,+ onInputs,+ engine,+ onEngine,+ tried,+}: {+ /** The skills that run by themselves (null: still loading). */+ skills: SkillSummary[] | null;+ name: string | null;+ onName: (name: string) => void;+ /** The picked skill's recipe, once it's loaded. */+ view: RecipeView | undefined;+ /** Why the skill's recipe didn't load. */+ failed?: string;+ inputs: SkillInputs;+ onInputs: (next: SkillInputs) => void;+ /** The engine it runs on (one its steps run on). */+ engine: Engine;+ onEngine: (e: Engine) => void;+ tried: boolean;+}) {+ const pickId = useId();+ const actions = useRecipeActions();+ const t = view ? skillTask(view, inputs) : null;+ const body = t ? JSON.stringify({ values: t.priced, engine }) : "";+ const key = useDebounced(body, 400);+ const price = useQuery({+ queryKey: ["assist-recipe-estimate", name, "schedule", key],+ enabled: !!view && !!t?.ok && key === body && view.engines.includes(engine),+ retry: false,+ placeholderData: keepPreviousData,+ queryFn: () => actions.estimate(view!.name, JSON.parse(key)),+ });+ const est = t?.ok ? price.data : undefined;+ const estError = t?.ok ? (price.error ? (price.error as Error).message : (est?.errors[0] ?? est?.runs.flatMap((r) => r.errors)[0])) : undefined;+ const listed = !!name && !!skills?.some((s) => s.name === name);+ const set = (patch: Partial<SkillInputs>) => onInputs({ ...inputs, ...patch });++ return (+ <div className="space-y-4">+ <div className="space-y-2">+ <label htmlFor={pickId} className="text-sm font-medium">+ Skill+ </label>+ {skills === null ? (+ <Skeleton className="h-9 w-full" />+ ) : skills.length === 0 ? (+ <p className="rounded-xl bg-muted/60 px-3.5 py-2.5 text-[13px] text-muted-foreground">+ No skills that run by themselves yet. Make one from a result you like (its ⋯ menu → Make a skill), or save a chat as a skill, then schedule it here.{" "}+ <Link href="/assist/skills" className="font-medium text-brand-text underline-offset-2 hover:underline">+ Open Skills+ </Link>+ </p>+ ) : (+ <Select value={listed ? name! : undefined} onValueChange={onName}>+ <SelectTrigger id={pickId} className="w-full">+ <SelectValue placeholder="Pick a skill" />+ </SelectTrigger>+ <SelectContent>+ {skills.map((s) => (+ <SelectItem key={s.name} value={s.name}>+ <SkillIcon name={s.name} icon={s.icon} size="sm" /> {s.title} <span className="text-muted-foreground">/{s.name}</span>+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )}+ {name && skills && !listed && (+ <p role="alert" className="flex items-start gap-1.5 text-[12px] text-amber-700 dark:text-amber-300">+ <AlertTriangle className="mt-0.5 size-3.5 shrink-0" /> /{name} is switched off or doesn't run by itself any more — pick another skill.+ </p>+ )}+ </div>++ {listed && !view && (failed ? <p className="text-[13px] text-destructive">{failed}</p> : <Skeleton className="h-32 w-full" />)}++ {listed && view && (+ <>+ <p className="text-[12px] text-muted-foreground">No AI model plans these runs: each one starts {view.title}'s saved steps with the inputs below.</p>+ {view.recipe.params.length === 0 && <p className="text-[13px] text-muted-foreground">It takes no inputs: each run makes the same steps.</p>}+ {view.recipe.params.map((p) =>+ isMediaType(p.type) ? (+ <FileInput+ key={p.id}+ p={p as FileParam}+ source={sourceOf(p, inputs)}+ onSource={(s) => set({ sources: { ...inputs.sources, [p.id]: s } })}+ slot={slotOf(p as FileParam, inputs)}+ onSlot={(v) => set({ slots: { ...inputs.slots, [p.id]: v } })}+ error={tried ? t?.errors[p.id] : undefined}+ />+ ) : (+ <RecipeField+ key={p.id}+ p={p}+ value={inputs.values[p.id] ?? p.default}+ onChange={(v) => set({ values: { ...inputs.values, [p.id]: v } })}+ slot={null}+ onSlot={() => {}}+ error={tried ? t?.errors[p.id] : undefined}+ />+ ),+ )}+ <div className="flex flex-wrap items-center gap-2">+ {view.engines.length > 1 ? (+ <EngineSwitch value={engine} onChange={onEngine} size="sm" compact={false} />+ ) : (+ view.engines.length === 1 && (+ <span className="inline-flex h-8 items-center gap-1.5 rounded-full bg-muted px-3 text-[12px] font-medium text-muted-foreground">+ {view.engines[0] === "open" ? <Cpu className="size-3.5" /> : <Cloud className="size-3.5" />}+ {view.engines[0] === "open" ? "Runs on your GPU · open source" : "Runs in the cloud"}+ </span>+ )+ )}+ <p className={cn("min-w-0 text-[13px] break-words", estError ? "text-destructive" : "text-muted-foreground")} aria-live="polite">+ {!view.engines.length+ ? (view.why ?? "This skill can't run here as it is.")+ : !t?.ok+ ? t?.uploading+ ? "Uploading…"+ : "Fill in the inputs to see the price"+ : (estError ?? (est && !price.isFetching && key === body ? priceText(est) : "Pricing…"))}+ </p>+ </div>+ </>+ )}+ </div>+ );+}++/** A file input: the newest upload of its kind when the run starts, or one file picked now. */+function FileInput({+ p,+ source,+ onSource,+ slot,+ onSlot,+ error,+}: {+ p: FileParam;+ source: "newest" | "file";+ onSource: (s: "newest" | "file") => void;+ slot: SlotValue | null;+ onSlot: (v: SlotValue | null) => void;+ error?: string;+}) {+ const labelId = useId();+ const options = [+ { id: "newest", label: "Newest upload (when it runs)" },+ { id: "file", label: "This file" },+ ] as const;+ return (+ <div className="space-y-2">+ <p id={labelId} className="text-sm font-medium">+ {p.label}+ {p.required && p.default === undefined ? "" : <span className="font-normal text-muted-foreground"> · optional</span>}+ </p>+ <div role="radiogroup" aria-labelledby={labelId} onKeyDown={radioKeys} className="flex w-fit max-w-full flex-wrap gap-1 rounded-2xl bg-muted p-0.5">+ {options.map((o) => (+ <button+ key={o.id}+ type="button"+ role="radio"+ aria-checked={source === o.id}+ tabIndex={radioTab(source === o.id)}+ onClick={() => onSource(o.id)}+ className={cn("h-8 rounded-full px-3 text-[13px] font-medium text-muted-foreground transition-colors", source === o.id && "bg-background text-foreground shadow-soft")}+ >+ {o.label}+ </button>+ ))}+ </div>+ {source === "newest" ? (+ <p className="text-[12px] text-muted-foreground">Each run uses {newestWords(p.type)} at that moment: upload a new one before it runs, and that's the one it takes.</p>+ ) : (+ <div className="flex items-center gap-3">+ <MediaSlot label={p.label} kind={p.type} value={slot} onChange={onSlot} required={p.required} />+ <p className="min-w-0 flex-1 text-[12px] text-muted-foreground">Every run uses this {p.type === "image" ? "picture" : p.type === "video" ? "clip" : "sound file"}. Upload one, or pick it from your Library.</p>+ </div>+ )}+ {error && (+ <p role="alert" className="text-[12px] text-destructive">+ {error}+ </p>+ )}+ </div>+ );+}diff --git a/src/lib/assist-schedule.ts b/src/lib/assist-schedule.tsindex e2c20a2c..288748ad 100644--- a/src/lib/assist-schedule.ts+++ b/src/lib/assist-schedule.ts@@ -287,8 +287,8 @@ export const newestWords = (type: "image" | "video" | "audio"): string => `yourexport function skillTaskLine(skill: ScheduleSkill, params: { id: string; label: string; type: string }[], files?: (url: string) => string): string {const parts = params.flatMap((p) => {const v = skill.values[p.id];- const file = p.type === "image" || p.type === "video" || p.type === "audio";- if (skill.sources?.[p.id] === "newest" && file) return [`${p.label}: ${newestWords(p.type)}${files && v ? ` (${files(v)})` : ""}`];+ const file = p.type === "image" || p.type === "video" || p.type === "audio" ? p.type : null;+ if (skill.sources?.[p.id] === "newest" && file) return [`${p.label}: ${newestWords(file)}${files && v ? ` (${files(v)})` : ""}`];if (v === undefined || v === "") return [];if (file && /^(\/api\/files\/|https?:\/\/)/i.test(v)) return [`${p.label}: ${files ? files(v) : "a file you picked"}`];return [`${p.label}: ${v.length > 80 ? `${v.slice(0, 79).trimEnd()}…` : v}`];