From 9edcc50045b86caca93026ac591500e1d0389f8f Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Wed, 4 Jun 2025 14:53:53 +0100 Subject: [PATCH 01/14] Display warning banner in knowledge base tab when re-indexing is in progress --- .../public/helpers/test_helper.tsx | 13 ++++- .../components/knowledge_base_tab.test.tsx | 47 ++++++++++++++++++- .../routes/components/knowledge_base_tab.tsx | 24 ++++++++++ 3 files changed, 81 insertions(+), 3 deletions(-) diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx index e520cc4052b59..6079352e14a6c 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx @@ -76,7 +76,7 @@ export const render = ( }, }; - return testLibRender( + const TestWrapper = ({ children }: { children: React.ReactNode }) => ( // @ts-ignore @@ -87,7 +87,7 @@ export const render = ( history={history} router={aIAssistantManagementObservabilityRouter as any} > - {component} + {children} @@ -95,4 +95,13 @@ export const render = ( ); + + const renderResult = testLibRender(component, { wrapper: TestWrapper }); + + return { + ...renderResult, + rerender: (newComponent: React.ReactNode) => { + renderResult.rerender(newComponent); + }, + }; }; diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx index f282ddfe51962..a24cc1ecc157d 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { fireEvent } from '@testing-library/react'; +import { act, fireEvent } from '@testing-library/react'; import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public'; import { useGenAIConnectors, useKnowledgeBase } from '@kbn/ai-assistant/src/hooks'; import { render } from '../../helpers/test_helper'; @@ -104,6 +104,51 @@ describe('KnowledgeBaseTab', () => { }); }); + describe('when the knowledge base is re-indexing', () => { + beforeEach(() => { + useKnowledgeBaseMock.mockReturnValue({ + status: { + value: { + kbState: KnowledgeBaseState.READY, + enabled: true, + isReIndexing: true, + }, + }, + isInstalling: false, + install: jest.fn(), + }); + }); + + it('should show a warning callout', () => { + const { getByTestId } = render(); + const reindexingCallout = getByTestId('knowledgeBaseReindexingCallOut'); + + expect(reindexingCallout).toBeInTheDocument(); + }); + + it('should hide warning callout after re-indexing is complete', async () => { + const { getByTestId, queryByTestId, rerender } = render(); + expect(getByTestId('knowledgeBaseReindexingCallOut')).toBeInTheDocument(); + + useKnowledgeBaseMock.mockReturnValue({ + status: { + value: { + kbState: KnowledgeBaseState.READY, + enabled: true, + isReIndexing: false, + }, + }, + isInstalling: false, + install: jest.fn(), + }); + + await act(async () => { + rerender(); + }); + expect(queryByTestId('knowledgeBaseReindexingCallOut')).not.toBeInTheDocument(); + }); + }); + describe('when the knowledge base is installed and ready', () => { beforeEach(() => { useKnowledgeBaseMock.mockReturnValue({ diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx index d20c0bfacdfcd..a8b0e980a8e31 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx @@ -15,6 +15,7 @@ import { EuiBasicTableColumn, EuiButton, EuiButtonIcon, + EuiCallOut, EuiContextMenuItem, EuiContextMenuPanel, EuiFieldSearch, @@ -256,6 +257,29 @@ export function KnowledgeBaseTab() { return ( <> + {knowledgeBase.status.value?.isReIndexing && ( + + + {i18n.translate( + 'xpack.observabilityAiAssistantManagement.knowledgeBaseTab.reindexingCalloutBody', + { + defaultMessage: + 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', + } + )} + + + )} From d96ef41a64ef678257ea713d70371c3ccb5b9a6f Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Thu, 5 Jun 2025 12:09:53 +0100 Subject: [PATCH 02/14] Display warning banner on assistant conversations while the knowledge base is re-indexing --- .../welcome_message_knowledge_base.test.tsx | 51 +++++++++++++++++++ .../welcome_message_knowledge_base.tsx | 30 ++++++++++- 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx index 990a23faee276..095271ca06487 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx @@ -269,4 +269,55 @@ describe('WelcomeMessageKnowledgeBase', () => { expect(screen.queryByText(/Get started by setting up the Knowledge Base/i)).toBeNull(); expect(screen.queryByText(/Knowledge base successfully installed/i)).toBeNull(); }); + + it('renders a warning callout while knowledge base is re-indexing', async () => { + // Start in re-indexing state + let kb = createMockKnowledgeBase({ + status: { + value: { + kbState: KnowledgeBaseState.READY, + enabled: true, + concreteWriteIndex: 'my-index', + currentInferenceId: 'inference_id', + isReIndexing: true, + }, + loading: false, + error: undefined, + refresh: jest.fn(), + }, + }); + + const { rerender } = renderComponent(kb); + // Banner is shown + expect(screen.queryByText(/Re-indexing in progress/i)).toBeInTheDocument(); + expect( + screen.queryByText(/Knowledge base is currently being re-indexed./i) + ).toBeInTheDocument(); + + // Knowledge base finished re-indexing + kb = createMockKnowledgeBase({ + status: { + value: { + kbState: KnowledgeBaseState.READY, + enabled: true, + concreteWriteIndex: 'my-index', + currentInferenceId: 'inference_id', + isReIndexing: false, + }, + loading: false, + error: undefined, + refresh: jest.fn(), + }, + }); + + await act(async () => { + rerender(); + }); + + // Banner is no longer shown + expect(screen.queryByText(/Re-indexing in progress/i)).not.toBeInTheDocument(); + expect( + screen.queryByText(/Knowledge base is currently being re-indexed./i) + ).not.toBeInTheDocument(); + }); }); diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx index 7471b26047328..3be43c4bbf788 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx @@ -7,7 +7,7 @@ import React, { useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; +import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public'; import usePrevious from 'react-use/lib/usePrevious'; import { UseKnowledgeBaseResult } from '../hooks'; @@ -39,6 +39,34 @@ export function WelcomeMessageKnowledgeBase({ } if (knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY) { + if (knowledgeBase.status.value?.isReIndexing) { + return ( + + + + {i18n.translate( + 'xpack.observabilityAiAssistantManagement.knowledgeBaseTab.reindexingCalloutBody', + { + defaultMessage: + 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', + } + )} + + + + ); + } + return showSuccessBanner ? (
From d2d46c2261cbb650ae2d3e4065bd63647cbc9048 Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Thu, 5 Jun 2025 13:28:55 +0100 Subject: [PATCH 03/14] Combine knowledge base's re-indexing callout test logic into a single test --- .../routes/components/knowledge_base_tab.test.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx index a24cc1ecc157d..c06bed775bd60 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.test.tsx @@ -119,17 +119,11 @@ describe('KnowledgeBaseTab', () => { }); }); - it('should show a warning callout', () => { - const { getByTestId } = render(); - const reindexingCallout = getByTestId('knowledgeBaseReindexingCallOut'); - - expect(reindexingCallout).toBeInTheDocument(); - }); - - it('should hide warning callout after re-indexing is complete', async () => { + it('should show a warning callout while re-indexing is in progress', async () => { const { getByTestId, queryByTestId, rerender } = render(); expect(getByTestId('knowledgeBaseReindexingCallOut')).toBeInTheDocument(); + // Re-indexing completed useKnowledgeBaseMock.mockReturnValue({ status: { value: { @@ -145,6 +139,8 @@ describe('KnowledgeBaseTab', () => { await act(async () => { rerender(); }); + + // Callout is no longer shown expect(queryByTestId('knowledgeBaseReindexingCallOut')).not.toBeInTheDocument(); }); }); From 6c72e6a299ee57f6fe0df9fcf16d5cb499c27554 Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Thu, 5 Jun 2025 13:57:46 +0100 Subject: [PATCH 04/14] Fix string resource ids for the re-indexing callout title and body --- .../src/knowledge_base/welcome_message_knowledge_base.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx index 3be43c4bbf788..191da02c3bcbf 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx @@ -45,7 +45,7 @@ export function WelcomeMessageKnowledgeBase({ {i18n.translate( - 'xpack.observabilityAiAssistantManagement.knowledgeBaseTab.reindexingCalloutBody', + 'xpack.aiAssistant.welcomeMessage.knowledgeBaseReindexingCalloutBody', { defaultMessage: 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', From 90d4d6738dfc0fab0f4276dae8f57b6fa447516a Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Thu, 5 Jun 2025 14:12:27 +0100 Subject: [PATCH 05/14] Add return type to the test_helper render function --- .../public/helpers/test_helper.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx index 6079352e14a6c..133ad49e5c6b2 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/helpers/test_helper.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { createMemoryHistory } from 'history'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { render as testLibRender } from '@testing-library/react'; +import { RenderResult, 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'; @@ -41,7 +41,7 @@ const queryClient = new QueryClient({ export const render = ( component: React.ReactNode, mocks?: { coreStart?: DeepPartial; appContextValue?: AppContextValue } -) => { +): RenderResult => { const history = createMemoryHistory(); const startDeps = { From 7b2cc38b8821ea6885a443a7d7ababeb15ecb2ad Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Fri, 6 Jun 2025 12:25:59 +0100 Subject: [PATCH 06/14] Extract re-indexing callout into a shared component --- .../knowledge_base_reindexing_callout.tsx | 32 +++++++++++++++++++ .../welcome_message_knowledge_base.tsx | 29 ++--------------- .../routes/components/knowledge_base_tab.tsx | 27 ++-------------- 3 files changed, 38 insertions(+), 50 deletions(-) create mode 100644 x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx new file mode 100644 index 0000000000000..8dcbc93b6f4be --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx @@ -0,0 +1,32 @@ +/* + * 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 { EuiCallOut, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +export const KnowledgeBaseReindexingCallout = () => { + return ( + + + + {i18n.translate('xpack.aiAssistant.knowledgeBase.reindexingCalloutBody', { + defaultMessage: + 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', + })} + + + + ); +}; diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx index 191da02c3bcbf..5b2034e044e34 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx @@ -7,13 +7,14 @@ import React, { useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public'; import usePrevious from 'react-use/lib/usePrevious'; import { UseKnowledgeBaseResult } from '../hooks'; import { KnowledgeBaseInstallationStatusPanel } from './knowledge_base_installation_status_panel'; import { SettingUpKnowledgeBase } from './setting_up_knowledge_base'; import { InspectKnowledgeBasePopover } from './inspect_knowlegde_base_popover'; +import { KnowledgeBaseReindexingCallout } from './knowledge_base_reindexing_callout'; export function WelcomeMessageKnowledgeBase({ knowledgeBase, @@ -40,31 +41,7 @@ export function WelcomeMessageKnowledgeBase({ if (knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY) { if (knowledgeBase.status.value?.isReIndexing) { - return ( - - - - {i18n.translate( - 'xpack.aiAssistant.welcomeMessage.knowledgeBaseReindexingCalloutBody', - { - defaultMessage: - 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', - } - )} - - - - ); + return ; } return showSuccessBanner ? ( diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx index a8b0e980a8e31..5e9e17d0e8cd4 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx @@ -15,7 +15,6 @@ import { EuiBasicTableColumn, EuiButton, EuiButtonIcon, - EuiCallOut, EuiContextMenuItem, EuiContextMenuPanel, EuiFieldSearch, @@ -40,6 +39,7 @@ import { useKnowledgeBase } from '@kbn/ai-assistant/src/hooks'; import { KnowledgeBaseInstallationStatusPanel } from '@kbn/ai-assistant/src/knowledge_base/knowledge_base_installation_status_panel'; import { SettingUpKnowledgeBase } from '@kbn/ai-assistant/src/knowledge_base/setting_up_knowledge_base'; import { InspectKnowledgeBasePopover } from '@kbn/ai-assistant/src/knowledge_base/inspect_knowlegde_base_popover'; +import { KnowledgeBaseReindexingCallout } from '@kbn/ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout'; import { useGetKnowledgeBaseEntries } from '../../hooks/use_get_knowledge_base_entries'; import { categorizeEntries, KnowledgeBaseEntryCategory } from '../../helpers/categorize_entries'; import { KnowledgeBaseEditManualEntryFlyout } from './knowledge_base_edit_manual_entry_flyout'; @@ -257,29 +257,8 @@ export function KnowledgeBaseTab() { return ( <> - {knowledgeBase.status.value?.isReIndexing && ( - - - {i18n.translate( - 'xpack.observabilityAiAssistantManagement.knowledgeBaseTab.reindexingCalloutBody', - { - defaultMessage: - 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', - } - )} - - - )} + {knowledgeBase.status.value?.isReIndexing && } + From fe836a48ef745707f191d15d8cdc957a9523cdc6 Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Tue, 10 Jun 2025 13:26:56 +0100 Subject: [PATCH 07/14] Move re-indexing callout to the top of the welcome message --- .../src/chat/welcome_message.test.tsx | 140 ++++++++++++++++++ .../src/chat/welcome_message.tsx | 8 + .../welcome_message_knowledge_base.test.tsx | 51 ------- .../welcome_message_knowledge_base.tsx | 5 - 4 files changed, 148 insertions(+), 56 deletions(-) create mode 100644 x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx new file mode 100644 index 0000000000000..ae09e0c411ca0 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx @@ -0,0 +1,140 @@ +/* + * 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 { act, render, screen } from '@testing-library/react'; +import { KnowledgeBaseState } from '@kbn/observability-ai-assistant-plugin/public'; +import { WelcomeMessage } from './welcome_message'; +import type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base'; +import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors'; + +const mockConnectors: UseGenAIConnectorsResult = { + connectors: [ + { + id: 'test-connector', + name: 'Test Connector', + actionTypeId: '.gen-ai', + isPreconfigured: false, + isDeprecated: false, + isSystemAction: false, + referencedByCount: 0, + }, + ], + loading: false, + selectedConnector: 'test-connector', + selectConnector: jest.fn(), + reloadConnectors: jest.fn(), +}; + +jest.mock('@kbn/kibana-react-plugin/public', () => ({ + useKibana: () => ({ + services: { + triggersActionsUi: { + getAddConnectorFlyout: jest.fn(() => null), + }, + observabilityAIAssistant: { + service: { + getScreenContexts: jest.fn(() => []), + }, + useGenAIConnectors: jest.fn(() => mockConnectors), + }, + }, + }), +})); + +const createMockKnowledgeBase = ( + partial: Partial = {} +): UseKnowledgeBaseResult => ({ + isInstalling: false, + isPolling: false, + install: jest.fn(), + warmupModel: jest.fn(), + isWarmingUpModel: false, + status: { + value: { + enabled: true, + errorMessage: undefined, + kbState: KnowledgeBaseState.NOT_INSTALLED, + concreteWriteIndex: undefined, + currentInferenceId: undefined, + isReIndexing: false, + }, + loading: false, + error: undefined, + refresh: jest.fn(), + }, + ...partial, +}); + +describe('WelcomeMessage', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + it('renders a warning callout while knowledge base is re-indexing', async () => { + const knowledgeBase = createMockKnowledgeBase({ + status: { + value: { + kbState: KnowledgeBaseState.READY, + enabled: true, + concreteWriteIndex: 'my-index', + currentInferenceId: 'inference_id', + isReIndexing: true, + }, + loading: false, + error: undefined, + refresh: jest.fn(), + }, + }); + + const { rerender } = render( + + ); + + // Banner is shown during re-indexing + expect(screen.queryByText(/Re-indexing in progress/i)).toBeInTheDocument(); + expect( + screen.queryByText(/Knowledge base is currently being re-indexed./i) + ).toBeInTheDocument(); + + // Knowledge base finished re-indexing + const updatedKnowledgeBase = createMockKnowledgeBase({ + status: { + value: { + kbState: KnowledgeBaseState.READY, + enabled: true, + concreteWriteIndex: 'my-index', + currentInferenceId: 'inference_id', + isReIndexing: false, + }, + loading: false, + error: undefined, + refresh: jest.fn(), + }, + }); + + await act(async () => { + rerender( + + ); + }); + + // Banner is no longer shown + expect(screen.queryByText(/Re-indexing in progress/i)).not.toBeInTheDocument(); + expect( + screen.queryByText(/Knowledge base is currently being re-indexed./i) + ).not.toBeInTheDocument(); + }); +}); 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 29d024d8d0ffd..ef86dd6affa1d 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 @@ -12,6 +12,7 @@ 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 type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base'; import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors'; import { Disclaimer } from './disclaimer'; @@ -20,6 +21,7 @@ import { WelcomeMessageKnowledgeBase } from '../knowledge_base/welcome_message_k import { StarterPrompts } from './starter_prompts'; import { useKibana } from '../hooks/use_kibana'; import { ElasticLlmConversationCallout } from './elastic_llm_conversation_callout'; +import { KnowledgeBaseReindexingCallout } from '../knowledge_base/knowledge_base_reindexing_callout'; const fullHeightClassName = css` height: 100%; @@ -70,6 +72,11 @@ export function WelcomeMessage({ [triggersActionsUi] ); + const showKnowledgeBaseReindexingCallout = + knowledgeBase.status.value?.enabled && + knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY && + knowledgeBase.status.value?.isReIndexing; + return ( <> {showElasticLlmCalloutInChat ? : null} + {showKnowledgeBaseReindexingCallout && } diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx index 095271ca06487..990a23faee276 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.test.tsx @@ -269,55 +269,4 @@ describe('WelcomeMessageKnowledgeBase', () => { expect(screen.queryByText(/Get started by setting up the Knowledge Base/i)).toBeNull(); expect(screen.queryByText(/Knowledge base successfully installed/i)).toBeNull(); }); - - it('renders a warning callout while knowledge base is re-indexing', async () => { - // Start in re-indexing state - let kb = createMockKnowledgeBase({ - status: { - value: { - kbState: KnowledgeBaseState.READY, - enabled: true, - concreteWriteIndex: 'my-index', - currentInferenceId: 'inference_id', - isReIndexing: true, - }, - loading: false, - error: undefined, - refresh: jest.fn(), - }, - }); - - const { rerender } = renderComponent(kb); - // Banner is shown - expect(screen.queryByText(/Re-indexing in progress/i)).toBeInTheDocument(); - expect( - screen.queryByText(/Knowledge base is currently being re-indexed./i) - ).toBeInTheDocument(); - - // Knowledge base finished re-indexing - kb = createMockKnowledgeBase({ - status: { - value: { - kbState: KnowledgeBaseState.READY, - enabled: true, - concreteWriteIndex: 'my-index', - currentInferenceId: 'inference_id', - isReIndexing: false, - }, - loading: false, - error: undefined, - refresh: jest.fn(), - }, - }); - - await act(async () => { - rerender(); - }); - - // Banner is no longer shown - expect(screen.queryByText(/Re-indexing in progress/i)).not.toBeInTheDocument(); - expect( - screen.queryByText(/Knowledge base is currently being re-indexed./i) - ).not.toBeInTheDocument(); - }); }); diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx index 5b2034e044e34..7471b26047328 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/welcome_message_knowledge_base.tsx @@ -14,7 +14,6 @@ import { UseKnowledgeBaseResult } from '../hooks'; import { KnowledgeBaseInstallationStatusPanel } from './knowledge_base_installation_status_panel'; import { SettingUpKnowledgeBase } from './setting_up_knowledge_base'; import { InspectKnowledgeBasePopover } from './inspect_knowlegde_base_popover'; -import { KnowledgeBaseReindexingCallout } from './knowledge_base_reindexing_callout'; export function WelcomeMessageKnowledgeBase({ knowledgeBase, @@ -40,10 +39,6 @@ export function WelcomeMessageKnowledgeBase({ } if (knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY) { - if (knowledgeBase.status.value?.isReIndexing) { - return ; - } - return showSuccessBanner ? (
From e273bfee085c6f59bdc5c3f0a0e166fef737be9b Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Tue, 10 Jun 2025 13:53:46 +0100 Subject: [PATCH 08/14] Add re-indexing callout to the chat timeline --- .../kbn-ai-assistant/src/chat/chat_timeline.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 df104c27c9093..916c5553ddde1 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 @@ -13,6 +13,7 @@ import { omit } from 'lodash'; import { ChatActionClickPayload, ChatState, + KnowledgeBaseState, type Feedback, type Message, type ObservabilityAIAssistantChatService, @@ -26,6 +27,7 @@ import { ChatConsolidatedItems } from './chat_consolidated_items'; import { getTimelineItemsfromConversation } from '../utils/get_timeline_items_from_conversation'; import { useKibana } from '../hooks/use_kibana'; import { ElasticLlmConversationCallout } from './elastic_llm_conversation_callout'; +import { KnowledgeBaseReindexingCallout } from '../knowledge_base/knowledge_base_reindexing_callout'; export interface ChatTimelineItem extends Pick { @@ -107,7 +109,7 @@ const euiCommentListClassName = css` padding-bottom: 32px; `; -const stickyElasticLlmCalloutContainerClassName = css` +const stickyCalloutContainerClassName = css` position: sticky; top: 0; z-index: 1; @@ -122,6 +124,7 @@ export function ChatTimeline({ isConversationOwnedByCurrentUser, isArchived, showElasticLlmCalloutInChat, + knowledgeBase, onEdit, onFeedback, onRegenerate, @@ -196,10 +199,17 @@ export function ChatTimeline({ anonymizationEnabled, ]); + const showKnowledgeBaseReindexingCallout = + knowledgeBase.status.value?.enabled && + knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY && + knowledgeBase.status.value?.isReIndexing; return ( +
+ {showKnowledgeBaseReindexingCallout ? : null} +
{showElasticLlmCalloutInChat ? ( -
+
) : null} From 5d6ff811d489c2bb0c42b851dd84c946bbc1e8a5 Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Tue, 10 Jun 2025 14:13:35 +0100 Subject: [PATCH 09/14] Fix variable name for showKnowledgeBaseReIndexingCallout --- .../shared/kbn-ai-assistant/src/chat/chat_timeline.tsx | 4 ++-- .../shared/kbn-ai-assistant/src/chat/welcome_message.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 916c5553ddde1..ee36421d409c7 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 @@ -199,14 +199,14 @@ export function ChatTimeline({ anonymizationEnabled, ]); - const showKnowledgeBaseReindexingCallout = + const showKnowledgeBaseReIndexingCallout = knowledgeBase.status.value?.enabled && knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY && knowledgeBase.status.value?.isReIndexing; return (
- {showKnowledgeBaseReindexingCallout ? : null} + {showKnowledgeBaseReIndexingCallout ? : null}
{showElasticLlmCalloutInChat ? (
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 ef86dd6affa1d..68e33a83d6167 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 @@ -72,7 +72,7 @@ export function WelcomeMessage({ [triggersActionsUi] ); - const showKnowledgeBaseReindexingCallout = + const showKnowledgeBaseReIndexingCallout = knowledgeBase.status.value?.enabled && knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY && knowledgeBase.status.value?.isReIndexing; @@ -85,8 +85,8 @@ export function WelcomeMessage({ gutterSize="none" className={fullHeightClassName} > + {showKnowledgeBaseReIndexingCallout && } {showElasticLlmCalloutInChat ? : null} - {showKnowledgeBaseReindexingCallout && } From e5c0537d624034f304c1665c3c1ed21455c06c68 Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Tue, 10 Jun 2025 23:13:57 +0100 Subject: [PATCH 10/14] Update styling of the re-indexing callout to be compatible and consistent with Elastic LLM callout that can appear simultaneously --- .../src/chat/chat_timeline.tsx | 32 ++++++++------- .../src/chat/welcome_message.test.tsx | 6 ++- .../src/chat/welcome_message.tsx | 2 +- .../knowledge_base_reindexing_callout.tsx | 41 +++++++++++-------- 4 files changed, 45 insertions(+), 36 deletions(-) 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 ee36421d409c7..ce0829d944698 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 @@ -7,7 +7,7 @@ import React, { type ReactNode, useMemo } from 'react'; import { css } from '@emotion/css'; -import { EuiCode, EuiCommentList } from '@elastic/eui'; +import { EuiCode, EuiCommentList, useEuiTheme } from '@elastic/eui'; import type { AuthenticatedUser } from '@kbn/security-plugin/common'; import { omit } from 'lodash'; import { @@ -105,15 +105,6 @@ function highlightContent( } return parts; } -const euiCommentListClassName = css` - padding-bottom: 32px; -`; - -const stickyCalloutContainerClassName = css` - position: sticky; - top: 0; - z-index: 1; -`; export function ChatTimeline({ conversationId, @@ -147,6 +138,21 @@ export function ChatTimeline({ return { anonymizationEnabled: false }; } }, [uiSettings]); + const { euiTheme } = useEuiTheme(); + + const euiCommentListClassName = css` + padding-bottom: 32px; + `; + + const stickyCalloutContainerClassName = css` + position: sticky; + top: 0; + z-index: 1; + background: ${euiTheme.colors.backgroundBasePlain}; + &:empty { + display: none; + } + `; const items = useMemo(() => { const timelineItems = getTimelineItemsfromConversation({ @@ -207,12 +213,8 @@ export function ChatTimeline({
{showKnowledgeBaseReIndexingCallout ? : null} + {showElasticLlmCalloutInChat ? : null}
- {showElasticLlmCalloutInChat ? ( -
- -
- ) : null} {items.map((item, index) => { return Array.isArray(item) ? ( { knowledgeBase={knowledgeBase} connectors={mockConnectors} onSelectPrompt={jest.fn()} + showElasticLlmCalloutInChat={false} /> ); - // Banner is shown during re-indexing + // Callout is shown during re-indexing expect(screen.queryByText(/Re-indexing in progress/i)).toBeInTheDocument(); expect( screen.queryByText(/Knowledge base is currently being re-indexed./i) @@ -127,11 +128,12 @@ describe('WelcomeMessage', () => { knowledgeBase={updatedKnowledgeBase} connectors={mockConnectors} onSelectPrompt={jest.fn()} + showElasticLlmCalloutInChat={false} /> ); }); - // Banner is no longer shown + // Callout is no longer shown expect(screen.queryByText(/Re-indexing in progress/i)).not.toBeInTheDocument(); expect( screen.queryByText(/Knowledge base is currently being re-indexed./i) 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 68e33a83d6167..5d024ca939bd7 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 @@ -85,7 +85,7 @@ export function WelcomeMessage({ gutterSize="none" className={fullHeightClassName} > - {showKnowledgeBaseReIndexingCallout && } + {showKnowledgeBaseReIndexingCallout ? : null} {showElasticLlmCalloutInChat ? : null} diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx index 8dcbc93b6f4be..c09ff0139c598 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx @@ -6,27 +6,32 @@ */ import React from 'react'; -import { EuiCallOut, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { css } from '@emotion/css'; +import { EuiCallOut, useEuiTheme } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; export const KnowledgeBaseReindexingCallout = () => { + const { euiTheme } = useEuiTheme(); + + const knowledgeBaseReindexingCalloutName = css` + margin-bottom: ${euiTheme.size.s}; + width: 100%; + `; + return ( - - - - {i18n.translate('xpack.aiAssistant.knowledgeBase.reindexingCalloutBody', { - defaultMessage: - 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', - })} - - - + + {i18n.translate('xpack.aiAssistant.knowledgeBase.reindexingCalloutBody', { + defaultMessage: + 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', + })} + ); }; From 17416fa3b7ac23683e79be809df06e230edae117 Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Thu, 12 Jun 2025 11:41:53 +0100 Subject: [PATCH 11/14] Move re-indexing callout flag to the parent component and fix style definition for the comment list --- .../shared/kbn-ai-assistant/src/chat/chat_body.tsx | 9 ++++++++- .../shared/kbn-ai-assistant/src/chat/chat_timeline.tsx | 10 ++-------- .../kbn-ai-assistant/src/chat/welcome_message.tsx | 8 ++------ 3 files changed, 12 insertions(+), 15 deletions(-) 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 cc85c5bf8c1a1..7dd66f5e87679 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 @@ -35,6 +35,7 @@ import { type Feedback, aiAssistantSimulatedFunctionCalling, getElasticManagedLlmConnector, + KnowledgeBaseState, } from '@kbn/observability-ai-assistant-plugin/public'; import type { AuthenticatedUser } from '@kbn/security-plugin/common'; import { findLastIndex } from 'lodash'; @@ -388,6 +389,11 @@ export function ChatBody({ !conversationCalloutDismissed && tourCalloutDismissed; + const showKnowledgeBaseReIndexingCallout = + knowledgeBase.status.value?.enabled === true && + knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY && + knowledgeBase.status.value?.isReIndexing === true; + const isPublic = conversation.value?.public; const isArchived = !!conversation.value?.archived; const showPromptEditor = !isArchived && (!isPublic || isConversationOwnedByCurrentUser); @@ -529,12 +535,12 @@ export function ChatBody({ ) } showElasticLlmCalloutInChat={showElasticLlmCalloutInChat} + showKnowledgeBaseReIndexingCallout={showKnowledgeBaseReIndexingCallout} /> ) : ( )} 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 ce0829d944698..c84a9a1587b2a 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 @@ -13,7 +13,6 @@ import { omit } from 'lodash'; import { ChatActionClickPayload, ChatState, - KnowledgeBaseState, type Feedback, type Message, type ObservabilityAIAssistantChatService, @@ -21,7 +20,6 @@ import { aiAssistantAnonymizationRules, } from '@kbn/observability-ai-assistant-plugin/public'; import { AnonymizationRule } from '@kbn/observability-ai-assistant-plugin/common'; -import type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base'; import { ChatItem } from './chat_item'; import { ChatConsolidatedItems } from './chat_consolidated_items'; import { getTimelineItemsfromConversation } from '../utils/get_timeline_items_from_conversation'; @@ -55,7 +53,6 @@ export interface ChatTimelineItem export interface ChatTimelineProps { conversationId?: string; messages: Message[]; - knowledgeBase: UseKnowledgeBaseResult; chatService: ObservabilityAIAssistantChatService; hasConnector: boolean; chatState: ChatState; @@ -63,6 +60,7 @@ export interface ChatTimelineProps { isArchived: boolean; currentUser?: Pick; showElasticLlmCalloutInChat: boolean; + showKnowledgeBaseReIndexingCallout: boolean; onEdit: (message: Message, messageAfterEdit: Message) => void; onFeedback: (feedback: Feedback) => void; onRegenerate: (message: Message) => void; @@ -115,7 +113,7 @@ export function ChatTimeline({ isConversationOwnedByCurrentUser, isArchived, showElasticLlmCalloutInChat, - knowledgeBase, + showKnowledgeBaseReIndexingCallout, onEdit, onFeedback, onRegenerate, @@ -205,10 +203,6 @@ export function ChatTimeline({ anonymizationEnabled, ]); - const showKnowledgeBaseReIndexingCallout = - knowledgeBase.status.value?.enabled && - knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY && - knowledgeBase.status.value?.isReIndexing; 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 5d024ca939bd7..0b9d5d31f2d36 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 @@ -12,7 +12,6 @@ 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 type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base'; import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors'; import { Disclaimer } from './disclaimer'; @@ -36,11 +35,13 @@ export function WelcomeMessage({ connectors, knowledgeBase, showElasticLlmCalloutInChat, + showKnowledgeBaseReIndexingCallout, onSelectPrompt, }: { connectors: UseGenAIConnectorsResult; knowledgeBase: UseKnowledgeBaseResult; showElasticLlmCalloutInChat: boolean; + showKnowledgeBaseReIndexingCallout: boolean; onSelectPrompt: (prompt: string) => void; }) { const breakpoint = useCurrentEuiBreakpoint(); @@ -72,11 +73,6 @@ export function WelcomeMessage({ [triggersActionsUi] ); - const showKnowledgeBaseReIndexingCallout = - knowledgeBase.status.value?.enabled && - knowledgeBase.status.value?.kbState === KnowledgeBaseState.READY && - knowledgeBase.status.value?.isReIndexing; - return ( <> Date: Thu, 12 Jun 2025 11:53:18 +0100 Subject: [PATCH 12/14] Update the callout wording to make reduce confusion in case it appears for new users. --- .../src/knowledge_base/knowledge_base_reindexing_callout.tsx | 2 +- .../public/routes/components/knowledge_base_tab.tsx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx index c09ff0139c598..111a08e1d3b2e 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/knowledge_base/knowledge_base_reindexing_callout.tsx @@ -30,7 +30,7 @@ export const KnowledgeBaseReindexingCallout = () => { > {i18n.translate('xpack.aiAssistant.knowledgeBase.reindexingCalloutBody', { defaultMessage: - 'Knowledge base is currently being re-indexed. Some entries will be unavailable until the operation completes.', + 'Knowledge base is currently being re-indexed. If you have entries, some may be unavailable until the operation completes.', })} ); diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx index 5e9e17d0e8cd4..20d994ffa45a9 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx @@ -65,6 +65,9 @@ export function KnowledgeBaseTab() { const dateFormat = uiSettings.get('dateFormat'); const knowledgeBase = useKnowledgeBase(); + + // eslint-disable-next-line no-console + console.log(knowledgeBase); const { euiTheme } = useEuiTheme(); const columns: Array> = [ From fd4a2b3d04bd1a491f8b3222c67f29333aba8d8c Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Thu, 12 Jun 2025 12:55:01 +0100 Subject: [PATCH 13/14] Update tests --- .../shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx index 8f7027447470b..6a7f98297321c 100644 --- a/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx +++ b/x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/welcome_message.test.tsx @@ -97,6 +97,7 @@ describe('WelcomeMessage', () => { connectors={mockConnectors} onSelectPrompt={jest.fn()} showElasticLlmCalloutInChat={false} + showKnowledgeBaseReIndexingCallout={true} /> ); @@ -129,6 +130,7 @@ describe('WelcomeMessage', () => { connectors={mockConnectors} onSelectPrompt={jest.fn()} showElasticLlmCalloutInChat={false} + showKnowledgeBaseReIndexingCallout={false} /> ); }); From 9edbb0f96603e8e3ca9649df637b9b66a2679a7c Mon Sep 17 00:00:00 2001 From: Srdjan Lulic Date: Thu, 12 Jun 2025 14:15:26 +0100 Subject: [PATCH 14/14] Move eui comment styling outside of the ChatTimeline component --- .../shared/kbn-ai-assistant/src/chat/chat_timeline.tsx | 8 ++++---- .../public/routes/components/knowledge_base_tab.tsx | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) 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 c84a9a1587b2a..77027a0a545f6 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 @@ -104,6 +104,10 @@ function highlightContent( return parts; } +const euiCommentListClassName = css` + padding-bottom: 32px; +`; + export function ChatTimeline({ conversationId, messages, @@ -138,10 +142,6 @@ export function ChatTimeline({ }, [uiSettings]); const { euiTheme } = useEuiTheme(); - const euiCommentListClassName = css` - padding-bottom: 32px; - `; - const stickyCalloutContainerClassName = css` position: sticky; top: 0; diff --git a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx index 20d994ffa45a9..5e9e17d0e8cd4 100644 --- a/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx +++ b/x-pack/platform/plugins/private/observability_ai_assistant_management/public/routes/components/knowledge_base_tab.tsx @@ -65,9 +65,6 @@ export function KnowledgeBaseTab() { const dateFormat = uiSettings.get('dateFormat'); const knowledgeBase = useKnowledgeBase(); - - // eslint-disable-next-line no-console - console.log(knowledgeBase); const { euiTheme } = useEuiTheme(); const columns: Array> = [