ibc-ai-web-sdk 2.0.3 → 2.0.5

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/index.d.ts CHANGED
@@ -34,12 +34,18 @@ export interface AIChatDialogEvents extends SDKEvents {
34
34
  * AI Chat Dialog 组件方法
35
35
  */
36
36
  export interface AIChatDialogMethods {
37
+ /** 初始化 */
38
+ init(config: Partial<AIChatConfig>): any
39
+
37
40
  /** 打开对话框 */
38
41
  open(): void
39
42
 
40
43
  /** 关闭对话框 */
41
44
  close(): void
42
45
 
46
+ /** 切换可见性 */
47
+ toggle(forceState?: boolean): void
48
+
43
49
  /** 清除对话(开始新对话) */
44
50
  clearChat(): void
45
51
 
@@ -48,6 +54,21 @@ export interface AIChatDialogMethods {
48
54
 
49
55
  /** 上传附件 */
50
56
  uploadAttachment(file: File, options?: Record<string, any>): Promise<AIResponse>
57
+
58
+ /** 外部触发发送 */
59
+ send(text: string): void
60
+
61
+ /** 设置页面上下文数据 */
62
+ setContext(context: Record<string, any> | null): void
63
+
64
+ /** 获取当前上下文数据 */
65
+ getContext(): Record<string, any>
66
+
67
+ /** 更新配置 */
68
+ updateConfig(config: Partial<AIChatConfig>): void
69
+
70
+ /** 销毁 */
71
+ destroy(): void
51
72
  }
52
73
 
53
74
  /**
@@ -69,6 +90,18 @@ export const AIChatClient: {
69
90
 
70
91
  export function createAIChatDialog(options?: Partial<AIChatConfig>): any
71
92
 
93
+ export function useAIChat(options?: Partial<AIChatConfig>): {
94
+ open(): void
95
+ close(): void
96
+ toggle(): void
97
+ sendMessage(content: string): void
98
+ clearMessages(): void
99
+ isVisible: boolean
100
+ messages: any[]
101
+ isLoading: boolean
102
+ ref: any
103
+ }
104
+
72
105
  export function installVuePlugin(Vue: any): void
73
106
 
74
107
  /**
@@ -79,7 +112,8 @@ export default {
79
112
  AIChatDialog,
80
113
  AIChatClient,
81
114
  createAIChatDialog,
82
- installVuePlugin
115
+ installVuePlugin,
116
+ useAIChat
83
117
  }
84
118
 
85
119
  // 导出类型
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibc-ai-web-sdk",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "IBC AI Web SDK - 纯JavaScript实现的AI对话组件,支持任意框架(Vue/React/Angular/原生HTML)",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -8,7 +8,7 @@
8
8
  "unpkg": "dist/index.umd.min.js",
9
9
  "jsdelivr": "dist/index.umd.min.js",
10
10
  "types": "./index.d.ts",
11
- "sideEffects": false,
11
+ "sideEffects": ["./src/index.js", "./dist/index.esm.js", "./src/AIChatDialog.js", "./src/core/AIChatClient.js"],
12
12
  "exports": {
13
13
  ".": {
14
14
  "types": "./index.d.ts",