Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from elastic:main #228

Merged
merged 44 commits into from
Jul 15, 2023
Merged

[pull] main from elastic:main #228

merged 44 commits into from
Jul 15, 2023

Conversation

pull[bot]
Copy link

@pull pull bot commented Jul 14, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

kibanamachine and others added 30 commits July 14, 2023 01:04
Relates to #159655.

### Changes

This PR include the following changes:

- [x] Update the copy in the page subtitle with “Select your method for
collecting data into Observability.”
- [x] Remove badges (Quickstart, in a few minutes, setup guide,
integrations, sample data) from all cards
- [x] Remove ‘skip for now’ link
- [x] Change system logs card title with “Stream host system logs” and
card description with “The quickest path to onboard log data from your
own machine or server.”
- [x] Add system icon to system logs card
- [x] Change custom logs card title with “Stream log files” and card
description with “Stream any logs into Elastic in a simple way and
explore their data.”
- [x] Add logging icon to stream logs card 
- [x] Remove horizontal line below the cards’ title
- [x] Add “Elastic agent” badge to system logs card and stream log files
- [x] Change CTA button text with ‘Get started’ of both system logs and
stream log files card.
- [x] Remove the cards shadow and add 1px stroke Core/lightShade
- [x] Add 2px stroke Text/accentText around system logs card +
Quickstart badge on top of the card
- [x] Remove ‘sample data’ card
- [x] Change APM card title with “Collect application performance data”
and description with “Collect traces, logs, and metrics from
OpenTelemetry or APM custom agent.”
- [x] Add secondary CTA button to APM card with the text “Get started”
that links to the current flow
- [x] Add Elastic APM logo and Open Telemetry logo to APM card
- [x] Change Kubernetes card title with “Collect Kubernetes clusters
data” and description with “Collect logs and metrics from Kubernetes
clusters with Elastic agent.”
- [x] Add Kubernetes logo to Kubernetes card that links to the current
setup guide
- [x] Add secondary CTA button to Kubernetes card with the text “Get
started”
- [x] Create custom card for integrations with logs from: Amazon
Kinesis, AWS, Apache, Nginx, Google Cloud Platform, Azure and card title
“Explore 300+ ways of ingesting data with our integrations”
- [x] Add secondary CTA button to Integrations card with the text “Start
exploring” that links to the Integrations page with ‘logs’ in the search
bar
- [x] Add quick links to Integrations card to Use sample data (link to
actual flow) + Upload file (link to actual flow) + AWS Firehose (link to
docs:
https://www.elastic.co/guide/en/kinesis/current/aws-firehose-setup-guide.html)

### Missing
- [ ] Link ‘Get started’ button from Stream log files directly to the
stream log files onboarding flow (remove the select logs step)

This will be addressed in a follow up Pr since it's depending on
#159500.

### Screenshots

#### Before
<img width="2222" alt="image"
src="https://github.com/elastic/kibana/assets/1313018/d9120656-7357-4bf0-b8c8-6ce1a85e731c">

#### After
<img width="2225" alt="image"
src="https://github.com/elastic/kibana/assets/1313018/83275710-c9eb-45ac-a3b3-42ca4debf9a6">
## Summary

Closes elastic/fleet-server#2596

Depends on elastic/fleet-server#2782

After changes in fleet-server, there will be no duplicate action results
per agent, so the agent status query can be simplified to use
`doc_count` instead of cardinality agg.
This should eliminate the bug where the calculation is not accurate on
higher scale.

To verify, run scale tests on 25-50-75k and verify that the status calc
is accurate (not reporting more or less action results than the actual
actioned agents).


### Checklist

- [ ] [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
#161886)

…te depth exceeded"

## Summary

Fixes #161885. The infinite
update loop doesn't happen as we stabilized the `defaultTheme` object.
…161929)

## Summary

This PR just moves the error message to the beginning of the footer.

<img width="504" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/f215c416-0eba-4afb-bf28-44bca471e8b1">
#161230)

Closes #159500.

This PR focuses on adding client-site routing support to the wizard
developed for observability_onboarding plugin.

### Changes
- Added routes for each step of the wizard.
- Added support for `history.push` and `history.goBack` in wizard
context.
- Added basePath to wizard provider.



https://github.com/elastic/kibana/assets/1313018/c32e25b3-2470-41a4-8c34-f2dd5ea7c366
Closes: #155330

Adds `index.fast_refresh` to `.apm-custom-link` in order to ensure fast
index refreshes on serverless (1 second periodic refreshes instead of 5
second which is the new default on serverless).

This is pending on Elasticsearch adding support for `index.fast_refresh`
(elastic/elasticsearch#96660)

---------

Co-authored-by: miriam.aparicio <miriam.aparicio@gmail.com>
Co-authored-by: Miriam <31922082+MiriamAparicio@users.noreply.github.com>
Closes #160160

## Summary

This PR adds functionality to the new autocomplete generation script for
creating an `availability` property in the spec files that is used for
filtering out endpoints that are not available in the current
environment (e.g. `serverless` or `stack`). It also adds a config
setting in the console plugin that specifies the current environment.
This setting is also configured accordingly for serverless.


**How to test**
1. Checkout the [ES specification
repo](https://github.com/elastic/elasticsearch-specification)
2. Run the command with `node scripts/generate_console_definitions.js
--source <ES_SPECIFICATION_REPO> --emptyDest` where
`<ES_SPECIFICATION_REPO>` is the absolute path to the root of the ES
specification repo
3. Start the classic Kibana and verify that Console suggests only
endpoints that are available in the `stack` environment.
4. Start Kibana in any of the serverless modes and verify that Console
suggests only endpoints that are available in the `serverless`
environment.

Here are some example endpoints that can be used for testing:
| Endpoint  | Available in Stack | Available in Serverless |
| ------------- | ------------- | ------------- |
| [POST
_bulk](https://github.com/elastic/elasticsearch-specification/blob/main/specification/_global/bulk/BulkRequest.ts)
| Yes | Yes |
| [DELETE
_security/oauth2/token](https://github.com/elastic/elasticsearch-specification/blob/main/specification/security/invalidate_token/SecurityInvalidateTokenRequest.ts)
| Yes | No |
## Summary

Analyzing the MKI QA logs, I discovered that errors encountered during
shutdown were effectively triggering a second shutdown process, making
the logs unclear:

<img width="1564" alt="Screenshot 2023-07-13 at 16 07 22"
src="https://github.com/elastic/kibana/assets/1532934/8d718a99-2187-4fa3-b6f6-9c3f0e7a3925">

it has the side effect to also make "normals" shutdown (e.g via SIGINT
like in the screenshot) to appear as error shutdowns because of the
error thrown during the shutdown.

This PR addresses it, by making sure that `Root` only shutdown once.
Errors occurring during the shutdown will be appearing in the logs, but
they will not surface as the cause of the shutdown (no `FATAL` log
entry).
## Summary

Fix an unwanted behavior of the config merging logic, that was merging
arrays the same way objects are merged.

E.g the output of `getConfigFromFiles(file1, file2)` with 

```yaml
### file 1
array: [1, 2, 3]
obj_array:
  - id: 1
  - id: 2

### file 2
array: [4]
obj_array:
  - id: 3
```

was 

```yaml
array: [4, 2, 3]
obj_array:
  - id: 3
  - id: 2
```

instead of 

```yaml
array: [4]
obj_array:
  - id: 3
```

Which is causing problems when merging the default, serverless,
serverless project and dev file in some scenarios.
## Summary

This PR fixes the filters passed to Lens charts that was the query to
not return the data

Filter by  inexistent `service.name`
<img width="907" alt="image"
src="https://github.com/elastic/kibana/assets/2767137/49d68710-7958-4ed5-a20f-c73aa3c30581">

Query by  inexistent `service.name`

<img width="904" alt="image"
src="https://github.com/elastic/kibana/assets/2767137/a67cc1df-10ef-4d2d-8072-5ba698d16313">

Filter by  existent `service.name`

<img width="904" alt="image"
src="https://github.com/elastic/kibana/assets/2767137/55a86ca9-f0a1-486a-974f-ab0c9e09dbc0">

Query by  existent `service.name`

<img width="910" alt="image"
src="https://github.com/elastic/kibana/assets/2767137/1c31ca45-e47b-42cd-bee8-26bc0e93f3de">



### How to test
-  Start a local Kibana instance
- Navigate to `Infrastructure` > `Hosts`
- Change the filters and see how the charts react. 
- Open a chart in Lens and confirm whether the data there is the same as
in the Hosts View
## Summary

Fixing calculated theme tags. An issue found was in the bootstrap
renderer when User Profile's Theme was set to 'Light' and Adv. Setting's
Theme was set to 'Dark'.

In my original PR, I had originally had the UserSettings > darkMode be a
string ('', 'light', 'dark'), but changed it to a boolean | undefined
and the conditional no longer worked.

This should fix a number of sporadic darkmode issues
…#161728)

## Summary

Fix #161652

Add the `serverless.projectId` config setting to the `cloud` plugin, and
expose the `isCloudServerless` and `serverless.projectId` info from the
cloud plugin's API.
…_views endpoint (#160982)

closes [#157520](#157520)
## Summary

This PR adds strict payload validation to `metrics_explorer_views`
endpoint. This PR depends on this to be merged
#160852


### How to test

- Call the endpoint below trying to use invalid values. see
[here](https://github.com/elastic/kibana/pull/160982/files#diff-4573683b3b62cdf5f6426ec345b7ad6c7d6e6328237b213ca7519f686d8fa951R125-R131).

```bash
[POST|PUT] kbn:/api/infra/metrics_explorer_views
{
  "attributes": {
    "name": "Ad-hoc",
    "options": {
      "aggregation": "avg",
      "metrics": [
        {
          "aggregation": "avg",
          "field": "system.cpu.total.norm.pct",
          "color": "color0"
        },
      ],
      "source": "default",
      "groupBy": [
        "host.name"
      ]
    },
    "chartOptions": {
      "type": "line",
      "yAxisMode": "fromZero",
      "stack": false
    },
    "currentTimerange": {
      "from": "now-1h",
      "to": "now",
      "interval": ">=10s"
    }
  }
}
```

- Set up a local Kibana instance
- Navigate to `Infrastructure > Metrics Explorer`
- In the UI, use the Saved View feature and try different field
combinations

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…ration/apis/lists/create_exception_list_item.ts` (#161941)

## Summary

- Unskip
`x-pack/test/api_integration/apis/lists/create_exception_list_item.ts`

- Addresses #151636

-  #151637
## Summary

The access control deletion function was importing the wrong
`isIndexNotFoundException` to identify when an index doesn't exist. This
would cause index deletion to fail if a search index is missing an
access control index.
… custom item (#161940)

## Summary

Closes #160729

Fixes the bug described in the issue.
When you try to edit a multi values filter (is one of, is not one of)
and add a custom label, the selected values are all vanishing. The
problem was on the initialization of the state


![uni](https://github.com/elastic/kibana/assets/17003240/2cb322fb-3978-4147-bd5d-d440b598804e)
#161732)

Closes #161169 

## Summary

This PR removes the popout icon from APM Services and open as page links

Update: (`APM Services` is changed to `View APM Services`)
<img width="962" alt="image"
src="https://github.com/elastic/kibana/assets/14139027/10909976-1367-4b48-9fdb-bff56fcf354b">


## Testing
-  Go to Hosts view and open the flyout (for any host)
- The top right links shouldn't have a popout and should open in the
same tab

![image](https://github.com/elastic/kibana/assets/14139027/01601637-60a0-42d5-b0b2-bd3b0ff822a9)
**TopN functions**
<img width="1795" alt="Screenshot 2023-07-04 at 12 01 30 PM"
src="https://github.com/elastic/kibana/assets/55978943/9acab124-ffb5-4c5f-8e53-fdfe2bd7a247">

**Diff TopN functions**
<img width="1799" alt="Screenshot 2023-07-04 at 12 03 04 PM"
src="https://github.com/elastic/kibana/assets/55978943/ec0acf68-7337-48ab-a031-49420a2d770a">
…et (#161859)

## Summary

During Cypress tests, intercept `POST
/api/fleet/epm/packages/security_detection_engine/*`.

This is the endpoint used when a specific `security_detection_engine`
package is set to be used via the
`--xpack.securitySolution.prebuiltRulesPackageVersion` config flag,
which is used to test by the TRADE team.

This PR updates the test to account for that flow.

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
…h to Search (#161902)

## Summary

Updated usages of "Enterprise Search" to "Search" in the content
application
## Summary

Removes the lock tip icon in favor of a standard tool tip for the theme
mode keypad menu.

Previous render:
<img width="1051" alt="Screenshot 2023-06-30 at 12 24 12 PM"
src="https://github.com/elastic/kibana/assets/103939324/5968e1e4-88ae-43a6-8fea-0df7cf2db25b">

New Render:
<img width="1051" alt="Screenshot 2023-07-11 at 2 41 28 PM"
src="https://github.com/elastic/kibana/assets/103939324/b45d5df6-4f04-446f-8d5c-f2c4dda2fa06">

### Tests
-
`x-pack/plugins/security/public/account_management/user_profile/user_profile.test.tsx`

### Manual Testing
- Start Elasricsearch, and start Kibana with an empty
kibana.yml/kibana.dev.yml
- Navigate to the _Edit profile_ screen via the profile/avatar button in
the top right portion of the uI

<img width="269" alt="Screenshot 2023-06-29 at 11 47 42 AM"
src="https://github.com/elastic/kibana/assets/103939324/52f5288f-0623-4658-a7a2-2ef85164cadc">

- Verify the theme settings appear as a KeyPadMenu and function as
expected

<img width="1079" alt="Screenshot 2023-06-28 at 2 38 44 PM"
src="https://github.com/elastic/kibana/assets/103939324/a3745b8b-f908-4cd0-bcf6-2bf878578499">

- Modify the kibana.yml (or kibana.dev.yml) with the line
`uiSettings.overrides.theme:darkMode: true`
- Refresh Kibana and verify that the dark theme is rendered and the
theme settings are disabled and includes a tooltip explaining why the
mode setting is locked
<img width="1051" alt="Screenshot 2023-07-11 at 2 41 28 PM"
src="https://github.com/elastic/kibana/assets/103939324/b45d5df6-4f04-446f-8d5c-f2c4dda2fa06">
## Summary

Closes #161557

Enabled flaky test
…in self-managed only (#160499)

Partially addresses #159590

## Summary

This PR adds an an internal uiSettings API that is a duplicate of the
public API and is intended for use by the browser-side uiSettings
client.

The PR also adds a config settings that is configured in serverless
context only and exposes the public uiSettings routes based on the value
of this setting (it defaults to false since we don't want to expose the
public routes in serverless).

**How to test:**

I. Verify that in serverless the internal routes are exposed but the
public ones aren't:
1. Start Es with `yarn es snapshot` and Kibana with `yarn
serverless-{mode}` where `{mode}` can be `es`, `oblt`, or `security`
(the public routes should be disabled for all projects).
2. Verify that the public endpoints are not accessible. For example,
`curl --user elastic:changeme
'http://localhost:5601/zhb/api/kibana/settings' -X 'GET'` should return
`{"statusCode":404,"error":"Not Found","message":"Not Found"}`.
3. Verify that the internal endpoints are accessible. For example, `curl
--user elastic:changeme
'http://localhost:5601/zhb/internal/kibana/settings' -X 'GET'` should
return
`{"settings":{"buildNum":{"userValue":9007199254740991},"isDefaultIndexMigrated":{"userValue":true},"defaultRoute":{"isOverridden":true,"userValue":"/app/elasticsearch"}}}`


II. Verify that the both public and internal routes are exposed in
self-managed:
1. Start Es with `yarn es snapshot` and Kibana with `yarn start`
2. Verify that the public endpoints are accessible. For example, `curl
--user elastic:changeme 'http://localhost:5601/zhb/api/kibana/settings'
-X 'GET'` should return
`{"settings":{"buildNum":{"userValue":9007199254740991},"isDefaultIndexMigrated":{"userValue":true}}}`
3. Verify that the internal endpoints are accessible. For example, `curl
--user elastic:changeme
'http://localhost:5601/zhb/internal/kibana/settings' -X 'GET'` should
return
`{"settings":{"buildNum":{"userValue":9007199254740991},"isDefaultIndexMigrated":{"userValue":true}}}`

III. Verify that the plugins/services that consume the internal
uiSettings endpoints work as expected in both self-managed and
serverless environment.

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…161796)

Closes #158551

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Includes a few compiled cypress typescript files generated during `node
scripts/type_check`. We're not using a global glob due to some plugins
using a javascript base.
## Summary

This PR fixes #161861 by adding `shouldUnregister` to the `Controller`
components for `indicator.params.from` and `indicator.params.to` to
ensure the fields are unregistered when they are unmounted.

### Testing

1. Create a new SLO using the histogram indicator.
2. Set both the  "good" and "total" events to use value count
3. Ensure the preview chart displays data
4. Set the "good" events to a range, the previous chart should update.
benakansara and others added 7 commits July 14, 2023 18:34
Resolves elastic/actionable-observability#70

For the APM Error Count rule -
- Added `error.grouping_name` in the index mapping of AAD index
- Added `error.grouping_name` in the alert document in AAD index
- Added `errorGroupingName` in the list of action variables

I discussed with @simianhacker regarding the alert instance ID having
space/quotes with introduction of `errorGroupingName`. It appears that
using `errorGroupingName` as is should not be an issue and so we don't
need to modify or hash it.

## Group by dropdown
<img width="604" alt="Screenshot 2023-07-13 at 17 27 44"
src="https://github.com/elastic/kibana/assets/69037875/d9ab1a8d-3272-4c36-8c71-a7163a024249">

## Reason message
<img width="755" alt="Screenshot 2023-07-13 at 17 38 31"
src="https://github.com/elastic/kibana/assets/69037875/dbe4a86b-812b-4068-abea-4b96fa5fb38b">

## Index mapping
<img width="1514" alt="Screenshot 2023-07-13 at 17 40 32"
src="https://github.com/elastic/kibana/assets/69037875/f1e48045-a7a8-4044-bc33-f4d34dc1c8cc">

## Alert document
<img width="681" alt="Screenshot 2023-07-13 at 17 39 46"
src="https://github.com/elastic/kibana/assets/69037875/985cf003-ac32-4c7e-9f2a-5bda033c194b">

## Action variable
<img width="612" alt="Screenshot 2023-07-13 at 17 43 13"
src="https://github.com/elastic/kibana/assets/69037875/2edfb388-f99d-4cae-98ef-3e9b275bb848">

## Alert notification
<img width="650" alt="Screenshot 2023-07-13 at 17 41 37"
src="https://github.com/elastic/kibana/assets/69037875/c057a3a1-dc6e-4fee-97ad-5790ab3c531b">
…ipeline (#161895)

## Summary

This PR changes the backend logic for passing the pipeline parameters to
the create pipeline API (`POST
/internal/enterprise_search/indices/{indexName}/ml_inference/pipeline_processors`).
When creating an ELSER pipeline, the UI already passes a full
`pipelineDefinition` and populated `fieldMappings` - we're extending
this to non-ELSER pipelines too.

Once all pipelines work with the multi-field selector, we can remove all
special handling logic to backfill `fieldMappings`.

The changes were manually tested for backward compatibility with ELSER,
non-ELSER and zero-shot classification pipelines.

### Checklist

Delete any items that are not applicable to this PR.
- [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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary

`eui@83.1.0` ⏩ `eui@84.0.0`

---

## [`84.0.0`](https://github.com/elastic/eui/tree/v84.0.0)

- Updated `EuiDualRange`'s `minInputProps` and `maxInputProps` to
support passing more props to underlying inputs
([#6902](elastic/eui#6902))
- `EuiFocusTrap` now supports configuring cross-iframe focus trapping
via the `crossFrame` prop
([#6908](elastic/eui#6908))

**Bug fixes**

- Fixed `EuiFilterButton` icon display
([#6900](elastic/eui#6900))
- Fixed `EuiCombobox` compressed plain text display
([#6910](elastic/eui#6910))
- Fixed visual appearance of collapse buttons on collapsible
`EuiResizablePanel`s ([#6926](elastic/eui#6926))

**Breaking changes**

- `EuiFocusTrap` now defaults to *not* trapping focus across iframes
([#6908](elastic/eui#6908))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…esults (#161706)

## Summary

Updated enterprise search search provider to use "Search" as type
instead of Enterprise Search. Manaully added App Search & Workplace
Search for search results now that we removed the apps from the global
nav.

### Screenshots
<img width="1689" alt="image"
src="https://github.com/elastic/kibana/assets/1972968/888d527a-b755-4baf-b58b-1c5f4cbb7a73">
<img width="1689" alt="image"
src="https://github.com/elastic/kibana/assets/1972968/17e8c4e9-5bdc-4114-a08a-a1c321fc64ee">
)

Closes #141978

<img width="600" alt="Screen Shot 2023-07-12 at 1 51 45 PM"
src="https://github.com/elastic/kibana/assets/373691/a71fc82f-31e0-49b2-9178-c70d890a9912">

### Test instructions
* clone https://github.com/thomasneirynck/faketracks
* cd into `faketracks`
* run `npm install`
* run `node ./generate_tracks.js --isTimeSeries`
* In Kibana, create `tracks` data view
* In Maps, create new map and add `Top hits` layer. Select `Tracks` data
view.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@pull pull bot added the ⤵️ pull label Jul 14, 2023
animehart and others added 7 commits July 14, 2023 13:34
…ability (#160696)

## Summary

- added 1s delay between adding a filter and checking the filter
- added 1s delay to allow both Kubernetes and Cloud tab to render on
Dashboard page
## Summary

Resolves #77971.

Adds a `toKqlExpression` method to the `@kbn/es-query` that allows
generating a KQL expression from an AST node.

Example:

```ts
const node = fromKueryExpression('extension: "jpg"');
const kql = toKqlExpression(node); // 'extension: "jpg"'
```

Note that the generated KQL expression may not exactly match the
original text (whitespace is not preserved, parentheses may be added,
etc.).

### Checklist

Delete any items that are not applicable to this PR.

- [ ]
[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
## Summary

We received an alert on GPCTL that a kibana commit (9509425) did
not exist, because it was being parsed as e4 (scientific representation)
which is not what we want 😅

So, in this PR i am making sure the hash is not being parsed in any
funny way.

Relevant slack thread:
https://elastic.slack.com/archives/C03PAKL2KLK/p1689264633036939
Cypress tests were failing with esArchiver service unavailability.

This PR fixes it by adding basic services (es, kibanaServier, esArchive
& retry) from `@kbn/ftr-common-functional-services` in shared FTR
configuration file. This way all the child config files will have these
services pre-loaded.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…connector (#161676)

Resolves #159598

## Summary

This PR modifies the `test` subaction of the Generative AI connector to
accept a `stream` parameter (default: `false`) that allows for a
streaming response.

The Generative AI connector is basically a pass-through to the Open
AI/Azure OpenAI APIs, where the `stream` parameter is passed in via the
body of the request. This means that with the existing connector, users
could specify `stream: true` in the body which would lead to unexpected
results when the action is unprepared to return streaming results. This
PR sanitizes the body that is passed in the `run` subaction to prevent
the `stream` parameter from being set to `true` and explicitly sets the
`stream` parameter for the `test` subaction.

In order to test the streaming response, I created an example plugin
that prompts users to create a Generative AI connector if one does not
exist and then executes actions using the connector with `stream` set to
`true`. This borrows liberally from @dgieselaar's existing work from
#158678


https://github.com/elastic/kibana/assets/13104637/441694cb-0154-4450-bd93-3907c4a9995c



## To Verify

1. Navigate to https://localhost:5601/app/GenAiStreamingResponseExample
2. Set up a Generative AI connector
3. Open the network console. Enter a prompt and click `Stream Response`
4. You should see the chat response return streaming results.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…nding as part of the conversation (#161920)

## Summary

Resolves System Prompt not sending issues:
#161809

Also resolves:
- [X] Not being able to delete really long Conversation, System Prompt,
and Quick Prompt names
- [X] Fix user/all System Prompts being overridden on refresh
- [X] Conversation without default System Prompt not healed if it is
initial conversation when Assistant opens (Timeline)
- [X] New conversation created from Conversations Settings not getting a
connector by default
- [X] Current conversation not selected by default when settings gear is
clicked (and other assistant instances exist)
- [X] Sent to Timeline action sends anonymized values instead of actual
plaintext
- [X] Clicking Submit does not clear the text area
- [X] Remove System Prompt Tooltip
- [X] Fixes confusion when System or Quick Prompt is empty by adding a
placeholder value
- [X] Shows (empty prompt) in System Prompt selector when the Prompt
content is empty
- [X] Fixes connector error callout flashing on initial load
- [X] Shows `(empty prompt)` text within Prompt Editor when prompt
content is empty to prevent confusion

### Checklist

Delete any items that are not applicable to this PR.

- [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
@pull pull bot merged commit 83a31bf into afharo:main Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.