Skip to content

Commit 4004c4e

Browse files
authored
docs: Add Inkeep AI Chat Widget and update Install page (#3575)
1 parent dac533e commit 4004c4e

File tree

4 files changed

+413
-141
lines changed

4 files changed

+413
-141
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"use client";
2+
declare global {
3+
interface Window {
4+
Inkeep: any;
5+
}
6+
}
7+
8+
import Script from "next/script";
9+
import { settings } from "../inkeep-settings";
10+
11+
export function InkeepScript() {
12+
return (
13+
<Script
14+
id="inkeep-script"
15+
src="https://unpkg.com/@inkeep/uikit-js@0.3.14/dist/embed.js"
16+
type="module"
17+
strategy="afterInteractive"
18+
onReady={() => {
19+
const config = {
20+
colorModeSync: {
21+
observedElement: document.documentElement,
22+
isDarkModeCallback: (el: any) => {
23+
return el.classList.contains("dark");
24+
},
25+
colorModeAttribute: "class",
26+
},
27+
properties: settings,
28+
};
29+
window.Inkeep().embed({
30+
componentType: "ChatButton",
31+
...config,
32+
});
33+
}}
34+
/>
35+
);
36+
}

docs/app/inkeep-settings.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// inkeep apiKeys is public, set to only work on https://www.anchor-lang.com
2+
export const settings = {
3+
baseSettings: {
4+
apiKey: "815f8fee7a5da7d98c681626dfbd268bdf7f7dc7cb80f618",
5+
integrationId: "cm7nvgfuu001ks6016t3m0gje",
6+
organizationId: "org_iKCh36NfndEFpB3M",
7+
organizationDisplayName: "Anchor",
8+
primaryBrandColor: "#9945ff",
9+
customCardSettings: [
10+
{
11+
filters: {
12+
UrlMatch: {
13+
ruleType: "PartialUrl",
14+
partialUrl: "https://www.anchor-lang.com/docs",
15+
},
16+
},
17+
searchTabLabel: "Anchor Docs",
18+
},
19+
{
20+
filters: {
21+
UrlMatch: {
22+
ruleType: "PartialUrl",
23+
partialUrl: "solana.com",
24+
},
25+
},
26+
searchTabLabel: "Solana Docs",
27+
},
28+
{
29+
filters: {
30+
UrlMatch: {
31+
ruleType: "PartialUrl",
32+
partialUrl: "https://docs.anza.xyz/",
33+
},
34+
},
35+
searchTabLabel: "Anza Docs",
36+
},
37+
{
38+
filters: {
39+
UrlMatch: {
40+
ruleType: "PartialUrl",
41+
partialUrl: "https://solana.stackexchange.com/",
42+
},
43+
},
44+
searchTabLabel: "Stack Exchange",
45+
},
46+
],
47+
},
48+
searchSettings: {
49+
shouldOpenLinksInNewTab: true,
50+
placeholder: "Search",
51+
},
52+
aiChatSettings: {
53+
chatSubjectName: "Solana",
54+
introMessage:
55+
"I'm an AI assistant trained on documentation, github repos, and other content. Ask me anything about `Solana`.",
56+
botAvatarSrcUrl: "https://solana.com/favicon.png",
57+
disclaimerSettings: {
58+
isDisclaimerEnabled: true,
59+
},
60+
actionButtonLabels: {
61+
getHelpButtonLabel: "Get Support",
62+
},
63+
getHelpCallToActions: [
64+
{
65+
name: "Discord",
66+
url: "https://discord.com/invite/NHHGSXAnXk",
67+
icon: {
68+
builtIn: "FaDiscord",
69+
},
70+
},
71+
{
72+
name: "Stack Exchange",
73+
url: "https://solana.stackexchange.com/",
74+
icon: {
75+
builtIn: "FaStackOverflow",
76+
},
77+
},
78+
],
79+
quickQuestions: [
80+
"How to set up local environment for Solana development?",
81+
"What is the Solana Account Model?",
82+
"How to build a Solana Program?",
83+
],
84+
},
85+
};

docs/app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { RootProvider } from "fumadocs-ui/provider";
33
import { Inter } from "next/font/google";
44
import type { ReactNode } from "react";
55
import { GoogleAnalytics } from "@next/third-parties/google";
6+
import { InkeepScript } from "./components/inkeep-script";
67
const inter = Inter({
78
subsets: ["latin"],
89
});
@@ -12,6 +13,7 @@ export default function Layout({ children }: { children: ReactNode }) {
1213
<html lang="en" className={inter.className} suppressHydrationWarning>
1314
<body className="flex flex-col min-h-screen">
1415
<RootProvider>{children}</RootProvider>
16+
<InkeepScript />
1517
</body>
1618
<GoogleAnalytics gaId="G-ZJYNM2WNM0" />
1719
</html>

0 commit comments

Comments
 (0)