@schmitech/chatbot-api 0.1.0 → 0.1.1
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/README.md +30 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -58,6 +58,36 @@ To make this library available to anyone via npm:
|
|
|
58
58
|
npm publish
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
### Option 4: Using via CDN (for websites)
|
|
62
|
+
|
|
63
|
+
You can include the library directly in your website using jsDelivr CDN:
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<!-- For ESM (modern browsers) -->
|
|
67
|
+
<script type="module">
|
|
68
|
+
import { configureApi, streamChat } from 'https://cdn.jsdelivr.net/npm/@schmitech/chatbot-api@0.1.0/dist/api.mjs';
|
|
69
|
+
|
|
70
|
+
// Configure the API with your server URL
|
|
71
|
+
configureApi('https://your-api-server.com');
|
|
72
|
+
|
|
73
|
+
// Use the API functions
|
|
74
|
+
async function handleChat() {
|
|
75
|
+
for await (const response of streamChat('Hello', false)) {
|
|
76
|
+
console.log(response.text);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
</script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For production use, you can omit the version to always get the latest:
|
|
83
|
+
|
|
84
|
+
```html
|
|
85
|
+
<script type="module">
|
|
86
|
+
import { configureApi, streamChat } from 'https://cdn.jsdelivr.net/npm/@schmitech/chatbot-api/dist/api.mjs';
|
|
87
|
+
// ...
|
|
88
|
+
</script>
|
|
89
|
+
```
|
|
90
|
+
|
|
61
91
|
## Usage
|
|
62
92
|
|
|
63
93
|
### Configuration (Required)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schmitech/chatbot-api",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "API client for the Chatbot server",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/api.cjs",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"import": "./dist/api.mjs",
|
|
13
|
-
"require": "./dist/api.cjs"
|
|
13
|
+
"require": "./dist/api.cjs",
|
|
14
|
+
"types": "./api.d.ts"
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
"files": [
|