diff --git a/apps/adminpanel/pages/chatbot.tsx b/apps/adminpanel/pages/chatbot.tsx index 50096fa64..2342801c7 100644 --- a/apps/adminpanel/pages/chatbot.tsx +++ b/apps/adminpanel/pages/chatbot.tsx @@ -1,13 +1,13 @@ import React, { useEffect, useState } from 'react' import Head from 'next/head' import { SiteConfig } from 'app/conf' -import dynamic from 'next/dynamic'; -import { Stack } from 'tamagui'; -import { useThemeSetting } from "@tamagui/next-theme"; -import {YStack} from 'tamagui' +import dynamic from 'next/dynamic' +import { YStack } from 'tamagui' +import { useRouter } from 'next/router' export default function Page(props: any) { - //@ts-ignore + const { query } = useRouter() + const apiUrl = query.apiUrl as string const Chatbot = dynamic(() => import('protolib/components/chatbot'), { ssr: false }) const projectName = SiteConfig.projectName @@ -17,8 +17,8 @@ export default function Page(props: any) { {projectName + " - Chatbot"} - + ) -} \ No newline at end of file +} diff --git a/packages/protolib/src/components/AdminPage.tsx b/packages/protolib/src/components/AdminPage.tsx index 42eccb8e7..af5a2d3f5 100644 --- a/packages/protolib/src/components/AdminPage.tsx +++ b/packages/protolib/src/components/AdminPage.tsx @@ -35,7 +35,7 @@ export const AdminPage = forwardRef(({ pageSession, title, children, integratedC - {integratedChat && settingsAssistantEnabled && } + {integratedChat && settingsAssistantEnabled && } ) diff --git a/packages/protolib/src/components/BubbleChat.tsx b/packages/protolib/src/components/BubbleChat.tsx index 93828ecc5..61bea69d8 100644 --- a/packages/protolib/src/components/BubbleChat.tsx +++ b/packages/protolib/src/components/BubbleChat.tsx @@ -1,10 +1,14 @@ import { useState } from "react"; import { Sparkles, X, Maximize, Minimize } from '@tamagui/lucide-icons'; import { Tinted } from './Tinted' -import { Chatbot } from './Chatbot' +import { Chat } from './Chat' import { YStack, Button, XStack, Theme, Spinner, Paragraph} from 'tamagui'; -export const BubbleChat = () => { +type BubleChatProps = { + apiUrl: string; +}; + +export const BubbleChat = ({ apiUrl }: BubleChatProps) => { const [isChatVisible, setIsChatVisible] = useState(false); const [isExpanded, setIsExpanded] = useState(false); const [isChatLoaded, setIsChatLoaded] = useState(false); @@ -93,7 +97,7 @@ export const BubbleChat = () => { Loading chat... - {isChatLoaded && } + {isChatLoaded && } diff --git a/packages/protolib/src/components/Chat.tsx b/packages/protolib/src/components/Chat.tsx new file mode 100644 index 000000000..da53dbdf2 --- /dev/null +++ b/packages/protolib/src/components/Chat.tsx @@ -0,0 +1,15 @@ +type ChatProps = { + apiUrl: string; + }; + + export const Chat = ({ apiUrl }: ChatProps) => { + return ( +