universal-chatbot-saas 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +22 -0
- package/README.md +93 -0
- package/package.json +28 -0
- package/public/chatbot.js +987 -0
- package/public/portal/admin-bots.html +142 -0
- package/public/portal/admin-bots.js +265 -0
- package/public/portal/admin-users.html +149 -0
- package/public/portal/admin-users.js +286 -0
- package/public/portal/login.html +65 -0
- package/public/portal/portal.js +266 -0
- package/react-wrapper/LICENSE +21 -0
- package/react-wrapper/README.md +48 -0
- package/react-wrapper/package.json +37 -0
- package/react-wrapper/src/index.tsx +137 -0
- package/react-wrapper/tsconfig.json +18 -0
- package/server/index.js +2331 -0
package/.env.example
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
PORT=8787
|
|
2
|
+
DEFAULT_PROVIDER=groq
|
|
3
|
+
DEFAULT_SYSTEM_PROMPT=You are a helpful support agent.
|
|
4
|
+
ALLOWED_ORIGINS=*
|
|
5
|
+
ENFORCE_ORIGIN_LOCK=false
|
|
6
|
+
RATE_LIMIT_WINDOW_MS=60000
|
|
7
|
+
RATE_LIMIT_MAX_REQUESTS=20
|
|
8
|
+
CHATBOT_AUTH_TOKENS=replace_with_random_token_1,replace_with_random_token_2
|
|
9
|
+
GROQ_API_KEY=
|
|
10
|
+
OPENAI_API_KEY=
|
|
11
|
+
ANTHROPIC_API_KEY=
|
|
12
|
+
MISTRAL_API_KEY=
|
|
13
|
+
MSSQL_ENABLED=false
|
|
14
|
+
MSSQL_SERVER=localhost
|
|
15
|
+
MSSQL_PORT=1433
|
|
16
|
+
MSSQL_INSTANCE=
|
|
17
|
+
MSSQL_USER=sa
|
|
18
|
+
MSSQL_PASSWORD=
|
|
19
|
+
MSSQL_DATABASE=chatbot
|
|
20
|
+
MSSQL_ENCRYPT=true
|
|
21
|
+
MSSQL_TRUST_SERVER_CERT=true
|
|
22
|
+
ENABLE_CHAT_HISTORY_STORAGE=true
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# universal_ai_chatbot
|
|
2
|
+
|
|
3
|
+
Production-ready React wrapper for the chatbot embed script.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
cp .env.example .env
|
|
10
|
+
npm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Server starts at `http://localhost:8787`.
|
|
14
|
+
|
|
15
|
+
- Embed script URL: `http://localhost:8787/embed/chatbot.js`
|
|
16
|
+
- Stream endpoint: `http://localhost:8787/api/chat/stream`
|
|
17
|
+
|
|
18
|
+
For Windows PowerShell copy env template using:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
Copy-Item .env.example .env
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 2) Static HTML / PHP usage
|
|
25
|
+
|
|
26
|
+
In a plain HTML file or a PHP layout template (for example, footer include), add:
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<script
|
|
30
|
+
src="http://localhost:8787/embed/chatbot.js"
|
|
31
|
+
data-bot-name="Aria"
|
|
32
|
+
data-color="#0ea5a4"
|
|
33
|
+
data-welcome="Hi! How can I help?"
|
|
34
|
+
data-api-base="http://localhost:8787"
|
|
35
|
+
data-system-prompt="You are a support agent for XYZ store."
|
|
36
|
+
data-provider="claude"
|
|
37
|
+
data-auth-token="replace_with_random_token_1"
|
|
38
|
+
data-apikey="replace_with_random_token_1"
|
|
39
|
+
data-aimodel="claude"
|
|
40
|
+
data-knowledge='[{"title":"Shipping policy","content":"Orders ship in 2 to 3 business days.","source":"inline"}]'
|
|
41
|
+
data-knowledge-url="https://xyz.example.com/chatbot/knowledge.json"
|
|
42
|
+
data-user-handle="default"
|
|
43
|
+
data-site-id="xyz-store"
|
|
44
|
+
data-site-name="XYZ Store"
|
|
45
|
+
data-site-url="https://xyz.example.com"
|
|
46
|
+
data-model="claude-sonnet-4-20250514"
|
|
47
|
+
data-position="right"
|
|
48
|
+
data-custom-css=".ucb-root .ucb-panel{border-radius:26px}.ucb-root .ucb-send{border-radius:999px;padding:10px 18px}"
|
|
49
|
+
></script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
No PHP logic changes are needed. You only include the script tag.
|
|
53
|
+
|
|
54
|
+
## 3) React usage (npm package wrapper)
|
|
55
|
+
|
|
56
|
+
Use the local wrapper package from `react-wrapper`.
|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
import ChatbotEmbed from "@universal-claude-chatbot/react";
|
|
60
|
+
|
|
61
|
+
export default function App() {
|
|
62
|
+
return (
|
|
63
|
+
<ChatbotEmbed
|
|
64
|
+
src="https://your-domain.com/embed/chatbot.js"
|
|
65
|
+
apiBase="https://your-domain.com"
|
|
66
|
+
botId="sb009"
|
|
67
|
+
botApiKey="your-bot-api-key"
|
|
68
|
+
aiApikey="your-provider-api-key"
|
|
69
|
+
provider="groq"
|
|
70
|
+
model="llama-3.3-70b-versatile"
|
|
71
|
+
botName="Support Assistant"
|
|
72
|
+
color="#0ea5a4"
|
|
73
|
+
welcome="Hi! How can I help you today?"
|
|
74
|
+
position="bottom-right"
|
|
75
|
+
visitorId="visitor-123"
|
|
76
|
+
sessionId="session-456"
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Build
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Publish
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm login
|
|
92
|
+
npm publish --access public
|
|
93
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "universal-chatbot-saas",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Universal chatbot SaaS platform with embeddable widget and React wrapper",
|
|
6
|
+
"main": "server/index.js",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"chatbot",
|
|
9
|
+
"ai",
|
|
10
|
+
"widget"
|
|
11
|
+
],
|
|
12
|
+
"author": "Your Name",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"start": "node server/index.js",
|
|
16
|
+
"dev": "node server/index.js",
|
|
17
|
+
"build": "echo \"No build step\""
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"cors": "^2.8.5",
|
|
24
|
+
"dotenv": "^16.4.5",
|
|
25
|
+
"express": "^4.19.2",
|
|
26
|
+
"mssql": "^12.2.1"
|
|
27
|
+
}
|
|
28
|
+
}
|