diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx
index 137f1166fb1fd..04c0fe89b3bbd 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx
@@ -18,7 +18,7 @@ import {
useEuiTheme,
UseEuiTheme,
} from '@elastic/eui';
-import { css, keyframes } from '@emotion/css';
+import { css } from '@emotion/css';
import { i18n } from '@kbn/i18n';
import type {
Conversation,
@@ -39,6 +39,7 @@ import type { AuthenticatedUser } from '@kbn/security-plugin/common';
import { findLastIndex } from 'lodash';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { ChatFeedback } from '@kbn/observability-ai-assistant-plugin/public/analytics/schemas/chat_feedback';
+import { AssistantBeacon } from '@kbn/ai-assistant-icon';
import type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base';
import { ASSISTANT_SETUP_TITLE, EMPTY_CONVERSATION_TITLE, UPGRADE_LICENSE_TITLE } from '../i18n';
import { useAIAssistantChatService } from '../hooks/use_ai_assistant_chat_service';
@@ -72,11 +73,6 @@ const promptEditorClassname = (euiTheme: UseEuiTheme['euiTheme']) => css`
}
`;
-const incorrectLicenseContainer = (euiTheme: UseEuiTheme['euiTheme']) => css`
- height: 100%;
- padding: ${euiTheme.size.base};
-`;
-
const chatBodyContainerClassNameWithError = css`
align-self: center;
margin: 12px;
@@ -87,24 +83,9 @@ const promptEditorContainerClassName = css`
padding-bottom: 8px;
`;
-const fadeInAnimation = keyframes`
- from {
- opacity: 0;
- transform: scale(0.9);
- }
- to {
- opacity: 1;
- transform: scale(1);
- }
-`;
-
-const animClassName = (euiTheme: UseEuiTheme['euiTheme']) => css`
+const panelClassName = css`
+ display: flex;
height: 100%;
- opacity: 0;
- ${euiCanAnimate} {
- animation: ${fadeInAnimation} ${euiTheme.animation.normal} ${euiTheme.animation.bounce}
- ${euiTheme.animation.normal} forwards;
- }
`;
const containerClassName = css`
@@ -112,6 +93,14 @@ const containerClassName = css`
max-height: 100%;
`;
+const loadingClassname = css`
+ height: 100%;
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}`;
+
const PADDING_AND_BORDER = 32;
export function ChatBody({
@@ -462,33 +451,23 @@ export function ChatBody({
}
let footer: React.ReactNode;
+
if (!hasCorrectLicense && !initialConversationId) {
footer = (
- <>
-
-
-
-
-
-
-
-
- {
- next(messages.concat(message));
- }}
- onSendTelemetry={(eventWithPayload) =>
- chatService.sendAnalyticsEvent(eventWithPayload)
- }
- />
-
-
-
- >
+
+
+
+ );
+ } else if (connectors.loading) {
+ footer = (
+
);
} else if (!conversation.value && conversation.loading) {
footer = null;
@@ -502,7 +481,7 @@ export function ChatBody({
hasBorder={false}
hasShadow={false}
paddingSize="m"
- className={animClassName(euiTheme)}
+ className={panelClassName}
>
{connectors.connectors?.length === 0 || messages.length === 0 ? (
- ) : (
+ ) : connectors.connectors?.length ? (
- )}
+ ) : null}
) : null}
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_timeline.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_timeline.tsx
index 119a57e69f337..83ceb403fa9d7 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_timeline.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_timeline.tsx
@@ -134,6 +134,7 @@ export function ChatTimeline({
{items.map((item, index) => {
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.test.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.test.tsx
index d82d994e1742a..468bd1f99a16a 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.test.tsx
@@ -11,7 +11,7 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { DATE_CATEGORY_LABELS } from '../i18n';
import { ConversationList } from './conversation_list';
import { UseConversationListResult } from '../hooks/use_conversation_list';
-import { useConversationsByDate, useConversationContextMenu } from '../hooks';
+import { useConversationsByDate, useConversationContextMenu, useGenAIConnectors } from '../hooks';
import type { AuthenticatedUser } from '@kbn/security-plugin/common';
import { getDisplayedConversation } from '../hooks/use_conversations_by_date.test';
@@ -32,6 +32,12 @@ jest.mock('../hooks/use_conversation_context_menu', () => ({
}),
}));
+jest.mock('../hooks/use_genai_connectors', () => ({
+ useGenAIConnectors: jest.fn().mockReturnValue({
+ connectors: ['connector_1', 'connector_2'],
+ }),
+}));
+
const mockConversations: UseConversationListResult['conversations'] = {
value: {
conversations: [
@@ -239,6 +245,12 @@ describe('ConversationList', () => {
expect(defaultProps.onConversationSelect).toHaveBeenCalledWith(undefined);
});
+ it('does not render a new chat button if no connectors are configured', () => {
+ (useGenAIConnectors as jest.Mock).mockReturnValue({ connectors: [] });
+ render();
+ expect(screen.queryByTestId('observabilityAiAssistantNewChatButton')).not.toBeInTheDocument();
+ });
+
it('defaults to archived section open if selected conversation is archived', () => {
const archivedConversation = {
...mockConversations.value!.conversations[0],
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.tsx
index 9b64b038e94d8..fe536409af234 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/conversation_list.tsx
@@ -25,7 +25,12 @@ import { i18n } from '@kbn/i18n';
import React, { MouseEvent, useEffect, useMemo, useState } from 'react';
import type { AuthenticatedUser } from '@kbn/security-plugin/common';
import type { UseConversationListResult } from '../hooks/use_conversation_list';
-import { useConfirmModal, useConversationsByDate, useConversationContextMenu } from '../hooks';
+import {
+ useConfirmModal,
+ useConversationsByDate,
+ useConversationContextMenu,
+ useGenAIConnectors,
+} from '../hooks';
import { DATE_CATEGORY_LABELS } from '../i18n';
import { NewChatButton } from '../buttons/new_chat_button';
import { ConversationListItemLabel } from './conversation_list_item_label';
@@ -88,6 +93,7 @@ export function ConversationList({
}) {
const euiTheme = useEuiTheme();
const scrollBarStyles = euiScrollBarStyles(euiTheme);
+ const { connectors } = useGenAIConnectors();
const [allConversations, activeConversations, archivedConversations] = useMemo(() => {
const conversationList = conversations.value?.conversations ?? [];
@@ -325,18 +331,20 @@ export function ConversationList({
>
) : null}
-
-
-
-
- onClickConversation(event)}
- />
-
-
-
-
+ {connectors?.length ? (
+
+
+
+
+ onClickConversation(event)}
+ />
+
+
+
+
+ ) : null}
{confirmDeleteElement}
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/incorrect_license_panel.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/incorrect_license_panel.tsx
index 136f8d5918fb7..c3df76d3be743 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/incorrect_license_panel.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/incorrect_license_panel.tsx
@@ -6,76 +6,18 @@
*/
import React from 'react';
-import {
- EuiButton,
- EuiButtonEmpty,
- EuiFlexGroup,
- EuiFlexItem,
- EuiImage,
- EuiPanel,
- EuiText,
- EuiTitle,
- useEuiTheme,
-} from '@elastic/eui';
-import { css } from '@emotion/css';
-import { i18n } from '@kbn/i18n';
-import { elasticAiAssistantImage } from '@kbn/observability-ai-assistant-plugin/public';
-import { UPGRADE_LICENSE_TITLE } from '../i18n';
+import { NeedLicenseUpgrade } from '@kbn/ai-assistant-cta';
import { useLicenseManagementLocator } from '../hooks/use_license_management_locator';
+// TODO - onManageLicense does not work in serverless.
export function IncorrectLicensePanel() {
- const handleNavigateToLicenseManagement = useLicenseManagementLocator();
- const { euiTheme } = useEuiTheme();
+ const handler = useLicenseManagementLocator();
- const incorrectLicenseContainer = css`
- height: 100%;
- padding: ${euiTheme.size.base};
- `;
+ const onManageLicense = () => {
+ if (handler) {
+ handler();
+ }
+ };
- return (
-
-
-
-
- {UPGRADE_LICENSE_TITLE}
-
-
- {i18n.translate('xpack.aiAssistant.incorrectLicense.body', {
- defaultMessage: 'You need an Enterprise license to use the Elastic AI Assistant.',
- })}
-
-
-
-
-
- {i18n.translate('xpack.aiAssistant.incorrectLicense.subscriptionPlansButton', {
- defaultMessage: 'Subscription plans',
- })}
-
-
-
-
- {i18n.translate('xpack.aiAssistant.incorrectLicense.manageLicense', {
- defaultMessage: 'Manage license',
- })}
-
-
-
-
-
-
- );
+ return ;
}
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.tsx
index 5876269d8e03a..a7131f1123ce4 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.tsx
@@ -7,29 +7,30 @@
import React, { useMemo, useState } from 'react';
import { css } from '@emotion/css';
-import { EuiFlexGroup, EuiFlexItem, EuiSpacer, useCurrentEuiBreakpoint } from '@elastic/eui';
+import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
import { GenerativeAIForObservabilityConnectorFeatureId } from '@kbn/actions-plugin/common';
import { isSupportedConnectorType } from '@kbn/inference-common';
-import { AssistantBeacon } from '@kbn/ai-assistant-icon';
import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public';
+
+import {
+ AddConnector,
+ ReadyToHelp,
+ ReadyToHelpProps,
+ NoConnectorAccess,
+} from '@kbn/ai-assistant-cta';
+
import type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base';
import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors';
import { Disclaimer } from './disclaimer';
-import { WelcomeMessageConnectors } from './welcome_message_connectors';
-import { WelcomeMessageKnowledgeBase } from './welcome_message_knowledge_base';
import { StarterPrompts } from './starter_prompts';
import { useKibana } from '../hooks/use_kibana';
+import { WelcomeMessageKnowledgeBase } from './welcome_message_knowledge_base';
const fullHeightClassName = css`
height: 100%;
`;
-const centerMaxWidthClassName = css`
- max-width: 600px;
- text-align: center;
-`;
-
export function WelcomeMessage({
connectors,
knowledgeBase,
@@ -39,9 +40,10 @@ export function WelcomeMessage({
knowledgeBase: UseKnowledgeBaseResult;
onSelectPrompt: (prompt: string) => void;
}) {
- const breakpoint = useCurrentEuiBreakpoint();
-
- const { application, triggersActionsUi } = useKibana().services;
+ const { application, triggersActionsUi, observabilityAIAssistant } = useKibana().services;
+ const {
+ service: { getScopes },
+ } = observabilityAIAssistant;
const [connectorFlyoutOpen, setConnectorFlyoutOpen] = useState(false);
@@ -61,13 +63,6 @@ export function WelcomeMessage({
if (isSupportedConnectorType(createdConnector.actionTypeId)) {
connectors.reloadConnectors();
}
-
- if (
- !knowledgeBase.status.value ||
- knowledgeBase.status.value?.kbState === KnowledgeBaseState.NOT_INSTALLED
- ) {
- knowledgeBase.install();
- }
};
const ConnectorFlyout = useMemo(
@@ -75,32 +70,78 @@ export function WelcomeMessage({
[triggersActionsUi]
);
+ const isKnowledgeBaseReady = useMemo(
+ () =>
+ knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY &&
+ !knowledgeBase.isInstalling &&
+ !knowledgeBase.status.value?.errorMessage,
+ [knowledgeBase]
+ );
+
+ const isConnectorReady = useMemo(
+ () => !connectors.error && connectors.connectors?.length && connectors.connectors.length > 0,
+ [connectors]
+ );
+
+ const CallToAction = () => {
+ if (!isConnectorReady) {
+ if (connectors.error) {
+ return ;
+ }
+ return ;
+ }
+
+ if (knowledgeBase.isInstalling || !isKnowledgeBaseReady || knowledgeBase.isPolling) {
+ return ;
+ }
+
+ const scopes = getScopes();
+
+ let type: ReadyToHelpProps['type'] = 'stack';
+
+ if (scopes.length === 1) {
+ if (scopes[0] === 'observability') {
+ type = 'oblt';
+ }
+ if (scopes[0] === 'search') {
+ type = 'search';
+ }
+ }
+ return ;
+ };
+
+ const Footer = () => {
+ if (!isConnectorReady || !isKnowledgeBaseReady) {
+ return null;
+ }
+
+ return (
+
+
+
+
+
+ );
+ };
+
return (
<>
-
-
-
-
-
-
- {knowledgeBase.status.value?.enabled && connectors.connectors?.length ? (
-
- ) : null}
-
-
-
-
-
+
+
+
{connectorFlyoutOpen ? (
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_connectors.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_connectors.tsx
deleted file mode 100644
index 376ea8ad58aed..0000000000000
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_connectors.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import React from 'react';
-import { css, keyframes } from '@emotion/css';
-import {
- EuiButton,
- EuiFlexGroup,
- EuiFlexItem,
- EuiIcon,
- EuiSpacer,
- EuiText,
- EuiIconTip,
- useEuiTheme,
- euiCanAnimate,
-} from '@elastic/eui';
-import { i18n } from '@kbn/i18n';
-import { isHttpFetchError } from '@kbn/core-http-browser';
-import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors';
-
-const fadeInAnimation = keyframes`
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-`;
-
-export function WelcomeMessageConnectors({
- connectors,
- onSetupConnectorClick,
-}: {
- connectors: UseGenAIConnectorsResult;
- onSetupConnectorClick?: () => void;
-}) {
- const { euiTheme } = useEuiTheme();
-
- const fadeInClassName = css`
- ${euiCanAnimate} {
- animation: ${fadeInAnimation} ${euiTheme.animation.normal} ease-in-out;
- }
- `;
-
- if (connectors.error) {
- const isForbiddenError =
- isHttpFetchError(connectors.error) &&
- (connectors.error.body as { statusCode: number }).statusCode === 403;
-
- return (
-
-
-
-
-
-
-
- {isForbiddenError
- ? i18n.translate(
- 'xpack.aiAssistant.welcomeMessageConnectors.connectorsForbiddenTextLabel',
- { defaultMessage: 'Required privileges to get connectors are missing' }
- )
- : i18n.translate(
- 'xpack.aiAssistant.welcomeMessageConnectors.connectorsErrorTextLabel',
- { defaultMessage: 'Could not load connectors' }
- )}
-
-
-
-
- );
- }
- return !connectors.loading && connectors.connectors?.length === 0 && onSetupConnectorClick ? (
-
-
- {i18n.translate('xpack.aiAssistant.initialSetupPanel.setupConnector.description2', {
- defaultMessage:
- 'Start working with the Elastic AI Assistant by setting up a connector for your AI provider. The model needs to support function calls. When using OpenAI or Azure, we recommend using GPT4.',
- })}
-
-
-
-
-
-
-
- {i18n.translate('xpack.aiAssistant.initialSetupPanel.setupConnector.buttonLabel', {
- defaultMessage: 'Set up GenAI connector',
- })}
-
-
-
- ) : null;
-}
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.test.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.test.tsx
index 6f00f8f7498c1..c2e38786c91e9 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.test.tsx
@@ -10,7 +10,12 @@ import { act, render, screen } from '@testing-library/react';
import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public';
import { WelcomeMessageKnowledgeBase } from './welcome_message_knowledge_base';
+import { translations } from '@kbn/ai-assistant-cta/install_knowledge_base/install_knowledge_base.translations';
import type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base';
+import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
+import { coreMock } from '@kbn/core/public/mocks';
+
+const corePluginMock = coreMock.createStart();
describe('WelcomeMessageKnowledgeBase', () => {
afterEach(() => {
@@ -38,7 +43,11 @@ describe('WelcomeMessageKnowledgeBase', () => {
}
function renderComponent(kb: UseKnowledgeBaseResult) {
- return render();
+ return render(
+
+
+
+ );
}
it('renders install message if isInstalling', () => {
@@ -56,8 +65,7 @@ describe('WelcomeMessageKnowledgeBase', () => {
});
renderComponent(kb);
- expect(screen.getByText(/We are setting up your knowledge base/i)).toBeInTheDocument();
- expect(screen.getByText(/Setting up Knowledge base/i)).toBeInTheDocument();
+ expect(screen.getByText(translations.installingButton)).toBeInTheDocument();
});
it('renders the success banner after a transition from installing to not installing with no error', async () => {
@@ -71,10 +79,10 @@ describe('WelcomeMessageKnowledgeBase', () => {
refresh: jest.fn(),
},
});
- const { rerender } = renderComponent(kb);
+ const { rerender, container } = renderComponent(kb);
// Should not see success banner initially
- expect(screen.queryByText(/Knowledge base successfully installed/i)).toBeNull();
+ expect(container).not.toBeEmptyDOMElement();
kb = {
...kb,
@@ -98,7 +106,7 @@ describe('WelcomeMessageKnowledgeBase', () => {
});
// Now we should see success banner
- expect(screen.getByText(/Knowledge base successfully installed/i)).toBeInTheDocument();
+ expect(container).toBeEmptyDOMElement();
});
it('renders "We are setting up your knowledge base" with the inspect button', () => {
@@ -128,8 +136,10 @@ describe('WelcomeMessageKnowledgeBase', () => {
});
renderComponent(kb);
- expect(screen.getByText(/We are setting up your knowledge base/i)).toBeInTheDocument();
- expect(screen.getByText(/Inspect/i)).toBeInTheDocument();
+ expect(screen.getByText(translations.cardTitle)).toBeInTheDocument();
+ expect(screen.getByText(translations.installButton)).toBeInTheDocument();
+ // Because we have an installError, we also see "Inspect issues" button
+ expect(screen.getByText(/Inspect issues/i)).toBeInTheDocument();
});
it('renders "Base setup failed" with inspect issues', () => {
@@ -185,9 +195,9 @@ describe('WelcomeMessageKnowledgeBase', () => {
});
renderComponent(kb);
- expect(screen.getByText(/Your Knowledge base hasn't been set up/i)).toBeInTheDocument();
- expect(screen.getByText(/Install Knowledge base/i)).toBeInTheDocument();
- expect(screen.queryByText(/Inspect/i)).toBeNull();
+ expect(screen.getByText(translations.cardTitle)).toBeInTheDocument();
+ expect(screen.getByText(translations.installButton)).toBeInTheDocument();
+ expect(screen.queryByText(/Inspect issues/i)).toBeNull();
});
it('renders "not set up" if model is not ready (but no errorMessage because endpoint exists)', () => {
@@ -220,8 +230,9 @@ describe('WelcomeMessageKnowledgeBase', () => {
});
renderComponent(kb);
- expect(screen.getByText(/We are setting up your knowledge base/i)).toBeInTheDocument();
- expect(screen.getByText(/Inspect/i)).toBeInTheDocument();
+ expect(screen.getByText(translations.cardTitle)).toBeInTheDocument();
+ expect(screen.getByText(translations.installButton)).toBeInTheDocument();
+ expect(screen.getByText(/Inspect issues/i)).toBeInTheDocument();
});
it('renders nothing if the knowledge base is already installed', () => {
@@ -240,8 +251,7 @@ describe('WelcomeMessageKnowledgeBase', () => {
});
renderComponent(kb);
- expect(screen.queryByText(/We are setting up your knowledge base/i)).toBeNull();
- expect(screen.queryByText(/Your Knowledge base hasn't been set up/i)).toBeNull();
- expect(screen.queryByText(/Knowledge base successfully installed/i)).toBeNull();
+ expect(screen.queryByText(translations.cardDescription)).toBeNull();
+ expect(screen.queryByText(translations.cardTitle)).toBeNull();
});
});
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.tsx
index 75631ec635d08..8eadcde8d33dc 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.tsx
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message_knowledge_base.tsx
@@ -8,7 +8,6 @@
import React, { useEffect, useState } from 'react';
import { i18n } from '@kbn/i18n';
import {
- EuiButton,
EuiButtonEmpty,
EuiFlexGroup,
EuiFlexItem,
@@ -20,32 +19,11 @@ import {
import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public';
import usePrevious from 'react-use/lib/usePrevious';
+import { InstallKnowledgeBase } from '@kbn/ai-assistant-cta';
+import { css } from '@emotion/react';
import { WelcomeMessageKnowledgeBaseSetupErrorPanel } from './welcome_message_knowledge_base_setup_error_panel';
import { UseKnowledgeBaseResult } from '../hooks';
-const SettingUpKnowledgeBase = () => (
- <>
-
- {i18n.translate('xpack.aiAssistant.welcomeMessage.weAreSettingUpTextLabel', {
- defaultMessage:
- 'We are setting up your knowledge base. This may take a few minutes. You can continue to use the Assistant while this process is underway.',
- })}
-
-
-
-
- {}}
- >
- {i18n.translate('xpack.aiAssistant.welcomeMessage.div.settingUpKnowledgeBaseLabel', {
- defaultMessage: 'Setting up Knowledge base',
- })}
-
- >
-);
-
const InspectKnowledgeBasePopover = ({
knowledgeBase,
}: {
@@ -60,7 +38,13 @@ const InspectKnowledgeBasePopover = ({
};
return knowledgeBase.status.value?.modelStats ? (
-
+ css`
+ text-align: center;
+ margin-top: -${euiTheme.size.xxxxl};
+ `}
+ >
setIsPopoverOpen(!isPopoverOpen)}
>
{i18n.translate('xpack.aiAssistant.welcomeMessage.inspectErrorsButtonEmptyLabel', {
- defaultMessage: 'Inspect',
+ defaultMessage: 'Inspect issues',
})}
}
@@ -100,55 +84,27 @@ export function WelcomeMessageKnowledgeBase({
}
}, [knowledgeBase.isInstalling, prevIsInstalling]);
- const install = async () => {
- await knowledgeBase.install();
- };
-
- if (knowledgeBase.isInstalling) return ;
-
+ // If we are installing at any step (POST /setup + model deployment)
switch (knowledgeBase.status.value?.kbState) {
case KnowledgeBaseState.NOT_INSTALLED:
+ case KnowledgeBaseState.DEPLOYING_MODEL:
+ case KnowledgeBaseState.PENDING_MODEL_DEPLOYMENT:
+ case KnowledgeBaseState.ERROR:
return (
<>
-
- {i18n.translate(
- 'xpack.aiAssistant.welcomeMessageKnowledgeBase.yourKnowledgeBaseIsNotSetUpCorrectlyLabel',
- { defaultMessage: `Your Knowledge base hasn't been set up.` }
- )}
-
-
-
-
-
+
-
-
- {i18n.translate('xpack.aiAssistant.welcomeMessage.retryButtonLabel', {
- defaultMessage: 'Install Knowledge base',
- })}
-
-
+
+
>
);
- case KnowledgeBaseState.DEPLOYING_MODEL:
- case KnowledgeBaseState.PENDING_MODEL_DEPLOYMENT:
- return (
- <>
-
-
- >
- );
case KnowledgeBaseState.READY:
return showSuccessBanner ? (
@@ -167,17 +123,6 @@ export function WelcomeMessageKnowledgeBase({
) : null;
- case KnowledgeBaseState.ERROR:
- return (
- <>
-
- {i18n.translate('xpack.aiAssistant.welcomeMessage.SettingUpFailTextLabel', {
- defaultMessage: `Knowledge Base setup failed. Check 'Inspect' for details.`,
- })}
-
-
- >
- );
default:
return null;
}
diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.json b/x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.json
index c4afb837ca9ae..aad4443e1359c 100644
--- a/x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.json
+++ b/x-pack/platform/packages/shared/kbn-ai-assistant/tsconfig.json
@@ -6,7 +6,8 @@
"jest",
"node",
"react",
- "@emotion/react/types/css-prop"
+ "@emotion/react/types/css-prop",
+ "../../../../../typings/emotion.d.ts",
]
},
"include": [
@@ -19,7 +20,6 @@
"target/**/*"
],
"kbn_references": [
- "@kbn/core-http-browser",
"@kbn/i18n",
"@kbn/triggers-actions-ui-plugin",
"@kbn/actions-plugin",
@@ -42,5 +42,7 @@
"@kbn/ai-assistant-icon",
"@kbn/datemath",
"@kbn/security-plugin-types-common",
+ "@kbn/ai-assistant-cta",
+ "@kbn/react-kibana-context-render",
]
}
diff --git a/x-pack/platform/plugins/private/translations/translations/fr-FR.json b/x-pack/platform/plugins/private/translations/translations/fr-FR.json
index 7cbba7d50aa9b..afe226007f26e 100644
--- a/x-pack/platform/plugins/private/translations/translations/fr-FR.json
+++ b/x-pack/platform/plugins/private/translations/translations/fr-FR.json
@@ -10240,35 +10240,23 @@
"xpack.aiAssistant.flyout.confirmDeleteConversationTitle": "Supprimer cette conversation ?",
"xpack.aiAssistant.hideExpandConversationButton.hide": "Masquer les chats",
"xpack.aiAssistant.hideExpandConversationButton.show": "Afficher les chats",
- "xpack.aiAssistant.incorrectLicense.body": "Une licence d'entreprise est requise pour utiliser l'assistant d'intelligence artificielle d'Elastic.",
- "xpack.aiAssistant.incorrectLicense.manageLicense": "Gérer la licence",
- "xpack.aiAssistant.incorrectLicense.subscriptionPlansButton": "Plans d'abonnement",
"xpack.aiAssistant.incorrectLicense.title": "Mettez votre licence à niveau",
- "xpack.aiAssistant.initialSetupPanel.setupConnector.buttonLabel": "Configurer un connecteur GenAI",
- "xpack.aiAssistant.initialSetupPanel.setupConnector.description2": "Commencez à travailler avec l'assistant AI Elastic en configurant un connecteur pour votre fournisseur d'IA. Le modèle doit prendre en charge les appels de fonction. Lorsque vous utilisez OpenAI ou Azure, nous vous recommandons d'utiliser GPT4.",
"xpack.aiAssistant.newChatButton": "Nouvelle conversation",
"xpack.aiAssistant.prompt.placeholder": "Envoyer un message à l'assistant",
"xpack.aiAssistant.promptEditorNaturalLanguage.euiSelectable.selectAnOptionLabel": "Sélectionner une option",
"xpack.aiAssistant.settingsPage.goToConnectorsButtonLabel": "Gérer les connecteurs",
"xpack.aiAssistant.simulatedFunctionCallingCalloutLabel": "L'appel de fonctions simulées est activé. Vous risquez de voir les performances se dégrader.",
"xpack.aiAssistant.suggestedFunctionEvent": "a demandé la fonction {functionName}",
- "xpack.aiAssistant.technicalPreviewBadgeDescription": "GTP4 est nécessaire pour bénéficier d'une meilleure expérience avec les appels de fonctions (par exemple lors de la réalisation d'analyse de la cause d'un problème, de la visualisation de données et autres). GPT3.5 peut fonctionner pour certains des workflows les plus simples comme les explications d'erreurs ou pour bénéficier d'une expérience comparable à ChatGPT au sein de Kibana à partir du moment où les appels de fonctions ne sont pas fréquents.",
"xpack.aiAssistant.userExecutedFunctionEvent": "a exécuté la fonction {functionName}",
"xpack.aiAssistant.userSuggestedFunctionEvent": "a demandé la fonction {functionName}",
"xpack.aiAssistant.welcomeMessage.div.checkTrainedModelsToLabel": "{retryInstallingLink} ou vérifiez {trainedModelsLink} pour vous assurer que {modelId} est déployé et en cours d'exécution.",
- "xpack.aiAssistant.welcomeMessage.div.settingUpKnowledgeBaseLabel": "Configuration de la base de connaissances",
"xpack.aiAssistant.welcomeMessage.inspectErrorsButtonEmptyLabel": "Inspecter les problèmes",
"xpack.aiAssistant.welcomeMessage.issuesDescriptionListTitleLabel": "Problèmes",
"xpack.aiAssistant.welcomeMessage.knowledgeBaseSuccessfullyInstalledLabel": "La base de connaissances a été installée avec succès",
"xpack.aiAssistant.welcomeMessage.modelIsNotDeployedLabel": "Le modèle {modelId} n'est pas déployé",
"xpack.aiAssistant.welcomeMessage.modelIsNotFullyAllocatedLabel": "L'état d'allocation de {modelId} est {allocationState}",
"xpack.aiAssistant.welcomeMessage.modelIsNotStartedLabel": "L'état de déploiement de {modelId} est {deploymentState}",
- "xpack.aiAssistant.welcomeMessage.retryButtonLabel": "Installer la base de connaissances",
"xpack.aiAssistant.welcomeMessage.trainedModelsLinkLabel": "Modèles entraînés",
- "xpack.aiAssistant.welcomeMessage.weAreSettingUpTextLabel": "Nous configurons votre base de connaissances. Cette opération peut prendre quelques minutes. Vous pouvez continuer à utiliser l'Assistant lors de ce processus.",
- "xpack.aiAssistant.welcomeMessageConnectors.connectorsErrorTextLabel": "Impossible de charger les connecteurs",
- "xpack.aiAssistant.welcomeMessageConnectors.connectorsForbiddenTextLabel": "Vous n'avez pas les autorisations requises pour charger les connecteurs",
- "xpack.aiAssistant.welcomeMessageKnowledgeBase.yourKnowledgeBaseIsNotSetUpCorrectlyLabel": "Votre base de connaissances n'a pas été configurée.",
"xpack.aiAssistant.welcomeMessageKnowledgeBaseSetupErrorPanel.retryInstallingLinkLabel": "Réessayer l'installation",
"xpack.aiops.actions.openChangePointInMlAppName": "Ouvrir dans AIOps Labs",
"xpack.aiops.analysis.analysisTypeDipFallbackInfoTitle": "Meilleurs éléments pour la plage temporelle de référence de base",
diff --git a/x-pack/platform/plugins/private/translations/translations/ja-JP.json b/x-pack/platform/plugins/private/translations/translations/ja-JP.json
index 5232d0f2a0de7..a441174a393eb 100644
--- a/x-pack/platform/plugins/private/translations/translations/ja-JP.json
+++ b/x-pack/platform/plugins/private/translations/translations/ja-JP.json
@@ -10232,35 +10232,23 @@
"xpack.aiAssistant.flyout.confirmDeleteConversationTitle": "この会話を削除しますか?",
"xpack.aiAssistant.hideExpandConversationButton.hide": "チャットを非表示",
"xpack.aiAssistant.hideExpandConversationButton.show": "チャットを表示",
- "xpack.aiAssistant.incorrectLicense.body": "Elastic AI Assistantを使用するにはEnterpriseライセンスが必要です。",
- "xpack.aiAssistant.incorrectLicense.manageLicense": "ライセンスの管理",
- "xpack.aiAssistant.incorrectLicense.subscriptionPlansButton": "サブスクリプションオプション",
"xpack.aiAssistant.incorrectLicense.title": "ライセンスをアップグレード",
- "xpack.aiAssistant.initialSetupPanel.setupConnector.buttonLabel": "GenAIコネクターをセットアップ",
- "xpack.aiAssistant.initialSetupPanel.setupConnector.description2": "Elastic AI Assistantの使用を開始するには、AIプロバイダーのコネクターを設定します。モデルは関数呼び出しをサポートしている必要があります。OpenAIまたはAzureを使用するときには、GPT4を使用することをお勧めします。",
"xpack.aiAssistant.newChatButton": "新しい会話",
"xpack.aiAssistant.prompt.placeholder": "アシスタントにメッセージを送信",
"xpack.aiAssistant.promptEditorNaturalLanguage.euiSelectable.selectAnOptionLabel": "オプションを選択",
"xpack.aiAssistant.settingsPage.goToConnectorsButtonLabel": "コネクターを管理",
"xpack.aiAssistant.simulatedFunctionCallingCalloutLabel": "シミュレートされた関数呼び出しが有効です。パフォーマンスが劣化する場合があります。",
"xpack.aiAssistant.suggestedFunctionEvent": "関数{functionName}を要求しました",
- "xpack.aiAssistant.technicalPreviewBadgeDescription": "関数呼び出し(根本原因分析やデータの視覚化など)を使用する際に、より一貫性のあるエクスペリエンスを実現するために、GPT4が必要です。GPT3.5は、エラーの説明などのシンプルなワークフローの一部や、頻繁な関数呼び出しの使用が必要とされないKibana内のエクスペリエンスなどのChatGPTで機能します。",
"xpack.aiAssistant.userExecutedFunctionEvent": "関数{functionName}を実行しました",
"xpack.aiAssistant.userSuggestedFunctionEvent": "関数{functionName}を要求しました",
"xpack.aiAssistant.welcomeMessage.div.checkTrainedModelsToLabel": "{retryInstallingLink}か、{trainedModelsLink}を確認して、{modelId}がデプロイされ、実行中であることを確かめてください。",
- "xpack.aiAssistant.welcomeMessage.div.settingUpKnowledgeBaseLabel": "ナレッジベースをセットアップ中",
"xpack.aiAssistant.welcomeMessage.inspectErrorsButtonEmptyLabel": "問題を検査",
"xpack.aiAssistant.welcomeMessage.issuesDescriptionListTitleLabel": "問題",
"xpack.aiAssistant.welcomeMessage.knowledgeBaseSuccessfullyInstalledLabel": "ナレッジベースは正常にインストールされました",
"xpack.aiAssistant.welcomeMessage.modelIsNotDeployedLabel": "モデル\"{modelId}\"はデプロイされていません",
"xpack.aiAssistant.welcomeMessage.modelIsNotFullyAllocatedLabel": "\"{modelId}\"の割り当て状態は{allocationState}です",
"xpack.aiAssistant.welcomeMessage.modelIsNotStartedLabel": "\"{modelId}\"のデプロイ状態は{deploymentState}です",
- "xpack.aiAssistant.welcomeMessage.retryButtonLabel": "ナレッジベースをインストール",
"xpack.aiAssistant.welcomeMessage.trainedModelsLinkLabel": "学習済みモデル",
- "xpack.aiAssistant.welcomeMessage.weAreSettingUpTextLabel": "ナレッジベースをセットアップしています。これには数分かかる場合があります。この処理の実行中には、アシスタントを使用し続けることができます。",
- "xpack.aiAssistant.welcomeMessageConnectors.connectorsErrorTextLabel": "コネクターを読み込めませんでした",
- "xpack.aiAssistant.welcomeMessageConnectors.connectorsForbiddenTextLabel": "コネクターを取得するために必要な権限が不足しています",
- "xpack.aiAssistant.welcomeMessageKnowledgeBase.yourKnowledgeBaseIsNotSetUpCorrectlyLabel": "ナレッジベースはセットアップされていません。",
"xpack.aiAssistant.welcomeMessageKnowledgeBaseSetupErrorPanel.retryInstallingLinkLabel": "インストールを再試行",
"xpack.aiops.actions.openChangePointInMlAppName": "AIOps Labsで開く",
"xpack.aiops.analysis.analysisTypeDipFallbackInfoTitle": "ベースライン時間範囲の上位のアイテム",
diff --git a/x-pack/platform/plugins/private/translations/translations/zh-CN.json b/x-pack/platform/plugins/private/translations/translations/zh-CN.json
index 33eb7ec59a18f..8c50688be2ec0 100644
--- a/x-pack/platform/plugins/private/translations/translations/zh-CN.json
+++ b/x-pack/platform/plugins/private/translations/translations/zh-CN.json
@@ -10248,35 +10248,23 @@
"xpack.aiAssistant.flyout.confirmDeleteConversationTitle": "删除此对话?",
"xpack.aiAssistant.hideExpandConversationButton.hide": "隐藏聊天",
"xpack.aiAssistant.hideExpandConversationButton.show": "显示聊天",
- "xpack.aiAssistant.incorrectLicense.body": "您需要企业级许可证才能使用 Elastic AI 助手。",
- "xpack.aiAssistant.incorrectLicense.manageLicense": "管理许可证",
- "xpack.aiAssistant.incorrectLicense.subscriptionPlansButton": "订阅计划",
"xpack.aiAssistant.incorrectLicense.title": "升级您的许可证",
- "xpack.aiAssistant.initialSetupPanel.setupConnector.buttonLabel": "设置 GenAI 连接器",
- "xpack.aiAssistant.initialSetupPanel.setupConnector.description2": "通过为您的 AI 提供商设置连接器,开始使用 Elastic AI 助手。此模型需要支持函数调用。使用 OpenAI 或 Azure 时,建议使用 GPT4。",
"xpack.aiAssistant.newChatButton": "新聊天",
"xpack.aiAssistant.prompt.placeholder": "向助手发送消息",
"xpack.aiAssistant.promptEditorNaturalLanguage.euiSelectable.selectAnOptionLabel": "选择选项",
"xpack.aiAssistant.settingsPage.goToConnectorsButtonLabel": "管理连接器",
"xpack.aiAssistant.simulatedFunctionCallingCalloutLabel": "模拟函数调用已启用。您可能会面临性能降级。",
"xpack.aiAssistant.suggestedFunctionEvent": "已请求函数 {functionName}",
- "xpack.aiAssistant.technicalPreviewBadgeDescription": "需要 GPT4 以在使用函数调用时(例如,执行根本原因分析、数据可视化等时候)获得更加一致的体验。GPT3.5 可作用于某些更简单的工作流(如解释错误),或在 Kibana 中获得不需要频繁使用函数调用的与 ChatGPT 类似的体验。",
"xpack.aiAssistant.userExecutedFunctionEvent": "已执行函数 {functionName}",
"xpack.aiAssistant.userSuggestedFunctionEvent": "已请求函数 {functionName}",
"xpack.aiAssistant.welcomeMessage.div.checkTrainedModelsToLabel": "{retryInstallingLink} 或检查 {trainedModelsLink},确保 {modelId} 已部署并正在运行。",
- "xpack.aiAssistant.welcomeMessage.div.settingUpKnowledgeBaseLabel": "正在设置知识库",
"xpack.aiAssistant.welcomeMessage.inspectErrorsButtonEmptyLabel": "检查问题",
"xpack.aiAssistant.welcomeMessage.issuesDescriptionListTitleLabel": "问题",
"xpack.aiAssistant.welcomeMessage.knowledgeBaseSuccessfullyInstalledLabel": "已成功安装知识库",
"xpack.aiAssistant.welcomeMessage.modelIsNotDeployedLabel": "未部署模型 {modelId}",
"xpack.aiAssistant.welcomeMessage.modelIsNotFullyAllocatedLabel": "{modelId} 的分配状态为 {allocationState}",
"xpack.aiAssistant.welcomeMessage.modelIsNotStartedLabel": "{modelId} 的部署状态为 {deploymentState}",
- "xpack.aiAssistant.welcomeMessage.retryButtonLabel": "安装知识库",
"xpack.aiAssistant.welcomeMessage.trainedModelsLinkLabel": "已训练模型",
- "xpack.aiAssistant.welcomeMessage.weAreSettingUpTextLabel": "我们正在设置您的知识库。这可能需要若干分钟。此进程处于运行状态时,您可以继续使用该助手。",
- "xpack.aiAssistant.welcomeMessageConnectors.connectorsErrorTextLabel": "无法加载连接器",
- "xpack.aiAssistant.welcomeMessageConnectors.connectorsForbiddenTextLabel": "缺少获取连接器所需的权限",
- "xpack.aiAssistant.welcomeMessageKnowledgeBase.yourKnowledgeBaseIsNotSetUpCorrectlyLabel": "尚未设置您的知识库。",
"xpack.aiAssistant.welcomeMessageKnowledgeBaseSetupErrorPanel.retryInstallingLinkLabel": "重试安装",
"xpack.aiops.actions.openChangePointInMlAppName": "在 Aiops 实验室中打开",
"xpack.aiops.analysis.analysisTypeDipFallbackInfoTitle": "基线时间范围的主要项目",
diff --git a/x-pack/platform/plugins/shared/stack_connectors/public/connector_types/openai/constants.tsx b/x-pack/platform/plugins/shared/stack_connectors/public/connector_types/openai/constants.tsx
index 70d79e98ad109..60dd1759e5e39 100644
--- a/x-pack/platform/plugins/shared/stack_connectors/public/connector_types/openai/constants.tsx
+++ b/x-pack/platform/plugins/shared/stack_connectors/public/connector_types/openai/constants.tsx
@@ -118,7 +118,6 @@ export const openAiConfig: ConfigFieldSchema[] = [
/>
),
euiFieldProps: {
- autocomplete: 'new-password',
autoComplete: 'new-password',
onFocus: (event: React.FocusEvent) => {
event.target.setAttribute('autocomplete', 'new-password');
diff --git a/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/helpers/test_helper.tsx b/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/helpers/test_helper.tsx
index e520cc4052b59..6632ce72e36ac 100644
--- a/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/helpers/test_helper.tsx
+++ b/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/helpers/test_helper.tsx
@@ -10,12 +10,12 @@ import { createMemoryHistory } from 'history';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render as testLibRender } from '@testing-library/react';
import { coreMock } from '@kbn/core/public/mocks';
-import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';
import { observabilityAIAssistantPluginMock } from '@kbn/observability-ai-assistant-plugin/public/mock';
import { RouterProvider } from '@kbn/typed-react-router-config';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { merge } from 'lodash';
import { DeepPartial } from 'utility-types';
+import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { AppContextProvider, AppContextValue } from '../context/app_context';
import { RedirectToHomeIfUnauthorized } from '../routes/components/redirect_to_home_if_unauthorized';
import { aIAssistantManagementObservabilityRouter } from '../routes/config';
@@ -77,8 +77,7 @@ export const render = (
};
return testLibRender(
- // @ts-ignore
-
+
@@ -93,6 +92,6 @@ export const render = (
-
+
);
};
diff --git a/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx b/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx
index abc393f7b9843..659a2a20f5f58 100644
--- a/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx
+++ b/x-pack/solutions/observability/plugins/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx
@@ -15,6 +15,7 @@ import { useGetKnowledgeBaseEntries } from '../../hooks/use_get_knowledge_base_e
import { useImportKnowledgeBaseEntries } from '../../hooks/use_import_knowledge_base_entries';
import { KnowledgeBaseTab } from './knowledge_base_tab';
import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public';
+import { DATA_TEST_SUBJ_INSTALL_KNOWLEDGE_BASE_BUTTON } from '@kbn/ai-assistant-cta';
jest.mock('../../hooks/use_get_knowledge_base_entries');
jest.mock('../../hooks/use_create_knowledge_base_entry');
@@ -92,9 +93,7 @@ describe('KnowledgeBaseTab', () => {
it('should render the Install Knowledge base setup', () => {
const { getByTestId } = render();
- expect(
- getByTestId('observabilityAiAssistantWelcomeMessageSetUpKnowledgeBaseButton')
- ).toBeInTheDocument();
+ expect(getByTestId(DATA_TEST_SUBJ_INSTALL_KNOWLEDGE_BASE_BUTTON)).toBeInTheDocument();
});
});
diff --git a/x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.json b/x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.json
index ea66c0e418635..ae74f92c4d8cd 100644
--- a/x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.json
+++ b/x-pack/solutions/observability/plugins/observability_ai_assistant_management/tsconfig.json
@@ -29,7 +29,9 @@
"@kbn/core-plugins-server",
"@kbn/product-doc-base-plugin",
"@kbn/ai-assistant-icon",
- "@kbn/ml-plugin"
+ "@kbn/ml-plugin",
+ "@kbn/react-kibana-context-render",
+ "@kbn/ai-assistant-cta"
],
"exclude": [
"target/**/*"
diff --git a/x-pack/test/observability_ai_assistant_functional/common/ui/index.ts b/x-pack/test/observability_ai_assistant_functional/common/ui/index.ts
index 3a12e17860254..a53eceb229033 100644
--- a/x-pack/test/observability_ai_assistant_functional/common/ui/index.ts
+++ b/x-pack/test/observability_ai_assistant_functional/common/ui/index.ts
@@ -9,6 +9,10 @@ import type { PathsOf, TypeAsArgs, TypeOf } from '@kbn/typed-react-router-config
import { kbnTestConfig } from '@kbn/test';
import type { ObservabilityAIAssistantRoutes } from '@kbn/observability-ai-assistant-app-plugin/public/routes/config';
import qs from 'query-string';
+import {
+ DATA_TEST_SUBJ_ADD_CONNECTOR_BUTTON,
+ DATA_TEST_SUBJ_INSTALL_KNOWLEDGE_BASE_BUTTON,
+} from '@kbn/ai-assistant-cta';
import { User } from '../../../observability_ai_assistant_api_integration/common/users/users';
import type { InheritedFtrProviderContext } from '../../ftr_provider_context';
@@ -33,13 +37,12 @@ const pages = {
tableAuthorCell: 'knowledgeBaseTableAuthorCell',
},
conversations: {
- setupGenAiConnectorsButtonSelector:
- 'observabilityAiAssistantInitialSetupPanelSetUpGenerativeAiConnectorButton',
+ setupGenAiConnectorsButtonSelector: DATA_TEST_SUBJ_ADD_CONNECTOR_BUTTON,
chatInput: 'observabilityAiAssistantChatPromptEditorTextArea',
- retryButton: 'observabilityAiAssistantWelcomeMessageSetUpKnowledgeBaseButton',
+ retryButton: DATA_TEST_SUBJ_INSTALL_KNOWLEDGE_BASE_BUTTON,
conversationLink: 'observabilityAiAssistantConversationsLink',
positiveFeedbackButton: 'observabilityAiAssistantFeedbackButtonsPositiveButton',
- connectorsErrorMsg: 'observabilityAiAssistantConnectorsError',
+ connectorsErrorMsg: 'no-connector-access-cta',
conversationsPage: 'observabilityAiAssistantConversationsPage',
access: {
shareButton: 'observabilityAiAssistantChatAccessBadge',
diff --git a/x-pack/test/observability_ai_assistant_functional/tests/conversations/index.spec.ts b/x-pack/test/observability_ai_assistant_functional/tests/conversations/index.spec.ts
index 5ca02f8607335..e44c83e6df7e7 100644
--- a/x-pack/test/observability_ai_assistant_functional/tests/conversations/index.spec.ts
+++ b/x-pack/test/observability_ai_assistant_functional/tests/conversations/index.spec.ts
@@ -165,19 +165,7 @@ export default function ApiTest({ getService, getPageObjects }: FtrProviderConte
`http://localhost:${proxy.getPort()}`
);
await testSubjects.setValue(ui.pages.createConnectorFlyout.apiKeyInput, 'myApiKey');
-
- // intercept the request to set up the knowledge base,
- // so we don't have to wait until it's fully downloaded
- await interceptRequest(
- driver.driver,
- '*kb\\/setup*',
- (responseFactory) => {
- return responseFactory.fail();
- },
- async () => {
- await testSubjects.clickWhenNotDisabled(ui.pages.createConnectorFlyout.saveButton);
- }
- );
+ await testSubjects.clickWhenNotDisabled(ui.pages.createConnectorFlyout.saveButton);
await retry.waitFor('Connector created toast', async () => {
const count = await toasts.getCount();
@@ -198,6 +186,21 @@ export default function ApiTest({ getService, getPageObjects }: FtrProviderConte
describe('after refreshing the page', () => {
before(async () => {
await browser.refresh();
+
+ // intercept the request to set up the knowledge base,
+ // so we don't have to wait until it's fully downloaded
+ await interceptRequest(
+ driver.driver,
+ '*kb\\/setup*',
+ (responseFactory) => {
+ return responseFactory.fail();
+ },
+ async () => {
+ await testSubjects.clickWhenNotDisabled(ui.pages.conversations.retryButton);
+ }
+ );
+
+ await toasts.dismissAll();
});
it('shows a setup kb button', async () => {
diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json
index a405ed64d2685..106126b74d558 100644
--- a/x-pack/test/tsconfig.json
+++ b/x-pack/test/tsconfig.json
@@ -192,5 +192,6 @@
"@kbn/apm-sources-access-plugin",
"@kbn/aiops-change-point-detection",
"@kbn/es-errors",
+ "@kbn/ai-assistant-cta"
]
}