mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[8.16] [Security solution] `assistantKnowledgeBaseByDefault` flag defaults to `true` (#198178) (#198458)
# Backport This will backport the following commits from `main` to `8.16`: - [[Security solution] `assistantKnowledgeBaseByDefault` flag defaults to `true` (#198178)](https://github.com/elastic/kibana/pull/198178) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2024-10-31T02:36:14Z","message":"[Security solution] `assistantKnowledgeBaseByDefault` flag defaults to `true` (#198178)","sha":"88225fff07c416a6939c415d8ac65e473a3ffd0e","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team: SecuritySolution","Team:Security Generative AI","v8.16.0","backport:version","v8.17.0"],"title":"[Security solution] `assistantKnowledgeBaseByDefault` flag defaults to `true`","number":198178,"url":"https://github.com/elastic/kibana/pull/198178","mergeCommit":{"message":"[Security solution] `assistantKnowledgeBaseByDefault` flag defaults to `true` (#198178)","sha":"88225fff07c416a6939c415d8ac65e473a3ffd0e"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198178","number":198178,"mergeCommit":{"message":"[Security solution] `assistantKnowledgeBaseByDefault` flag defaults to `true` (#198178)","sha":"88225fff07c416a6939c415d8ac65e473a3ffd0e"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
This commit is contained in:
parent
f02d1303b5
commit
6014038100
4 changed files with 3 additions and 82 deletions
|
@ -19,6 +19,6 @@ export type AssistantFeatureKey = keyof AssistantFeatures;
|
|||
* Default features available to the elastic assistant
|
||||
*/
|
||||
export const defaultAssistantFeatures = Object.freeze({
|
||||
assistantKnowledgeBaseByDefault: false,
|
||||
assistantKnowledgeBaseByDefault: true,
|
||||
assistantModelEvaluation: false,
|
||||
});
|
||||
|
|
|
@ -23,7 +23,6 @@ import { Conversation } from '../assistant_context/types';
|
|||
import * as all from './chat_send/use_chat_send';
|
||||
import { useConversation } from './use_conversation';
|
||||
import { AIConnector } from '../connectorland/connector_selector';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
jest.mock('../connectorland/use_load_connectors');
|
||||
jest.mock('../connectorland/connector_setup');
|
||||
|
@ -140,84 +139,6 @@ describe('Assistant', () => {
|
|||
});
|
||||
|
||||
describe('persistent storage', () => {
|
||||
it('should refetchCurrentUserConversations after settings save button click', async () => {
|
||||
const chatSendSpy = jest.spyOn(all, 'useChatSend');
|
||||
await renderAssistant();
|
||||
|
||||
fireEvent.click(screen.getByTestId('settings'));
|
||||
|
||||
jest.mocked(useFetchCurrentUserConversations).mockReturnValue({
|
||||
data: {
|
||||
...mockData,
|
||||
welcome_id: {
|
||||
...mockData.welcome_id,
|
||||
apiConfig: { newProp: true },
|
||||
},
|
||||
},
|
||||
isLoading: false,
|
||||
refetch: jest.fn().mockResolvedValue({
|
||||
isLoading: false,
|
||||
data: {
|
||||
...mockData,
|
||||
welcome_id: {
|
||||
...mockData.welcome_id,
|
||||
apiConfig: { newProp: true },
|
||||
},
|
||||
},
|
||||
}),
|
||||
isFetched: true,
|
||||
} as unknown as DefinedUseQueryResult<Record<string, Conversation>, unknown>);
|
||||
|
||||
await act(async () => {
|
||||
fireEvent.click(screen.getByTestId('save-button'));
|
||||
});
|
||||
|
||||
expect(chatSendSpy).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({
|
||||
currentConversation: {
|
||||
apiConfig: { newProp: true },
|
||||
category: 'assistant',
|
||||
id: mockData.welcome_id.id,
|
||||
messages: [],
|
||||
title: 'Welcome',
|
||||
replacements: {},
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('should refetchCurrentUserConversations after settings save button click, but do not update convos when refetch returns bad results', async () => {
|
||||
jest.mocked(useFetchCurrentUserConversations).mockReturnValue({
|
||||
data: mockData,
|
||||
isLoading: false,
|
||||
refetch: jest.fn().mockResolvedValue({
|
||||
isLoading: false,
|
||||
data: omit(mockData, 'welcome_id'),
|
||||
}),
|
||||
isFetched: true,
|
||||
} as unknown as DefinedUseQueryResult<Record<string, Conversation>, unknown>);
|
||||
const chatSendSpy = jest.spyOn(all, 'useChatSend');
|
||||
await renderAssistant();
|
||||
|
||||
fireEvent.click(screen.getByTestId('settings'));
|
||||
await act(async () => {
|
||||
fireEvent.click(screen.getByTestId('save-button'));
|
||||
});
|
||||
|
||||
expect(chatSendSpy).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({
|
||||
currentConversation: {
|
||||
apiConfig: { connectorId: '123' },
|
||||
replacements: {},
|
||||
category: 'assistant',
|
||||
id: mockData.welcome_id.id,
|
||||
messages: [],
|
||||
title: 'Welcome',
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('should delete conversation when delete button is clicked', async () => {
|
||||
await renderAssistant();
|
||||
const deleteButton = screen.getAllByTestId('delete-option')[0];
|
||||
|
|
|
@ -111,7 +111,7 @@ export const allowedExperimentalValues = Object.freeze({
|
|||
/**
|
||||
* Enables new Knowledge Base Entries features, introduced in `8.15.0`.
|
||||
*/
|
||||
assistantKnowledgeBaseByDefault: false,
|
||||
assistantKnowledgeBaseByDefault: true,
|
||||
|
||||
/**
|
||||
* Enables the Managed User section inside the new user details flyout.
|
||||
|
|
|
@ -32,7 +32,7 @@ export default ({ getService }: FtrProviderContext) => {
|
|||
const es = getService('es');
|
||||
const ml = getService('ml') as ReturnType<typeof MachineLearningProvider>;
|
||||
|
||||
describe('@ess Basic Security AI Assistant Knowledge Base Entries', () => {
|
||||
describe.skip('@ess Basic Security AI Assistant Knowledge Base Entries', () => {
|
||||
before(async () => {
|
||||
await installTinyElser(ml);
|
||||
await setupKnowledgeBase(supertest, log);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue