docs: add AI Assistant (#5249)

* added components

* added ai assistant button

* change styling

* improve AI assistant

* change to a drawer

* added command support into search

* add AiAssistant to all projects

* remove usage of Text component

* added error handling

* use recaptcha

* fix new configurations

* fix background color

* change suggested questions
This commit is contained in:
Shahed Nasser
2023-10-05 11:10:44 +03:00
committed by GitHub
parent b6bea74914
commit b3f75d8f21
45 changed files with 1864 additions and 437 deletions

View File

@@ -1,6 +1,7 @@
"use client"
import {
AiAssistantProvider,
AnalyticsProvider,
ColorModeProvider,
MobileProvider,

View File

@@ -1,6 +1,11 @@
"use client"
import { usePageLoading, SearchProvider as UiSearchProvider } from "docs-ui"
import {
usePageLoading,
SearchProvider as UiSearchProvider,
AiAssistantCommandIcon,
AiAssistantProvider,
} from "docs-ui"
import getBaseUrl from "../utils/get-base-url"
type SearchProviderProps = {
@@ -66,6 +71,27 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
},
],
}}
commands={[
{
name: "ai-assistant",
icon: <AiAssistantCommandIcon />,
component: (
<AiAssistantProvider
apiUrl={process.env.NEXT_PUBLIC_AI_ASSISTANT_URL || "temp"}
websiteId={process.env.NEXT_PUBLIC_AI_WEBSITE_ID || "temp"}
recaptchaSiteKey={
process.env.NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY ||
"temp"
}
/>
),
title: "AI Assistant",
badge: {
variant: "purple",
children: "Beta",
},
},
]}
>
{children}
</UiSearchProvider>