Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9b01e66

Browse files
authoredMar 11, 2025··
docs(website): add RunLLM agent back to website (#1775)
WIP shouldn't disrupt anything.
1 parent ae356b7 commit 9b01e66

File tree

7 files changed

+115
-8
lines changed

7 files changed

+115
-8
lines changed
 

‎docs/docs/hydro/index.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ style={{
2323
}}
2424
src="https://www.youtube.com/embed/LdZ94m7anTw?si=5duyR1MjSRRdPJId"
2525
title="YouTube video player"
26-
frameborder="0"
26+
frameBorder="0"
2727
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
28-
referrerpolicy="strict-origin-when-cross-origin"
29-
allowfullscreen
28+
referrerPolicy="strict-origin-when-cross-origin"
29+
allowFullScreen
3030
></iframe>
3131

3232
:::caution

‎docs/docusaurus.config.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const katex = require("rehype-katex");
1010
/** @type {import('@docusaurus/types').Config} */
1111
const config = {
1212
title: "Hydro - Build for Every Scale",
13-
tagline: "Dinosaurs are cool",
13+
tagline: "Build for every scale",
1414
favicon: "img/favicon.ico",
1515

1616
// Set the production url of your site here
@@ -152,6 +152,11 @@ const config = {
152152
label: "GitHub",
153153
position: "right",
154154
},
155+
{
156+
href: "/askai",
157+
label: "AI Assistant",
158+
position: "right",
159+
},
155160
],
156161
},
157162
footer: {

‎docs/src/pages/askai.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import React, { useEffect } from "react";
2+
import { useLocation } from "@docusaurus/router";
3+
import Layout from "@theme/Layout";
4+
5+
import styles from "./askai.module.css";
6+
7+
export default function AskAI() {
8+
const location = useLocation(); // Track current route
9+
10+
useEffect(() => {
11+
const scriptId = "runllm-widget-script";
12+
13+
// Check if script is already added
14+
if (!document.getElementById(scriptId)) {
15+
const script = document.createElement("script");
16+
script.type = "module";
17+
script.id = scriptId;
18+
script.src = "https://widget.runllm.com";
19+
20+
script.setAttribute("version", "stable");
21+
script.setAttribute("runllm-keyboard-shortcut", "Mod+j");
22+
script.setAttribute("runllm-name", "Hydro");
23+
script.setAttribute("runllm-position", "TOP_RIGHT");
24+
script.setAttribute("runllm-assistant-id", "136");
25+
script.setAttribute("runllm-preset", "docusaurus");
26+
script.setAttribute("runllm-brand-logo", "img/hydro-turtle.png");
27+
28+
script.async = true;
29+
document.body.appendChild(script);
30+
}
31+
32+
const removeWidget = () => {
33+
// Remove script
34+
const existingScript = document.getElementById(scriptId);
35+
if (existingScript) {
36+
existingScript.remove();
37+
}
38+
39+
// Remove widget and any associated elements
40+
const removeElements = () => {
41+
document
42+
.querySelectorAll("runllm-widget, iframe[src*='widget.runllm.com'], .runllm-container")
43+
.forEach((el) => el.remove());
44+
};
45+
46+
// Try removing immediately and again after a short delay
47+
removeElements();
48+
setTimeout(removeElements, 1000);
49+
};
50+
51+
return () => {
52+
removeWidget();
53+
};
54+
}, [location.pathname]); // Runs effect on every route change
55+
56+
return (
57+
<Layout description="AI assistant for the Hydro API">
58+
<main>
59+
<div className={styles["main_text"]}>
60+
<h2> Hydro AI Assistant </h2>
61+
<p>
62+
Hydro has a built-in AI assistant that can help you with your
63+
questions about the Hydro API. You can ask it anything related to
64+
Hydro, and it will try its best to answer you.
65+
</p>
66+
<p>To give it a try, just press the "Ask AI" button.</p>
67+
</div>
68+
</main>
69+
</Layout>
70+
);
71+
}

‎docs/src/pages/askai.module.css

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.subtitle {
2+
font-family: 'Inter', sans-serif;
3+
font-size: 50px;
4+
text-align: center;
5+
font-weight: 600;
6+
margin-top: 25px;
7+
margin-bottom: 0;
8+
}
9+
10+
.main_text {
11+
text-align: Left;
12+
font-family: 'Inter', sans-serif;
13+
font-size: 16px;
14+
font-weight: 300;
15+
line-height: 1.4;
16+
17+
color: #262626;
18+
19+
margin-top: 20px;
20+
margin-bottom: 10px;
21+
22+
margin-left: 20px;
23+
margin-right: 20px;
24+
}
25+
26+
@media screen and (max-width: 1000px) {
27+
.subtitle {
28+
font-size: 40px;
29+
margin-top: 30px;
30+
}
31+
}

‎docs/src/pages/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ export default function Home() {
8181
}}
8282
src="https://www.youtube.com/embed/LdZ94m7anTw?si=5duyR1MjSRRdPJId"
8383
title="YouTube video player"
84-
frameborder="0"
84+
frameBorder="0"
8585
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
86-
referrerpolicy="strict-origin-when-cross-origin"
87-
allowfullscreen
86+
referrerPolicy="strict-origin-when-cross-origin"
87+
allowFullScreen
8888
></iframe>
8989
</div>
9090
</div>

‎docs/src/pages/people.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import natacha from "./people-img/natacha.jpeg";
1313
import shadaj from "./people-img/shadaj.png";
1414
import lucky from "./people-img/lucky.jpeg";
1515
import rohit from "./people-img/rohit.jpg";
16-
import hydroTurtle from "./people-img/hydro-turtle.png";
16+
import hydroTurtle from "../../static/img/hydro-turtle.png";
1717

1818
import styles from "./people.module.css";
1919

0 commit comments

Comments
 (0)
Please sign in to comment.