fix(web): offer media card follow-ups on any settled job
Failed or cancelled jobs can still carry finished outputs, so the card asks for the space's capabilities whenever a settled job shows video or audio. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
This commit is contained in:
parent
e66ce42d73
commit
74c3685397
@ -41,6 +41,8 @@ export interface MediaCardAvailability {
|
|||||||
transcribe: boolean;
|
transcribe: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NOTHING_AVAILABLE: MediaCardAvailability = { export: false, transcribe: false };
|
||||||
|
|
||||||
const OPERATION_ICONS: Record<MediaOperation, LucideIcon> = {
|
const OPERATION_ICONS: Record<MediaOperation, LucideIcon> = {
|
||||||
generate_image: Sparkles,
|
generate_image: Sparkles,
|
||||||
generate_video: Sparkles,
|
generate_video: Sparkles,
|
||||||
@ -171,7 +173,7 @@ function OutputActions({
|
|||||||
export function MediaCardView({
|
export function MediaCardView({
|
||||||
block,
|
block,
|
||||||
target,
|
target,
|
||||||
available = { export: false, transcribe: false },
|
available = NOTHING_AVAILABLE,
|
||||||
onAction,
|
onAction,
|
||||||
}: {
|
}: {
|
||||||
block: MediaJobBlock;
|
block: MediaJobBlock;
|
||||||
@ -304,7 +306,6 @@ export function MediaCardView({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const NOTHING_AVAILABLE: MediaCardAvailability = { export: false, transcribe: false };
|
|
||||||
const CAPABILITIES_TTL_MS = 60_000;
|
const CAPABILITIES_TTL_MS = 60_000;
|
||||||
let capabilities:
|
let capabilities:
|
||||||
| { spaceId: string | null; at: number; value: Promise<MediaCardAvailability> }
|
| { spaceId: string | null; at: number; value: Promise<MediaCardAvailability> }
|
||||||
@ -359,9 +360,9 @@ export function MediaCard({
|
|||||||
/** The message carrying the card; a follow-up job is posted by the same bot. */
|
/** The message carrying the card; a follow-up job is posted by the same bot. */
|
||||||
messageId: string;
|
messageId: string;
|
||||||
}) {
|
}) {
|
||||||
// Follow-ups apply to finished video and audio only; other cards never ask.
|
// Follow-ups apply to video and audio of a settled job only; other cards never ask.
|
||||||
const available = useAvailability(
|
const available = useAvailability(
|
||||||
block.status === "done" &&
|
!isActiveMediaStatus(block.status) &&
|
||||||
block.outputs.some((output) => output.kind === "video" || output.kind === "audio"),
|
block.outputs.some((output) => output.kind === "video" || output.kind === "audio"),
|
||||||
);
|
);
|
||||||
const onAction = async (action: MediaCardAction) => {
|
const onAction = async (action: MediaCardAction) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user