= {
- createGroup: true,
- editGroup: true,
-};
-
-export function useServiceGroupsTour(type: TourType) {
- const [tourEnabled, setTourEnabled] = useLocalStorage('apm.serviceGroupsTour', INITIAL_STATE);
-
- return {
- tourEnabled: tourEnabled[type],
- dismissTour: () =>
- setTourEnabled({
- ...tourEnabled,
- [type]: false,
- }),
- };
-}
diff --git a/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/welcome_modal.tsx b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/welcome_modal.tsx
index 1bfab81231ea0..deba472b401c5 100644
--- a/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/welcome_modal.tsx
+++ b/x-pack/plugins/observability_solution/apm/public/components/shared/entity_enablement/welcome_modal.tsx
@@ -95,7 +95,7 @@ export function Welcome({
{i18n.translate('xpack.apm.welcome.body', {
defaultMessage:
- 'You can now see services detected from logs alongside services instrumented with APM our new service inventory so you can view all of your services in a single place.',
+ 'You can now see services detected from logs alongside your APM-instrumented services in a single inventory so you can view all of your services in one place.',
})}
diff --git a/x-pack/plugins/search_playground/public/components/chat.tsx b/x-pack/plugins/search_playground/public/components/chat.tsx
index cc4c0b1ccdff2..b27955c326d23 100644
--- a/x-pack/plugins/search_playground/public/components/chat.tsx
+++ b/x-pack/plugins/search_playground/public/components/chat.tsx
@@ -56,7 +56,7 @@ export const Chat = () => {
handleSubmit,
getValues,
} = useFormContext();
- const { messages, append, stop: stopRequest, setMessages, reload, error } = useChat();
+ const { messages, append, stop: stopRequest, setMessages, reload } = useChat();
const messagesRef = useAutoBottomScroll();
const [isRegenerating, setIsRegenerating] = useState(false);
const usageTracker = useUsageTracker();
@@ -88,8 +88,8 @@ export const Chat = () => {
);
const isToolBarActionsDisabled = useMemo(
- () => chatMessages.length <= 1 || !!error || isRegenerating || isSubmitting,
- [chatMessages, error, isSubmitting, isRegenerating]
+ () => chatMessages.length <= 1 || isRegenerating || isSubmitting,
+ [chatMessages, isSubmitting, isRegenerating]
);
const regenerateMessages = async () => {
diff --git a/x-pack/plugins/search_playground/server/lib/conversational_chain.test.ts b/x-pack/plugins/search_playground/server/lib/conversational_chain.test.ts
index 88a6052a0bbf7..13959e4455c29 100644
--- a/x-pack/plugins/search_playground/server/lib/conversational_chain.test.ts
+++ b/x-pack/plugins/search_playground/server/lib/conversational_chain.test.ts
@@ -305,6 +305,45 @@ describe('conversational chain', () => {
});
}, 10000);
+ it('should omit the system messages in chat', async () => {
+ await createTestChain({
+ responses: ['the final answer'],
+ chat: [
+ {
+ id: '1',
+ role: MessageRole.user,
+ content: 'what is the work from home policy?',
+ },
+ {
+ id: '2',
+ role: MessageRole.system,
+ content: 'Error occurred. Please try again.',
+ },
+ ],
+ expectedFinalAnswer: 'the final answer',
+ expectedDocs: [
+ {
+ documents: [
+ { metadata: { _id: '1', _index: 'index' }, pageContent: 'value' },
+ { metadata: { _id: '1', _index: 'website' }, pageContent: 'value2' },
+ ],
+ type: 'retrieved_docs',
+ },
+ ],
+ expectedTokens: [
+ { type: 'context_token_count', count: 15 },
+ { type: 'prompt_token_count', count: 28 },
+ ],
+ expectedSearchRequest: [
+ {
+ method: 'POST',
+ path: '/index,website/_search',
+ body: { query: { match: { field: 'what is the work from home policy?' } }, size: 3 },
+ },
+ ],
+ });
+ }, 10000);
+
it('should cope with quotes in the query', async () => {
await createTestChain({
responses: ['rewrite "the" question', 'the final answer'],
diff --git a/x-pack/plugins/search_playground/server/lib/conversational_chain.ts b/x-pack/plugins/search_playground/server/lib/conversational_chain.ts
index f7b1634dd27b1..c63481e93c98f 100644
--- a/x-pack/plugins/search_playground/server/lib/conversational_chain.ts
+++ b/x-pack/plugins/search_playground/server/lib/conversational_chain.ts
@@ -18,7 +18,7 @@ import { createStreamDataTransformer, experimental_StreamData } from 'ai';
import { BaseLanguageModel } from '@langchain/core/language_models/base';
import { BaseMessage } from '@langchain/core/messages';
import { HumanMessage, AIMessage } from '@langchain/core/messages';
-import { ChatMessage, MessageRole } from '../types';
+import { ChatMessage } from '../types';
import { ElasticsearchRetriever } from './elasticsearch_retriever';
import { renderTemplate } from '../utils/render_template';
@@ -49,25 +49,28 @@ interface ContextInputs {
question: string;
}
-const getSerialisedMessages = (chatHistory: ChatMessage[]) => {
+const getSerialisedMessages = (chatHistory: BaseMessage[]) => {
const formattedDialogueTurns = chatHistory.map((message) => {
- if (message.role === MessageRole.user) {
+ if (message instanceof HumanMessage) {
return `Human: ${message.content}`;
- } else if (message.role === MessageRole.assistant) {
+ } else if (message instanceof AIMessage) {
return `Assistant: ${message.content}`;
}
});
return formattedDialogueTurns.join('\n');
};
-const getMessages = (chatHistory: ChatMessage[]) => {
- return chatHistory.map((message) => {
- if (message.role === 'human') {
- return new HumanMessage(message.content);
- } else {
- return new AIMessage(message.content);
- }
- });
+export const getMessages = (chatHistory: ChatMessage[]) => {
+ return chatHistory
+ .map((message) => {
+ if (message.role === 'human') {
+ return new HumanMessage(message.content);
+ } else if (message.role === 'assistant') {
+ return new AIMessage(message.content);
+ }
+ return null;
+ })
+ .filter((message): message is BaseMessage => message !== null);
};
const buildContext = (docs: Document[]) => {
@@ -141,8 +144,9 @@ class ConversationalChainFn {
const data = new experimental_StreamData();
const messages = msgs ?? [];
- const previousMessages = messages.slice(0, -1);
- const question = messages[messages.length - 1]!.content;
+ const lcMessages = getMessages(messages);
+ const previousMessages = lcMessages.slice(0, -1);
+ const question = lcMessages[lcMessages.length - 1]!.content;
const retrievedDocs: Document[] = [];
let retrievalChain: Runnable = RunnableLambda.from(() => '');
@@ -165,7 +169,7 @@ class ConversationalChainFn {
return input.question;
});
- if (previousMessages.length > 0) {
+ if (lcMessages.length > 1) {
const questionRewritePromptTemplate = PromptTemplate.fromTemplate(
this.options.questionRewritePrompt
);
@@ -184,7 +188,6 @@ class ConversationalChainFn {
});
}
- const lcMessages = getMessages(messages);
const prompt = ChatPromptTemplate.fromMessages([
SystemMessagePromptTemplate.fromTemplate(this.options.prompt),
...lcMessages,
diff --git a/x-pack/plugins/search_playground/server/routes.ts b/x-pack/plugins/search_playground/server/routes.ts
index de26776816f33..a71e650a8dae8 100644
--- a/x-pack/plugins/search_playground/server/routes.ts
+++ b/x-pack/plugins/search_playground/server/routes.ts
@@ -31,7 +31,7 @@ export function createRetriever(esQuery: string) {
const query = JSON.parse(replacedQuery);
return query;
} catch (e) {
- throw Error(e);
+ throw Error("Failed to parse the Elasticsearch Query. Check Query to make sure it's valid.");
}
};
}
diff --git a/x-pack/plugins/security_solution/scripts/openapi/bundle_detections.js b/x-pack/plugins/security_solution/scripts/openapi/bundle_detections.js
index e2df0d47f5b47..f79437c33222c 100644
--- a/x-pack/plugins/security_solution/scripts/openapi/bundle_detections.js
+++ b/x-pack/plugins/security_solution/scripts/openapi/bundle_detections.js
@@ -11,34 +11,36 @@ const { join, resolve } = require('path');
const ROOT = resolve(__dirname, '../..');
-bundle({
- sourceGlob: join(ROOT, 'common/api/detection_engine/**/*.schema.yaml'),
- outputFilePath: join(
- ROOT,
- 'docs/openapi/serverless/security_solution_detections_api_{version}.bundled.schema.yaml'
- ),
- options: {
- includeLabels: ['serverless'],
- specInfo: {
- title: 'Security Solution Detections API (Elastic Cloud Serverless)',
- description:
- 'You can create rules that automatically turn events and external alerts sent to Elastic Security into detection alerts. These alerts are displayed on the Detections page.',
+(async () => {
+ await bundle({
+ sourceGlob: join(ROOT, 'common/api/detection_engine/**/*.schema.yaml'),
+ outputFilePath: join(
+ ROOT,
+ 'docs/openapi/serverless/security_solution_detections_api_{version}.bundled.schema.yaml'
+ ),
+ options: {
+ includeLabels: ['serverless'],
+ specInfo: {
+ title: 'Security Solution Detections API (Elastic Cloud Serverless)',
+ description:
+ 'You can create rules that automatically turn events and external alerts sent to Elastic Security into detection alerts. These alerts are displayed on the Detections page.',
+ },
},
- },
-});
+ });
-bundle({
- sourceGlob: join(ROOT, 'common/api/detection_engine/**/*.schema.yaml'),
- outputFilePath: join(
- ROOT,
- 'docs/openapi/ess/security_solution_detections_api_{version}.bundled.schema.yaml'
- ),
- options: {
- includeLabels: ['ess'],
- specInfo: {
- title: 'Security Solution Detections API (Elastic Cloud and self-hosted)',
- description:
- 'You can create rules that automatically turn events and external alerts sent to Elastic Security into detection alerts. These alerts are displayed on the Detections page.',
+ await bundle({
+ sourceGlob: join(ROOT, 'common/api/detection_engine/**/*.schema.yaml'),
+ outputFilePath: join(
+ ROOT,
+ 'docs/openapi/ess/security_solution_detections_api_{version}.bundled.schema.yaml'
+ ),
+ options: {
+ includeLabels: ['ess'],
+ specInfo: {
+ title: 'Security Solution Detections API (Elastic Cloud and self-hosted)',
+ description:
+ 'You can create rules that automatically turn events and external alerts sent to Elastic Security into detection alerts. These alerts are displayed on the Detections page.',
+ },
},
- },
-});
+ });
+})();
diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json
index 62ce477ecca04..a528782abc0ec 100644
--- a/x-pack/plugins/translations/translations/fr-FR.json
+++ b/x-pack/plugins/translations/translations/fr-FR.json
@@ -10079,13 +10079,6 @@
"xpack.apm.serviceGroups.selectServicesList.nameColumnLabel": "Nom",
"xpack.apm.serviceGroups.selectServicesList.notFoundLabel": "Aucun service disponible dans les dernières 24 heures. Vous pouvez toujours créer le groupe et les services qui correspondent à votre requête.",
"xpack.apm.serviceGroups.sortLabel": "Trier",
- "xpack.apm.serviceGroups.tour.content.link": "Découvrez plus d'informations dans le {docsLink}.",
- "xpack.apm.serviceGroups.tour.content.link.docs": "documents",
- "xpack.apm.serviceGroups.tour.createGroups.content": "Regroupez les services afin de créer des vues d'inventaire organisées qui éliminent le bruit et simplifient les enquêtes sur les services. Les groupes sont spécifiques à l'espace Kibana et sont disponibles pour tous les utilisateurs ayant un accès approprié.",
- "xpack.apm.serviceGroups.tour.createGroups.title": "Présentation des groupes de services",
- "xpack.apm.serviceGroups.tour.dismiss": "Rejeter",
- "xpack.apm.serviceGroups.tour.editGroups.content": "Utilisez l'option de modification pour changer le nom, la requête ou les détails de ce groupe de services.",
- "xpack.apm.serviceGroups.tour.editGroups.title": "Modifier ce groupe de services",
"xpack.apm.serviceHealthStatus.critical": "Critique",
"xpack.apm.serviceHealthStatus.healthy": "Intègre",
"xpack.apm.serviceHealthStatus.unknown": "Inconnu",
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index bba91c32ffc4c..6a3ba57b57fae 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -10042,13 +10042,6 @@
"xpack.apm.serviceGroups.selectServicesList.nameColumnLabel": "名前",
"xpack.apm.serviceGroups.selectServicesList.notFoundLabel": "過去24時間以内にサービスはありません。グループを作成できます。クエリと一致するサービスが追加されます。",
"xpack.apm.serviceGroups.sortLabel": "並べ替え",
- "xpack.apm.serviceGroups.tour.content.link": "詳細は{docsLink}をご覧ください。",
- "xpack.apm.serviceGroups.tour.content.link.docs": "ドキュメント",
- "xpack.apm.serviceGroups.tour.createGroups.content": "サービスをグループ化し、ノイズを減らした編集済みのインベントリビューを作成し、サービス全体での調査を簡素化します。グループはKibanaスペース固有であり、適切なアクセス権のあるユーザーが使用できます。",
- "xpack.apm.serviceGroups.tour.createGroups.title": "サービスグループの概要",
- "xpack.apm.serviceGroups.tour.dismiss": "閉じる",
- "xpack.apm.serviceGroups.tour.editGroups.content": "編集オプションを使用して、名前、クエリ、このサービスグループの詳細を変更します。",
- "xpack.apm.serviceGroups.tour.editGroups.title": "このサービスグループを編集",
"xpack.apm.serviceHealthStatus.critical": "重大",
"xpack.apm.serviceHealthStatus.healthy": "正常",
"xpack.apm.serviceHealthStatus.unknown": "不明",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index b2fb6ec9b4f02..4051e74ceb544 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -10095,13 +10095,6 @@
"xpack.apm.serviceGroups.selectServicesList.nameColumnLabel": "名称",
"xpack.apm.serviceGroups.selectServicesList.notFoundLabel": "过去 24 小时内没有服务可用。您仍然可以创建该组,并且会添加与您的查询匹配的服务。",
"xpack.apm.serviceGroups.sortLabel": "排序",
- "xpack.apm.serviceGroups.tour.content.link": "在{docsLink}中了解详情。",
- "xpack.apm.serviceGroups.tour.content.link.docs": "文档",
- "xpack.apm.serviceGroups.tour.createGroups.content": "将服务组合在一起以构建策展库存视图,进而跨服务消除噪音并简化调查。组特定于 Kibana 工作区,并且可用于任何具有适当访问权限的用户。",
- "xpack.apm.serviceGroups.tour.createGroups.title": "服务组简介",
- "xpack.apm.serviceGroups.tour.dismiss": "关闭",
- "xpack.apm.serviceGroups.tour.editGroups.content": "使用编辑选项更改此服务组的名称、查询或详情。",
- "xpack.apm.serviceGroups.tour.editGroups.title": "编辑此服务组",
"xpack.apm.serviceHealthStatus.critical": "紧急",
"xpack.apm.serviceHealthStatus.healthy": "运行正常",
"xpack.apm.serviceHealthStatus.unknown": "未知",