diff --git a/x-pack/packages/kbn-ai-assistant/src/chat/chat_item.tsx b/x-pack/packages/kbn-ai-assistant/src/chat/chat_item.tsx index 23bdbdaea3593..fac7c77570673 100644 --- a/x-pack/packages/kbn-ai-assistant/src/chat/chat_item.tsx +++ b/x-pack/packages/kbn-ai-assistant/src/chat/chat_item.tsx @@ -99,7 +99,7 @@ export function ChatItem({ const [editing, setEditing] = useState(false); const [expanded, setExpanded] = useState(Boolean(element)); - const actions = [canCopy, collapsed, canCopy].filter(Boolean); + const actions = [canCopy, collapsed].filter(Boolean); const noBodyMessageClassName = css` ${moreCompactHeaderClassName} @@ -182,7 +182,7 @@ export function ChatItem({ /> } className={ - actions.length === 0 && !content + actions.length === 0 && !content && !element ? noPanelMessageClassName : collapsed ? noBodyMessageClassName diff --git a/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.test.tsx b/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.test.tsx index 6a304430103ab..7dcf9cadb6bbf 100644 --- a/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.test.tsx +++ b/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.test.tsx @@ -247,7 +247,7 @@ describe('getTimelineItemsFromConversation', () => { expect(pick(items[3], 'actions', 'display')).toEqual({ actions: { - canCopy: true, + canCopy: false, canEdit: false, canGiveFeedback: false, canRegenerate: false, diff --git a/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.tsx b/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.tsx index 999ac4f095025..5160e8b636b6c 100644 --- a/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.tsx +++ b/x-pack/packages/kbn-ai-assistant/src/utils/get_timeline_items_from_conversation.tsx @@ -130,7 +130,6 @@ export function getTimelineItemsfromConversation({ switch (role) { case MessageRole.User: - actions.canCopy = true; actions.canGiveFeedback = false; actions.canRegenerate = false; @@ -210,11 +209,16 @@ export function getTimelineItemsfromConversation({ display.collapsed = false; } + if (!content) { + actions.canCopy = false; + } else { + actions.canCopy = true; + } + break; case MessageRole.Assistant: actions.canRegenerate = hasConnector; - actions.canCopy = true; actions.canGiveFeedback = true; display.hide = false; @@ -250,6 +254,13 @@ export function getTimelineItemsfromConversation({ display.collapsed = false; actions.canEdit = false; } + + if (!content) { + actions.canCopy = false; + } else { + actions.canCopy = true; + } + break; }