Skip to content

Commit 77a7549

Browse files
committed
feat: add Knowrithm widget via global JavaScript file
1 parent 958c209 commit 77a7549

File tree

6 files changed

+62
-20
lines changed

6 files changed

+62
-20
lines changed

ai-tools/claude-code.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ description: "Configure Claude Code for your documentation workflow"
44
icon: "asterisk"
55
---
66

7-
import Widget from '../snippets/widget.mdx'
8-
9-
<Widget />
10-
117
Claude Code is Anthropic's official CLI tool. This guide will help you set up Claude Code to help you write and maintain your documentation.
128

139
## Prerequisites

ai-tools/cursor.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ description: "Configure Cursor for your documentation workflow"
44
icon: "arrow-pointer"
55
---
66

7-
import Widget from '../snippets/widget.mdx'
8-
9-
<Widget />
10-
117
Use Cursor to help write and maintain your documentation. This guide shows how to configure Cursor for better results on technical writing tasks and using Mintlify components.
128

139
## Prerequisites

api-reference/agents.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ title: "Agents"
33
description: "Create, manage, and observe Knowrithm agents."
44
---
55

6-
import Widget from '../snippets/widget.mdx'
7-
8-
<Widget />
9-
106
## Agent lifecycle
117

128
<Columns cols={2}>

index.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ title: "Welcome to Knowrithm"
33
description: "Build, train, and operate multi-agent AI assistants backed by enterprise-grade infrastructure."
44
---
55

6-
import Widget from './snippets/widget.mdx'
7-
8-
<Widget />
9-
106
<Hero
117
title="Knowrithm Platform Documentation"
128
subtitle="Everything you need to create production-ready AI agents, manage knowledge sources, and integrate with the Knowrithm API."

knowrithm-widget.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
(function () {
2+
// Only run in browser
3+
if (typeof window === 'undefined') return;
4+
5+
// Prevent duplicate loads
6+
if (window.__knowrithmWidgetLoaded) return;
7+
window.__knowrithmWidgetLoaded = true;
8+
9+
// Configure the widget
10+
window.AIChatWidget = {
11+
agentId: "2b041b45-a585-47e9-abaf-ebaad766bce9",
12+
apiUrl: "https://app.knowrithm.org/api/v1",
13+
color: "#0972A3",
14+
position: "right",
15+
appearance: {
16+
theme: "light",
17+
primaryColor: "#0972A3",
18+
placement: "bottom-right",
19+
buttonText: "Chat with us",
20+
showBranding: true
21+
},
22+
behavior: {
23+
autoOpen: false,
24+
initialDelay: 0,
25+
persistSession: true,
26+
pollingInterval: 10000,
27+
enableSounds: false
28+
},
29+
callbacks: {
30+
onLoad: null,
31+
onError: null,
32+
onMessage: null,
33+
onClose: null
34+
},
35+
assets: {
36+
scriptUrl: "https://app.knowrithm.org/api/widget.js",
37+
styleUrl: "https://minio.knowrithm.org/browser/knowrithm-bucket/chat-widget.css"
38+
}
39+
};
40+
41+
// Load the widget script
42+
var script = document.createElement('script');
43+
script.src = 'https://app.knowrithm.org/api/widget.js';
44+
script.type = 'text/javascript';
45+
script.async = true;
46+
script.onload = function () {
47+
console.log('Knowrithm widget loaded successfully');
48+
};
49+
script.onerror = function (error) {
50+
console.error('Failed to load Knowrithm widget:', error);
51+
};
52+
document.head.appendChild(script);
53+
54+
// Load the widget CSS
55+
var link = document.createElement('link');
56+
link.rel = 'stylesheet';
57+
link.href = 'https://minio.knowrithm.org/browser/knowrithm-bucket/chat-widget.css';
58+
link.onload = function () {
59+
console.log('Knowrithm widget CSS loaded');
60+
};
61+
document.head.appendChild(link);
62+
})();

quickstart.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ title: "Quickstart"
33
description: "Provision Knowrithm locally in minutes and connect your first agent."
44
---
55

6-
import Widget from './snippets/widget.mdx'
7-
8-
<Widget />
9-
106
## Prerequisites
117

128
- **Python** 3.11+

0 commit comments

Comments
 (0)