diff --git a/app/layout.tsx b/app/layout.tsx index 2872921c96c..169e0b0cbb1 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -35,7 +35,7 @@ export default function Layout({ children }: { children: ReactNode }) { {children} - + diff --git a/components/chatbot.tsx b/components/chatbot.tsx index 58537d17ef8..6f36f3b204c 100644 --- a/components/chatbot.tsx +++ b/components/chatbot.tsx @@ -1,34 +1,24 @@ "use client"; import React, { useEffect } from 'react'; -interface KapaWidgetProps { - websiteId: string; - projectName: string; - projectColor: string; - projectLogo: string; -} - -const Chatbot: React.FC = ({ websiteId, projectName, projectColor, projectLogo }) => { +const COOKBOOK_API_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NmJlNDZhZDZkMjk4YjBkZjY5OWExMTgiLCJpYXQiOjE3MjM3NDU5NjUsImV4cCI6MjAzOTMyMTk2NX0.YRFXnhY4r8Z3it93zRzBenOL3oBPtD96tGYYl-USX2o" +const Chatbot: React.FC = () => { useEffect(() => { - const script = document.createElement("script"); - script.src = "https://widget.kapa.ai/kapa-widget.bundle.js"; - script.setAttribute("data-website-id", websiteId); - script.setAttribute("data-project-name", projectName); - script.setAttribute("data-project-color", projectColor); - script.setAttribute("data-project-logo", projectLogo); - script.setAttribute("data-user-analytics-fingerprint-enabled", "true"); - script.async = true; - document.head.appendChild(script); - - return () => { - if (document.head.contains(script)) { - document.head.removeChild(script); + if (typeof document !== 'undefined') { + let script = document.getElementById('__cookbook-script') as HTMLScriptElement | null; + if (!script) { + script = document.createElement('script'); + script.src = 'https://cdn.jsdelivr.net/npm/@cookbookdev/docsbot/dist/standalone/index.cjs.js'; + script.id = '__cookbook-script'; + script.async = true; + document.body.appendChild(script); } - }; - }, [websiteId, projectName, projectColor, projectLogo]); + } + }, []); - return null; + return ( +
+ ); }; -export default Chatbot; - +export default Chatbot; \ No newline at end of file