mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 06:17:23 +00:00
feat(docs): mount the DocsGPT chat widget
Adds a floating "Ask the docs" bubble to every docs page. docsgpt-react was already a dependency but nothing imported it, so no widget rendered. The widget reads window and navigator on mount, so it is lazy-loaded with ssr: false from a client wrapper. Its light/dark theme follows the site toggle via next-themes, promoted here from a transitive dependency to a declared one. The key comes from NEXT_PUBLIC_DOCSGPT_API_KEY and the host from NEXT_PUBLIC_DOCSGPT_API_HOST. With no key set the wrapper renders nothing rather than falling through to the demo key the package defaults to. Bumping docsgpt-react to ^0.7.0 also drops a duplicate React. The old ^0.6.3 pin depended on React 18 and npm installed a nested 18.3.1 beside the app's 19.2.8, which would have thrown an invalid hook call on first render.
This commit is contained in:
1 parent
74b4ae30f9
commit
3711426c83
4 files changed
+55
-65
No files matched your search
@@ -5,6 +5,7 @@ import { getPageMap } from 'nextra/page-map';
|
||||
import { Footer, Layout, Navbar } from 'nextra-theme-docs';
|
||||
import 'nextra-theme-docs/style.css';
|
||||
|
||||
import { DocsGPTChatWidget } from '../components/DocsGPTChatWidget';
|
||||
import CuteLogo from '../public/cute-docsgpt.png';
|
||||
import themeConfig from '../theme.config';
|
||||
|
||||
@@ -79,6 +80,7 @@ export default async function RootLayout({ children }) {
|
||||
>
|
||||
{children}
|
||||
</Layout>
|
||||
<DocsGPTChatWidget />
|
||||
<Analytics />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in new issue
Block a user