athena-chat-widget 0.0.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 +82 -0
- package/athena-chat-widget.iife.js +2530 -0
- package/athena-chat-widget.mjs +77820 -0
- package/athena-chat-widget.umd.cjs +2530 -0
- package/index.d.ts +56 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Athena Chat Widget
|
|
2
|
+
|
|
3
|
+
Embeddable AI chat widget — drop a single script tag to add an intelligent assistant to any page.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install athena-chat-widget
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Via Script Tag (CDN)
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://unpkg.com/athena-chat-widget/athena-chat-widget.iife.js"></script>
|
|
17
|
+
<script>
|
|
18
|
+
AthenaChat.init({
|
|
19
|
+
serverUrl: 'https://your-server.com',
|
|
20
|
+
apiKey: 'your-api-key'
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Via NPM (ES Module)
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import AthenaChat from 'athena-chat-widget'
|
|
29
|
+
|
|
30
|
+
const widget = AthenaChat.init({
|
|
31
|
+
serverUrl: 'https://your-server.com',
|
|
32
|
+
apiKey: 'your-api-key',
|
|
33
|
+
position: 'right',
|
|
34
|
+
title: '智能助手'
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Auto Init
|
|
39
|
+
|
|
40
|
+
Set `window.AthenaChatConfig` before loading the script to auto-initialize:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<script>
|
|
44
|
+
window.AthenaChatConfig = {
|
|
45
|
+
serverUrl: 'https://your-server.com',
|
|
46
|
+
apiKey: 'your-api-key'
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
<script src="https://unpkg.com/athena-chat-widget/athena-chat-widget.iife.js"></script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Configuration
|
|
53
|
+
|
|
54
|
+
| Option | Type | Default | Description |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| `serverUrl` | `string` | *required* | Server URL |
|
|
57
|
+
| `apiKey` | `string` | *required* | API Key |
|
|
58
|
+
| `position` | `'left' \| 'right'` | `'right'` | Widget position |
|
|
59
|
+
| `offsetX` | `number` | `24` | Horizontal offset (px) |
|
|
60
|
+
| `offsetY` | `number` | `24` | Vertical offset (px) |
|
|
61
|
+
| `width` | `number` | `420` | Panel width (px) |
|
|
62
|
+
| `height` | `number` | `640` | Panel height (px) |
|
|
63
|
+
| `bubbleSize` | `number` | `56` | Bubble button size (px) |
|
|
64
|
+
| `bubbleColor` | `string` | `'#692ee6'` | Bubble button color |
|
|
65
|
+
| `bubbleIcon` | `string` | `''` | Custom icon URL |
|
|
66
|
+
| `title` | `string` | `'智能助手'` | Widget title |
|
|
67
|
+
| `zIndex` | `number` | `99999` | CSS z-index |
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
const widget = AthenaChat.init({ serverUrl: '...', apiKey: '...' })
|
|
73
|
+
|
|
74
|
+
widget.open() // Open chat panel
|
|
75
|
+
widget.close() // Close chat panel
|
|
76
|
+
widget.toggle() // Toggle chat panel
|
|
77
|
+
widget.destroy() // Remove widget from DOM
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|