From 06bee37138497fa6be532250f4133e293db2a9a7 Mon Sep 17 00:00:00 2001 From: Viduni Wickramarachchi Date: Fri, 29 Nov 2024 10:28:14 -0500 Subject: [PATCH] [Obs AI Assistant] Remove the navigate-to-conversation button when there are initial messages but no conversationId (#202243) Closes https://github.com/elastic/kibana/issues/198379 ## Summary ### Problem When a conversation is started from contextual insights, `initialMessages` are set and displayed on the `ChatFlyout`. However, when the user clicks on "Navigate to conversations` from the Chat flyout header, a new conversation opens in the `ai_assistant_app`. This is because, even though there are initial messages set, there is no conversation ID until the user interacts with the AI Assistant for the conversation started from contextual insights. In order to navigate to a conversation (to the `ai_assistant_app`), a conversationID is required, if not a new conversation opens up. This behaviour seems a little inconsistent, because the expectation is to have the initial messages displayed on the AI Assistant app too. ### Solution Since we do not have a way to persist these initial messages from contextual insights when navigating to the conversations view (`ai_assistant_app`), the navigate to conversations button is removed. If the user interacts with this conversation, since the conversation will be persisted with a conversationId, "navigate to conversations" will be available. ### Checklist - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --- x-pack/packages/kbn-ai-assistant/src/chat/chat_body.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/packages/kbn-ai-assistant/src/chat/chat_body.tsx b/x-pack/packages/kbn-ai-assistant/src/chat/chat_body.tsx index b8ea673483372..00879b38932aa 100644 --- a/x-pack/packages/kbn-ai-assistant/src/chat/chat_body.tsx +++ b/x-pack/packages/kbn-ai-assistant/src/chat/chat_body.tsx @@ -509,7 +509,9 @@ export function ChatBody({ saveTitle(newTitle); }} onToggleFlyoutPositionMode={onToggleFlyoutPositionMode} - navigateToConversation={navigateToConversation} + navigateToConversation={ + initialMessages?.length && !initialConversationId ? undefined : navigateToConversation + } />