[ai][assistant] Refactor search to use new Assistant logo and beacon (#204287)

> A follow-up to #203879 

## Summary

This PR integrates the new Assistant Icon, Beacon, and Avatar into
solutions and packages owned by Search. In most cases this was a 1:1
replacement, but in a few, Icon was replaced with Beacon or Beacon was
added for consistency, (e.g. welcome screens, upsells, etc), .

Note: the scaling of the icon/avatar _before_ was one different from
EUI. The new components match EUI directly and represent a 2x scale
change (e.g. 's' becomes 'l', 'm' becomes 'xl', etc).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Clint Andrew Hall 2024-12-18 08:51:45 -06:00 committed by GitHub
parent 6cd2cd6cf8
commit e0786738c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 25 deletions

View file

@ -19,7 +19,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { css } from '@emotion/css';
import { AssistantAvatar } from '@kbn/observability-ai-assistant-plugin/public';
import { AssistantIcon } from '@kbn/ai-assistant-icon';
import { ChatActionsMenu } from './chat_actions_menu';
import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors';
import { FlyoutPositionMode } from './chat_flyout';
@ -94,7 +94,7 @@ export function ChatHeader({
{loading ? (
<EuiLoadingSpinner size={breakpoint === 'xs' ? 'm' : 'l'} />
) : (
<AssistantAvatar size={breakpoint === 'xs' ? 'xs' : 's'} />
<AssistantIcon size={breakpoint === 'xs' ? 'm' : 'l'} />
)}
</EuiFlexItem>

View file

@ -7,10 +7,10 @@
import React from 'react';
import { UserAvatar } from '@kbn/user-profile-components';
import { css } from '@emotion/css';
import { EuiAvatar, EuiLoadingSpinner } from '@elastic/eui';
import type { AuthenticatedUser } from '@kbn/security-plugin/common';
import { AssistantAvatar, MessageRole } from '@kbn/observability-ai-assistant-plugin/public';
import { MessageRole } from '@kbn/observability-ai-assistant-plugin/public';
import { AssistantAvatar } from '@kbn/ai-assistant-icon';
interface ChatAvatarProps {
currentUser?: Pick<AuthenticatedUser, 'full_name' | 'username'> | undefined;
@ -18,13 +18,6 @@ interface ChatAvatarProps {
loading: boolean;
}
const assistantAvatarClassName = css`
svg {
width: 16px;
height: 16px;
}
`;
export function ChatItemAvatar({ currentUser, role, loading }: ChatAvatarProps) {
const isLoading = loading || !currentUser;
@ -39,14 +32,7 @@ export function ChatItemAvatar({ currentUser, role, loading }: ChatAvatarProps)
case MessageRole.Assistant:
case MessageRole.Elastic:
case MessageRole.Function:
return (
<EuiAvatar
name="Elastic Assistant"
iconType={AssistantAvatar}
color="subdued"
className={assistantAvatarClassName}
/>
);
return <AssistantAvatar name="Elastic Assistant" color="subdued" size="m" />;
case MessageRole.System:
return <EuiAvatar name="system" iconType="dot" color="subdued" />;

View file

@ -11,6 +11,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer, useCurrentEuiBreakpoint } from '@
import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
import { GenerativeAIForObservabilityConnectorFeatureId } from '@kbn/actions-plugin/common';
import { isSupportedConnectorType } from '@kbn/observability-ai-assistant-plugin/public';
import { AssistantBeacon } from '@kbn/ai-assistant-icon';
import type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base';
import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors';
import { Disclaimer } from './disclaimer';
@ -78,9 +79,11 @@ export function WelcomeMessage({
gutterSize="none"
className={fullHeightClassName}
>
<EuiFlexItem grow={false}>
<AssistantBeacon backgroundColor="ghost" size="xl" />
</EuiFlexItem>
<EuiFlexItem grow className={centerMaxWidthClassName}>
<EuiSpacer size={['xl', 'l'].includes(breakpoint!) ? 'l' : 's'} />
<WelcomeMessageConnectors
connectors={connectors}
onSetupConnectorClick={handleConnectorClick}
@ -89,10 +92,8 @@ export function WelcomeMessage({
<WelcomeMessageKnowledgeBase connectors={connectors} knowledgeBase={knowledgeBase} />
) : null}
</EuiFlexItem>
<EuiFlexItem grow={false}>
<StarterPrompts onSelectPrompt={onSelectPrompt} />
<EuiSpacer size="l" />
<Disclaimer />
</EuiFlexItem>

View file

@ -38,5 +38,6 @@
"@kbn/share-plugin",
"@kbn/ai-assistant-common",
"@kbn/storybook",
"@kbn/ai-assistant-icon",
]
}

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import React, { useEffect, useRef, useState } from 'react';
import { AssistantAvatar, useAbortableAsync } from '@kbn/observability-ai-assistant-plugin/public';
import { useAbortableAsync } from '@kbn/observability-ai-assistant-plugin/public';
import { EuiButton, EuiLoadingSpinner, EuiToolTip, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import { v4 } from 'uuid';
@ -19,6 +19,7 @@ import type { CoreStart } from '@kbn/core/public';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme';
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
import { AssistantIcon } from '@kbn/ai-assistant-icon';
interface NavControlWithProviderDeps {
coreStart: CoreStart;
@ -123,7 +124,7 @@ export function NavControl() {
fullWidth={false}
minWidth={0}
>
{chatService.loading ? <EuiLoadingSpinner size="s" /> : <AssistantAvatar size="xs" />}
{chatService.loading ? <EuiLoadingSpinner size="s" /> : <AssistantIcon size="m" />}
</EuiButton>
</EuiToolTip>
{chatService.value &&

View file

@ -28,7 +28,8 @@
"@kbn/licensing-plugin",
"@kbn/ml-plugin",
"@kbn/share-plugin",
"@kbn/triggers-actions-ui-plugin"
"@kbn/triggers-actions-ui-plugin",
"@kbn/ai-assistant-icon"
],
"exclude": [
"target/**/*",