Skip to content

Commit

Permalink
[Obs AI Assistant] Avoid AI assistant overlaying AI conversations (#1…
Browse files Browse the repository at this point in the history
…94722)

Closes #190430

## Summary

### Problem
After navigating to AI conversations, from the AI assistant overlay via
the "Navigate to Conversations" button, the AI assistant overlay doesn't
close. Instead, it remains open and the same content is shown on the
overlay and the conversations page.

### Solution
Close the AI Assistant overlay when navigating to the AI conversations
page.


https://github.com/user-attachments/assets/db1b9a30-c073-4867-a2aa-520e1b5c3fa1

---------

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
viduni94 and elasticmachine authored Oct 7, 2024
1 parent 36fe809 commit 99970dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function ChatBody({
showLinkToConversationsApp,
onConversationUpdate,
onToggleFlyoutPositionMode,
onClose,
}: {
connectors: ReturnType<typeof useGenAIConnectors>;
currentUser?: Pick<AuthenticatedUser, 'full_name' | 'username'>;
Expand All @@ -121,6 +122,7 @@ export function ChatBody({
showLinkToConversationsApp: boolean;
onConversationUpdate: (conversation: { conversation: Conversation['conversation'] }) => void;
onToggleFlyoutPositionMode?: (flyoutPositionMode: FlyoutPositionMode) => void;
onClose?: () => void;
}) {
const license = useLicense();
const hasCorrectLicense = license?.hasAtLeast('enterprise');
Expand Down Expand Up @@ -498,6 +500,7 @@ export function ChatBody({
saveTitle(newTitle);
}}
onToggleFlyoutPositionMode={onToggleFlyoutPositionMode}
onClose={onClose}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export function ChatFlyout({
conversationList.conversations.refresh();
}}
onToggleFlyoutPositionMode={handleToggleFlyoutPositionMode}
onClose={onClose}
/>
</EuiFlexItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function ChatHeader({
onCopyConversation,
onSaveTitle,
onToggleFlyoutPositionMode,
onClose,
}: {
connectors: UseGenAIConnectorsResult;
conversationId?: string;
Expand All @@ -60,6 +61,7 @@ export function ChatHeader({
onCopyConversation: () => void;
onSaveTitle: (title: string) => void;
onToggleFlyoutPositionMode?: (newFlyoutPositionMode: FlyoutPositionMode) => void;
onClose?: () => void;
}) {
const theme = useEuiTheme();
const breakpoint = useCurrentEuiBreakpoint();
Expand All @@ -73,6 +75,10 @@ export function ChatHeader({
}, [title]);

const handleNavigateToConversations = () => {
if (onClose) {
onClose();
}

if (conversationId) {
router.push('/conversations/{conversationId}', {
path: {
Expand Down

0 comments on commit 99970dc

Please sign in to comment.