diff --git a/frontend/src/components/workspace/messages/message-list.tsx b/frontend/src/components/workspace/messages/message-list.tsx index b5a5cff19..36565a31e 100644 --- a/frontend/src/components/workspace/messages/message-list.tsx +++ b/frontend/src/components/workspace/messages/message-list.tsx @@ -212,6 +212,7 @@ export function MessageList({ canRegenerate = false, canBranch = false, enableSidecarActions = true, + sidecarSurface = false, initialScroll = "smooth", resizeScroll = "smooth", }: { @@ -235,6 +236,7 @@ export function MessageList({ canRegenerate?: boolean; canBranch?: boolean; enableSidecarActions?: boolean; + sidecarSurface?: boolean; initialScroll?: ConversationProps["initial"]; resizeScroll?: ConversationProps["resize"]; }) { @@ -417,10 +419,18 @@ export function MessageList({ if (!selectionToolbar) { return; } - sidecar?.addContextToConversation(selectionToolbar.context); + // On the sidecar surface, "add to conversation" targets the side chat's + // own composer (activeReferences) rather than the main composer's quotes, + // so the selected snippet is attached to the conversation the user is + // actually reading. + if (sidecarSurface) { + sidecar?.openContext(selectionToolbar.context); + } else { + sidecar?.addContextToConversation(selectionToolbar.context); + } window.getSelection()?.removeAllRanges(); setSelectionToolbar(null); - }, [selectionToolbar, sidecar]); + }, [selectionToolbar, sidecar, sidecarSurface]); const handleAskSelectionInSidecar = useCallback(() => { if (!selectionToolbar) { @@ -873,17 +883,19 @@ export function MessageList({ {t.sidecar.addToConversation} - + {!sidecarSurface && ( + + )}