mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary This PR implements the frontend for opening a Saved Playground. As a part of that there are several refactors to the current playground that warrant regression testing. ### Testing To test the saved playground view the search mode feature flag should be enabled, either with a config override or via console: ``` POST kbn:/internal/kibana/settings/searchPlayground:searchModeEnabled {"value": true} ``` Then you will need to manually save a playground: ``` curl -X "PUT" "http://localhost:5601/internal/search_playground/playgrounds" \ -H 'elastic-api-version: 1' \ -H 'kbn-xsrf: dev' \ -H 'x-elastic-internal-origin: Kibana' \ -H 'Content-Type: application/json; charset=utf-8' \ -u 'elastic_serverless:<PASSWORD>' \ -d $'{ "elasticsearchQueryJSON": "{\\"retriever\\":{\\"standard\\":{\\"query\\":{\\"semantic\\":{\\"field\\":\\"text\\",\\"query\\":\\"{query}\\"}}}},\\"highlight\\":{\\"fields\\":{\\"text\\":{\\"type\\":\\"semantic\\",\\"number_of_fragments\\":2,\\"order\\":\\"score\\"}}}}", "indices": [ "search-test" ], "name": "Test playground", "queryFields": { "search-test": [ "text" ] } }' ``` *Note this creates a saved playground in the Default space, and playgrounds are space aware so it will only be available in the default space. If you want to create a playground in another space you will need to update this URL to include the space. This assumes you have a `search-test` index created using the semantic_text onboarding workflow mapping. Then you can open the saved playground page at: `/app/search_playground/p/<ID_RETURNED_FROM_CURL>` ## Screenshots Chat  Chat - Query  Search - Query  ### Checklist - [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) - [ ] [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] [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) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
/*
|
|
* 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 { i18n } from '@kbn/i18n';
|
|
import { Pagination } from './types';
|
|
export { APIRoutes, type PlaygroundSavedObject } from './types';
|
|
|
|
export const PLUGIN_ID = 'searchPlayground';
|
|
export const PLUGIN_NAME = i18n.translate('xpack.searchPlayground.plugin.name', {
|
|
defaultMessage: 'Playground',
|
|
});
|
|
export const PLUGIN_PATH = '/app/search_playground';
|
|
|
|
export const SEARCH_MODE_FEATURE_FLAG_ID = 'searchPlayground:searchModeEnabled';
|
|
|
|
export const DEFAULT_PAGINATION: Pagination = {
|
|
from: 0,
|
|
size: 10,
|
|
total: 0,
|
|
};
|
|
|
|
export const ContextModelLimitError = i18n.translate(
|
|
'xpack.searchPlayground.error.contextLimitError',
|
|
{
|
|
defaultMessage: 'Context exceeds the model limit',
|
|
}
|
|
);
|
|
|
|
export enum ROUTE_VERSIONS {
|
|
v1 = '1',
|
|
}
|
|
|
|
export const PLAYGROUND_SAVED_OBJECT_TYPE = 'search_playground';
|
|
|
|
export const DEFAULT_CONTEXT_DOCUMENTS = 3;
|