Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(timeline): let the chat confirm Auto-enhance, instead of the timeline guessing

Etienne Lescot48a7a97d8bdd
diff --git a/src/components/ai-edition/LeftPanel.tsx b/src/components/ai-edition/LeftPanel.tsx
index 051700364..aa44d3b20 100644
--- a/src/components/ai-edition/LeftPanel.tsx
+++ b/src/components/ai-edition/LeftPanel.tsx
@@ -647,6 +647,9 @@ function ModelQuickPopover({
function ChatStripPanel() {
const t = useScopedT("editor");
const tc = useScopedT("common");
+ // The Auto-enhance confirmation is timeline-owned copy, fired from here —
+ // see the prompt-bus effect below.
+ const tTimeline = useScopedT("timeline");
const projectId = useProjectStore((s) => s.projectId);
const [messages, setMessages] = useState<ChatDisplayMessage[]>([]);
const [input, setInput] = useState("");
@@ -865,14 +868,23 @@ function ChatStripPanel() {
// timeline's Auto-enhance → "Smart zooms + cuts with AI"). Routes through
// the normal send() so sessions/checkpoints/rewind all keep working; the
// message shows in the composer's history exactly as if typed.
+ //
+ // The confirmation toast lives here rather than at the submit site because
+ // only this side knows whether the prompt was taken: with no usable
+ // provider send() bounces it to the settings modal, and the producer would
+ // otherwise claim success on a request that never left.
+ // ponytail: one producer today (Auto-enhance), so the queued prompt and the
+ // toast copy are assumed to be that one. A second producer needs the bus to
+ // carry its own confirmation string.
const pendingPrompt = useChatPromptBus((s) => s.pending);
const consumePrompt = useChatPromptBus((s) => s.consume);
// biome-ignore lint/correctness/useExhaustiveDependencies: send() is intentionally not a dep (recreated each render); consume() clears `pending` so this fires once per queued prompt.
useEffect(() => {
if (!pendingPrompt || !projectId || busy) return;
consumePrompt();
+ if (canChat) toast.success(tTimeline("toolbar.aiEnhanceRequested"));
void send(pendingPrompt);
- }, [pendingPrompt, projectId, busy, consumePrompt]);
+ }, [pendingPrompt, projectId, busy, consumePrompt, canChat, tTimeline]);
// ponytail: per-user-message rewind. Pops a confirmation popover, then
// asks the main process to roll the session + document back to the
diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsx
index 9d8990944..d75da33a9 100644
--- a/src/components/ai-edition/v4/V4Timeline.tsx
+++ b/src/components/ai-edition/v4/V4Timeline.tsx
@@ -832,12 +832,13 @@ export function V4Timeline({
}, [videoSources, tl, t]);
// Auto-enhance option 2 — hand a generic prompt to the AI agent (smart
- // zooms + cuts) via the chat prompt-bus.
+ // zooms + cuts) via the chat prompt-bus. The chat panel owns the outcome
+ // toast: submitting is not the same as being accepted (no usable provider
+ // bounces the prompt), and only the consumer knows which happened.
const runAiEnhance = useCallback(() => {
setAutoEnhanceOpen(false);
useChatPromptBus.getState().submit(AI_ENHANCE_PROMPT);
- toast.success(t("toolbar.aiEnhanceRequested"));
- }, [t]);
+ }, []);
const isPillSelected = (id: string) =>
tl.selection?.id === id || tl.multiSelection.some((m) => m.id === id);