-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace AI widget with kapa (#32222)
GitOrigin-RevId: 335b5a795708420a00298fa74d73165eb10e9620
- Loading branch information
Showing
4 changed files
with
22 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
"jetbrains", | ||
"Jetpack", | ||
"JWKS", | ||
"kapa", | ||
"keyof", | ||
"kotlinx", | ||
"LangChain", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,12 @@ | ||
import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; | ||
import React from "react"; | ||
import { ConvexAiChat as ConvexAiChatComponent } from "convex-ai-chat/react"; | ||
import "convex-ai-chat/react/styles-docs.css"; | ||
|
||
export function ConvexAiChat() { | ||
const { | ||
siteConfig: { | ||
customFields: { convexUrl }, | ||
}, | ||
} = useDocusaurusContext(); | ||
|
||
const configuredConvexUrl = getConvexURLFromQueryParam() ?? convexUrl; | ||
|
||
return configuredConvexUrl !== undefined ? ( | ||
<ConvexAiChatComponent | ||
convexUrl={configuredConvexUrl} | ||
infoMessage={ | ||
"Convex AI Bot can make mistakes. " + | ||
"When in doubt, reach out to our human team on Discord." | ||
} | ||
welcomeMessage="Hey there, what can I answer about Convex?" | ||
renderTrigger={(onClick) => ( | ||
<button className="convex-ai-chat" onClick={onClick}> | ||
<span /> | ||
</button> | ||
)} | ||
/> | ||
) : null; | ||
} | ||
|
||
function getConvexURLFromQueryParam() { | ||
if (typeof window === "undefined") { | ||
return undefined; | ||
} | ||
const url = window.location.href; | ||
const urlParams = new URLSearchParams(new URL(url).search); | ||
return urlParams.get("chatUrl"); | ||
return ( | ||
<> | ||
<button className="convex-ai-chat" id="kapa-ai-chat-button"> | ||
Ask AI | ||
</button> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters