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/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface WidgetConfig {
|
|
2
|
+
/** 服务端地址 */
|
|
3
|
+
serverUrl: string
|
|
4
|
+
/** API Key(必填) */
|
|
5
|
+
apiKey: string
|
|
6
|
+
/** 气泡按钮位置,默认 'right' */
|
|
7
|
+
position?: 'left' | 'right'
|
|
8
|
+
/** 水平偏移量(px),默认 24 */
|
|
9
|
+
offsetX?: number
|
|
10
|
+
/** 垂直偏移量(px),默认 24 */
|
|
11
|
+
offsetY?: number
|
|
12
|
+
/** 面板宽度(px),默认 420 */
|
|
13
|
+
width?: number
|
|
14
|
+
/** 面板高度(px),默认 640 */
|
|
15
|
+
height?: number
|
|
16
|
+
/** 气泡按钮尺寸(px),默认 56 */
|
|
17
|
+
bubbleSize?: number
|
|
18
|
+
/** 气泡按钮颜色,默认 '#692ee6' */
|
|
19
|
+
bubbleColor?: string
|
|
20
|
+
/** 自定义气泡图标 URL */
|
|
21
|
+
bubbleIcon?: string
|
|
22
|
+
/** 组件标题,默认 '智能助手' */
|
|
23
|
+
title?: string
|
|
24
|
+
/** CSS z-index,默认 99999 */
|
|
25
|
+
zIndex?: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface WidgetInstance {
|
|
29
|
+
/** 打开聊天面板 */
|
|
30
|
+
open: () => void
|
|
31
|
+
/** 关闭聊天面板 */
|
|
32
|
+
close: () => void
|
|
33
|
+
/** 切换聊天面板 */
|
|
34
|
+
toggle: () => void
|
|
35
|
+
/** 销毁组件,移除所有 DOM 元素 */
|
|
36
|
+
destroy: () => void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface AthenaChatStatic {
|
|
40
|
+
/**
|
|
41
|
+
* 初始化聊天组件
|
|
42
|
+
* @param config 组件配置
|
|
43
|
+
* @returns 组件实例,如果参数校验失败则返回 null
|
|
44
|
+
*/
|
|
45
|
+
init(config: WidgetConfig): WidgetInstance | null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare const AthenaChat: AthenaChatStatic
|
|
49
|
+
export default AthenaChat
|
|
50
|
+
|
|
51
|
+
declare global {
|
|
52
|
+
interface Window {
|
|
53
|
+
AthenaChat: AthenaChatStatic
|
|
54
|
+
AthenaChatConfig?: WidgetConfig
|
|
55
|
+
}
|
|
56
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "athena-chat-widget",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Embeddable AI chat widget powered by Athena",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./athena-chat-widget.umd.cjs",
|
|
8
|
+
"module": "./athena-chat-widget.mjs",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"import": "./athena-chat-widget.mjs",
|
|
14
|
+
"require": "./athena-chat-widget.umd.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./iife": "./athena-chat-widget.iife.js"
|
|
17
|
+
},
|
|
18
|
+
"unpkg": "./athena-chat-widget.iife.js",
|
|
19
|
+
"jsdelivr": "./athena-chat-widget.iife.js",
|
|
20
|
+
"sideEffects": true,
|
|
21
|
+
"files": [
|
|
22
|
+
"*.mjs",
|
|
23
|
+
"*.cjs",
|
|
24
|
+
"*.js",
|
|
25
|
+
"*.d.ts",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"chat",
|
|
30
|
+
"widget",
|
|
31
|
+
"ai",
|
|
32
|
+
"athena",
|
|
33
|
+
"embedded",
|
|
34
|
+
"chatbot"
|
|
35
|
+
]
|
|
36
|
+
}
|