Skip to content

Open source CapCut alternative.

TypeScript

fix(site): report a failed frame grab instead of attaching the clip

David Leaf712bbb1a6d
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsx
index 39f16004..36e1a21d 100644
--- a/site/src/cut/components/AiPanel.tsx
+++ b/site/src/cut/components/AiPanel.tsx
@@ -647,6 +647,7 @@ function ChatSession({
);
return false;
},
+ notice: showNotice,
});
}, [readOnly]);
const sessionKeyRef = useRef<string | null>(null);
diff --git a/site/src/cut/lib/chatIntake.ts b/site/src/cut/lib/chatIntake.ts
index 207dcca5..4c5199b9 100644
--- a/site/src/cut/lib/chatIntake.ts
+++ b/site/src/cut/lib/chatIntake.ts
@@ -19,6 +19,8 @@ interface ChatIntake {
* reference capacity it declines — surfacing why in its own notice tab —
* and the grab ends before any capture or flight. */
acceptFrame?: () => boolean;
+ /** Say why a grab ended with nothing, in the composer's notice tab. */
+ notice?: (message: string) => void;
}
let intake: ChatIntake | null = null;
@@ -93,7 +95,9 @@ export async function sendFrameToChat(ref: AssetRef, from: FrameGrabOrigin): Pro
// Capture before the flight so it shows the exact frame it delivers.
const frame = await refToInlineImage(ref).catch(() => null);
if (!frame) {
- target.add(ref);
+ // The clip itself is a heavier, different thing than the moment that was
+ // asked for, so nothing is attached — the grab says why and ends.
+ target.notice?.(`Couldn’t read a frame from “${ref.name}”.`);
return;
}
const frameRef: AssetRef = {