diff --git a/packages/kbn-ai-playground/hooks/useChatContext.ts b/packages/kbn-ai-playground/hooks/useChatContext.ts index 23d8256e600bb..a9212d992a458 100644 --- a/packages/kbn-ai-playground/hooks/useChatContext.ts +++ b/packages/kbn-ai-playground/hooks/useChatContext.ts @@ -6,7 +6,7 @@ */ import { useContext } from 'react'; -import { ChatContext } from '../providers/chat_provider'; +import { ChatContext } from '../providers/ai_playground_provider'; export const useChatContext = () => { return useContext(ChatContext); diff --git a/packages/kbn-ai-playground/providers/ai_playground_provider.tsx b/packages/kbn-ai-playground/providers/ai_playground_provider.tsx index f919876f4c71e..708bde9956b79 100644 --- a/packages/kbn-ai-playground/providers/ai_playground_provider.tsx +++ b/packages/kbn-ai-playground/providers/ai_playground_provider.tsx @@ -6,17 +6,18 @@ * Side Public License, v 1. */ -import React, { ReactNode } from 'react'; +import React, { createContext, ReactNode } from 'react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { FormProvider, useForm } from 'react-hook-form'; import { ChatForm } from '../types'; -import { ChatProvider } from '@kbn/ai-playground/providers/chat_provider'; interface AIPlaygroundProviderProps { navigateToIndexPage: () => void; children: ReactNode; } +export const ChatContext = createContext<{ navigateToIndexPage?: () => void }>({}); + const queryClient = new QueryClient({}); export const AIPlaygroundProvider: React.FC = ({ @@ -26,10 +27,10 @@ export const AIPlaygroundProvider: React.FC = ({ const form = useForm(); return ( - + {children} - + ); }; diff --git a/packages/kbn-ai-playground/providers/chat_provider.tsx b/packages/kbn-ai-playground/providers/chat_provider.tsx deleted file mode 100644 index b54e661294db2..0000000000000 --- a/packages/kbn-ai-playground/providers/chat_provider.tsx +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 React, { createContext } from 'react'; - -export const ChatContext = createContext({ - navigateToIndexPage: () => {}, -}); - -interface ChatProviderProps { - navigateToIndexPage: () => void; -} - -export const ChatProvider: React.FC = ({ navigateToIndexPage, children }) => { - return {children}; -};