-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
62 lines (54 loc) · 2.02 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Clerk JavaScript Starter with Chatbot</title>
</head>
<body>
<div id="app"></div>
<!-- Clerk Script Tag -->
<script
async
crossorigin="anonymous"
data-clerk-publishable-key="process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY"
onload="window.Clerk.load()"
src="https://bold-dolphin-3.clerk.accounts.dev/npm/@clerk/clerk-js@latest/dist/clerk.browser.js"
type="text/javascript"
></script>
<script>
window.addEventListener("load", async function () {
await Clerk.load();
if (Clerk.user) {
document.getElementById("app").innerHTML = `
<div id="user-button"></div>
<div id="chatbot-container" style="width: 100%; height: 500px; border: none; border-radius: 8px;"></div>
`;
const userButtonDiv = document.getElementById("user-button");
Clerk.mountUserButton(userButtonDiv);
// Chatbot integration
const botId = "js71qsag15hdeg8v2h859kwebd6zv35f";
const iframe = document.createElement("iframe");
iframe.src = `https://easy-rag.vercel.app/bot/${botId}`;
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.style.borderRadius = "8px";
const chatbotContainer = document.getElementById("chatbot-container");
if (chatbotContainer) {
chatbotContainer.appendChild(iframe);
} else {
console.error("Container with ID 'chatbot-container' not found.");
}
} else {
document.getElementById("app").innerHTML = `
<div id="sign-in"></div>
`;
const signInDiv = document.getElementById("sign-in");
Clerk.mountSignIn(signInDiv);
}
});
</script>
</body>
</html>