Skip to content

[AI Infra] Choose which AI Assistant to show in the Elastic Header & Move the AI Assistant visibility setting to GenAI Settings page#233727

Merged
rbrtj merged 33 commits intoelastic:mainfrom
rbrtj:move-ai-assistant-visibility-to-genai-settings-page
Sep 29, 2025
Merged

[AI Infra] Choose which AI Assistant to show in the Elastic Header & Move the AI Assistant visibility setting to GenAI Settings page#233727
rbrtj merged 33 commits intoelastic:mainfrom
rbrtj:move-ai-assistant-visibility-to-genai-settings-page

Conversation

@rbrtj
Copy link
Contributor

@rbrtj rbrtj commented Sep 2, 2025

Resolves #235602
This PR:

  • Moves the AI Assistant Visibility UI setting to GenAI Settings page. It disables the setting in Serverless and ECH Solution views.
image
  • Introduces a new navigation header selector for non-solution pages (Analytics, Stack Management), allowing users to choose which version of the Assistant they want to see. Based on their selection, the UI setting is updated, and the relevant Assistant window opens instantly.
Screen.Recording.2025-09-19.at.11.41.41.mov
@rbrtj rbrtj changed the title Remove aiAssistantPreferredAIAssistantType setting from Observability… Sep 19, 2025
Comment on lines 121 to 132
useEffect(() => {
const openChatSubscription = aiAssistantManagementSelection.openChat$.subscribe((event) => {
if (event.assistant === 'observability') {
service.conversations.openNewConversation({ messages: [] });
}
});

return () => {
openChatSubscription.unsubscribe();
};
}, [aiAssistantManagementSelection.openChat$, service.conversations]);

Copy link
Contributor Author

@rbrtj rbrtj Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I don't think it's the right move to introduce this new subscription here. However, with this new selector, we need a way to instantly open the appropriate assistant window, and I couldn't think of a better solution to populate it with all the relevant configuration already in place. The trigger is exposed from ai_assistant_management plugin start contract.
I'm open to any ideas.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine.

@rbrtj rbrtj changed the title [AI Infra] Choose which AI Assistant to show in the Elastic Header Sep 19, 2025
@rbrtj rbrtj self-assigned this Sep 19, 2025
@rbrtj rbrtj added backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:AI Infra Platform AppEx AI Infrastructure Team t// v9.2.0 labels Sep 19, 2025
@rbrtj rbrtj marked this pull request as ready for review September 19, 2025 09:53
@rbrtj rbrtj requested review from a team as code owners September 19, 2025 09:53
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-ai-infra (Team:AI Infra)

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Sep 19, 2025
@github-actions
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@rbrtj rbrtj removed request for a team and paul-tavares September 25, 2025 15:10
@rbrtj
Copy link
Contributor Author

rbrtj commented Sep 25, 2025

Damn.. I'm so sorry for all the pings, something went wrong 😅

triggerOpenChat: (event: { assistant: AIAssistantType }) => void;
}

export const AiAssistantHeaderButton: React.FC<AiAssistantHeaderButtonProps> = ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super duper nit: Suggestion to make this consistent with the rest with AIAssistant... (so upper cased I and instead of lower-cased)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 21648e4

@rbrtj rbrtj requested a review from qn895 September 26, 2025 08:10
async function handleSave() {
try {
await saveAll();
window.location.reload();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When registering the settings in the server-side plugin, there is a "requires reload" property. Can we set that property to true for the respective setting and then check Inside of useSettingsContext() > saveAll() if a reload is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, done in ff34021

Comment on lines +58 to +59
readonly: true,
readonlyMode: 'ui',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is readonly: true needed if you use readonlyMode:'ui'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems like we need both, otherwise it would show up in the Kibana Advanced Settings


// TODO: This is duplicated code. It should be removed when the logo becomes available in EUI.

const AssistantLogo = (props: React.SVGProps<SVGSVGElement>) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assistant logo in shared component library: x-pack/platform/packages/shared/ai-assistant/icon/icon.tsx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to use the logo in src/platform... (OSS), so I couldn't import it from x-pack. Ideally, the shared logo should live in the OSS code probably, but I wanted to avoid relocating it and updating all current imports in this PR.

@rbrtj rbrtj requested a review from KDKHD September 29, 2025 08:07
@KDKHD
Copy link
Member

KDKHD commented Sep 29, 2025

I'm seeing a few small issues only after initially selecting the default assistant and before a page reload. Otherwise, all ok!
image

  1. The assistant automatically opens every time I return to the Discover page. After page reload, this issue disappeared.
Screen.Recording.2025-09-29.at.09.19.40.mov
  1. Even when I select "Security" as the default assistant the first time I open the assistant, if I go into GenAi settings, the setting still shows "Only in their own solutions". After page reload, the correct value is shown in the setting.
Copy link
Contributor

@csr csr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/platform/test/tsconfig.json LGTM 👍

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config changes LGTM. Thanks for testing on a serverless deployment as well!

@rbrtj
Copy link
Contributor Author

rbrtj commented Sep 29, 2025

I'm seeing a few small issues only after initially selecting the default assistant and before a page reload. Otherwise, all ok! image

  1. The assistant automatically opens every time I return to the Discover page. After page reload, this issue disappeared.

Screen.Recording.2025-09-29.at.09.19.40.mov
2. Even when I select "Security" as the default assistant the first time I open the assistant, if I go into GenAi settings, the setting still shows "Only in their own solutions". After page reload, the correct value is shown in the setting.

  1. Thanks for catching that. The problem was the use of ReplaySubject for openChatTrigger. We need to persist the value with either ReplaySubject or BehaviorSubject because the appropriate assistants nav buttons are mounted after the observable emits a value. However, this causes the nav components to consume the persisted value on each re-mount (e.g., when navigating to other solution pages). To prevent this, I added a simple completeOpenChat function exposed from the management plugin. 7e8d819
  1. I created a separate issue [AI Infra] GenAI Settings Page: AI Assistants Visibility setting doesn't reflect the option selected in the nav header #236804
@elasticmachine
Copy link
Contributor

elasticmachine commented Sep 29, 2025

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: 28fce07
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-233727-28fce075257d

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #104 / Endpoint plugin @ess @serverless @skipInServerlessMKI Endpoint execute response action "after all" hook for "should succeed with valid endpoint id, command and an optional timeout"

The CI Stats report is too large to be displayed here, check out the CI build annotation for this information.

History

cc @rbrtj

@rbrtj rbrtj merged commit 46d638c into elastic:main Sep 29, 2025
12 checks passed
niros1 pushed a commit that referenced this pull request Sep 30, 2025
…Move the `AI Assistant visibility` setting to `GenAI Settings` page (#233727)

Resolves #235602
This PR:
* Moves the `AI Assistant Visibility` UI setting to `GenAI Settings`
page. It disables the setting in Serverless and ECH Solution views.

<img width="1096" height="713" alt="image"
src="https://github.com/user-attachments/assets/5e8c7dce-13e5-44b4-81a5-cf3936a7ba5f"
/>

* Introduces a new navigation header selector for non-solution pages
(Analytics, Stack Management), allowing users to choose which version of
the Assistant they want to see. Based on their selection, the UI setting
is updated, and the relevant Assistant window opens instantly.


https://github.com/user-attachments/assets/8cc2644f-45e7-4200-b92f-df96ef827847

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
VladimirFilonov pushed a commit to VladimirFilonov/kibana that referenced this pull request Sep 30, 2025
…Move the `AI Assistant visibility` setting to `GenAI Settings` page (elastic#233727)

Resolves elastic#235602
This PR:
* Moves the `AI Assistant Visibility` UI setting to `GenAI Settings`
page. It disables the setting in Serverless and ECH Solution views.

<img width="1096" height="713" alt="image"
src="https://github.com/user-attachments/assets/5e8c7dce-13e5-44b4-81a5-cf3936a7ba5f"
/>

* Introduces a new navigation header selector for non-solution pages
(Analytics, Stack Management), allowing users to choose which version of
the Assistant they want to see. Based on their selection, the UI setting
is updated, and the relevant Assistant window opens instantly.


https://github.com/user-attachments/assets/8cc2644f-45e7-4200-b92f-df96ef827847

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
…Move the `AI Assistant visibility` setting to `GenAI Settings` page (elastic#233727)

Resolves elastic#235602
This PR:
* Moves the `AI Assistant Visibility` UI setting to `GenAI Settings`
page. It disables the setting in Serverless and ECH Solution views.

<img width="1096" height="713" alt="image"
src="https://github.com/user-attachments/assets/5e8c7dce-13e5-44b4-81a5-cf3936a7ba5f"
/>

* Introduces a new navigation header selector for non-solution pages
(Analytics, Stack Management), allowing users to choose which version of
the Assistant they want to see. Based on their selection, the UI setting
is updated, and the relevant Assistant window opens instantly.


https://github.com/user-attachments/assets/8cc2644f-45e7-4200-b92f-df96ef827847

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:project-deploy-observability Create an Observability project :ml release_note:enhancement Team:AI Infra Platform AppEx AI Infrastructure Team t// Team:Obs AI Assistant Observability AI Assistant v9.2.0