forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] [AI Assistant] Update copy of the citations tour. (…
…elastic#210398) ## Summary Addresses elastic/security-docs#6485 (comment) This PR updates the copy in the Citations and Anonymized values tour according to the figma linked in the issue. Furthermore, the PR includes the logic that disables the "Show anonymized values" and "Show citations" buttons in the assistant settings menu when the conversation does not contain anonymized values or citations respectivly. ### How to test new copy is correct <img width="864" alt="image" src="https://github.com/user-attachments/assets/22bd2671-6d06-4e68-85f5-3c10d9974a4a" /> - Enable feature flag ```yaml # kibana.dev.yml xpack.securitySolution.enableExperimental: ['contentReferencesEnabled'] ``` - Clear the key `elasticAssistant.anonymizedValuesAndCitationsTourCompleted.v8.18` from your local storage if it exists. - Open Security assistant - Ask the assistant a question about your alerts or a KB document, the response should contain anonymized values or a citation. - The tour with the new copy should appear (copy in screenshot above). *the Anonymized values and citations will not appear if the knowledge base tour is currently open. ### How to test assistant settings menu changes: <img width="349" alt="image" src="https://github.com/user-attachments/assets/58e445d7-79c0-46ca-a245-bc2ab90eeb5d" /> - Enable feature flag ```yaml # kibana.dev.yml xpack.securitySolution.enableExperimental: ['contentReferencesEnabled'] ``` - Open Security assistant - In a new conversation, inside the settings menu, the "Show anonymized values" and "Show citations" menu items should be disabled because the conversation is empty and does not contain citations or anonymized values. - Ask the assistant a question about a KB document or Alert. The "Show citations" menu item should become available if the response contains citations. The "Show anonymized values" menu item will become available if the conversation contains replacements. Hovering over the disabled menu item will make a tooltip appear explaining why it is disabled. *Sometimes the conversation will contain replacements but the replacements are not used in the messages. In that case, the anonymized values menu item will not be disabled. This is a known [issue](elastic#208517). ### 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 features 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) ### 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 <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
0c932fd
commit b59712f
Showing
10 changed files
with
225 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...rm/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/utils/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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 { alertConvo, conversationWithContentReferences } from '../../../mock/conversation'; | ||
import { Conversation } from '../../../..'; | ||
import { conversationContainsContentReferences, conversationContainsAnonymizedValues } from '.'; | ||
|
||
describe('conversation utils', () => { | ||
it.each([ | ||
[undefined, false], | ||
[conversationWithContentReferences, true], | ||
[alertConvo, false], | ||
])( | ||
'conversationContainsContentReferences', | ||
(conversation: Conversation | undefined, expected: boolean) => { | ||
expect(conversationContainsContentReferences(conversation)).toBe(expected); | ||
} | ||
); | ||
|
||
it.each([ | ||
[undefined, false], | ||
[conversationWithContentReferences, false], | ||
[alertConvo, true], | ||
])( | ||
'conversationContainsAnonymizedValues', | ||
(conversation: Conversation | undefined, expected: boolean) => { | ||
expect(conversationContainsAnonymizedValues(conversation)).toBe(expected); | ||
} | ||
); | ||
}); |
20 changes: 20 additions & 0 deletions
20
...latform/packages/shared/kbn-elastic-assistant/impl/assistant/conversations/utils/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 { isEmpty } from 'lodash'; | ||
import { Conversation } from '../../../..'; | ||
|
||
export const conversationContainsContentReferences = (conversation?: Conversation): boolean => { | ||
return ( | ||
conversation?.messages.some((message) => !isEmpty(message.metadata?.contentReferences)) ?? false | ||
); | ||
}; | ||
|
||
/** Checks if the conversations has replacements, not if the replacements are actually used */ | ||
export const conversationContainsAnonymizedValues = (conversation?: Conversation): boolean => { | ||
return !isEmpty(conversation?.replacements); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.