diff --git a/packages/kbn-playground/public/components/chat.tsx b/packages/kbn-playground/public/components/chat.tsx index cc91fa531c26e..f27db7cd6cda1 100644 --- a/packages/kbn-playground/public/components/chat.tsx +++ b/packages/kbn-playground/public/components/chat.tsx @@ -23,7 +23,7 @@ import { v4 as uuidv4 } from 'uuid'; import { i18n } from '@kbn/i18n'; import { ChatSidebar } from './chat_sidebar'; -import { useChat } from '../hooks/useChat'; +import { useChat } from '../hooks/use_chat'; import { ChatForm, ChatFormFields, MessageRole, SummarizationModelName } from '../../types'; import { MessageList } from './message_list/message_list'; @@ -31,7 +31,7 @@ import { QuestionInput } from './question_input'; import { StartNewChat } from './start_new_chat'; import { TelegramIcon } from './telegram_icon'; -import { transformFromChatMessages } from '../utils/transformToMessages'; +import { transformFromChatMessages } from '../utils/transform_to_messages'; export const Chat = () => { const [showStartPage, setShowStartPage] = useState(true); diff --git a/packages/kbn-playground/public/components/sources_panel/add_indices_field.tsx b/packages/kbn-playground/public/components/sources_panel/add_indices_field.tsx index 1b8c2ba96e34c..061d9e3e3abbb 100644 --- a/packages/kbn-playground/public/components/sources_panel/add_indices_field.tsx +++ b/packages/kbn-playground/public/components/sources_panel/add_indices_field.tsx @@ -11,7 +11,7 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiComboBoxOptionOption } from '@elastic/eui/src/components/combo_box/types'; import { IndexName } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { useQueryIndices } from '../../hooks/useQueryIndices'; +import { useQueryIndices } from '../../hooks/use_query_indices'; interface AddIndicesFieldProps { selectedIndices: IndexName[]; diff --git a/packages/kbn-playground/public/components/sources_panel/create_index_callout.tsx b/packages/kbn-playground/public/components/sources_panel/create_index_callout.tsx index 5660b3aea92f1..26b276368e432 100644 --- a/packages/kbn-playground/public/components/sources_panel/create_index_callout.tsx +++ b/packages/kbn-playground/public/components/sources_panel/create_index_callout.tsx @@ -10,7 +10,7 @@ import { EuiButton, EuiCallOut, EuiSpacer, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import React from 'react'; -import { useChatContext } from '../../hooks/useChatContext'; +import { useChatContext } from '../../hooks/use_chat_context'; export const CreateIndexCallout: React.FC = () => { const { navigateToIndexPage } = useChatContext(); diff --git a/packages/kbn-playground/public/components/sources_panel/sources_panel_for_start_chat.tsx b/packages/kbn-playground/public/components/sources_panel/sources_panel_for_start_chat.tsx index e1d0f7e23e451..a53f40fe9a083 100644 --- a/packages/kbn-playground/public/components/sources_panel/sources_panel_for_start_chat.tsx +++ b/packages/kbn-playground/public/components/sources_panel/sources_panel_for_start_chat.tsx @@ -14,10 +14,10 @@ import { AddIndicesField } from './add_indices_field'; import { IndicesTable } from './indices_table'; import { StartChatPanel } from '../start_chat_panel'; import { CreateIndexCallout } from './create_index_callout'; -import { useSourceIndicesField } from '../../hooks/useSourceIndicesField'; -import { useQueryIndices } from '../../hooks/useQueryIndices'; +import { useSourceIndicesField } from '../../hooks/use_source_indices_field'; +import { useQueryIndices } from '../../hooks/use_query_indices'; import { ChatFormFields } from '../../../types'; -import { useIndicesFields } from '../../hooks/useIndicesFields'; +import { useIndicesFields } from '../../hooks/use_indices_fields'; import { createQuery, getDefaultQueryFields } from '../../utils/create_query'; export const SourcesPanelForStartChat: React.FC = () => { diff --git a/packages/kbn-playground/public/components/sources_panel/sources_panel_sidebar.tsx b/packages/kbn-playground/public/components/sources_panel/sources_panel_sidebar.tsx index de9bb13022935..d569ac214593d 100644 --- a/packages/kbn-playground/public/components/sources_panel/sources_panel_sidebar.tsx +++ b/packages/kbn-playground/public/components/sources_panel/sources_panel_sidebar.tsx @@ -10,8 +10,8 @@ import React, { useEffect } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiCallOut, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { useController } from 'react-hook-form'; -import { useSourceIndicesField } from '../../hooks/useSourceIndicesField'; -import { useIndicesFields } from '../../hooks/useIndicesFields'; +import { useSourceIndicesField } from '../../hooks/use_source_indices_field'; +import { useIndicesFields } from '../../hooks/use_indices_fields'; import { createQuery, getDefaultQueryFields } from '../../utils/create_query'; import { ChatFormFields } from '../../../types'; import { AddIndicesField } from './add_indices_field'; diff --git a/packages/kbn-playground/public/components/view_code/create_api_key_form.tsx b/packages/kbn-playground/public/components/view_code/create_api_key_form.tsx index 7f359850e039f..25dbc4ef98c3b 100644 --- a/packages/kbn-playground/public/components/view_code/create_api_key_form.tsx +++ b/packages/kbn-playground/public/components/view_code/create_api_key_form.tsx @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { FormattedMessage } from '@kbn/i18n-react'; import { AIPlaygroundPluginStartDeps } from '../../../types'; -import { useCreateApiKeyQuery } from '../../hooks/useCreateApiKeyQuery'; +import { useCreateApiKeyQuery } from '../../hooks/use_create_api_key_query'; enum ApiKeyFormFields { Name = 'name', diff --git a/packages/kbn-playground/public/components/view_query/view_query_action.tsx b/packages/kbn-playground/public/components/view_query/view_query_action.tsx index 25b0e4d9d767a..6430a617c5121 100644 --- a/packages/kbn-playground/public/components/view_query/view_query_action.tsx +++ b/packages/kbn-playground/public/components/view_query/view_query_action.tsx @@ -27,7 +27,7 @@ import { } from '@elastic/eui'; import { useController, useFormContext } from 'react-hook-form'; import { ChatForm, ChatFormFields } from '../../../types'; -import { useIndicesFields } from '../../hooks/useIndicesFields'; +import { useIndicesFields } from '../../hooks/use_indices_fields'; import { createQuery, getDefaultQueryFields } from '../../utils/create_query'; export const ViewQueryAction: React.FC = () => { diff --git a/packages/kbn-playground/public/hooks/useAIAssistChat.ts b/packages/kbn-playground/public/hooks/use_ai_assist_chat.ts similarity index 100% rename from packages/kbn-playground/public/hooks/useAIAssistChat.ts rename to packages/kbn-playground/public/hooks/use_ai_assist_chat.ts diff --git a/packages/kbn-playground/public/hooks/useChat.tsx b/packages/kbn-playground/public/hooks/use_chat.ts similarity index 94% rename from packages/kbn-playground/public/hooks/useChat.tsx rename to packages/kbn-playground/public/hooks/use_chat.ts index b404f81076660..b5bc49e063826 100644 --- a/packages/kbn-playground/public/hooks/useChat.tsx +++ b/packages/kbn-playground/public/hooks/use_chat.ts @@ -7,7 +7,7 @@ */ import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { useAIAssistChat } from './useAIAssistChat'; +import { useAIAssistChat } from './use_ai_assist_chat'; import { AIPlaygroundPluginStartDeps, UseChatHelpers } from '../../types'; export const useChat = (): UseChatHelpers => { diff --git a/packages/kbn-playground/public/hooks/useChatContext.ts b/packages/kbn-playground/public/hooks/use_chat_context.ts similarity index 100% rename from packages/kbn-playground/public/hooks/useChatContext.ts rename to packages/kbn-playground/public/hooks/use_chat_context.ts diff --git a/packages/kbn-playground/public/hooks/useCreateApiKeyQuery.ts b/packages/kbn-playground/public/hooks/use_create_api_key_query.ts similarity index 100% rename from packages/kbn-playground/public/hooks/useCreateApiKeyQuery.ts rename to packages/kbn-playground/public/hooks/use_create_api_key_query.ts diff --git a/packages/kbn-playground/public/hooks/useIndicesFields.tsx b/packages/kbn-playground/public/hooks/use_indices_fields.ts similarity index 100% rename from packages/kbn-playground/public/hooks/useIndicesFields.tsx rename to packages/kbn-playground/public/hooks/use_indices_fields.ts diff --git a/packages/kbn-playground/public/hooks/useQueryIndices.tsx b/packages/kbn-playground/public/hooks/use_query_indices.ts similarity index 100% rename from packages/kbn-playground/public/hooks/useQueryIndices.tsx rename to packages/kbn-playground/public/hooks/use_query_indices.ts diff --git a/packages/kbn-playground/public/hooks/useSourceIndicesField.ts b/packages/kbn-playground/public/hooks/use_source_indices_field.ts similarity index 100% rename from packages/kbn-playground/public/hooks/useSourceIndicesField.ts rename to packages/kbn-playground/public/hooks/use_source_indices_field.ts diff --git a/packages/kbn-playground/public/utils/transformAnnotationToDoc.ts b/packages/kbn-playground/public/utils/transform_annotation_to_doc.ts similarity index 100% rename from packages/kbn-playground/public/utils/transformAnnotationToDoc.ts rename to packages/kbn-playground/public/utils/transform_annotation_to_doc.ts diff --git a/packages/kbn-playground/public/utils/transformToMessages.ts b/packages/kbn-playground/public/utils/transform_to_messages.ts similarity index 94% rename from packages/kbn-playground/public/utils/transformToMessages.ts rename to packages/kbn-playground/public/utils/transform_to_messages.ts index acf66455ca230..829e7e13f8b9f 100644 --- a/packages/kbn-playground/public/utils/transformToMessages.ts +++ b/packages/kbn-playground/public/utils/transform_to_messages.ts @@ -7,7 +7,7 @@ */ import { AIMessage, Message, MessageRole, UseChatHelpers } from '../../types'; -import { transformAnnotationToDoc } from './transformAnnotationToDoc'; +import { transformAnnotationToDoc } from './transform_annotation_to_doc'; export const transformFromChatMessages = (messages: UseChatHelpers['messages']): Message[] => messages.map(({ id, content, createdAt, role, annotations }) => { diff --git a/packages/kbn-playground/server/routes.ts b/packages/kbn-playground/server/routes.ts index 54a9556829aeb..77349f9f975ab 100644 --- a/packages/kbn-playground/server/routes.ts +++ b/packages/kbn-playground/server/routes.ts @@ -13,7 +13,7 @@ import { Logger } from '@kbn/logging'; import { IRouter, RequestHandler } from '@kbn/core/server'; import { fetchFields } from './utils/fetch_query_source_fields'; import { AssistClientOptionsWithClient, createAssist as Assist } from './utils/assist'; -import { ConversationalChain } from './utils/conversationalChain'; +import { ConversationalChain } from './utils/conversational_chain'; import { Prompt } from './utils/prompt'; export function registerPlaygroundRoutes( diff --git a/packages/kbn-playground/server/utils/conversationalChain.ts b/packages/kbn-playground/server/utils/conversational_chain.ts similarity index 97% rename from packages/kbn-playground/server/utils/conversationalChain.ts rename to packages/kbn-playground/server/utils/conversational_chain.ts index 72b23ae0aa675..29ee4f2ee6b19 100644 --- a/packages/kbn-playground/server/utils/conversationalChain.ts +++ b/packages/kbn-playground/server/utils/conversational_chain.ts @@ -18,11 +18,11 @@ import { experimental_StreamData, Message as VercelChatMessage, } from 'ai'; -import { ElasticsearchRetriever } from './elasticsearchRetriever'; -import { renderTemplate } from './renderTemplate'; +import { ElasticsearchRetriever } from './elasticsearch_retriever'; +import { renderTemplate } from './render_template'; import { AssistClient } from './assist'; -import { getCitations } from './getCitations'; +import { getCitations } from './get_citations'; interface RAGOptions { index: string; diff --git a/packages/kbn-playground/server/utils/elasticsearchRetriever.ts b/packages/kbn-playground/server/utils/elasticsearch_retriever.ts similarity index 100% rename from packages/kbn-playground/server/utils/elasticsearchRetriever.ts rename to packages/kbn-playground/server/utils/elasticsearch_retriever.ts diff --git a/packages/kbn-playground/server/utils/getCitations.test.ts b/packages/kbn-playground/server/utils/get_citations.test.ts similarity index 96% rename from packages/kbn-playground/server/utils/getCitations.test.ts rename to packages/kbn-playground/server/utils/get_citations.test.ts index 7bc88448b34ce..54e9908a0b336 100644 --- a/packages/kbn-playground/server/utils/getCitations.test.ts +++ b/packages/kbn-playground/server/utils/get_citations.test.ts @@ -7,7 +7,7 @@ */ import { Document } from '@langchain/core/documents'; -import { getCitations } from './getCitations'; +import { getCitations } from './get_citations'; describe('getCitations', () => { test('should enrich citations', () => { diff --git a/packages/kbn-playground/server/utils/getCitations.ts b/packages/kbn-playground/server/utils/get_citations.ts similarity index 92% rename from packages/kbn-playground/server/utils/getCitations.ts rename to packages/kbn-playground/server/utils/get_citations.ts index 529e073826838..ea0ebbd1e17de 100644 --- a/packages/kbn-playground/server/utils/getCitations.ts +++ b/packages/kbn-playground/server/utils/get_citations.ts @@ -18,7 +18,7 @@ export function getCitations( return docs.filter((doc, i) => { return gatheredCitations.some((citation) => { - return i + 1 === parseInt(citation.slice(1, -1)); + return i + 1 === parseInt(citation.slice(1, -1), 10); }); }); } diff --git a/packages/kbn-playground/server/utils/renderTemplate.ts b/packages/kbn-playground/server/utils/render_template.ts similarity index 100% rename from packages/kbn-playground/server/utils/renderTemplate.ts rename to packages/kbn-playground/server/utils/render_template.ts