From c967f2df96d0b34bb3f233ab80f2a08452b1811e Mon Sep 17 00:00:00 2001
From: Kenneth Kreindler <42113355+KDKHD@users.noreply.github.com>
Date: Thu, 25 Sep 2025 11:14:26 +0100
Subject: [PATCH 01/11] [Security Solution] [GenAi] Use default LLM setting for
security GenAi features (#234480)
## Summary
Summarize your PR. If it involves visual changes include a screenshot or
gif.
This PR integrates the new [default LLM
setting](https://github.com/elastic/kibana/pull/231940) with the
security solution GenAI features (AI assistant and Attack discovery).
The default LLM setting allows admins to configure the preferred AI
connector. This PR make sure that this setting is actually respected in
the AI assistant and Attack discovery.
### How to test:
- Start Kibana locally from this branch
- Make sure you have at least 3 LLM connectors configured (can be
preconfigured ones).
- Go to stack management > advanced settings and switch the following
setting to "Security AI assistant in other apps". (This will make
testing a little bit easier)
- Enable the feature flag by adding the following to kibana.dev.yml:
```
feature_flags.overrides.aiAssistant.defaultLlmSettingEnabled: true
```
- Go to the GenAi Settings page:
http://localhost:5601/app/management/ai/genAiSettings
- Select a default LLM:
- Save the setting change using the footer at the bottom of the page.
- Open the Security AI assistant (if you changed the Assistant
visibility setting, you can open the assistant from the GenAi page
directly)
- Check that the LLM connector for the conversation is the one you
configured as the default LLM. Also, verify that you can still change
the connector used in your conversation to one of your other connectors.
- Change the LLM to a non-default connector for the conversation.
- Once you select a non-default connector, chat with the assistant and
then start a new conversation, your non-default connector should still
be active for the new conversation.
- Now back on the GenAi settings page, check the `Disallow all other
connectors` checkbox.
- Open the AI assistant again and go to the existing conversation that
has a few messages inside.
- You should see a red banner indicating that a connector needs to be
selected.
- If you open the connector selector, you should now only see the
default LLM you have configured as an option.
#### Attack Discovery
In attack discovery, you should observe the same behavior.
- Go to attack discovery
http://localhost:5601/app/security/attack_discovery
- Open the manual run config flyout
- Verify that only the default LLM is available as the connector:
- Go back to the GenAi settings page
http://localhost:5601/app/management/ai/genAiSettings and deselect the
`Disallow all other connectors` checkbox and select a different default
connector.
- Go to Attack Discovery and open the manual run config flyout again.
- Check that by default, your new default connector is used. Also,
verify that you now again have the option of changing the connector to
any of the other configured connectors.
### TODO
The designs of the connector selector for Attack discovery and the
Assistant still need to be implemented. That will be done in a separate
PR.
### Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
- [X] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [X]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for feaures that require explanation or tutorials
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [X] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [X] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [X] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [X] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [X] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
### Identify risks
Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.
- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine
(cherry picked from commit b543b8c8fbb0527bd704984946bc240af8104bc2)
# Conflicts:
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/api/chat_complete/use_chat_complete.ts
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.ts
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/index.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/search_ai_lake_configurations_settings_management.test.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/search_ai_lake_configurations_settings_management.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_selector/index.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx
# x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json
# x-pack/platform/plugins/private/gen_ai_settings/public/components/default_ai_connector/default_ai_connector.tsx
# x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx
# x-pack/solutions/security/plugins/elastic_assistant/public/src/context/assistant_context/assistant_provider.tsx
# x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx
# x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/schedule/create_flyout/index.tsx
# x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/schedule/details_flyout/index.tsx
# x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx
# x-pack/solutions/security/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/insights/workflow_insights_scan.tsx
# x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx
---
.../conversation_settings_editor.tsx | 7 +-
.../impl/assistant/helpers.test.ts | 102 +++++++++++++-----
.../impl/assistant/helpers.ts | 27 ++++-
.../impl/assistant/index.tsx | 7 +-
.../assistant/settings/assistant_settings.tsx | 4 +-
.../assistant_settings_management.test.tsx | 18 ++++
.../assistant_settings_management.tsx | 6 +-
.../evaluation_settings.tsx | 5 +-
.../impl/assistant_context/index.tsx | 7 ++
.../connector_selector/index.tsx | 11 +-
.../connectorland/connector_setup/index.tsx | 4 +-
.../use_load_connectors/index.test.tsx | 18 +++-
.../use_load_connectors/index.tsx | 46 ++++++--
.../mock/test_providers/test_providers.tsx | 13 ++-
.../impl/tour/elastic_llm/index.tsx | 3 +-
.../steps/connector_step/connector_step.tsx | 4 +-
.../mock/test_providers/test_providers.tsx | 11 +-
.../ecs-data-quality-dashboard/tsconfig.json | 3 +-
.../public/attack_discovery/pages/index.tsx | 3 +-
.../pages/use_attack_discovery/index.tsx | 3 +
.../common/mock/mock_assistant_provider.tsx | 6 ++
.../insights/workflow_insights_scan.tsx | 3 +-
.../cards/assistant/assistant_card.tsx | 13 ++-
23 files changed, 259 insertions(+), 65 deletions(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
index ba18594836792..f8da56c815292 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
@@ -11,9 +11,10 @@ import React, { useCallback, useMemo } from 'react';
import { HttpSetup } from '@kbn/core-http-browser';
import { FormattedMessage } from '@kbn/i18n-react';
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/public/common';
-import { noop } from 'lodash/fp';
-import { PromptResponse } from '@kbn/elastic-assistant-common';
import { Conversation } from '../../../..';
+import { noop } from 'lodash/fp';
+import type { PromptResponse } from '@kbn/elastic-assistant-common';
+import { useAssistantContext } from '../../../..';
import * as i18n from './translations';
import * as i18nModel from '../../../connectorland/models/model_selector/translations';
@@ -52,8 +53,10 @@ export const ConversationSettingsEditor: React.FC {
+ const { settings } = useAssistantContext();
const { data: connectors, isSuccess: areConnectorsFetched } = useLoadConnectors({
http,
+ settings,
});
const selectedSystemPrompt = useMemo(() => {
return getDefaultSystemPrompt({ allSystemPrompts, conversation: selectedConversation });
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts
index 26609dea82164..188b4bf14d05c 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts
@@ -5,12 +5,10 @@
* 2.0.
*/
-import {
- getDefaultConnector,
- getOptionalRequestParams,
- mergeBaseWithPersistedConversations,
-} from './helpers';
-import { AIConnector } from '../connectorland/connector_selector';
+import { getDefaultConnector, getOptionalRequestParams, mergeBaseWithPersistedConversations } from './helpers';
+import type { AIConnector } from '../connectorland/connector_selector';
+import type { SettingsStart } from '@kbn/core-ui-settings-browser';
+import { GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR } from '@kbn/management-settings-ids';
describe('helpers', () => {
describe('getDefaultConnector', () => {
@@ -29,41 +27,97 @@ describe('helpers', () => {
apiUrl: 'https://api.openai.com/v1/chat/completions',
},
};
+
+ const connector2: AIConnector = {
+ ...defaultConnector,
+ id: 'c7f91dc0-2197-11ee-aded-897192c5d633',
+ name: 'OpenAI',
+ config: {
+ apiProvider: 'OpenAI 2',
+ apiUrl: 'https://api.openai.com/v1/chat/completions',
+ },
+ };
+
+ const clientGet = jest.fn();
+
+ const settings = {
+ client: {
+ get: clientGet,
+ },
+ } as unknown as SettingsStart;
+
+ beforeEach(() => {
+ jest.clearAllMocks();
+ clientGet.mockImplementation((key: string) => {
+ return undefined;
+ });
+ });
+
it('should return undefined if connectors array is undefined', () => {
const connectors = undefined;
- const result = getDefaultConnector(connectors);
+ const result = getDefaultConnector(connectors, settings);
expect(result).toBeUndefined();
});
it('should return undefined if connectors array is empty', () => {
const connectors: AIConnector[] = [];
- const result = getDefaultConnector(connectors);
+ const result = getDefaultConnector(connectors, settings);
expect(result).toBeUndefined();
});
- it('should return the connector id if there is only one connector', () => {
+ it('should return the first connector if there is only one connector available', () => {
const connectors: AIConnector[] = [defaultConnector];
- const result = getDefaultConnector(connectors);
+ const result = getDefaultConnector(connectors, settings);
expect(result).toBe(connectors[0]);
});
- it('should return the connector id if there are multiple connectors', () => {
- const connectors: AIConnector[] = [
- defaultConnector,
- {
- ...defaultConnector,
- id: 'c7f91dc0-2197-11ee-aded-897192c5d633',
- name: 'OpenAI',
- config: {
- apiProvider: 'OpenAI 2',
- apiUrl: 'https://api.openai.com/v1/chat/completions',
- },
- },
- ];
- const result = getDefaultConnector(connectors);
+ it('should return the default connector if there are multiple connectors and default connector is defined', () => {
+ clientGet.mockImplementation((key: string) => {
+ if (key === GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR) {
+ return defaultConnector.id;
+ }
+ return undefined;
+ });
+ const connectors: AIConnector[] = [defaultConnector, connector2];
+ const result = getDefaultConnector(connectors, settings);
+ expect(result).toBe(defaultConnector);
+ });
+
+ it('should return the default connector if there are multiple connectors and default connector is defined but they are in a different order', () => {
+ clientGet.mockImplementation((key: string) => {
+ if (key === GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR) {
+ return defaultConnector.id;
+ }
+ return undefined;
+ });
+ const connectors: AIConnector[] = [connector2, defaultConnector];
+ const result = getDefaultConnector(connectors, settings);
+ expect(result).toBe(defaultConnector);
+ });
+
+ it('should return the first connector if there are multiple connectors and no default connector is defined', () => {
+ clientGet.mockImplementation(() => {
+ return undefined;
+ });
+
+ const connectors: AIConnector[] = [connector2, defaultConnector];
+ const result = getDefaultConnector(connectors, settings);
+ expect(result).toBe(connectors[0]);
+ });
+
+ it('should return the first connector if there are multiple connectors and a default connector is defined but it does not exist', () => {
+ clientGet.mockImplementation((key: string) => {
+ if (key === GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR) {
+ return 'randomConnectorIdThatDoesNotExist';
+ }
+ return undefined;
+ });
+
+ const connectors: AIConnector[] = [connector2, defaultConnector];
+ const result = getDefaultConnector(connectors, settings);
expect(result).toBe(connectors[0]);
});
});
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.ts
index 7c4aa0482c052..6e29addf4d1e9 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.ts
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.ts
@@ -6,10 +6,12 @@
*/
import { isEmpty, some } from 'lodash';
-import { AIConnector } from '../connectorland/connector_selector';
-import { FetchConnectorExecuteResponse, FetchConversationsResponse } from './api';
-import { Conversation } from '../..';
+import type { SettingsStart } from '@kbn/core-ui-settings-browser';
+import { GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR } from '@kbn/management-settings-ids';
+import type { AIConnector } from '../connectorland/connector_selector';
+import type { FetchConnectorExecuteResponse, FetchConversationsResponse } from './api';
import type { ClientMessage } from '../assistant_context/types';
+import { Conversation } from '../..';
export const getMessageFromRawResponse = (
rawResponse: FetchConnectorExecuteResponse
@@ -59,13 +61,30 @@ export const mergeBaseWithPersistedConversations = (
* @param connectors
*/
export const getDefaultConnector = (
- connectors: AIConnector[] | undefined
+ connectors: AIConnector[] | undefined,
+ settings: SettingsStart
): AIConnector | undefined => {
+ const defaultAiConnectorId = settings.client.get(
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR,
+ undefined
+ );
+
const validConnectors = connectors?.filter((connector) => !connector.isMissingSecrets);
+ const defaultConnector = validConnectors?.find(
+ (connector) => connector.id === defaultAiConnectorId
+ );
+
+ if (defaultConnector) {
+ // If the user has set a default connector setting, and that connector exists, use it
+ return defaultConnector;
+ }
+
if (validConnectors?.length) {
+ // In case the default connector is not set or is invalid, return the first valid connector
return validConnectors[0];
}
+ // If no valid connectors are available, return undefined
return undefined;
};
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/index.tsx
index 76c4aa8cbb226..be95deba8a8be 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/index.tsx
@@ -101,6 +101,7 @@ const AssistantComponent: React.FC = ({
showAnonymizedValues,
setContentReferencesVisible,
setShowAnonymizedValues,
+ settings,
} = useAssistantContext();
const [selectedPromptContexts, setSelectedPromptContexts] = useState<
@@ -131,8 +132,12 @@ const AssistantComponent: React.FC = ({
// Connector details
const { data: connectors, isFetchedAfterMount: isFetchedConnectors } = useLoadConnectors({
http,
+ settings,
});
- const defaultConnector = useMemo(() => getDefaultConnector(connectors), [connectors]);
+ const defaultConnector = useMemo(
+ () => getDefaultConnector(connectors, settings),
+ [connectors, settings]
+ );
const {
currentConversation,
currentSystemPrompt,
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx
index 04c5818118728..0fa682cd2939b 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx
@@ -75,7 +75,8 @@ export const AssistantSettings: React.FC = React.memo(
conversations,
conversationsLoaded,
}) => {
- const { http, toasts, selectedSettingsTab, setSelectedSettingsTab } = useAssistantContext();
+ const { http, toasts, selectedSettingsTab, setSelectedSettingsTab, settings,
+ } = useAssistantContext();
useEffect(() => {
if (selectedSettingsTab == null) {
@@ -89,6 +90,7 @@ export const AssistantSettings: React.FC = React.memo(
const { data: connectors } = useLoadConnectors({
http,
+ settings,
});
const {
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx
index ee75732165423..958a0d818e388 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx
@@ -27,6 +27,10 @@ import {
import { mockSystemPrompts } from '../../mock/system_prompt';
import { DataViewsContract } from '@kbn/data-views-plugin/public';
import { SettingsStart } from '@kbn/core-ui-settings-browser';
+import {
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR,
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY,
+} from '@kbn/management-settings-ids';
const mockConversations = {
[alertConvo.title]: alertConvo,
@@ -50,6 +54,20 @@ const mockContext = {
assistantAvailability: {
isAssistantEnabled: true,
},
+ settings: {
+ client: {
+ get: jest.fn((key) => {
+ if (key === GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR) {
+ return 'c5f91dc0-2197-11ee-aded-897192c5d6f5';
+ }
+ if (key === GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY) {
+ return false;
+ }
+ return undefined;
+ }),
+ },
+ },
+ navigateToApp: jest.fn(),
};
const mockDataViews = {
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.tsx
index bc4245df88387..e8ef89eac7fa9 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.tsx
@@ -60,8 +60,12 @@ export const AssistantSettingsManagement: React.FC = React.memo(
} = useAssistantContext();
const { data: connectors } = useLoadConnectors({
http,
+ settings,
});
- const defaultConnector = useMemo(() => getDefaultConnector(connectors), [connectors]);
+ const defaultConnector = useMemo(
+ () => getDefaultConnector(connectors, settings),
+ [connectors, settings]
+ );
const { euiTheme } = useEuiTheme();
const headerIconShadow = useEuiShadow('s');
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx
index 5e15dfcd4c8c4..2789a4c055512 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/evaluation_settings/evaluation_settings.tsx
@@ -49,8 +49,9 @@ const AS_PLAIN_TEXT: EuiComboBoxSingleSelectionShape = { asPlainText: true };
* Evaluation Settings -- development-only feature for evaluating models
*/
export const EvaluationSettings: React.FC = React.memo(() => {
- const { actionTypeRegistry, http, setTraceOptions, toasts, traceOptions } = useAssistantContext();
- const { data: connectors } = useLoadConnectors({ http, inferenceEnabled: true });
+ const { actionTypeRegistry, http, setTraceOptions, toasts, traceOptions, settings } =
+ useAssistantContext();
+ const { data: connectors } = useLoadConnectors({ http, inferenceEnabled: true, settings });
const { mutate: performEvaluation, isLoading: isPerformingEvaluation } = usePerformEvaluation({
http,
toasts,
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx
index 22838f307c491..d351660ba4cf9 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant_context/index.tsx
@@ -17,6 +17,7 @@ import { AssistantFeatures, defaultAssistantFeatures } from '@kbn/elastic-assist
import { ApplicationStart, ChromeStart, UserProfileService } from '@kbn/core/public';
import type { ProductDocBasePluginStart } from '@kbn/product-doc-base-plugin/public';
import { useQuery } from '@tanstack/react-query';
+import type { SettingsStart } from '@kbn/core-ui-settings-browser';
import { updatePromptContexts } from './helpers';
import type {
PromptContext,
@@ -83,6 +84,7 @@ export interface AssistantProviderProps {
nameSpace?: string;
navigateToApp: ApplicationStart['navigateToApp'];
title?: string;
+ settings: SettingsStart;
toasts?: IToasts;
currentAppId: string;
productDocBase: ProductDocBasePluginStart;
@@ -124,6 +126,7 @@ export interface UseAssistantContext {
selectedSettingsTab: SettingsTabs | null;
contentReferencesVisible: boolean;
showAnonymizedValues: boolean;
+ settings: SettingsStart;
setShowAnonymizedValues: React.Dispatch>;
setContentReferencesVisible: React.Dispatch>;
setAssistantStreamingEnabled: React.Dispatch>;
@@ -156,6 +159,7 @@ export const AssistantProvider: React.FC = ({
alertsIndexPattern,
assistantAvailability,
assistantTelemetry,
+ settings,
augmentMessageCodeBlocks,
docLinks,
basePath,
@@ -318,6 +322,7 @@ export const AssistantProvider: React.FC = ({
getComments,
getUrlForApp,
http,
+ settings,
inferenceEnabled,
knowledgeBase: {
...DEFAULT_KNOWLEDGE_BASE_SETTINGS,
@@ -331,6 +336,7 @@ export const AssistantProvider: React.FC = ({
selectedSettingsTab,
// can be undefined from localStorage, if not defined, default to true
assistantStreamingEnabled: localStorageStreaming ?? true,
+
setAssistantStreamingEnabled: setLocalStorageStreaming,
setKnowledgeBase: setLocalStorageKnowledgeBase,
contentReferencesVisible: contentReferencesVisible ?? true,
@@ -368,6 +374,7 @@ export const AssistantProvider: React.FC = ({
basePromptContexts,
currentUserAvatar,
docLinks,
+ settings,
getComments,
getUrlForApp,
http,
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_selector/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_selector/index.tsx
index a0fd1e070d724..26a0bff4db2ef 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_selector/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_selector/index.tsx
@@ -15,6 +15,7 @@ import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/c
import { euiThemeVars } from '@kbn/ui-theme';
import { some } from 'lodash';
import type { AttackDiscoveryStats } from '@kbn/elastic-assistant-common';
+import { GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR } from '@kbn/management-settings-ids';
import { AttackDiscoveryStatusIndicator } from './attack_discovery_status_indicator';
import { useLoadConnectors } from '../use_load_connectors';
import * as i18n from '../translations';
@@ -57,7 +58,7 @@ export const ConnectorSelector: React.FC = React.memo(
setIsOpen,
stats = null,
}) => {
- const { actionTypeRegistry, http, assistantAvailability, inferenceEnabled } =
+ const { actionTypeRegistry, http, assistantAvailability, inferenceEnabled, settings } =
useAssistantContext();
// Connector Modal State
const [isConnectorModalVisible, setIsConnectorModalVisible] = useState(false);
@@ -68,6 +69,7 @@ export const ConnectorSelector: React.FC = React.memo(
const { data: aiConnectors, refetch: refetchConnectors } = useLoadConnectors({
http,
inferenceEnabled,
+ settings,
});
const localIsDisabled = isDisabled || !assistantAvailability.hasConnectorsReadPrivilege;
@@ -185,6 +187,11 @@ export const ConnectorSelector: React.FC = React.memo(
[cleanupAndCloseModal, onConnectorSelectionChange, refetchConnectors]
);
+ const defaultAIConnectorId = settings.client.get(
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR,
+ undefined
+ );
+
return (
<>
{!connectorExists && !connectorOptions.length ? (
@@ -208,7 +215,7 @@ export const ConnectorSelector: React.FC = React.memo(
isOpen={modalForceOpen}
onChange={onChange}
options={allConnectorOptions}
- valueOfSelected={selectedConnectorId}
+ valueOfSelected={selectedConnectorId ?? defaultAIConnectorId}
placeholder={i18n.INLINE_CONNECTOR_PLACEHOLDER}
popoverProps={{ panelMinWidth: 400, anchorPosition: 'downRight' }}
/>
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_setup/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_setup/index.tsx
index bde72752cc903..2e09b872fe8d4 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_setup/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/connector_setup/index.tsx
@@ -35,9 +35,9 @@ export const ConnectorSetup = ({
);
const { setApiConfig } = useConversation();
// Access all conversations so we can add connector to all on initial setup
- const { actionTypeRegistry, http, inferenceEnabled } = useAssistantContext();
+ const { actionTypeRegistry, http, inferenceEnabled, settings } = useAssistantContext();
- const { refetch: refetchConnectors } = useLoadConnectors({ http, inferenceEnabled });
+ const { refetch: refetchConnectors } = useLoadConnectors({ http, inferenceEnabled, settings });
const { data: actionTypes } = useLoadActionTypes({ http });
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.test.tsx
index e1c7fa93116c5..3dc937aeaa6fa 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.test.tsx
@@ -9,6 +9,10 @@ import { waitFor, renderHook } from '@testing-library/react';
import { useLoadConnectors, Props } from '.';
import { mockConnectors } from '../../mock/connectors';
import { TestProviders } from '../../mock/test_providers/test_providers';
+import {
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR,
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY,
+} from '@kbn/management-settings-ids';
const mockConnectorsAndExtras = [
...mockConnectors,
@@ -52,7 +56,19 @@ const http = {
const toasts = {
addError: jest.fn(),
};
-const defaultProps = { http, toasts } as unknown as Props;
+const settings = {
+ client: {
+ get: jest.fn().mockImplementation((settingKey) => {
+ if (settingKey === GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR) {
+ return undefined;
+ }
+ if (settingKey === GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY) {
+ return false;
+ }
+ }),
+ },
+};
+const defaultProps = { http, toasts, settings } as unknown as Props;
describe('useLoadConnectors', () => {
beforeEach(() => {
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.tsx
index 078a5c483d3e4..f0d19a4fd9b08 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/connectorland/use_load_connectors/index.tsx
@@ -9,11 +9,15 @@ import type { UseQueryResult } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import type { ServerError } from '@kbn/cases-plugin/public/types';
import { loadAllActions as loadConnectors } from '@kbn/triggers-actions-ui-plugin/public/common/constants';
-import type { IHttpFetchError } from '@kbn/core-http-browser';
-import { HttpSetup } from '@kbn/core-http-browser';
-import { IToasts } from '@kbn/core-notifications-browser';
-import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
-import { AIConnector } from '../connector_selector';
+import type { IHttpFetchError, HttpSetup } from '@kbn/core-http-browser';
+import type { IToasts } from '@kbn/core-notifications-browser';
+import type { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants';
+import type { SettingsStart } from '@kbn/core-ui-settings-browser';
+import {
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR,
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY,
+} from '@kbn/management-settings-ids';
+import type { AIConnector } from '../connector_selector';
import * as i18n from '../translations';
/**
@@ -26,6 +30,7 @@ export interface Props {
http: HttpSetup;
toasts?: IToasts;
inferenceEnabled?: boolean;
+ settings: SettingsStart;
}
const actionTypes = ['.bedrock', '.gen-ai', '.gemini'];
@@ -34,6 +39,7 @@ export const useLoadConnectors = ({
http,
toasts,
inferenceEnabled = false,
+ settings,
}: Props): UseQueryResult => {
useEffect(() => {
if (inferenceEnabled && !actionTypes.includes('.inference')) {
@@ -41,13 +47,20 @@ export const useLoadConnectors = ({
}
}, [inferenceEnabled]);
+ const defaultAiConnectorId = settings.client.get(GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR);
+ const defaultAiConnectorOnly = settings.client.get(
+ GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY,
+ false
+ );
+
return useQuery(
QUERY_KEY,
async () => {
const connectors = await loadConnectors({ http });
- return connectors.reduce((acc: AIConnector[], connector) => {
+
+ const allAiConnectors = connectors.flatMap((connector) => {
if (!connector.isMissingSecrets && actionTypes.includes(connector.actionTypeId)) {
- acc.push({
+ const aiConnector: AIConnector = {
...connector,
apiProvider:
!connector.isPreconfigured &&
@@ -55,10 +68,23 @@ export const useLoadConnectors = ({
connector?.config?.apiProvider
? (connector?.config?.apiProvider as OpenAiProviderType)
: undefined,
- });
+ };
+ return [aiConnector];
}
- return acc;
- }, []);
+ return [];
+ });
+
+ const availableConnectors = allAiConnectors.filter((connector) => {
+ if (defaultAiConnectorOnly) {
+ return connector.id === defaultAiConnectorId;
+ }
+ return true;
+ });
+
+ if (availableConnectors.length === 0) {
+ return allAiConnectors;
+ }
+ return availableConnectors;
},
{
retry: false,
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx
index 9fbd3677d034d..0dd2f24b1071b 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx
@@ -17,8 +17,10 @@ import { UserProfileService } from '@kbn/core/public';
import { chromeServiceMock } from '@kbn/core-chrome-browser-mocks';
import { of } from 'rxjs';
import { docLinksServiceMock } from '@kbn/core/public/mocks';
-import { AssistantProvider, AssistantProviderProps } from '../../assistant_context';
-import { AssistantAvailability } from '../../assistant_context/types';
+import type { SettingsStart } from '@kbn/core-ui-settings-browser';
+import type { AssistantProviderProps } from '../../assistant_context';
+import { AssistantProvider } from '../../assistant_context';
+import type { AssistantAvailability } from '../../assistant_context/types';
interface Props {
assistantAvailability?: AssistantAvailability;
@@ -64,7 +66,7 @@ export const TestProvidersComponent: React.FC = ({
logger: {
log: console.log,
warn: console.warn,
- error: () => {},
+ error: () => { },
},
});
@@ -86,6 +88,11 @@ export const TestProvidersComponent: React.FC = ({
http={mockHttp}
baseConversations={{}}
navigateToApp={mockNavigateToApp}
+ settings={{
+ client: {
+ get: jest.fn(),
+ },
+ } as unknown as SettingsStart}
{...providerContext}
currentAppId={'test'}
productDocBase={{
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/tour/elastic_llm/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/tour/elastic_llm/index.tsx
index bdf42647e7b68..b40bc9ce41864 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/tour/elastic_llm/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/tour/elastic_llm/index.tsx
@@ -41,7 +41,7 @@ const ElasticLLMCostAwarenessTourComponent: React.FC = ({
zIndex,
wrapper = true, // Whether to wrap the children in a div with padding
}) => {
- const { http, inferenceEnabled } = useAssistantContext();
+ const { http, inferenceEnabled, settings } = useAssistantContext();
const { euiTheme } = useEuiTheme();
const tourStorageKey = useTourStorageKey(storageKey);
const [tourState, setTourState] = useLocalStorage(
@@ -72,6 +72,7 @@ const ElasticLLMCostAwarenessTourComponent: React.FC = ({
const { data: aiConnectors } = useLoadConnectors({
http,
inferenceEnabled,
+ settings,
});
const isElasticLLMConnectorSelected = useMemo(
() =>
diff --git a/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/steps/connector_step/connector_step.tsx b/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/steps/connector_step/connector_step.tsx
index 3c87e0aab7b36..e2abfe39cbad8 100644
--- a/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/steps/connector_step/connector_step.tsx
+++ b/x-pack/platform/plugins/shared/integration_assistant/public/components/create_integration/create_integration_assistant/steps/connector_step/connector_step.tsx
@@ -87,7 +87,7 @@ interface ConnectorStepProps {
export const ConnectorStep = React.memo(({ connector }) => {
const { euiTheme } = useEuiTheme();
- const { http, notifications, triggersActionsUi } = useKibana().services;
+ const { http, notifications, triggersActionsUi, settings } = useKibana().services;
const { setConnector, completeStep } = useActions();
const [connectors, setConnectors] = useState();
@@ -103,7 +103,7 @@ export const ConnectorStep = React.memo(({ connector }) => {
isLoading,
data: aiConnectors,
refetch: refetchConnectors,
- } = useLoadConnectors({ http, toasts: notifications.toasts, inferenceEnabled });
+ } = useLoadConnectors({ http, toasts: notifications.toasts, inferenceEnabled, settings });
useEffect(() => {
if (aiConnectors != null) {
diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx
index c40f40288d0b6..c6af23f5143da 100644
--- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx
+++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx
@@ -20,7 +20,8 @@ import { I18nProvider } from '@kbn/i18n-react';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { EuiThemeProvider } from '@elastic/eui';
-import { DataQualityProvider, DataQualityProviderProps } from '../../data_quality_context';
+import type { DataQualityProviderProps } from '../../data_quality_context';
+import { DataQualityProvider } from '../../data_quality_context';
import { ResultsRollupContext } from '../../contexts/results_rollup_context';
import { IndicesCheckContext } from '../../contexts/indices_check_context';
import { UseIndicesCheckReturnValue } from '../../hooks/use_indices_check/types';
@@ -34,6 +35,7 @@ import {
FetchHistoricalResultsReducerState,
UseHistoricalResultsReturnValue,
} from '../../data_quality_details/indices_details/pattern/hooks/use_historical_results/types';
+import { SettingsStart } from '@kbn/core/packages/ui-settings/browser';
interface TestExternalProvidersProps {
children: React.ReactNode;
@@ -64,7 +66,7 @@ const TestExternalProvidersComponent: React.FC = ({
logger: {
log: jest.fn(),
warn: jest.fn(),
- error: () => {},
+ error: () => { },
},
});
@@ -89,6 +91,11 @@ const TestExternalProvidersComponent: React.FC = ({
productDocBase={{
installation: { getStatus: jest.fn(), install: jest.fn(), uninstall: jest.fn() },
}}
+ settings={{
+ client: {
+ get: jest.fn(),
+ },
+ } as unknown as SettingsStart}
currentAppId={'securitySolutionUI'}
userProfileService={jest.fn() as unknown as UserProfileService}
getUrlForApp={jest.fn()}
diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
index 8334bc4449955..c9574559abb45 100644
--- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
+++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
@@ -24,6 +24,7 @@
"@kbn/core-notifications-browser-mocks",
"@kbn/core-chrome-browser-mocks",
"@kbn/ai-assistant-icon",
- "@kbn/react-kibana-context-render"
+ "@kbn/react-kibana-context-render",
+ "@kbn/core-ui-settings-browser"
]
}
diff --git a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx
index d9fa0b8ae607c..886903896a316 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx
@@ -49,12 +49,13 @@ export const ID = 'attackDiscoveryQuery';
const AttackDiscoveryPageComponent: React.FC = () => {
const {
- services: { uiSettings },
+ services: { uiSettings, settings },
} = useKibana();
const { http } = useAssistantContext();
const { data: aiConnectors } = useLoadConnectors({
http,
+ settings,
});
// for showing / hiding anonymized data:
diff --git a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/use_attack_discovery/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/use_attack_discovery/index.tsx
index 9cc7b7c475c09..5472ea1e3e954 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/use_attack_discovery/index.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/use_attack_discovery/index.tsx
@@ -59,9 +59,12 @@ export const useAttackDiscovery = ({
const {
http,
notifications: { toasts },
+ settings,
} = useKibana().services;
+
const { data: aiConnectors } = useLoadConnectors({
http,
+ settings,
});
// generation can take a long time, so we calculate an approximate future time:
diff --git a/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx b/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx
index 42f785e64d7e9..6841ea02294bf 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx
@@ -15,6 +15,7 @@ import { chromeServiceMock } from '@kbn/core-chrome-browser-mocks';
import { of } from 'rxjs';
import { docLinksServiceMock } from '@kbn/core/public/mocks';
import { BASE_SECURITY_CONVERSATIONS } from '../../assistant/content/conversations';
+import type { SettingsStart } from '@kbn/core-ui-settings-browser';
interface Props {
assistantAvailability?: AssistantAvailability;
@@ -65,6 +66,11 @@ export const MockAssistantProviderComponent: React.FC = ({
}}
userProfileService={mockUserProfileService}
chrome={chrome}
+ settings={{
+ client: {
+ get: jest.fn(),
+ },
+ } as unknown as SettingsStart}
>
{children}
diff --git a/x-pack/solutions/security/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/insights/workflow_insights_scan.tsx b/x-pack/solutions/security/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/insights/workflow_insights_scan.tsx
index 95beeb5699cd0..7387d794a9af9 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/insights/workflow_insights_scan.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/insights/workflow_insights_scan.tsx
@@ -40,9 +40,10 @@ export const WorkflowInsightsScanSection = ({
const CONNECTOR_ID_LOCAL_STORAGE_KEY = 'connectorId';
const spaceId = useSpaceId() ?? 'default';
- const { http } = useKibana().services;
+ const { http, settings } = useKibana().services;
const { data: aiConnectors } = useLoadConnectors({
http,
+ settings,
});
const { canWriteWorkflowInsights } = useUserPrivileges().endpointPrivileges;
diff --git a/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx b/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx
index 5b13f9b58b540..54cd594a420b5 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx
@@ -59,16 +59,21 @@ export const AssistantCard: OnboardingCardComponent = ({
const [selectedConnectorId, setSelectedConnectorId] = useStoredAssistantConnectorId(spaceId);
- const defaultConnector = useMemo(() => getDefaultConnector(connectors), [connectors]);
-
- const { setApiConfig } = useConversation();
-
const {
http,
assistantAvailability: { isAssistantEnabled },
baseConversations,
getLastConversationId,
+ settings
} = useAssistantContext();
+
+ const defaultConnector = useMemo(
+ () => getDefaultConnector(connectors, settings),
+ [connectors, settings]
+ );
+
+ const { setApiConfig } = useConversation();
+
const {
allSystemPrompts,
conversations,
From 1cb0ce6dc84fcfa80e34a31153e48d6d8115c719 Mon Sep 17 00:00:00 2001
From: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date: Thu, 25 Sep 2025 15:31:33 +0000
Subject: [PATCH 02/11] [CI] Auto-commit changed files from 'node
scripts/lint_ts_projects --fix'
---
.../security/packages/ecs-data-quality-dashboard/tsconfig.json | 1 -
.../solutions/security/plugins/security_solution/tsconfig.json | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
index c9574559abb45..9110637a74ab3 100644
--- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
+++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
@@ -25,6 +25,5 @@
"@kbn/core-chrome-browser-mocks",
"@kbn/ai-assistant-icon",
"@kbn/react-kibana-context-render",
- "@kbn/core-ui-settings-browser"
]
}
diff --git a/x-pack/solutions/security/plugins/security_solution/tsconfig.json b/x-pack/solutions/security/plugins/security_solution/tsconfig.json
index 0cc9998fbc14e..3191bec1e33f9 100644
--- a/x-pack/solutions/security/plugins/security_solution/tsconfig.json
+++ b/x-pack/solutions/security/plugins/security_solution/tsconfig.json
@@ -242,5 +242,6 @@
"@kbn/inference-endpoint-ui-common",
"@kbn/core-metrics-server",
"@kbn/ai-assistant-default-llm-setting",
+ "@kbn/core-ui-settings-browser",
]
}
From 41390684ad6d600919968c390e02950f4b9544f4 Mon Sep 17 00:00:00 2001
From: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date: Thu, 25 Sep 2025 16:33:08 +0000
Subject: [PATCH 03/11] [CI] Auto-commit changed files from 'node
scripts/eslint_all_files --no-cache --fix'
---
.../conversation_settings_editor.tsx | 2 +-
.../impl/assistant/helpers.test.ts | 6 +++++-
.../assistant/settings/assistant_settings.tsx | 4 ++--
.../impl/mock/test_providers/test_providers.tsx | 14 ++++++++------
.../mock/test_providers/test_providers.tsx | 16 +++++++++-------
.../common/mock/mock_assistant_provider.tsx | 14 ++++++++------
.../cards/assistant/assistant_card.tsx | 2 +-
7 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
index f8da56c815292..c63284f6722af 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
@@ -11,9 +11,9 @@ import React, { useCallback, useMemo } from 'react';
import { HttpSetup } from '@kbn/core-http-browser';
import { FormattedMessage } from '@kbn/i18n-react';
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/public/common';
-import { Conversation } from '../../../..';
import { noop } from 'lodash/fp';
import type { PromptResponse } from '@kbn/elastic-assistant-common';
+import { Conversation } from '../../../..';
import { useAssistantContext } from '../../../..';
import * as i18n from './translations';
import * as i18nModel from '../../../connectorland/models/model_selector/translations';
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts
index 188b4bf14d05c..e03081f4aefb7 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/helpers.test.ts
@@ -5,7 +5,11 @@
* 2.0.
*/
-import { getDefaultConnector, getOptionalRequestParams, mergeBaseWithPersistedConversations } from './helpers';
+import {
+ getDefaultConnector,
+ getOptionalRequestParams,
+ mergeBaseWithPersistedConversations,
+} from './helpers';
import type { AIConnector } from '../connectorland/connector_selector';
import type { SettingsStart } from '@kbn/core-ui-settings-browser';
import { GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR } from '@kbn/management-settings-ids';
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx
index 0fa682cd2939b..baf8c559b44ba 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx
@@ -75,8 +75,8 @@ export const AssistantSettings: React.FC = React.memo(
conversations,
conversationsLoaded,
}) => {
- const { http, toasts, selectedSettingsTab, setSelectedSettingsTab, settings,
- } = useAssistantContext();
+ const { http, toasts, selectedSettingsTab, setSelectedSettingsTab, settings } =
+ useAssistantContext();
useEffect(() => {
if (selectedSettingsTab == null) {
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx
index 0dd2f24b1071b..4a716d1a166ba 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/mock/test_providers/test_providers.tsx
@@ -66,7 +66,7 @@ export const TestProvidersComponent: React.FC = ({
logger: {
log: console.log,
warn: console.warn,
- error: () => { },
+ error: () => {},
},
});
@@ -88,11 +88,13 @@ export const TestProvidersComponent: React.FC = ({
http={mockHttp}
baseConversations={{}}
navigateToApp={mockNavigateToApp}
- settings={{
- client: {
- get: jest.fn(),
- },
- } as unknown as SettingsStart}
+ settings={
+ {
+ client: {
+ get: jest.fn(),
+ },
+ } as unknown as SettingsStart
+ }
{...providerContext}
currentAppId={'test'}
productDocBase={{
diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx
index c6af23f5143da..077683dc3cd0b 100644
--- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx
+++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/mock/test_providers/test_providers.tsx
@@ -20,6 +20,7 @@ import { I18nProvider } from '@kbn/i18n-react';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { EuiThemeProvider } from '@elastic/eui';
+import { SettingsStart } from '@kbn/core-ui-settings-browser';
import type { DataQualityProviderProps } from '../../data_quality_context';
import { DataQualityProvider } from '../../data_quality_context';
import { ResultsRollupContext } from '../../contexts/results_rollup_context';
@@ -35,7 +36,6 @@ import {
FetchHistoricalResultsReducerState,
UseHistoricalResultsReturnValue,
} from '../../data_quality_details/indices_details/pattern/hooks/use_historical_results/types';
-import { SettingsStart } from '@kbn/core/packages/ui-settings/browser';
interface TestExternalProvidersProps {
children: React.ReactNode;
@@ -66,7 +66,7 @@ const TestExternalProvidersComponent: React.FC = ({
logger: {
log: jest.fn(),
warn: jest.fn(),
- error: () => { },
+ error: () => {},
},
});
@@ -91,11 +91,13 @@ const TestExternalProvidersComponent: React.FC = ({
productDocBase={{
installation: { getStatus: jest.fn(), install: jest.fn(), uninstall: jest.fn() },
}}
- settings={{
- client: {
- get: jest.fn(),
- },
- } as unknown as SettingsStart}
+ settings={
+ {
+ client: {
+ get: jest.fn(),
+ },
+ } as unknown as SettingsStart
+ }
currentAppId={'securitySolutionUI'}
userProfileService={jest.fn() as unknown as UserProfileService}
getUrlForApp={jest.fn()}
diff --git a/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx b/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx
index 6841ea02294bf..1413594e4df5f 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/common/mock/mock_assistant_provider.tsx
@@ -14,8 +14,8 @@ import type { UserProfileService } from '@kbn/core/public';
import { chromeServiceMock } from '@kbn/core-chrome-browser-mocks';
import { of } from 'rxjs';
import { docLinksServiceMock } from '@kbn/core/public/mocks';
-import { BASE_SECURITY_CONVERSATIONS } from '../../assistant/content/conversations';
import type { SettingsStart } from '@kbn/core-ui-settings-browser';
+import { BASE_SECURITY_CONVERSATIONS } from '../../assistant/content/conversations';
interface Props {
assistantAvailability?: AssistantAvailability;
@@ -66,11 +66,13 @@ export const MockAssistantProviderComponent: React.FC = ({
}}
userProfileService={mockUserProfileService}
chrome={chrome}
- settings={{
- client: {
- get: jest.fn(),
- },
- } as unknown as SettingsStart}
+ settings={
+ {
+ client: {
+ get: jest.fn(),
+ },
+ } as unknown as SettingsStart
+ }
>
{children}
diff --git a/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx b/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx
index 54cd594a420b5..e8ba115b7e810 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/cards/assistant/assistant_card.tsx
@@ -64,7 +64,7 @@ export const AssistantCard: OnboardingCardComponent = ({
assistantAvailability: { isAssistantEnabled },
baseConversations,
getLastConversationId,
- settings
+ settings,
} = useAssistantContext();
const defaultConnector = useMemo(
From bf76d611d4bdc508db08c711dbb97709fb1f1592 Mon Sep 17 00:00:00 2001
From: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date: Thu, 25 Sep 2025 16:47:54 +0000
Subject: [PATCH 04/11] [CI] Auto-commit changed files from 'node
scripts/styled_components_mapping'
---
.../security/packages/ecs-data-quality-dashboard/tsconfig.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
index 9110637a74ab3..c85c07f8e33d3 100644
--- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
+++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/tsconfig.json
@@ -25,5 +25,6 @@
"@kbn/core-chrome-browser-mocks",
"@kbn/ai-assistant-icon",
"@kbn/react-kibana-context-render",
+ "@kbn/core-ui-settings-browser",
]
}
From d27b2a916cb57f70e65d67d0bfd8af8e2925e528 Mon Sep 17 00:00:00 2001
From: Kenneth Kreindler
Date: Thu, 25 Sep 2025 22:22:06 +0100
Subject: [PATCH 05/11] test
---
.../conversation_settings/conversation_settings_editor.tsx | 3 +--
.../impl/assistant/use_assistant_overlay/index.test.tsx | 5 +++++
.../impl/assistant/use_assistant_overlay/index.tsx | 5 +++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
index c63284f6722af..abcaaef48c5f3 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/conversation_settings/conversation_settings_editor.tsx
@@ -13,8 +13,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/public/common';
import { noop } from 'lodash/fp';
import type { PromptResponse } from '@kbn/elastic-assistant-common';
-import { Conversation } from '../../../..';
-import { useAssistantContext } from '../../../..';
+import { Conversation, useAssistantContext } from '../../../..';
import * as i18n from './translations';
import * as i18nModel from '../../../connectorland/models/model_selector/translations';
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx
index 7a142710d19ec..f604cdf9e625f 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx
@@ -17,6 +17,11 @@ const mockUseAssistantContext = {
registerPromptContext: jest.fn(),
showAssistantOverlay: jest.fn(),
unRegisterPromptContext: jest.fn(),
+ settings: {
+ client: {
+ get: jest.fn(),
+ },
+ }
};
jest.mock('../../assistant_context', () => {
const original = jest.requireActual('../../assistant_context');
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
index ec93829ac6727..5842852bcfb6e 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
@@ -82,13 +82,14 @@ export const useAssistantOverlay = (
*/
replacements?: Replacements | null
): UseAssistantOverlay => {
- const { http, inferenceEnabled } = useAssistantContext();
+ const { http, inferenceEnabled, settings } = useAssistantContext();
const { data: connectors } = useLoadConnectors({
http,
inferenceEnabled,
+ settings
});
- const defaultConnector = useMemo(() => getDefaultConnector(connectors), [connectors]);
+ const defaultConnector = useMemo(() => getDefaultConnector(connectors, settings), [connectors]);
const apiConfig = useMemo(() => getGenAiConfig(defaultConnector), [defaultConnector]);
const { createConversation } = useConversation();
From 06b5e0fa7138b39630c11c68c0a3529f034ab51f Mon Sep 17 00:00:00 2001
From: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date: Thu, 25 Sep 2025 21:51:17 +0000
Subject: [PATCH 06/11] [CI] Auto-commit changed files from 'node
scripts/eslint_all_files --no-cache --fix'
---
.../impl/assistant/use_assistant_overlay/index.test.tsx | 2 +-
.../impl/assistant/use_assistant_overlay/index.tsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx
index f604cdf9e625f..0f4096494af4c 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.test.tsx
@@ -21,7 +21,7 @@ const mockUseAssistantContext = {
client: {
get: jest.fn(),
},
- }
+ },
};
jest.mock('../../assistant_context', () => {
const original = jest.requireActual('../../assistant_context');
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
index 5842852bcfb6e..f2337dde09c86 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
@@ -86,7 +86,7 @@ export const useAssistantOverlay = (
const { data: connectors } = useLoadConnectors({
http,
inferenceEnabled,
- settings
+ settings,
});
const defaultConnector = useMemo(() => getDefaultConnector(connectors, settings), [connectors]);
From 2f5812cc3f30f25d5571a6fa6f7a82bbaefb49b7 Mon Sep 17 00:00:00 2001
From: Kenneth Kreindler
Date: Fri, 26 Sep 2025 00:07:20 +0100
Subject: [PATCH 07/11] lint
---
.../impl/assistant/use_assistant_overlay/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
index f2337dde09c86..7142a650f3d4c 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
@@ -89,7 +89,7 @@ export const useAssistantOverlay = (
settings,
});
- const defaultConnector = useMemo(() => getDefaultConnector(connectors, settings), [connectors]);
+ const defaultConnector = useMemo(() => getDefaultConnector(connectors, settings), [connectors, settings]);
const apiConfig = useMemo(() => getGenAiConfig(defaultConnector), [defaultConnector]);
const { createConversation } = useConversation();
From 733a15584d022bccf7d24c85c926c3123193d66e Mon Sep 17 00:00:00 2001
From: Kenneth Kreindler
Date: Fri, 26 Sep 2025 08:23:05 +0100
Subject: [PATCH 08/11] lint
---
.../plugins/security_solution/public/assistant/provider.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/x-pack/solutions/security/plugins/security_solution/public/assistant/provider.tsx b/x-pack/solutions/security/plugins/security_solution/public/assistant/provider.tsx
index bd56466db5bdc..b58a7bfdca869 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/assistant/provider.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/assistant/provider.tsx
@@ -144,6 +144,7 @@ export const AssistantProvider: FC> = ({ children })
docLinks,
userProfile,
chrome,
+ settings,
productDocBase,
} = useKibana().services;
@@ -243,6 +244,7 @@ export const AssistantProvider: FC> = ({ children })
currentAppId={currentAppId ?? 'securitySolutionUI'}
userProfileService={userProfile}
chrome={chrome}
+ settings={settings}
>
{children}
From 0af5592875d54c4a81ad1bbc9467fdb6a2d09ceb Mon Sep 17 00:00:00 2001
From: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date: Fri, 26 Sep 2025 07:48:12 +0000
Subject: [PATCH 09/11] [CI] Auto-commit changed files from 'node
scripts/eslint_all_files --no-cache --fix'
---
.../impl/assistant/use_assistant_overlay/index.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
index 7142a650f3d4c..88ff000199daa 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/use_assistant_overlay/index.tsx
@@ -89,7 +89,10 @@ export const useAssistantOverlay = (
settings,
});
- const defaultConnector = useMemo(() => getDefaultConnector(connectors, settings), [connectors, settings]);
+ const defaultConnector = useMemo(
+ () => getDefaultConnector(connectors, settings),
+ [connectors, settings]
+ );
const apiConfig = useMemo(() => getGenAiConfig(defaultConnector), [defaultConnector]);
const { createConversation } = useConversation();
From 270d74b915b319f3c8b17c596a7f941218a250d7 Mon Sep 17 00:00:00 2001
From: Kenneth Kreindler
Date: Fri, 26 Sep 2025 11:18:32 +0100
Subject: [PATCH 10/11] test
---
.../settings/assistant_settings_management.test.tsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx
index 958a0d818e388..9ad874693fbf2 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_management.test.tsx
@@ -80,7 +80,11 @@ const testProps = {
dataViews: mockDataViews,
onTabChange,
currentTab: CONNECTORS_TAB,
- settings: {} as SettingsStart,
+ settings: {
+ client: {
+ get: jest.fn(),
+ },
+ } as unknown as SettingsStart,
};
jest.mock('../../assistant_context');
From 075d522623a188e9f59ba4a0b2f7b8d5acb79b52 Mon Sep 17 00:00:00 2001
From: Kenneth Kreindler
Date: Fri, 26 Sep 2025 13:55:20 +0100
Subject: [PATCH 11/11] test
---
.../settings/assistant_settings.test.tsx | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.test.tsx
index 1837d40aae2b1..05d9045b76dd2 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.test.tsx
@@ -37,11 +37,27 @@ const setSelectedSettingsTab = jest.fn();
const mockContext = {
basePromptContexts: MOCK_QUICK_PROMPTS,
setSelectedSettingsTab,
- http: {},
+ http: {
+ get: jest.fn(),
+ },
selectedSettingsTab: 'CONVERSATIONS_TAB',
assistantAvailability: {
isAssistantEnabled: true,
},
+ settings: {
+ client: {
+ get: jest.fn((key) => {
+ if (key === 'genAiSettings:defaultAIConnector') {
+ return 'c5f91dc0-2197-11ee-aded-897192c5d6f5';
+ }
+ if (key === 'genAiSettings:defaultAIConnectorDefaultOnly') {
+ return false;
+ }
+ return undefined;
+ }),
+ },
+ },
+ assistantFeatures: { assistantModelEvaluation: true },
};
const onClose = jest.fn();
const onSave = jest.fn().mockResolvedValue(() => {});