[AI Assistant] Fix error creating an AI connector in Observability AI Assistant (#217740)

## Summary

This PR fixes https://github.com/elastic/kibana/issues/207912, which
causes error when creating an AI connector in Observability AI Assistant

Before:

![image](https://github.com/user-attachments/assets/56b3eb49-28ec-4add-94c5-bf52f4291f4f)


After:


<img width="1150" alt="image"
src="https://github.com/user-attachments/assets/f53b2c35-3e6e-4e45-ba24-907e6b55cf03"
/>


https://github.com/user-attachments/assets/f3f96f75-577f-421c-aeb7-de4ce9d234e9


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] 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)
- [ ] 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.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)
- [ ] ...
This commit is contained in:
Quynh Nguyen (Quinn) 2025-04-09 16:54:30 -05:00 committed by GitHub
parent 70c817db22
commit e2f09452cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View file

@ -31,7 +31,7 @@ describe('actionTypeRegistry.get() works', () => {
test('connector type static data is as expected', () => {
expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID);
expect(actionTypeModel.selectMessage).toBe(
'Use the Elastic Managed LLM for your chat and RAG usecases.'
'Use the Elastic Managed LLM for your chat and RAG use cases.'
);
expect(actionTypeModel.actionTypeTitle).toBe('AI Connector');
});

View file

@ -31,7 +31,7 @@ export function getConnectorType(): InferenceConnector {
iconClass: 'sparkles',
isExperimental: true,
selectMessage: i18n.translate('xpack.stackConnectors.components.inference.selectMessageText', {
defaultMessage: 'Use the Elastic Managed LLM for your chat and RAG usecases.',
defaultMessage: 'Use the Elastic Managed LLM for your chat and RAG use cases.',
}),
actionTypeTitle: INFERENCE_CONNECTOR_TITLE,
validateParams: async (

View file

@ -6,17 +6,22 @@
*/
import React from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ConnectorProvider } from '../application/context/connector_context';
import { CreateConnectorFlyout } from '../application/sections/action_connector_form';
import { CreateConnectorFlyoutProps } from '../application/sections/action_connector_form/create_connector_flyout';
import { ConnectorServices } from '../types';
const queryClient = new QueryClient();
export const getAddConnectorFlyoutLazy = (
props: CreateConnectorFlyoutProps & { connectorServices: ConnectorServices }
) => {
return (
<ConnectorProvider value={{ services: props.connectorServices }}>
<CreateConnectorFlyout {...props} />
</ConnectorProvider>
<QueryClientProvider client={queryClient}>
<ConnectorProvider value={{ services: props.connectorServices }}>
<CreateConnectorFlyout {...props} />
</ConnectorProvider>
</QueryClientProvider>
);
};