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

Extract AI assistant to package #194552

Merged
merged 30 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5c2bba5
Create ai-assistant packages
sphilipse Sep 26, 2024
f0869fd
Extract Observability AI Assistant into ai-assistant package
sphilipse Oct 1, 2024
30c6fd0
[CI] Auto-commit changed files from 'node scripts/lint_packages --fix'
kibanamachine Oct 1, 2024
e1db802
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 1, 2024
9a7f907
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 1, 2024
6d555cf
fix build error
sphilipse Oct 1, 2024
71ad9ed
add missing files
sphilipse Oct 1, 2024
cd7938f
Merge branch 'main' into search-assistant-implement-frontend
sphilipse Oct 1, 2024
b539fe5
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 1, 2024
c6cf9d7
Fix i18n
sphilipse Oct 1, 2024
59a6324
Fix typing and jest tests
sphilipse Oct 1, 2024
c5c19d8
Fix typing and jest tests
sphilipse Oct 1, 2024
c66d197
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 1, 2024
4b6cb0d
Move i18n label inside function
sphilipse Oct 1, 2024
ffa972e
re-add server to app tsconfig
sphilipse Oct 1, 2024
87d2e91
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 1, 2024
8b490b0
Fix linting error
sphilipse Oct 2, 2024
dbbdc21
fix router
sphilipse Oct 2, 2024
130a5e0
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Oct 2, 2024
aa2c644
Remove commented out function
sphilipse Oct 2, 2024
8cb0996
Merge branch 'main' into search-assistant-implement-frontend
sphilipse Oct 2, 2024
93a9970
Merge branch 'main' into search-assistant-implement-frontend
sphilipse Oct 7, 2024
911c57e
Remove context and revert useOnce
sphilipse Oct 8, 2024
2780c67
Merge remote-tracking branch 'upstream/main' into search-assistant-im…
sphilipse Oct 8, 2024
a48c5b9
Fix i18n
sphilipse Oct 8, 2024
7e03c29
Fix missing provider type
sphilipse Oct 8, 2024
e1a118c
Merge branch 'main' into search-assistant-implement-frontend
sphilipse Oct 9, 2024
6a10197
Merge branch 'main' into search-assistant-implement-frontend
sphilipse Oct 9, 2024
cbbb6cc
Replace \? with !
sphilipse Oct 10, 2024
8092482
Merge branch 'main' into search-assistant-implement-frontend
sphilipse Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ x-pack/plugins/actions @elastic/response-ops
x-pack/test/alerting_api_integration/common/plugins/actions_simulators @elastic/response-ops
packages/kbn-actions-types @elastic/response-ops
src/plugins/advanced_settings @elastic/appex-sharedux @elastic/kibana-management
x-pack/packages/kbn-ai-assistant @elastic/search-kibana
src/plugins/ai_assistant_management/selection @elastic/obs-knowledge-team
x-pack/packages/ml/aiops_change_point_detection @elastic/ml-ui
x-pack/packages/ml/aiops_common @elastic/ml-ui
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"@kbn/actions-simulators-plugin": "link:x-pack/test/alerting_api_integration/common/plugins/actions_simulators",
"@kbn/actions-types": "link:packages/kbn-actions-types",
"@kbn/advanced-settings-plugin": "link:src/plugins/advanced_settings",
"@kbn/ai-assistant": "link:x-pack/packages/kbn-ai-assistant",
"@kbn/ai-assistant-management-plugin": "link:src/plugins/ai_assistant_management/selection",
"@kbn/aiops-change-point-detection": "link:x-pack/packages/ml/aiops_change_point_detection",
"@kbn/aiops-common": "link:x-pack/packages/ml/aiops_common",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
'xpack.rollup.ui.enabled (boolean?)',
'xpack.saved_object_tagging.cache_refresh_interval (duration?)',
'xpack.search.homepage.ui.enabled (boolean?)',
'xpack.searchAssistant.ui.enabled (boolean?)',
'xpack.searchInferenceEndpoints.ui.enabled (boolean?)',
'xpack.searchPlayground.ui.enabled (boolean?)',
'xpack.security.loginAssistanceMessage (string?)',
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"@kbn/actions-types/*": ["packages/kbn-actions-types/*"],
"@kbn/advanced-settings-plugin": ["src/plugins/advanced_settings"],
"@kbn/advanced-settings-plugin/*": ["src/plugins/advanced_settings/*"],
"@kbn/ai-assistant": ["x-pack/packages/kbn-ai-assistant"],
"@kbn/ai-assistant/*": ["x-pack/packages/kbn-ai-assistant/*"],
"@kbn/ai-assistant-management-plugin": ["src/plugins/ai_assistant_management/selection"],
"@kbn/ai-assistant-management-plugin/*": ["src/plugins/ai_assistant_management/selection/*"],
"@kbn/aiops-change-point-detection": ["x-pack/packages/ml/aiops_change_point_detection"],
Expand Down
67 changes: 51 additions & 16 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"packages/ml/aiops_log_rate_analysis",
"plugins/aiops"
],
"xpack.aiAssistant": "packages/kbn-ai-assistant",
"xpack.alerting": "plugins/alerting",
"xpack.eventLog": "plugins/event_log",
"xpack.stackAlerts": "plugins/stack_alerts",
Expand Down Expand Up @@ -45,9 +46,15 @@
"xpack.dataVisualizer": "plugins/data_visualizer",
"xpack.exploratoryView": "plugins/observability_solution/exploratory_view",
"xpack.fileUpload": "plugins/file_upload",
"xpack.globalSearch": ["plugins/global_search"],
"xpack.globalSearchBar": ["plugins/global_search_bar"],
"xpack.graph": ["plugins/graph"],
"xpack.globalSearch": [
"plugins/global_search"
],
"xpack.globalSearchBar": [
"plugins/global_search_bar"
],
"xpack.graph": [
"plugins/graph"
],
"xpack.grokDebugger": "plugins/grokdebugger",
"xpack.idxMgmt": "plugins/index_management",
"xpack.idxMgmtPackage": "packages/index-management",
Expand All @@ -69,9 +76,13 @@
"xpack.licenseMgmt": "plugins/license_management",
"xpack.licensing": "plugins/licensing",
"xpack.lists": "plugins/lists",
"xpack.logstash": ["plugins/logstash"],
"xpack.logstash": [
"plugins/logstash"
],
"xpack.main": "legacy/plugins/xpack_main",
"xpack.maps": ["plugins/maps"],
"xpack.maps": [
"plugins/maps"
],
"xpack.metricsData": "plugins/observability_solution/metrics_data_access",
"xpack.ml": [
"packages/ml/anomaly_utils",
Expand All @@ -86,7 +97,9 @@
"packages/ml/ui_actions",
"plugins/ml"
],
"xpack.monitoring": ["plugins/monitoring"],
"xpack.monitoring": [
"plugins/monitoring"
],
"xpack.observability": "plugins/observability_solution/observability",
"xpack.observabilityAiAssistant": [
"plugins/observability_solution/observability_ai_assistant",
Expand All @@ -96,12 +109,21 @@
"xpack.observabilityLogsExplorer": "plugins/observability_solution/observability_logs_explorer",
"xpack.observability_onboarding": "plugins/observability_solution/observability_onboarding",
"xpack.observabilityShared": "plugins/observability_solution/observability_shared",
"xpack.osquery": ["plugins/osquery"],
"xpack.osquery": [
"plugins/osquery"
],
"xpack.painlessLab": "plugins/painless_lab",
"xpack.profiling": ["plugins/observability_solution/profiling"],
"xpack.profiling": [
"plugins/observability_solution/profiling"
],
"xpack.remoteClusters": "plugins/remote_clusters",
"xpack.reporting": ["plugins/reporting"],
"xpack.rollupJobs": ["packages/rollup", "plugins/rollup"],
"xpack.reporting": [
"plugins/reporting"
],
"xpack.rollupJobs": [
"packages/rollup",
"plugins/rollup"
],
"xpack.runtimeFields": "plugins/runtime_fields",
"xpack.screenshotting": "plugins/screenshotting",
"xpack.searchSharedUI": "packages/search/shared_ui",
Expand All @@ -112,7 +134,10 @@
"xpack.searchInferenceEndpoints": "plugins/search_inference_endpoints",
"xpack.searchAssistant": "plugins/search_assistant",
"xpack.searchProfiler": "plugins/searchprofiler",
"xpack.security": ["plugins/security", "packages/security"],
"xpack.security": [
"plugins/security",
"packages/security"
],
"xpack.server": "legacy/server",
"xpack.serverless": "plugins/serverless",
"xpack.serverlessSearch": "plugins/serverless_search",
Expand All @@ -124,20 +149,30 @@
"xpack.slo": "plugins/observability_solution/slo",
"xpack.snapshotRestore": "plugins/snapshot_restore",
"xpack.spaces": "plugins/spaces",
"xpack.savedObjectsTagging": ["plugins/saved_objects_tagging"],
"xpack.savedObjectsTagging": [
"plugins/saved_objects_tagging"
],
"xpack.taskManager": "legacy/plugins/task_manager",
"xpack.threatIntelligence": "plugins/threat_intelligence",
"xpack.timelines": "plugins/timelines",
"xpack.transform": "plugins/transform",
"xpack.triggersActionsUI": "plugins/triggers_actions_ui",
"xpack.upgradeAssistant": "plugins/upgrade_assistant",
"xpack.uptime": ["plugins/observability_solution/uptime"],
"xpack.synthetics": ["plugins/observability_solution/synthetics"],
"xpack.ux": ["plugins/observability_solution/ux"],
"xpack.uptime": [
"plugins/observability_solution/uptime"
],
"xpack.synthetics": [
"plugins/observability_solution/synthetics"
],
"xpack.ux": [
"plugins/observability_solution/ux"
],
"xpack.urlDrilldown": "plugins/drilldowns/url_drilldown",
"xpack.watcher": "plugins/watcher"
},
"exclude": ["examples"],
"exclude": [
"examples"
],
"translations": [
"@kbn/translations-plugin/translations/zh-CN.json",
"@kbn/translations-plugin/translations/ja-JP.json",
Expand Down
3 changes: 3 additions & 0 deletions x-pack/packages/kbn-ai-assistant/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/ai-assistant

Provides components, types and context to render the AI Assistant in plugins.
7 changes: 7 additions & 0 deletions x-pack/packages/kbn-ai-assistant/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* 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.
*/
export * from './src';
18 changes: 18 additions & 0 deletions x-pack/packages/kbn-ai-assistant/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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.
*/

module.exports = {
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/packages/kbn_ai_assistant_src',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'<rootDir>/x-pack/packages/kbn-ai-assistant/src/**/*.{ts,tsx}',
'!<rootDir>/x-pack/packages/kbn-ai-assistant/src/*.test.{ts,tsx}',
],
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/packages/kbn-ai-assistant'],
};
5 changes: 5 additions & 0 deletions x-pack/packages/kbn-ai-assistant/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "@kbn/ai-assistant",
"owner": "@elastic/search-kibana",
"type": "shared-browser"
}
7 changes: 7 additions & 0 deletions x-pack/packages/kbn-ai-assistant/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@kbn/ai-assistant",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0",
"sideEffects": false
}
9 changes: 9 additions & 0 deletions x-pack/packages/kbn-ai-assistant/setup_tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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.
*/

// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ export function AskAssistantButton({
variant,
onClick,
}: AskAssistantButtonProps) {
const buttonLabel = i18n.translate(
'xpack.observabilityAiAssistant.askAssistantButton.buttonLabel',
{
defaultMessage: 'Ask Assistant',
}
);
const buttonLabel = i18n.translate('xpack.aiAssistant.askAssistantButton.buttonLabel', {
defaultMessage: 'Ask Assistant',
});

const aiAssistantLabel = i18n.translate('xpack.aiAssistant.aiAssistantLabel', {
defaultMessage: 'AI Assistant',
});

switch (variant) {
case 'basic':
Expand Down Expand Up @@ -84,23 +85,13 @@ export function AskAssistantButton({
return (
<EuiToolTip
position="top"
title={i18n.translate('xpack.observabilityAiAssistant.askAssistantButton.popoverTitle', {
defaultMessage: 'AI Assistant for Observability',
title={aiAssistantLabel}
content={i18n.translate('xpack.aiAssistant.askAssistantButton.popoverContent', {
defaultMessage: 'Get insights into your data with the Elastic Assistant',
})}
content={i18n.translate(
'xpack.observabilityAiAssistant.askAssistantButton.popoverContent',
{
defaultMessage: 'Get insights into your data with the Elastic Assistant',
}
)}
>
<EuiButtonIcon
aria-label={i18n.translate(
'xpack.observabilityAiAssistant.askAssistantButton.popoverTitle',
{
defaultMessage: 'AI Assistant for Observability',
}
)}
aria-label={aiAssistantLabel}
data-test-subj="observabilityAiAssistantAskAssistantButtonButtonIcon"
display={fill ? 'fill' : 'base'}
iconType="sparkles"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export function HideExpandConversationListButton(props: HideExpandConversationLi
{...props}
>
{props.isExpanded
? i18n.translate('xpack.observabilityAiAssistant.hideExpandConversationButton.hide', {
? i18n.translate('xpack.aiAssistant.hideExpandConversationButton.hide', {
defaultMessage: 'Hide chats',
})
: i18n.translate('xpack.observabilityAiAssistant.hideExpandConversationButton.show', {
: i18n.translate('xpack.aiAssistant.hideExpandConversationButton.show', {
defaultMessage: 'Show chats',
})}
</EuiButtonEmpty>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function NewChatButton(
iconType="newChat"
{...nextProps}
>
{i18n.translate('xpack.observabilityAiAssistant.newChatButton', {
{i18n.translate('xpack.aiAssistant.newChatButton', {
defaultMessage: 'New chat',
})}
</EuiButton>
Expand Down
Loading