@ray-js/api 1.7.69 → 1.7.71

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.
Files changed (154) hide show
  1. package/@types/AIKit.d.ts +5509 -610
  2. package/@types/AIStreamKit.d.ts +2641 -0
  3. package/@types/AVideoKit.d.ts +1827 -0
  4. package/@types/BaseKit.d.ts +8682 -1893
  5. package/@types/BizKit.d.ts +6639 -1038
  6. package/@types/CategoryCommonBizKit.d.ts +1459 -0
  7. package/@types/CommunityKit.d.ts +154 -0
  8. package/@types/DeviceKit.d.ts +18475 -5662
  9. package/@types/GroupCITestKit.d.ts +651 -0
  10. package/@types/HealthKit.d.ts +2290 -357
  11. package/@types/HomeKit.d.ts +4068 -182
  12. package/@types/IPCKit.d.ts +4327 -1227
  13. package/@types/LightKit.d.ts +125 -0
  14. package/@types/MapKit.d.ts +1560 -204
  15. package/@types/MediaKit.d.ts +136 -16
  16. package/@types/MediaPlayerKit.d.ts +47 -0
  17. package/@types/MiniKit.d.ts +2976 -628
  18. package/@types/OutdoorKit.d.ts +1337 -24
  19. package/@types/P2PKit.d.ts +622 -103
  20. package/@types/PayKit.d.ts +115 -0
  21. package/@types/PlayNetKit.d.ts +3454 -1309
  22. package/@types/SweeperKit.d.ts +154 -0
  23. package/@types/ThirdAuthKit.d.ts +324 -0
  24. package/@types/ThirdPartyDeviceKit.d.ts +410 -0
  25. package/@types/WearKit.d.ts +10177 -375
  26. package/@types/gateway.d.ts +349 -61
  27. package/@types/health.d.ts +486 -304
  28. package/lib/AIKit-1.6.0.d.ts +265 -41
  29. package/lib/AIKit-1.6.0.js +374 -120
  30. package/lib/BaseKit-3.17.7.d.ts +704 -0
  31. package/lib/BaseKit-3.17.7.js +720 -1
  32. package/lib/BizKit-4.10.4.d.ts +336 -0
  33. package/lib/BizKit-4.10.4.js +342 -5
  34. package/lib/DeviceKit-4.13.1.d.ts +996 -0
  35. package/lib/DeviceKit-4.13.1.js +1247 -249
  36. package/lib/HealthKit-6.5.0.d.ts +210 -44
  37. package/lib/HealthKit-6.5.0.js +295 -128
  38. package/lib/HomeKit-3.1.4.d.ts +20 -6
  39. package/lib/HomeKit-3.1.4.js +29 -14
  40. package/lib/IPCKit-6.4.5.d.ts +375 -77
  41. package/lib/IPCKit-6.4.5.js +525 -228
  42. package/lib/MapKit-3.4.13.d.ts +70 -16
  43. package/lib/MapKit-3.4.13.js +98 -47
  44. package/lib/MediaKit-3.4.1.d.ts +5 -3
  45. package/lib/MediaKit-3.4.1.js +7 -6
  46. package/lib/MiniKit-3.14.1.d.ts +300 -0
  47. package/lib/MiniKit-3.14.1.js +302 -0
  48. package/lib/OutdoorKit-1.0.4.d.ts +55 -13
  49. package/lib/OutdoorKit-1.0.4.js +78 -35
  50. package/lib/P2PKit-2.0.3.d.ts +125 -27
  51. package/lib/P2PKit-2.0.3.js +175 -78
  52. package/lib/PlayNetKit-1.3.30.d.ts +290 -60
  53. package/lib/PlayNetKit-1.3.30.js +407 -176
  54. package/lib/WearKit-1.1.6.d.ts +125 -27
  55. package/lib/WearKit-1.1.6.js +176 -77
  56. package/lib/all-kits.d.ts +10 -10
  57. package/lib/all-kits.js +10 -10
  58. package/lib/cloud/core.d.ts +31 -1
  59. package/lib/cloud/core.js +31 -1
  60. package/lib/cloud/device.d.ts +155 -24
  61. package/lib/cloud/device.js +153 -22
  62. package/lib/cloud/gateway.d.ts +254 -0
  63. package/lib/cloud/gateway.js +269 -9
  64. package/lib/cloud/health.d.ts +1 -0
  65. package/lib/cloud/health.js +121 -0
  66. package/lib/cloud/interface.d.ts +222 -44
  67. package/lib/cloud/interface.js +15 -2
  68. package/lib/cloud/laser-clean/deleteCleaningRecord/index.d.ts +27 -0
  69. package/lib/cloud/laser-clean/deleteCleaningRecord/index.js +28 -0
  70. package/lib/cloud/laser-clean/deleteCleaningRecord/type.d.ts +7 -0
  71. package/lib/cloud/laser-clean/deleteCleaningRecord/type.js +1 -0
  72. package/lib/cloud/laser-clean/deleteGyroCleanRecord/index.d.ts +27 -0
  73. package/lib/cloud/laser-clean/deleteGyroCleanRecord/index.js +28 -0
  74. package/lib/cloud/laser-clean/deleteGyroCleanRecord/type.d.ts +7 -0
  75. package/lib/cloud/laser-clean/deleteGyroCleanRecord/type.js +1 -0
  76. package/lib/cloud/laser-clean/deleteMultipleMapFiles/index.d.ts +27 -0
  77. package/lib/cloud/laser-clean/deleteMultipleMapFiles/index.js +28 -0
  78. package/lib/cloud/laser-clean/deleteMultipleMapFiles/type.d.ts +7 -0
  79. package/lib/cloud/laser-clean/deleteMultipleMapFiles/type.js +1 -0
  80. package/lib/cloud/laser-clean/getCleaningRecords/index.d.ts +30 -0
  81. package/lib/cloud/laser-clean/getCleaningRecords/index.js +31 -0
  82. package/lib/cloud/laser-clean/getCleaningRecords/type.d.ts +39 -0
  83. package/lib/cloud/laser-clean/getCleaningRecords/type.js +1 -0
  84. package/lib/cloud/laser-clean/getGyroCleanRecordDetail/index.d.ts +29 -0
  85. package/lib/cloud/laser-clean/getGyroCleanRecordDetail/index.js +30 -0
  86. package/lib/cloud/laser-clean/getGyroCleanRecordDetail/type.d.ts +30 -0
  87. package/lib/cloud/laser-clean/getGyroCleanRecordDetail/type.js +1 -0
  88. package/lib/cloud/laser-clean/getGyroCleanRecords/index.d.ts +29 -0
  89. package/lib/cloud/laser-clean/getGyroCleanRecords/index.js +30 -0
  90. package/lib/cloud/laser-clean/getGyroCleanRecords/type.d.ts +35 -0
  91. package/lib/cloud/laser-clean/getGyroCleanRecords/type.js +1 -0
  92. package/lib/cloud/laser-clean/getGyroLatestCleanMap/index.d.ts +28 -0
  93. package/lib/cloud/laser-clean/getGyroLatestCleanMap/index.js +29 -0
  94. package/lib/cloud/laser-clean/getGyroLatestCleanMap/type.d.ts +28 -0
  95. package/lib/cloud/laser-clean/getGyroLatestCleanMap/type.js +1 -0
  96. package/lib/cloud/laser-clean/getMultipleMapFiles/index.d.ts +24 -0
  97. package/lib/cloud/laser-clean/getMultipleMapFiles/index.js +25 -0
  98. package/lib/cloud/laser-clean/getMultipleMapFiles/type.d.ts +29 -0
  99. package/lib/cloud/laser-clean/getMultipleMapFiles/type.js +1 -0
  100. package/lib/cloud/laser-clean/getSweeperStorageConfig/index.d.ts +24 -0
  101. package/lib/cloud/laser-clean/getSweeperStorageConfig/index.js +25 -0
  102. package/lib/cloud/laser-clean/getSweeperStorageConfig/type.d.ts +26 -0
  103. package/lib/cloud/laser-clean/getSweeperStorageConfig/type.js +1 -0
  104. package/lib/cloud/laser-clean/getVoiceList/index.d.ts +28 -0
  105. package/lib/cloud/laser-clean/getVoiceList/index.js +29 -0
  106. package/lib/cloud/laser-clean/getVoiceList/type.d.ts +48 -0
  107. package/lib/cloud/laser-clean/getVoiceList/type.js +1 -0
  108. package/lib/cloud/laser-clean/index.d.ts +1 -1
  109. package/lib/cloud/laser-clean/index.js +1 -1
  110. package/lib/cloud/laser-clean/map.d.ts +5 -7
  111. package/lib/cloud/laser-clean/map.js +5 -9
  112. package/lib/cloud/laser-clean/record.d.ts +5 -6
  113. package/lib/cloud/laser-clean/record.js +5 -7
  114. package/lib/cloud/laser-clean/renameHistoryMap/index.d.ts +28 -0
  115. package/lib/cloud/laser-clean/renameHistoryMap/index.js +29 -0
  116. package/lib/cloud/laser-clean/renameHistoryMap/type.d.ts +9 -0
  117. package/lib/cloud/laser-clean/renameHistoryMap/type.js +1 -0
  118. package/lib/cloud/laser-clean/voice.d.ts +1 -3
  119. package/lib/cloud/laser-clean/voice.js +1 -4
  120. package/lib/cloud/linkage.d.ts +271 -53
  121. package/lib/cloud/linkage.js +256 -51
  122. package/lib/cloud/remoteGroup.d.ts +37 -0
  123. package/lib/cloud/remoteGroup.js +37 -0
  124. package/lib/cloud/timer.d.ts +104 -26
  125. package/lib/cloud/timer.js +104 -26
  126. package/lib/getApp/index.thing.d.ts +47 -1
  127. package/lib/getApp/index.thing.js +40 -2
  128. package/lib/getBoundingClientRect/index.thing.d.ts +101 -1
  129. package/lib/getBoundingClientRect/index.thing.js +59 -0
  130. package/lib/getCurrentPages/index.thing.d.ts +40 -15
  131. package/lib/getCurrentPages/index.thing.js +36 -15
  132. package/lib/getCustomConfig/index.d.ts +5 -2
  133. package/lib/getCustomConfig/index.thing.d.ts +68 -2
  134. package/lib/getCustomConfig/index.thing.js +62 -0
  135. package/lib/getCustomConfig/index.wechat.d.ts +5 -2
  136. package/lib/getCustomConfig/type.d.ts +26 -15
  137. package/lib/getElementById/index.thing.d.ts +42 -1
  138. package/lib/getElementById/index.thing.js +40 -0
  139. package/lib/index.d.ts +3 -0
  140. package/lib/index.js +4 -2
  141. package/lib/nativeRouters/common.d.ts +8 -0
  142. package/lib/nativeRouters/device.d.ts +137 -5
  143. package/lib/nativeRouters/device.js +138 -6
  144. package/lib/nativeRouters/gw.d.ts +58 -8
  145. package/lib/nativeRouters/gw.js +57 -8
  146. package/lib/nativeRouters/outdoors.d.ts +16 -3
  147. package/lib/nativeRouters/outdoors.js +16 -3
  148. package/lib/nativeRouters/remoteGroup.d.ts +23 -0
  149. package/lib/nativeRouters/remoteGroup.js +23 -0
  150. package/lib/nativeRouters/root.d.ts +19 -0
  151. package/lib/nativeRouters/root.js +17 -0
  152. package/lib/openGroupCreate/index.d.ts +45 -0
  153. package/lib/openGroupCreate/index.js +32 -0
  154. package/package.json +5 -5
@@ -0,0 +1,2641 @@
1
+ /**
2
+ * AIStreamKit
3
+ *
4
+ * @version 2.1.0
5
+ */
6
+ declare namespace ty.aistream {
7
+ /**
8
+ * 获取通道连接状态
9
+ * @public
10
+ * @since AIStreamKit 1.0.0
11
+ * @platform iOS Android
12
+ */
13
+ export function isConnected(params: {
14
+ /**
15
+ * client 类型: 1-作为设备代理, 2-作为 App,3-作为开发者
16
+ * @since AIStreamKit 1.0.0
17
+ */
18
+ clientType: number
19
+ /**
20
+ * 代理的设备ID, clientType == 1 时必传
21
+ * @since AIStreamKit 1.0.0
22
+ */
23
+ deviceId?: string
24
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
25
+ complete?: () => void
26
+ /** 接口调用成功的回调函数 */
27
+ success?: (params: {
28
+ /**
29
+ * 是否已连接
30
+ * @since AIStreamKit 1.0.0
31
+ */
32
+ connected: boolean
33
+ /**
34
+ * 通道连接状态: 0-初始化,1-连接中,2-鉴权中,3-已连接,4-被云端断开,5-主动关闭
35
+ * @since AIStreamKit 1.0.0
36
+ */
37
+ state: number
38
+ /**
39
+ * client 类型: 1-作为设备代理, 2-作为 App,3-作为开发者
40
+ * @since AIStreamKit 1.0.0
41
+ */
42
+ clientType?: number
43
+ /**
44
+ * 连接的唯一标识
45
+ * @since AIStreamKit 1.0.0
46
+ */
47
+ connectionId?: string
48
+ }) => void
49
+ /** 接口调用失败的回调函数 */
50
+ fail?: (params: {
51
+ /** 错误信息 */
52
+ errorMsg: string
53
+ /** 错误码 */
54
+ errorCode: string | number
55
+ /** 错误扩展 */
56
+ innerError: {
57
+ /** 错误扩展码 */
58
+ errorCode: string | number
59
+ /** 错误扩展信息 */
60
+ errorMsg: string
61
+ }
62
+ }) => void
63
+ }): void
64
+
65
+ /**
66
+ * 获取通道连接状态
67
+ * @public
68
+ * @since AIStreamKit 1.0.0
69
+ * @platform iOS Android
70
+ */
71
+ export function isConnectedSync(params?: ConnectParams): {
72
+ /**
73
+ * 是否已连接
74
+ * @since AIStreamKit 1.0.0
75
+ */
76
+ connected: boolean
77
+ /**
78
+ * 通道连接状态: 0-初始化,1-连接中,2-鉴权中,3-已连接,4-被云端断开,5-主动关闭
79
+ * @since AIStreamKit 1.0.0
80
+ */
81
+ state: number
82
+ /**
83
+ * client 类型: 1-作为设备代理, 2-作为 App,3-作为开发者
84
+ * @since AIStreamKit 1.0.0
85
+ */
86
+ clientType?: number
87
+ /**
88
+ * 连接的唯一标识
89
+ * @since AIStreamKit 1.0.0
90
+ */
91
+ connectionId?: string
92
+ }
93
+
94
+ /**
95
+ * 发起通道连接,若此前已连接会直接回调成功
96
+ * @public
97
+ * @since AIStreamKit 1.0.0
98
+ * @platform iOS Android
99
+ */
100
+ export function connect(params: {
101
+ /**
102
+ * client 类型: 1-作为设备代理, 2-作为 App,3-作为开发者
103
+ * @since AIStreamKit 1.0.0
104
+ */
105
+ clientType: number
106
+ /**
107
+ * 代理的设备ID, clientType == 1 时必传
108
+ * @since AIStreamKit 1.0.0
109
+ */
110
+ deviceId?: string
111
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
112
+ complete?: () => void
113
+ /** 接口调用成功的回调函数 */
114
+ success?: (params: {
115
+ /**
116
+ * 连接的唯一标识
117
+ * @since AIStreamKit 1.0.0
118
+ */
119
+ connectionId: string
120
+ }) => void
121
+ /** 接口调用失败的回调函数 */
122
+ fail?: (params: {
123
+ /** 错误信息 */
124
+ errorMsg: string
125
+ /** 错误码 */
126
+ errorCode: string | number
127
+ /** 错误扩展 */
128
+ innerError: {
129
+ /** 错误扩展码 */
130
+ errorCode: string | number
131
+ /** 错误扩展信息 */
132
+ errorMsg: string
133
+ }
134
+ }) => void
135
+ }): void
136
+
137
+ /**
138
+ * 查询智能体 token,传递给 createSession
139
+ * @public
140
+ * @since AIStreamKit 1.0.0
141
+ * @platform iOS Android
142
+ */
143
+ export function queryAgentToken(params: {
144
+ /**
145
+ * Owner ID: HomeID,clientType = 3 时可以为空
146
+ * @since AIStreamKit 1.0.0
147
+ */
148
+ ownerId?: string
149
+ /**
150
+ * 智能解决方案 code
151
+ * @since AIStreamKit 1.0.0
152
+ */
153
+ solutionCode: string
154
+ /**
155
+ * 业务接口
156
+ * @since AIStreamKit 1.0.0
157
+ */
158
+ api: string
159
+ /**
160
+ * 业务接口版本,clientType = 3 时可以为空
161
+ * @since AIStreamKit 1.0.0
162
+ */
163
+ apiVersion?: string
164
+ /**
165
+ * 业务额外参数
166
+ * @since AIStreamKit 1.0.0
167
+ */
168
+ extParams: Record<string, string>
169
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
170
+ complete?: () => void
171
+ /** 接口调用成功的回调函数 */
172
+ success?: (params: {
173
+ /**
174
+ * 智能体 token
175
+ * @since AIStreamKit 1.0.0
176
+ */
177
+ agentToken: string
178
+ /**
179
+ * 业务配置
180
+ * @since AIStreamKit 1.0.0
181
+ */
182
+ bizConfig: BizConfig
183
+ /**
184
+ * 业务额外参数, 内容为 JSON String
185
+ * @since AIStreamKit 1.3.3
186
+ */
187
+ extParams: string
188
+ }) => void
189
+ /** 接口调用失败的回调函数 */
190
+ fail?: (params: {
191
+ /** 错误信息 */
192
+ errorMsg: string
193
+ /** 错误码 */
194
+ errorCode: string | number
195
+ /** 错误扩展 */
196
+ innerError: {
197
+ /** 错误扩展码 */
198
+ errorCode: string | number
199
+ /** 错误扩展信息 */
200
+ errorMsg: string
201
+ }
202
+ }) => void
203
+ }): void
204
+
205
+ /**
206
+ * 创建会话
207
+ * @public
208
+ * @since AIStreamKit 1.0.0
209
+ * @platform iOS Android
210
+ */
211
+ export function createSession(params: {
212
+ /**
213
+ * 业务 tag
214
+ * @since AIStreamKit 1.0.0
215
+ * @defaultValue 0
216
+ */
217
+ bizTag?: number
218
+ /**
219
+ * 智能体 token
220
+ * @since AIStreamKit 1.0.0
221
+ */
222
+ agentToken: string
223
+ /**
224
+ * 会话 id. 不传递则自动生成,传递则使用传递的
225
+ * @since AIStreamKit 1.0.0
226
+ */
227
+ sessionId?: string
228
+ /**
229
+ * 业务配置定义(通过 queryAgentToken 传递)
230
+ * @since AIStreamKit 1.0.0
231
+ */
232
+ bizConfig: BizConfig
233
+ /**
234
+ * 扩展属性。已废弃,请使用 userDataJson
235
+ * @since AIStreamKit 1.0.0
236
+ */
237
+ userData?: Attribute[]
238
+ /**
239
+ * 扩展属性
240
+ * @since AIStreamKit 2.0.0
241
+ */
242
+ userDataJson?: string
243
+ /**
244
+ * 是否复用数据通道,默认 不复用
245
+ * 通道复用概念:多个 Session 可复用同一份数据,例如:有两个 Session,一个做转写,一个做翻译,同时共用同一份音频流数据处理
246
+ * @since AIStreamKit 1.0.0
247
+ */
248
+ reuseDataChannel?: boolean
249
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
250
+ complete?: () => void
251
+ /** 接口调用成功的回调函数 */
252
+ success?: (params: {
253
+ /**
254
+ * 会话 id
255
+ * @since AIStreamKit 1.0.0
256
+ */
257
+ sessionId: string
258
+ /**
259
+ * 下发数据通道 DataChannel. (下发数据时,需要使用该列表中的 DataChannel)
260
+ * 音频视频图片文件都只有一路时,例如 bizCode 65537 ["audio", "video", "text", "image"]
261
+ * 有多路重复时,例如 双路音视频:["audio", "audio_1", "video", "video_1", "text", "image"]
262
+ * @since AIStreamKit 1.0.0
263
+ */
264
+ sendDataChannels: string[]
265
+ /**
266
+ * 接收数据通道 DataChannel. (接收数据时,数据中会使用该列表中的 DataChannel 进行上报)
267
+ * 接受通道不会复用,例如:文本、音频 ["text", "audio"]
268
+ * @since AIStreamKit 1.0.0
269
+ */
270
+ revDataChannels: string[]
271
+ }) => void
272
+ /** 接口调用失败的回调函数 */
273
+ fail?: (params: {
274
+ /** 错误信息 */
275
+ errorMsg: string
276
+ /** 错误码 */
277
+ errorCode: string | number
278
+ /** 错误扩展 */
279
+ innerError: {
280
+ /** 错误扩展码 */
281
+ errorCode: string | number
282
+ /** 错误扩展信息 */
283
+ errorMsg: string
284
+ }
285
+ }) => void
286
+ }): void
287
+
288
+ /**
289
+ * 关闭会话
290
+ * @public
291
+ * @since AIStreamKit 1.0.0
292
+ * @platform iOS Android
293
+ */
294
+ export function closeSession(params: {
295
+ /**
296
+ * 会话 id
297
+ * @since AIStreamKit 1.0.0
298
+ */
299
+ sessionId: string
300
+ /**
301
+ * 关闭原因, 非异常则使用 200 来关闭
302
+ * @since AIStreamKit 1.0.0
303
+ */
304
+ code: number
305
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
306
+ complete?: () => void
307
+ /** 接口调用成功的回调函数 */
308
+ success?: (params: null) => void
309
+ /** 接口调用失败的回调函数 */
310
+ fail?: (params: {
311
+ /** 错误信息 */
312
+ errorMsg: string
313
+ /** 错误码 */
314
+ errorCode: string | number
315
+ /** 错误扩展 */
316
+ innerError: {
317
+ /** 错误扩展码 */
318
+ errorCode: string | number
319
+ /** 错误扩展信息 */
320
+ errorMsg: string
321
+ }
322
+ }) => void
323
+ }): void
324
+
325
+ /**
326
+ * 关闭连接,主要针对作为设备代理的情况,以App身份使用时不需要调用
327
+ * @public
328
+ * @since AIStreamKit 1.0.0
329
+ * @platform iOS Android
330
+ */
331
+ export function disconnect(params: {
332
+ /**
333
+ * 需要断连的 connection Id
334
+ * @since AIStreamKit 1.0.0
335
+ */
336
+ connectionId: string
337
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
338
+ complete?: () => void
339
+ /** 接口调用成功的回调函数 */
340
+ success?: (params: null) => void
341
+ /** 接口调用失败的回调函数 */
342
+ fail?: (params: {
343
+ /** 错误信息 */
344
+ errorMsg: string
345
+ /** 错误码 */
346
+ errorCode: string | number
347
+ /** 错误扩展 */
348
+ innerError: {
349
+ /** 错误扩展码 */
350
+ errorCode: string | number
351
+ /** 错误扩展信息 */
352
+ errorMsg: string
353
+ }
354
+ }) => void
355
+ }): void
356
+
357
+ /**
358
+ * 开始事件
359
+ * @public
360
+ * @since AIStreamKit 1.0.0
361
+ * @platform iOS Android
362
+ */
363
+ export function sendEventStart(params: {
364
+ /**
365
+ * 会话 id
366
+ * @since AIStreamKit 1.0.0
367
+ */
368
+ sessionId: string
369
+ /**
370
+ * 扩展属性。已废弃,请使用 userDataJson
371
+ * @since AIStreamKit 1.0.0
372
+ */
373
+ userData?: Attribute[]
374
+ /**
375
+ * 扩展属性
376
+ * @since AIStreamKit 2.0.0
377
+ */
378
+ userDataJson?: string
379
+ /**
380
+ * Event ID 前缀。(可选)
381
+ * 传递则格式为: "$prefix_event_$sessionId.sub(8)_$timestamp"
382
+ * 不传递格式为: "ios_event_$sessionId.sub(8)_$timestamp"、"Android_Event_$sessionId.sub(8)_$timestamp"
383
+ * @since AIStreamKit 1.3.2
384
+ */
385
+ eventIdPrefix?: string
386
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
387
+ complete?: () => void
388
+ /** 接口调用成功的回调函数 */
389
+ success?: (params: {
390
+ /**
391
+ * 事件 id。此后 sendEventPayloadEnd、sendEventEnd、sendEventChatBreak 都需要使用该 eventId 直到下发一次 sendEventStart 生成新 eventId 之前。
392
+ * @since AIStreamKit 1.0.0
393
+ */
394
+ eventId: string
395
+ }) => void
396
+ /** 接口调用失败的回调函数 */
397
+ fail?: (params: {
398
+ /** 错误信息 */
399
+ errorMsg: string
400
+ /** 错误码 */
401
+ errorCode: string | number
402
+ /** 错误扩展 */
403
+ innerError: {
404
+ /** 错误扩展码 */
405
+ errorCode: string | number
406
+ /** 错误扩展信息 */
407
+ errorMsg: string
408
+ }
409
+ }) => void
410
+ }): void
411
+
412
+ /**
413
+ * 某个数据流传输结束事件(新版本已经废弃,现内部实现为永远callback success,所有数据传递完毕后,直接使用 sendEventEnd 结束即可)
414
+ * @public
415
+ * @since AIStreamKit 1.0.0
416
+ * @platform iOS Android
417
+ */
418
+ export function sendEventPayloadEnd(params: {
419
+ /**
420
+ * 事件 id
421
+ * @since AIStreamKit 1.0.0
422
+ */
423
+ eventId: string
424
+ /**
425
+ * 会话 id
426
+ * @since AIStreamKit 1.0.0
427
+ */
428
+ sessionId: string
429
+ /**
430
+ * 发送结束的数据通道
431
+ * @since AIStreamKit 1.0.0
432
+ */
433
+ dataChannel: string
434
+ /**
435
+ * 扩展属性。已废弃,请使用 userDataJson
436
+ * @since AIStreamKit 1.0.0
437
+ */
438
+ userData?: Attribute[]
439
+ /**
440
+ * 扩展属性
441
+ * @since AIStreamKit 2.0.0
442
+ */
443
+ userDataJson?: string
444
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
445
+ complete?: () => void
446
+ /** 接口调用成功的回调函数 */
447
+ success?: (params: null) => void
448
+ /** 接口调用失败的回调函数 */
449
+ fail?: (params: {
450
+ /** 错误信息 */
451
+ errorMsg: string
452
+ /** 错误码 */
453
+ errorCode: string | number
454
+ /** 错误扩展 */
455
+ innerError: {
456
+ /** 错误扩展码 */
457
+ errorCode: string | number
458
+ /** 错误扩展信息 */
459
+ errorMsg: string
460
+ }
461
+ }) => void
462
+ }): void
463
+
464
+ /**
465
+ * 结束事件
466
+ * @public
467
+ * @since AIStreamKit 1.0.0
468
+ * @platform iOS Android
469
+ */
470
+ export function sendEventEnd(params: {
471
+ /**
472
+ * 事件 id
473
+ * @since AIStreamKit 1.0.0
474
+ */
475
+ eventId: string
476
+ /**
477
+ * 会话 id
478
+ * @since AIStreamKit 1.0.0
479
+ */
480
+ sessionId: string
481
+ /**
482
+ * 扩展属性。已废弃,请使用 userDataJson
483
+ * @since AIStreamKit 1.0.0
484
+ */
485
+ userData?: Attribute[]
486
+ /**
487
+ * 扩展属性
488
+ * @since AIStreamKit 2.0.0
489
+ */
490
+ userDataJson?: string
491
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
492
+ complete?: () => void
493
+ /** 接口调用成功的回调函数 */
494
+ success?: (params: null) => void
495
+ /** 接口调用失败的回调函数 */
496
+ fail?: (params: {
497
+ /** 错误信息 */
498
+ errorMsg: string
499
+ /** 错误码 */
500
+ errorCode: string | number
501
+ /** 错误扩展 */
502
+ innerError: {
503
+ /** 错误扩展码 */
504
+ errorCode: string | number
505
+ /** 错误扩展信息 */
506
+ errorMsg: string
507
+ }
508
+ }) => void
509
+ }): void
510
+
511
+ /**
512
+ * 打断事件。用于:1. 中止自己的发送,2. 中止接收云端的回复
513
+ * @public
514
+ * @since AIStreamKit 1.0.0
515
+ * @platform iOS Android
516
+ */
517
+ export function sendEventChatBreak(params: {
518
+ /**
519
+ * 事件 id,
520
+ * @since AIStreamKit 1.0.0
521
+ */
522
+ eventId: string
523
+ /**
524
+ * 会话 id
525
+ * @since AIStreamKit 1.0.0
526
+ */
527
+ sessionId: string
528
+ /**
529
+ * 扩展属性。已废弃,请使用 userDataJson
530
+ * @since AIStreamKit 1.0.0
531
+ */
532
+ userData?: Attribute[]
533
+ /**
534
+ * 扩展属性
535
+ * @since AIStreamKit 2.0.0
536
+ */
537
+ userDataJson?: string
538
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
539
+ complete?: () => void
540
+ /** 接口调用成功的回调函数 */
541
+ success?: (params: null) => void
542
+ /** 接口调用失败的回调函数 */
543
+ fail?: (params: {
544
+ /** 错误信息 */
545
+ errorMsg: string
546
+ /** 错误码 */
547
+ errorCode: string | number
548
+ /** 错误扩展 */
549
+ innerError: {
550
+ /** 错误扩展码 */
551
+ errorCode: string | number
552
+ /** 错误扩展信息 */
553
+ errorMsg: string
554
+ }
555
+ }) => void
556
+ }): void
557
+
558
+ /**
559
+ * 初始化录制音频,默认配置: SampleRate=16000Hz, Channel=单声道, bitDepth=16位深, codec=PCM 编码。
560
+ * 目前仅能定义 SampleRate采样率
561
+ * @public
562
+ * @since AIStreamKit 1.0.0
563
+ * @platform iOS Android
564
+ */
565
+ export function initAudioRecorder(params?: {
566
+ /**
567
+ * 音频采样率,单位Hz, 默认 16000 Hz
568
+ * 表示每秒采样次数,常见值:8000, 16000, 22050, 24000, 44100等
569
+ * @since AIStreamKit 1.1.0
570
+ * @defaultValue 16000
571
+ */
572
+ sampleRate?: number
573
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
574
+ complete?: () => void
575
+ /** 接口调用成功的回调函数 */
576
+ success?: (params: null) => void
577
+ /** 接口调用失败的回调函数 */
578
+ fail?: (params: {
579
+ /** 错误信息 */
580
+ errorMsg: string
581
+ /** 错误码 */
582
+ errorCode: string | number
583
+ /** 错误扩展 */
584
+ innerError: {
585
+ /** 错误扩展码 */
586
+ errorCode: string | number
587
+ /** 错误扩展信息 */
588
+ errorMsg: string
589
+ }
590
+ }) => void
591
+ }): void
592
+
593
+ /**
594
+ * 开始录制并发送音频数据
595
+ * 注意:初始化会有 300 ~ 600ms 的初始化耗时,此时说话无法采集,建议前置调用 `initAudioRecorder` 初始化音频参数
596
+ * @public
597
+ * @since AIStreamKit 1.0.0
598
+ * @platform iOS Android
599
+ */
600
+ export function startRecordAndSendAudioData(params: {
601
+ /**
602
+ * 会话 id
603
+ * @since AIStreamKit 1.0.0
604
+ */
605
+ sessionId: string
606
+ /**
607
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
608
+ * @since AIStreamKit 1.0.0
609
+ */
610
+ dataChannel?: string
611
+ /**
612
+ * 扩展属性。已废弃,请使用 userDataJson
613
+ * @since AIStreamKit 1.0.0
614
+ */
615
+ userData?: Attribute[]
616
+ /**
617
+ * 是否需要保存录制的音频文件,仅单次录音周期生效。默认: false 不保存
618
+ * @since AIStreamKit 1.1.0
619
+ * @defaultValue false
620
+ */
621
+ saveFile?: boolean
622
+ /**
623
+ * 录音初始化参数(若使用 initAudioRecorder 提前初始化过,可以不传)
624
+ * 1. 不传递,则使用最后一次调用 `initAudioRecorder` 的值,从未调用过则会使用默认配置 16000Hz、单声道、16bit位深进行初始化。
625
+ * 2. 当传递的参数与上一次不一致时,则会重新初始化。
626
+ * 3. 初始化会有 300 ~ 600ms 的初始化耗时,此时说话无法采集,通常会丢 2 ~ 4 个汉字的音频,建议合适的时机提前调用 `initAudioRecorder` 完成初始化。
627
+ * @since AIStreamKit 1.1.0
628
+ */
629
+ recordInitParams?: RecordInitParams
630
+ /**
631
+ * 扩展属性
632
+ * @since AIStreamKit 2.0.0
633
+ */
634
+ userDataJson?: string
635
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
636
+ complete?: () => void
637
+ /** 接口调用成功的回调函数 */
638
+ success?: (params: null) => void
639
+ /** 接口调用失败的回调函数 */
640
+ fail?: (params: {
641
+ /** 错误信息 */
642
+ errorMsg: string
643
+ /** 错误码 */
644
+ errorCode: string | number
645
+ /** 错误扩展 */
646
+ innerError: {
647
+ /** 错误扩展码 */
648
+ errorCode: string | number
649
+ /** 错误扩展信息 */
650
+ errorMsg: string
651
+ }
652
+ }) => void
653
+ }): void
654
+
655
+ /**
656
+ * 结束录制并发送音频数据
657
+ * @public
658
+ * @since AIStreamKit 1.0.0
659
+ * @platform iOS Android
660
+ */
661
+ export function stopRecordAndSendAudioData(params: {
662
+ /**
663
+ * 会话 id
664
+ * @since AIStreamKit 1.0.0
665
+ */
666
+ sessionId: string
667
+ /**
668
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
669
+ * @since AIStreamKit 1.0.0
670
+ */
671
+ dataChannel?: string
672
+ /**
673
+ * 扩展属性。已废弃,请使用 userDataJson
674
+ * @since AIStreamKit 1.0.0
675
+ */
676
+ userData?: Attribute[]
677
+ /**
678
+ * 是否需要保存录制的音频文件,仅单次录音周期生效。默认: false 不保存
679
+ * @since AIStreamKit 1.1.0
680
+ * @defaultValue false
681
+ */
682
+ saveFile?: boolean
683
+ /**
684
+ * 录音初始化参数(若使用 initAudioRecorder 提前初始化过,可以不传)
685
+ * 1. 不传递,则使用最后一次调用 `initAudioRecorder` 的值,从未调用过则会使用默认配置 16000Hz、单声道、16bit位深进行初始化。
686
+ * 2. 当传递的参数与上一次不一致时,则会重新初始化。
687
+ * 3. 初始化会有 300 ~ 600ms 的初始化耗时,此时说话无法采集,通常会丢 2 ~ 4 个汉字的音频,建议合适的时机提前调用 `initAudioRecorder` 完成初始化。
688
+ * @since AIStreamKit 1.1.0
689
+ */
690
+ recordInitParams?: RecordInitParams
691
+ /**
692
+ * 扩展属性
693
+ * @since AIStreamKit 2.0.0
694
+ */
695
+ userDataJson?: string
696
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
697
+ complete?: () => void
698
+ /** 接口调用成功的回调函数 */
699
+ success?: (params: {
700
+ /**
701
+ * 录音保存的文件路径,注意需要在 `startRecordAndSendAudioData` 中传递 `saveFile` 为 true 时才会有值
702
+ * @since AIStreamKit 1.1.0
703
+ */
704
+ path?: string
705
+ /**
706
+ * 音频编码类型,表示音频数据的编码格式。目前仅保存为 WAV(PCM) 文件
707
+ * - 1000: WAV(PCM) App本地定义
708
+ * @since AIStreamKit 1.1.0
709
+ */
710
+ codecType: number
711
+ /**
712
+ * 音频采样率,单位Hz
713
+ * 表示每秒采样次数,常见值:8000, 16000, 22050, 24000, 44100等
714
+ * @since AIStreamKit 1.1.0
715
+ */
716
+ sampleRate: number
717
+ /**
718
+ * 音频通道数
719
+ * - 0: 单声道
720
+ * - 1: 立体声
721
+ * @since AIStreamKit 1.1.0
722
+ */
723
+ channels: number
724
+ /**
725
+ * 音频位深,表示每个采样点的位数
726
+ * 常见值:8, 16, 24, 32等
727
+ * @since AIStreamKit 1.1.0
728
+ */
729
+ bitDepth: number
730
+ }) => void
731
+ /** 接口调用失败的回调函数 */
732
+ fail?: (params: {
733
+ /** 错误信息 */
734
+ errorMsg: string
735
+ /** 错误码 */
736
+ errorCode: string | number
737
+ /** 错误扩展 */
738
+ innerError: {
739
+ /** 错误扩展码 */
740
+ errorCode: string | number
741
+ /** 错误扩展信息 */
742
+ errorMsg: string
743
+ }
744
+ }) => void
745
+ }): void
746
+
747
+ /**
748
+ * 发送图片数据
749
+ * @public
750
+ * @since AIStreamKit 1.0.0
751
+ * @platform iOS Android
752
+ */
753
+ export function sendImageData(params: {
754
+ /**
755
+ * 会话 id
756
+ * @since AIStreamKit 1.0.0
757
+ */
758
+ sessionId: string
759
+ /**
760
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
761
+ * @since AIStreamKit 1.0.0
762
+ */
763
+ dataChannel?: string
764
+ /**
765
+ * 图片路径
766
+ * @since AIStreamKit 1.0.0
767
+ */
768
+ path: string
769
+ /**
770
+ * 图片类型: 1-JPEG, 2-PNG
771
+ * @since AIStreamKit 1.0.0
772
+ */
773
+ format: number
774
+ /**
775
+ * 扩展属性。已废弃,请使用 userDataJson
776
+ * @since AIStreamKit 1.0.0
777
+ */
778
+ userData?: Attribute[]
779
+ /**
780
+ * 扩展属性
781
+ * @since AIStreamKit 2.0.0
782
+ */
783
+ userDataJson?: string
784
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
785
+ complete?: () => void
786
+ /** 接口调用成功的回调函数 */
787
+ success?: (params: null) => void
788
+ /** 接口调用失败的回调函数 */
789
+ fail?: (params: {
790
+ /** 错误信息 */
791
+ errorMsg: string
792
+ /** 错误码 */
793
+ errorCode: string | number
794
+ /** 错误扩展 */
795
+ innerError: {
796
+ /** 错误扩展码 */
797
+ errorCode: string | number
798
+ /** 错误扩展信息 */
799
+ errorMsg: string
800
+ }
801
+ }) => void
802
+ }): void
803
+
804
+ /**
805
+ * 发送文本数据
806
+ * @public
807
+ * @since AIStreamKit 1.0.0
808
+ * @platform iOS Android
809
+ */
810
+ export function sendTextData(params: {
811
+ /**
812
+ * 会话 id
813
+ * @since AIStreamKit 1.0.0
814
+ */
815
+ sessionId: string
816
+ /**
817
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
818
+ * @since AIStreamKit 1.0.0
819
+ */
820
+ dataChannel?: string
821
+ /**
822
+ * 文本内容
823
+ * @since AIStreamKit 1.0.0
824
+ */
825
+ text: string
826
+ /**
827
+ * 扩展属性。已废弃,请使用 userDataJson
828
+ * @since AIStreamKit 1.0.0
829
+ */
830
+ userData?: Attribute[]
831
+ /**
832
+ * 扩展属性
833
+ * @since AIStreamKit 2.0.0
834
+ */
835
+ userDataJson?: string
836
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
837
+ complete?: () => void
838
+ /** 接口调用成功的回调函数 */
839
+ success?: (params: null) => void
840
+ /** 接口调用失败的回调函数 */
841
+ fail?: (params: {
842
+ /** 错误信息 */
843
+ errorMsg: string
844
+ /** 错误码 */
845
+ errorCode: string | number
846
+ /** 错误扩展 */
847
+ innerError: {
848
+ /** 错误扩展码 */
849
+ errorCode: string | number
850
+ /** 错误扩展信息 */
851
+ errorMsg: string
852
+ }
853
+ }) => void
854
+ }): void
855
+
856
+ /**
857
+ * 批量查询记录
858
+ * @public
859
+ * @since AIStreamKit 1.0.0
860
+ * @platform iOS Android
861
+ */
862
+ export function queryRecordList(params?: {
863
+ /**
864
+ * 自增ID
865
+ * @since AIStreamKit 1.0.0
866
+ */
867
+ id?: number[]
868
+ /**
869
+ * biz Code 大类目,可搜索
870
+ * @since AIStreamKit 1.0.0
871
+ */
872
+ bizCode?: number[]
873
+ /**
874
+ * 智能解决方案 code, 可搜索
875
+ * @since AIStreamKit 1.0.0
876
+ */
877
+ solutionCode?: string[]
878
+ /**
879
+ * 设备 id,可搜索
880
+ * @since AIStreamKit 1.0.0
881
+ */
882
+ devId?: string[]
883
+ /**
884
+ * 家庭 id, 可搜索
885
+ * @since AIStreamKit 1.0.0
886
+ */
887
+ homeId?: number[]
888
+ /**
889
+ * type, 业务自行决定,可搜索
890
+ * @since AIStreamKit 1.0.0
891
+ */
892
+ type?: string[]
893
+ /**
894
+ * 索引, 业务自行决定,可搜索
895
+ * @since AIStreamKit 1.0.0
896
+ */
897
+ index?: string[]
898
+ /**
899
+ * 扩展索引1, 业务自行决定,可搜索
900
+ * @since AIStreamKit 1.0.0
901
+ */
902
+ index1?: string[]
903
+ /**
904
+ * 扩展索引2, 业务自行决定,可搜索
905
+ * @since AIStreamKit 1.0.0
906
+ */
907
+ index2?: string[]
908
+ /**
909
+ * offset 分页偏移量(删除时无需传递)
910
+ * @since AIStreamKit 1.0.0
911
+ */
912
+ offset?: number
913
+ /**
914
+ * limit 分页大小, 不传或传0则不分页(删除时无需传递)
915
+ * @since AIStreamKit 1.0.0
916
+ */
917
+ limit?: number
918
+ /**
919
+ * 排序方式,仅用于 `queryRecordList`
920
+ * - 0: 按 id 降序(默认)
921
+ * - 1: 按 id 升序
922
+ * @since AIStreamKit 1.0.0
923
+ */
924
+ sortType?: number
925
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
926
+ complete?: () => void
927
+ /** 接口调用成功的回调函数 */
928
+ success?: (params: {
929
+ /**
930
+ * 记录列表
931
+ * @since AIStreamKit 1.0.0
932
+ */
933
+ records: RecordBody[]
934
+ /**
935
+ * 记录总数
936
+ * @since AIStreamKit 1.0.0
937
+ */
938
+ total: number
939
+ }) => void
940
+ /** 接口调用失败的回调函数 */
941
+ fail?: (params: {
942
+ /** 错误信息 */
943
+ errorMsg: string
944
+ /** 错误码 */
945
+ errorCode: string | number
946
+ /** 错误扩展 */
947
+ innerError: {
948
+ /** 错误扩展码 */
949
+ errorCode: string | number
950
+ /** 错误扩展信息 */
951
+ errorMsg: string
952
+ }
953
+ }) => void
954
+ }): void
955
+
956
+ /**
957
+ * 批量删除记录
958
+ * @public
959
+ * @since AIStreamKit 1.0.0
960
+ * @platform iOS Android
961
+ */
962
+ export function deleteRecordList(params?: {
963
+ /**
964
+ * 自增ID
965
+ * @since AIStreamKit 1.0.0
966
+ */
967
+ id?: number[]
968
+ /**
969
+ * biz Code 大类目,可搜索
970
+ * @since AIStreamKit 1.0.0
971
+ */
972
+ bizCode?: number[]
973
+ /**
974
+ * 智能解决方案 code, 可搜索
975
+ * @since AIStreamKit 1.0.0
976
+ */
977
+ solutionCode?: string[]
978
+ /**
979
+ * 设备 id,可搜索
980
+ * @since AIStreamKit 1.0.0
981
+ */
982
+ devId?: string[]
983
+ /**
984
+ * 家庭 id, 可搜索
985
+ * @since AIStreamKit 1.0.0
986
+ */
987
+ homeId?: number[]
988
+ /**
989
+ * type, 业务自行决定,可搜索
990
+ * @since AIStreamKit 1.0.0
991
+ */
992
+ type?: string[]
993
+ /**
994
+ * 索引, 业务自行决定,可搜索
995
+ * @since AIStreamKit 1.0.0
996
+ */
997
+ index?: string[]
998
+ /**
999
+ * 扩展索引1, 业务自行决定,可搜索
1000
+ * @since AIStreamKit 1.0.0
1001
+ */
1002
+ index1?: string[]
1003
+ /**
1004
+ * 扩展索引2, 业务自行决定,可搜索
1005
+ * @since AIStreamKit 1.0.0
1006
+ */
1007
+ index2?: string[]
1008
+ /**
1009
+ * offset 分页偏移量(删除时无需传递)
1010
+ * @since AIStreamKit 1.0.0
1011
+ */
1012
+ offset?: number
1013
+ /**
1014
+ * limit 分页大小, 不传或传0则不分页(删除时无需传递)
1015
+ * @since AIStreamKit 1.0.0
1016
+ */
1017
+ limit?: number
1018
+ /**
1019
+ * 排序方式,仅用于 `queryRecordList`
1020
+ * - 0: 按 id 降序(默认)
1021
+ * - 1: 按 id 升序
1022
+ * @since AIStreamKit 1.0.0
1023
+ */
1024
+ sortType?: number
1025
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1026
+ complete?: () => void
1027
+ /** 接口调用成功的回调函数 */
1028
+ success?: (params: null) => void
1029
+ /** 接口调用失败的回调函数 */
1030
+ fail?: (params: {
1031
+ /** 错误信息 */
1032
+ errorMsg: string
1033
+ /** 错误码 */
1034
+ errorCode: string | number
1035
+ /** 错误扩展 */
1036
+ innerError: {
1037
+ /** 错误扩展码 */
1038
+ errorCode: string | number
1039
+ /** 错误扩展信息 */
1040
+ errorMsg: string
1041
+ }
1042
+ }) => void
1043
+ }): void
1044
+
1045
+ /**
1046
+ * 更新单条记录
1047
+ * @public
1048
+ * @since AIStreamKit 1.0.0
1049
+ * @platform iOS Android
1050
+ */
1051
+ export function updateRecord(params?: {
1052
+ /**
1053
+ * 记录ID, 自增. (insertRecord 不传, updateRecord 必传, 作为 Response 返回时必有值)
1054
+ * @since AIStreamKit 1.0.0
1055
+ */
1056
+ id?: number
1057
+ /**
1058
+ * biz Code 大类目,可搜索
1059
+ * @since AIStreamKit 1.0.0
1060
+ */
1061
+ bizCode?: number
1062
+ /**
1063
+ * 智能解决方案 code, 可搜索
1064
+ * @since AIStreamKit 1.0.0
1065
+ */
1066
+ solutionCode?: string
1067
+ /**
1068
+ * 设备 id,可搜索
1069
+ * @since AIStreamKit 1.0.0
1070
+ */
1071
+ devId?: string
1072
+ /**
1073
+ * 家庭 id, 可搜索
1074
+ * @since AIStreamKit 1.0.0
1075
+ */
1076
+ homeId?: number
1077
+ /**
1078
+ * type, 业务自行决定,可搜索
1079
+ * @since AIStreamKit 1.0.0
1080
+ */
1081
+ type?: string
1082
+ /**
1083
+ * 索引, 业务自行决定,可搜索
1084
+ * @since AIStreamKit 1.0.0
1085
+ */
1086
+ index?: string
1087
+ /**
1088
+ * 扩展索引1, 业务自行决定,可搜索
1089
+ * @since AIStreamKit 1.0.0
1090
+ */
1091
+ index1?: string
1092
+ /**
1093
+ * 扩展索引2, 业务自行决定,可搜索
1094
+ * @since AIStreamKit 1.0.0
1095
+ */
1096
+ index2?: string
1097
+ /**
1098
+ * 缓存数据,JSON格式,不可搜索
1099
+ * @since AIStreamKit 1.0.0
1100
+ */
1101
+ data?: string
1102
+ /**
1103
+ * 值,不可搜索
1104
+ * @since AIStreamKit 1.0.0
1105
+ */
1106
+ value?: string
1107
+ /**
1108
+ * 扩展值1,不可搜索
1109
+ * @since AIStreamKit 1.0.0
1110
+ */
1111
+ value1?: string
1112
+ /**
1113
+ * 扩展值2,不可搜索
1114
+ * @since AIStreamKit 1.0.0
1115
+ */
1116
+ value2?: string
1117
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1118
+ complete?: () => void
1119
+ /** 接口调用成功的回调函数 */
1120
+ success?: (params: null) => void
1121
+ /** 接口调用失败的回调函数 */
1122
+ fail?: (params: {
1123
+ /** 错误信息 */
1124
+ errorMsg: string
1125
+ /** 错误码 */
1126
+ errorCode: string | number
1127
+ /** 错误扩展 */
1128
+ innerError: {
1129
+ /** 错误扩展码 */
1130
+ errorCode: string | number
1131
+ /** 错误扩展信息 */
1132
+ errorMsg: string
1133
+ }
1134
+ }) => void
1135
+ }): void
1136
+
1137
+ /**
1138
+ * 插入单条记录
1139
+ * @public
1140
+ * @since AIStreamKit 1.0.0
1141
+ * @platform iOS Android
1142
+ */
1143
+ export function insertRecord(params?: {
1144
+ /**
1145
+ * 记录ID, 自增. (insertRecord 不传, updateRecord 必传, 作为 Response 返回时必有值)
1146
+ * @since AIStreamKit 1.0.0
1147
+ */
1148
+ id?: number
1149
+ /**
1150
+ * biz Code 大类目,可搜索
1151
+ * @since AIStreamKit 1.0.0
1152
+ */
1153
+ bizCode?: number
1154
+ /**
1155
+ * 智能解决方案 code, 可搜索
1156
+ * @since AIStreamKit 1.0.0
1157
+ */
1158
+ solutionCode?: string
1159
+ /**
1160
+ * 设备 id,可搜索
1161
+ * @since AIStreamKit 1.0.0
1162
+ */
1163
+ devId?: string
1164
+ /**
1165
+ * 家庭 id, 可搜索
1166
+ * @since AIStreamKit 1.0.0
1167
+ */
1168
+ homeId?: number
1169
+ /**
1170
+ * type, 业务自行决定,可搜索
1171
+ * @since AIStreamKit 1.0.0
1172
+ */
1173
+ type?: string
1174
+ /**
1175
+ * 索引, 业务自行决定,可搜索
1176
+ * @since AIStreamKit 1.0.0
1177
+ */
1178
+ index?: string
1179
+ /**
1180
+ * 扩展索引1, 业务自行决定,可搜索
1181
+ * @since AIStreamKit 1.0.0
1182
+ */
1183
+ index1?: string
1184
+ /**
1185
+ * 扩展索引2, 业务自行决定,可搜索
1186
+ * @since AIStreamKit 1.0.0
1187
+ */
1188
+ index2?: string
1189
+ /**
1190
+ * 缓存数据,JSON格式,不可搜索
1191
+ * @since AIStreamKit 1.0.0
1192
+ */
1193
+ data?: string
1194
+ /**
1195
+ * 值,不可搜索
1196
+ * @since AIStreamKit 1.0.0
1197
+ */
1198
+ value?: string
1199
+ /**
1200
+ * 扩展值1,不可搜索
1201
+ * @since AIStreamKit 1.0.0
1202
+ */
1203
+ value1?: string
1204
+ /**
1205
+ * 扩展值2,不可搜索
1206
+ * @since AIStreamKit 1.0.0
1207
+ */
1208
+ value2?: string
1209
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1210
+ complete?: () => void
1211
+ /** 接口调用成功的回调函数 */
1212
+ success?: (params: {
1213
+ /**
1214
+ * 记录ID
1215
+ * @since AIStreamKit 1.0.0
1216
+ */
1217
+ id: number
1218
+ }) => void
1219
+ /** 接口调用失败的回调函数 */
1220
+ fail?: (params: {
1221
+ /** 错误信息 */
1222
+ errorMsg: string
1223
+ /** 错误码 */
1224
+ errorCode: string | number
1225
+ /** 错误扩展 */
1226
+ innerError: {
1227
+ /** 错误扩展码 */
1228
+ errorCode: string | number
1229
+ /** 错误扩展信息 */
1230
+ errorMsg: string
1231
+ }
1232
+ }) => void
1233
+ }): void
1234
+
1235
+ /**
1236
+ * 注册音频幅度监听(通过 `onRecordAmplitudes` 回调)
1237
+ * @public
1238
+ * @since AIStreamKit 1.0.0
1239
+ * @platform iOS Android
1240
+ */
1241
+ export function registerRecordAmplitudes(params: {
1242
+ /**
1243
+ * 振幅柱状数据数量
1244
+ * @since AIStreamKit 1.0.0
1245
+ */
1246
+ count: number
1247
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1248
+ complete?: () => void
1249
+ /** 接口调用成功的回调函数 */
1250
+ success?: (params: null) => void
1251
+ /** 接口调用失败的回调函数 */
1252
+ fail?: (params: {
1253
+ /** 错误信息 */
1254
+ errorMsg: string
1255
+ /** 错误码 */
1256
+ errorCode: string | number
1257
+ /** 错误扩展 */
1258
+ innerError: {
1259
+ /** 错误扩展码 */
1260
+ errorCode: string | number
1261
+ /** 错误扩展信息 */
1262
+ errorMsg: string
1263
+ }
1264
+ }) => void
1265
+ }): void
1266
+
1267
+ /**
1268
+ * 注销音频振幅监听
1269
+ * @public
1270
+ * @since AIStreamKit 1.0.0
1271
+ * @platform iOS Android
1272
+ */
1273
+ export function unregisterVoiceAmplitudes(params?: {
1274
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1275
+ complete?: () => void
1276
+ /** 接口调用成功的回调函数 */
1277
+ success?: (params: null) => void
1278
+ /** 接口调用失败的回调函数 */
1279
+ fail?: (params: {
1280
+ /** 错误信息 */
1281
+ errorMsg: string
1282
+ /** 错误码 */
1283
+ errorCode: string | number
1284
+ /** 错误扩展 */
1285
+ innerError: {
1286
+ /** 错误扩展码 */
1287
+ errorCode: string | number
1288
+ /** 错误扩展信息 */
1289
+ errorMsg: string
1290
+ }
1291
+ }) => void
1292
+ }): void
1293
+
1294
+ /**
1295
+ * 开始播放收到的音频数据
1296
+ * @public
1297
+ * @since AIStreamKit 1.0.0
1298
+ * @platform iOS Android
1299
+ */
1300
+ export function startPlayAudio(params: {
1301
+ /**
1302
+ * 音频缓存路径
1303
+ * @since AIStreamKit 1.0.0
1304
+ */
1305
+ path: string
1306
+ /**
1307
+ * 音频编码类型,表示音频数据的编码格式。目前仅支持 `PCM`, `MP3`, `WAV(PCM)` 播放
1308
+ * - 101: PCM
1309
+ * - 109: MP3
1310
+ * - 1000: WAV(PCM) App本地定义
1311
+ * @since AIStreamKit 1.0.0
1312
+ */
1313
+ codecType: number
1314
+ /**
1315
+ * 音频采样率,单位Hz
1316
+ * 表示每秒采样次数,常见值:8000, 16000, 22050, 24000, 44100等
1317
+ * @since AIStreamKit 1.0.0
1318
+ */
1319
+ sampleRate: number
1320
+ /**
1321
+ * 音频通道数
1322
+ * - 0: 单声道
1323
+ * - 1: 立体声
1324
+ * @since AIStreamKit 1.0.0
1325
+ */
1326
+ channels: number
1327
+ /**
1328
+ * 音频位深,表示每个采样点的位数
1329
+ * 常见值:8, 16, 24, 32等
1330
+ * @since AIStreamKit 1.0.0
1331
+ */
1332
+ bitDepth: number
1333
+ /**
1334
+ * 微秒级时间戳
1335
+ * 用于音频回放时的同步
1336
+ * @since AIStreamKit 1.0.0
1337
+ */
1338
+ pts?: number
1339
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1340
+ complete?: () => void
1341
+ /** 接口调用成功的回调函数 */
1342
+ success?: (params: null) => void
1343
+ /** 接口调用失败的回调函数 */
1344
+ fail?: (params: {
1345
+ /** 错误信息 */
1346
+ errorMsg: string
1347
+ /** 错误码 */
1348
+ errorCode: string | number
1349
+ /** 错误扩展 */
1350
+ innerError: {
1351
+ /** 错误扩展码 */
1352
+ errorCode: string | number
1353
+ /** 错误扩展信息 */
1354
+ errorMsg: string
1355
+ }
1356
+ }) => void
1357
+ }): void
1358
+
1359
+ /**
1360
+ * 停止播放音频
1361
+ * @public
1362
+ * @since AIStreamKit 1.0.0
1363
+ * @platform iOS Android
1364
+ */
1365
+ export function stopPlayAudio(params?: {
1366
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
1367
+ complete?: () => void
1368
+ /** 接口调用成功的回调函数 */
1369
+ success?: (params: null) => void
1370
+ /** 接口调用失败的回调函数 */
1371
+ fail?: (params: {
1372
+ /** 错误信息 */
1373
+ errorMsg: string
1374
+ /** 错误码 */
1375
+ errorCode: string | number
1376
+ /** 错误扩展 */
1377
+ innerError: {
1378
+ /** 错误扩展码 */
1379
+ errorCode: string | number
1380
+ /** 错误扩展信息 */
1381
+ errorMsg: string
1382
+ }
1383
+ }) => void
1384
+ }): void
1385
+
1386
+ /**
1387
+ * 监听 Event事件 接收上报, 注意 body 中的 eventType 区别.
1388
+ * @public
1389
+ * @since AIStreamKit 1.0.0
1390
+ * @platform iOS Android
1391
+ */
1392
+ export function onEventReceived(listener: (params: EventBody) => void): void
1393
+
1394
+ /**
1395
+ * 监听 Event事件 接收上报, 注意 body 中的 eventType 区别.
1396
+ * @public
1397
+ * @since AIStreamKit 1.0.0
1398
+ * @platform iOS Android
1399
+ */
1400
+ export function offEventReceived(listener: (params: EventBody) => void): void
1401
+
1402
+ /**
1403
+ * 监听 音频数据 接收上报,仅回调 仅一包、首包、尾包
1404
+ * @public
1405
+ * @since AIStreamKit 1.0.0
1406
+ * @platform iOS Android
1407
+ */
1408
+ export function onAudioReceived(listener: (params: AudioBody) => void): void
1409
+
1410
+ /**
1411
+ * 监听 音频数据 接收上报,仅回调 仅一包、首包、尾包
1412
+ * @public
1413
+ * @since AIStreamKit 1.0.0
1414
+ * @platform iOS Android
1415
+ */
1416
+ export function offAudioReceived(listener: (params: AudioBody) => void): void
1417
+
1418
+ /**
1419
+ * 监听 图片数据 接收上报
1420
+ * @public
1421
+ * @since AIStreamKit 1.0.0
1422
+ * @platform iOS Android
1423
+ */
1424
+ export function onImageReceived(listener: (params: ImageBody) => void): void
1425
+
1426
+ /**
1427
+ * 监听 图片数据 接收上报
1428
+ * @public
1429
+ * @since AIStreamKit 1.0.0
1430
+ * @platform iOS Android
1431
+ */
1432
+ export function offImageReceived(listener: (params: ImageBody) => void): void
1433
+
1434
+ /**
1435
+ * 监听 文本数据 接收上报
1436
+ * @public
1437
+ * @since AIStreamKit 1.0.0
1438
+ * @platform iOS Android
1439
+ */
1440
+ export function onTextReceived(listener: (params: TextBody) => void): void
1441
+
1442
+ /**
1443
+ * 监听 文本数据 接收上报
1444
+ * @public
1445
+ * @since AIStreamKit 1.0.0
1446
+ * @platform iOS Android
1447
+ */
1448
+ export function offTextReceived(listener: (params: TextBody) => void): void
1449
+
1450
+ /**
1451
+ * 监听 通道连接 状态变化
1452
+ * @public
1453
+ * @since AIStreamKit 1.0.0
1454
+ * @platform iOS Android
1455
+ */
1456
+ export function onConnectStateChanged(
1457
+ listener: (params: ConnectStateBody) => void
1458
+ ): void
1459
+
1460
+ /**
1461
+ * 监听 通道连接 状态变化
1462
+ * @public
1463
+ * @since AIStreamKit 1.0.0
1464
+ * @platform iOS Android
1465
+ */
1466
+ export function offConnectStateChanged(
1467
+ listener: (params: ConnectStateBody) => void
1468
+ ): void
1469
+
1470
+ /**
1471
+ * 监听 会话 状态变化
1472
+ * @public
1473
+ * @since AIStreamKit 1.0.0
1474
+ * @platform iOS Android
1475
+ */
1476
+ export function onSessionStateChanged(
1477
+ listener: (params: SessionStateBody) => void
1478
+ ): void
1479
+
1480
+ /**
1481
+ * 监听 会话 状态变化
1482
+ * @public
1483
+ * @since AIStreamKit 1.0.0
1484
+ * @platform iOS Android
1485
+ */
1486
+ export function offSessionStateChanged(
1487
+ listener: (params: SessionStateBody) => void
1488
+ ): void
1489
+
1490
+ /**
1491
+ * 音频振幅回调(先通过 `registerRecordAmplitudes` 注册监听)
1492
+ * @public
1493
+ * @since AIStreamKit 1.0.0
1494
+ * @platform iOS Android
1495
+ */
1496
+ export function onRecordAmplitudes(
1497
+ listener: (params: RecordAmplitudesBody) => void
1498
+ ): void
1499
+
1500
+ /**
1501
+ * 音频振幅回调(先通过 `registerRecordAmplitudes` 注册监听)
1502
+ * @public
1503
+ * @since AIStreamKit 1.0.0
1504
+ * @platform iOS Android
1505
+ */
1506
+ export function offRecordAmplitudes(
1507
+ listener: (params: RecordAmplitudesBody) => void
1508
+ ): void
1509
+
1510
+ /**
1511
+ * 音频播放状态变化
1512
+ * @public
1513
+ * @since AIStreamKit 1.0.0
1514
+ * @platform iOS Android
1515
+ */
1516
+ export function onAudioPlayChanged(
1517
+ listener: (params: AudioPlayChangedBody) => void
1518
+ ): void
1519
+
1520
+ /**
1521
+ * 音频播放状态变化
1522
+ * @public
1523
+ * @since AIStreamKit 1.0.0
1524
+ * @platform iOS Android
1525
+ */
1526
+ export function offAudioPlayChanged(
1527
+ listener: (params: AudioPlayChangedBody) => void
1528
+ ): void
1529
+
1530
+ /**
1531
+ * 音频录制发送出现异常
1532
+ * @public
1533
+ * @since AIStreamKit 1.0.0
1534
+ * @platform iOS Android
1535
+ */
1536
+ export function onRecordAndSendAudioFail(
1537
+ listener: (params: RecordAndSendAudioFailBody) => void
1538
+ ): void
1539
+
1540
+ /**
1541
+ * 音频录制发送出现异常
1542
+ * @public
1543
+ * @since AIStreamKit 1.0.0
1544
+ * @platform iOS Android
1545
+ */
1546
+ export function offRecordAndSendAudioFail(
1547
+ listener: (params: RecordAndSendAudioFailBody) => void
1548
+ ): void
1549
+
1550
+ /** @since AIStreamKit 1.0.0 */
1551
+ export interface ConnectParams {
1552
+ /**
1553
+ * client 类型: 1-作为设备代理, 2-作为 App,3-作为开发者
1554
+ * @since AIStreamKit 1.0.0
1555
+ */
1556
+ clientType: number
1557
+ /**
1558
+ * 代理的设备ID, clientType == 1 时必传
1559
+ * @since AIStreamKit 1.0.0
1560
+ */
1561
+ deviceId?: string
1562
+ }
1563
+
1564
+ /** @since AIStreamKit 1.0.0 */
1565
+ export interface CheckConnectResponse {
1566
+ /**
1567
+ * 是否已连接
1568
+ * @since AIStreamKit 1.0.0
1569
+ */
1570
+ connected: boolean
1571
+ /**
1572
+ * 通道连接状态: 0-初始化,1-连接中,2-鉴权中,3-已连接,4-被云端断开,5-主动关闭
1573
+ * @since AIStreamKit 1.0.0
1574
+ */
1575
+ state: number
1576
+ /**
1577
+ * client 类型: 1-作为设备代理, 2-作为 App,3-作为开发者
1578
+ * @since AIStreamKit 1.0.0
1579
+ */
1580
+ clientType?: number
1581
+ /**
1582
+ * 连接的唯一标识
1583
+ * @since AIStreamKit 1.0.0
1584
+ */
1585
+ connectionId?: string
1586
+ }
1587
+
1588
+ /** @since AIStreamKit 1.0.0 */
1589
+ export interface ConnectResponse {
1590
+ /**
1591
+ * 连接的唯一标识
1592
+ * @since AIStreamKit 1.0.0
1593
+ */
1594
+ connectionId: string
1595
+ }
1596
+
1597
+ /** @since AIStreamKit 1.0.0 */
1598
+ export interface CreateAgentTokenParams {
1599
+ /**
1600
+ * Owner ID: HomeID,clientType = 3 时可以为空
1601
+ * @since AIStreamKit 1.0.0
1602
+ */
1603
+ ownerId?: string
1604
+ /**
1605
+ * 智能解决方案 code
1606
+ * @since AIStreamKit 1.0.0
1607
+ */
1608
+ solutionCode: string
1609
+ /**
1610
+ * 业务接口
1611
+ * @since AIStreamKit 1.0.0
1612
+ */
1613
+ api: string
1614
+ /**
1615
+ * 业务接口版本,clientType = 3 时可以为空
1616
+ * @since AIStreamKit 1.0.0
1617
+ */
1618
+ apiVersion?: string
1619
+ /**
1620
+ * 业务额外参数
1621
+ * @since AIStreamKit 1.0.0
1622
+ */
1623
+ extParams: Record<string, string>
1624
+ }
1625
+
1626
+ /** @since AIStreamKit 1.0.0 */
1627
+ export interface BizConfig {
1628
+ /**
1629
+ * 业务 code
1630
+ * @since AIStreamKit 1.0.0
1631
+ */
1632
+ bizCode: number
1633
+ /**
1634
+ * 发送数据通道类型定义,`createSession` 后对应 `sendDataChannels`
1635
+ * 例如 bizCode 65537 为 ["audio", "video", "text", "image", "file"]
1636
+ * @since AIStreamKit 1.0.0
1637
+ */
1638
+ sendData: string[]
1639
+ /**
1640
+ * 接收数据通道类型定义,`createSession` 后对应 `revDataChannels`
1641
+ * 例如 bizCode 65537 为 ["text", "audio", "image", "video", "file"]
1642
+ * @since AIStreamKit 1.0.0
1643
+ */
1644
+ revData: string[]
1645
+ }
1646
+
1647
+ /** @since AIStreamKit 1.0.0 */
1648
+ export interface CreateAgentTokenResponse {
1649
+ /**
1650
+ * 智能体 token
1651
+ * @since AIStreamKit 1.0.0
1652
+ */
1653
+ agentToken: string
1654
+ /**
1655
+ * 业务配置
1656
+ * @since AIStreamKit 1.0.0
1657
+ */
1658
+ bizConfig: BizConfig
1659
+ /**
1660
+ * 业务额外参数, 内容为 JSON String
1661
+ * @since AIStreamKit 1.3.3
1662
+ */
1663
+ extParams: string
1664
+ }
1665
+
1666
+ /** @since AIStreamKit 1.0.0 */
1667
+ export interface Attribute {
1668
+ /**
1669
+ * Attribute 类型
1670
+ * @since AIStreamKit 1.0.0
1671
+ */
1672
+ type: number
1673
+ /**
1674
+ * 数据类型:0x01-UInt8, 0x02-UInt16, 0x03-UInt32, 0x04-UInt64, 0x05-Bytes, 0x06-String
1675
+ * @since AIStreamKit 1.0.0
1676
+ */
1677
+ payloadType: number
1678
+ /**
1679
+ * 数据:UInt8~UInt64 数字用字符串传递,Bytes 用 HexString传递,
1680
+ * @since AIStreamKit 1.0.0
1681
+ */
1682
+ value: string
1683
+ }
1684
+
1685
+ /** @since AIStreamKit 1.0.0 */
1686
+ export interface CreateSessionParams {
1687
+ /**
1688
+ * 业务 tag
1689
+ * @since AIStreamKit 1.0.0
1690
+ * @defaultValue 0
1691
+ */
1692
+ bizTag?: number
1693
+ /**
1694
+ * 智能体 token
1695
+ * @since AIStreamKit 1.0.0
1696
+ */
1697
+ agentToken: string
1698
+ /**
1699
+ * 会话 id. 不传递则自动生成,传递则使用传递的
1700
+ * @since AIStreamKit 1.0.0
1701
+ */
1702
+ sessionId?: string
1703
+ /**
1704
+ * 业务配置定义(通过 queryAgentToken 传递)
1705
+ * @since AIStreamKit 1.0.0
1706
+ */
1707
+ bizConfig: BizConfig
1708
+ /**
1709
+ * 扩展属性。已废弃,请使用 userDataJson
1710
+ * @since AIStreamKit 1.0.0
1711
+ */
1712
+ userData?: Attribute[]
1713
+ /**
1714
+ * 扩展属性
1715
+ * @since AIStreamKit 2.0.0
1716
+ */
1717
+ userDataJson?: string
1718
+ /**
1719
+ * 是否复用数据通道,默认 不复用
1720
+ * 通道复用概念:多个 Session 可复用同一份数据,例如:有两个 Session,一个做转写,一个做翻译,同时共用同一份音频流数据处理
1721
+ * @since AIStreamKit 1.0.0
1722
+ */
1723
+ reuseDataChannel?: boolean
1724
+ }
1725
+
1726
+ /** @since AIStreamKit 1.0.0 */
1727
+ export interface CreateSessionResponse {
1728
+ /**
1729
+ * 会话 id
1730
+ * @since AIStreamKit 1.0.0
1731
+ */
1732
+ sessionId: string
1733
+ /**
1734
+ * 下发数据通道 DataChannel. (下发数据时,需要使用该列表中的 DataChannel)
1735
+ * 音频视频图片文件都只有一路时,例如 bizCode 65537 ["audio", "video", "text", "image"]
1736
+ * 有多路重复时,例如 双路音视频:["audio", "audio_1", "video", "video_1", "text", "image"]
1737
+ * @since AIStreamKit 1.0.0
1738
+ */
1739
+ sendDataChannels: string[]
1740
+ /**
1741
+ * 接收数据通道 DataChannel. (接收数据时,数据中会使用该列表中的 DataChannel 进行上报)
1742
+ * 接受通道不会复用,例如:文本、音频 ["text", "audio"]
1743
+ * @since AIStreamKit 1.0.0
1744
+ */
1745
+ revDataChannels: string[]
1746
+ }
1747
+
1748
+ /** @since AIStreamKit 1.0.0 */
1749
+ export interface CloseSessionParams {
1750
+ /**
1751
+ * 会话 id
1752
+ * @since AIStreamKit 1.0.0
1753
+ */
1754
+ sessionId: string
1755
+ /**
1756
+ * 关闭原因, 非异常则使用 200 来关闭
1757
+ * @since AIStreamKit 1.0.0
1758
+ */
1759
+ code: number
1760
+ }
1761
+
1762
+ /** @since AIStreamKit 1.0.0 */
1763
+ export interface DisconnectParams {
1764
+ /**
1765
+ * 需要断连的 connection Id
1766
+ * @since AIStreamKit 1.0.0
1767
+ */
1768
+ connectionId: string
1769
+ }
1770
+
1771
+ /** @since AIStreamKit 1.0.0 */
1772
+ export interface SendEventStartParams {
1773
+ /**
1774
+ * 会话 id
1775
+ * @since AIStreamKit 1.0.0
1776
+ */
1777
+ sessionId: string
1778
+ /**
1779
+ * 扩展属性。已废弃,请使用 userDataJson
1780
+ * @since AIStreamKit 1.0.0
1781
+ */
1782
+ userData?: Attribute[]
1783
+ /**
1784
+ * 扩展属性
1785
+ * @since AIStreamKit 2.0.0
1786
+ */
1787
+ userDataJson?: string
1788
+ /**
1789
+ * Event ID 前缀。(可选)
1790
+ * 传递则格式为: "$prefix_event_$sessionId.sub(8)_$timestamp"
1791
+ * 不传递格式为: "ios_event_$sessionId.sub(8)_$timestamp"、"Android_Event_$sessionId.sub(8)_$timestamp"
1792
+ * @since AIStreamKit 1.3.2
1793
+ */
1794
+ eventIdPrefix?: string
1795
+ }
1796
+
1797
+ /** @since AIStreamKit 1.0.0 */
1798
+ export interface SendEventStartResponse {
1799
+ /**
1800
+ * 事件 id。此后 sendEventPayloadEnd、sendEventEnd、sendEventChatBreak 都需要使用该 eventId 直到下发一次 sendEventStart 生成新 eventId 之前。
1801
+ * @since AIStreamKit 1.0.0
1802
+ */
1803
+ eventId: string
1804
+ }
1805
+
1806
+ /** @since AIStreamKit 1.0.0 */
1807
+ export interface SendEventPayloadEndParams {
1808
+ /**
1809
+ * 事件 id
1810
+ * @since AIStreamKit 1.0.0
1811
+ */
1812
+ eventId: string
1813
+ /**
1814
+ * 会话 id
1815
+ * @since AIStreamKit 1.0.0
1816
+ */
1817
+ sessionId: string
1818
+ /**
1819
+ * 发送结束的数据通道
1820
+ * @since AIStreamKit 1.0.0
1821
+ */
1822
+ dataChannel: string
1823
+ /**
1824
+ * 扩展属性。已废弃,请使用 userDataJson
1825
+ * @since AIStreamKit 1.0.0
1826
+ */
1827
+ userData?: Attribute[]
1828
+ /**
1829
+ * 扩展属性
1830
+ * @since AIStreamKit 2.0.0
1831
+ */
1832
+ userDataJson?: string
1833
+ }
1834
+
1835
+ /** @since AIStreamKit 1.0.0 */
1836
+ export interface SendEventEndParams {
1837
+ /**
1838
+ * 事件 id
1839
+ * @since AIStreamKit 1.0.0
1840
+ */
1841
+ eventId: string
1842
+ /**
1843
+ * 会话 id
1844
+ * @since AIStreamKit 1.0.0
1845
+ */
1846
+ sessionId: string
1847
+ /**
1848
+ * 扩展属性。已废弃,请使用 userDataJson
1849
+ * @since AIStreamKit 1.0.0
1850
+ */
1851
+ userData?: Attribute[]
1852
+ /**
1853
+ * 扩展属性
1854
+ * @since AIStreamKit 2.0.0
1855
+ */
1856
+ userDataJson?: string
1857
+ }
1858
+
1859
+ /** @since AIStreamKit 1.0.0 */
1860
+ export interface SendEventChatBreakParams {
1861
+ /**
1862
+ * 事件 id,
1863
+ * @since AIStreamKit 1.0.0
1864
+ */
1865
+ eventId: string
1866
+ /**
1867
+ * 会话 id
1868
+ * @since AIStreamKit 1.0.0
1869
+ */
1870
+ sessionId: string
1871
+ /**
1872
+ * 扩展属性。已废弃,请使用 userDataJson
1873
+ * @since AIStreamKit 1.0.0
1874
+ */
1875
+ userData?: Attribute[]
1876
+ /**
1877
+ * 扩展属性
1878
+ * @since AIStreamKit 2.0.0
1879
+ */
1880
+ userDataJson?: string
1881
+ }
1882
+
1883
+ /** @since AIStreamKit 1.1.0 */
1884
+ export interface RecordInitParams {
1885
+ /**
1886
+ * 音频采样率,单位Hz, 默认 16000 Hz
1887
+ * 表示每秒采样次数,常见值:8000, 16000, 22050, 24000, 44100等
1888
+ * @since AIStreamKit 1.1.0
1889
+ * @defaultValue 16000
1890
+ */
1891
+ sampleRate?: number
1892
+ }
1893
+
1894
+ /** @since AIStreamKit 1.0.0 */
1895
+ export interface SendAudioParams {
1896
+ /**
1897
+ * 会话 id
1898
+ * @since AIStreamKit 1.0.0
1899
+ */
1900
+ sessionId: string
1901
+ /**
1902
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
1903
+ * @since AIStreamKit 1.0.0
1904
+ */
1905
+ dataChannel?: string
1906
+ /**
1907
+ * 扩展属性。已废弃,请使用 userDataJson
1908
+ * @since AIStreamKit 1.0.0
1909
+ */
1910
+ userData?: Attribute[]
1911
+ /**
1912
+ * 是否需要保存录制的音频文件,仅单次录音周期生效。默认: false 不保存
1913
+ * @since AIStreamKit 1.1.0
1914
+ * @defaultValue false
1915
+ */
1916
+ saveFile?: boolean
1917
+ /**
1918
+ * 录音初始化参数(若使用 initAudioRecorder 提前初始化过,可以不传)
1919
+ * 1. 不传递,则使用最后一次调用 `initAudioRecorder` 的值,从未调用过则会使用默认配置 16000Hz、单声道、16bit位深进行初始化。
1920
+ * 2. 当传递的参数与上一次不一致时,则会重新初始化。
1921
+ * 3. 初始化会有 300 ~ 600ms 的初始化耗时,此时说话无法采集,通常会丢 2 ~ 4 个汉字的音频,建议合适的时机提前调用 `initAudioRecorder` 完成初始化。
1922
+ * @since AIStreamKit 1.1.0
1923
+ */
1924
+ recordInitParams?: RecordInitParams
1925
+ /**
1926
+ * 扩展属性
1927
+ * @since AIStreamKit 2.0.0
1928
+ */
1929
+ userDataJson?: string
1930
+ }
1931
+
1932
+ /** @since AIStreamKit 1.1.0 */
1933
+ export interface SendAudioResponse {
1934
+ /**
1935
+ * 录音保存的文件路径,注意需要在 `startRecordAndSendAudioData` 中传递 `saveFile` 为 true 时才会有值
1936
+ * @since AIStreamKit 1.1.0
1937
+ */
1938
+ path?: string
1939
+ /**
1940
+ * 音频编码类型,表示音频数据的编码格式。目前仅保存为 WAV(PCM) 文件
1941
+ * - 1000: WAV(PCM) App本地定义
1942
+ * @since AIStreamKit 1.1.0
1943
+ */
1944
+ codecType: number
1945
+ /**
1946
+ * 音频采样率,单位Hz
1947
+ * 表示每秒采样次数,常见值:8000, 16000, 22050, 24000, 44100等
1948
+ * @since AIStreamKit 1.1.0
1949
+ */
1950
+ sampleRate: number
1951
+ /**
1952
+ * 音频通道数
1953
+ * - 0: 单声道
1954
+ * - 1: 立体声
1955
+ * @since AIStreamKit 1.1.0
1956
+ */
1957
+ channels: number
1958
+ /**
1959
+ * 音频位深,表示每个采样点的位数
1960
+ * 常见值:8, 16, 24, 32等
1961
+ * @since AIStreamKit 1.1.0
1962
+ */
1963
+ bitDepth: number
1964
+ }
1965
+
1966
+ /** @since AIStreamKit 1.0.0 */
1967
+ export interface SendImageDataParams {
1968
+ /**
1969
+ * 会话 id
1970
+ * @since AIStreamKit 1.0.0
1971
+ */
1972
+ sessionId: string
1973
+ /**
1974
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
1975
+ * @since AIStreamKit 1.0.0
1976
+ */
1977
+ dataChannel?: string
1978
+ /**
1979
+ * 图片路径
1980
+ * @since AIStreamKit 1.0.0
1981
+ */
1982
+ path: string
1983
+ /**
1984
+ * 图片类型: 1-JPEG, 2-PNG
1985
+ * @since AIStreamKit 1.0.0
1986
+ */
1987
+ format: number
1988
+ /**
1989
+ * 扩展属性。已废弃,请使用 userDataJson
1990
+ * @since AIStreamKit 1.0.0
1991
+ */
1992
+ userData?: Attribute[]
1993
+ /**
1994
+ * 扩展属性
1995
+ * @since AIStreamKit 2.0.0
1996
+ */
1997
+ userDataJson?: string
1998
+ }
1999
+
2000
+ /** @since AIStreamKit 1.0.0 */
2001
+ export interface SendTextDataParams {
2002
+ /**
2003
+ * 会话 id
2004
+ * @since AIStreamKit 1.0.0
2005
+ */
2006
+ sessionId: string
2007
+ /**
2008
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
2009
+ * @since AIStreamKit 1.0.0
2010
+ */
2011
+ dataChannel?: string
2012
+ /**
2013
+ * 文本内容
2014
+ * @since AIStreamKit 1.0.0
2015
+ */
2016
+ text: string
2017
+ /**
2018
+ * 扩展属性。已废弃,请使用 userDataJson
2019
+ * @since AIStreamKit 1.0.0
2020
+ */
2021
+ userData?: Attribute[]
2022
+ /**
2023
+ * 扩展属性
2024
+ * @since AIStreamKit 2.0.0
2025
+ */
2026
+ userDataJson?: string
2027
+ }
2028
+
2029
+ /** @since AIStreamKit 1.0.0 */
2030
+ export interface EventBody {
2031
+ /**
2032
+ * 事件 id
2033
+ * @since AIStreamKit 1.0.0
2034
+ */
2035
+ eventId: string
2036
+ /**
2037
+ * 会话 id
2038
+ * @since AIStreamKit 1.0.0
2039
+ */
2040
+ sessionId: string
2041
+ /**
2042
+ * 事件类型: 0-Event Start, 1-Event Payload End, 2-Event End, 3 - OneShot, 4-Chat Break, 5-Server VAD
2043
+ * @since AIStreamKit 1.0.0
2044
+ */
2045
+ eventType: number
2046
+ /**
2047
+ * 扩展属性。已废弃,请使用 userDataJson
2048
+ * @since AIStreamKit 1.0.0
2049
+ */
2050
+ userData?: Attribute[]
2051
+ /**
2052
+ * 扩展属性
2053
+ * @since AIStreamKit 2.0.0
2054
+ */
2055
+ userDataJson?: string
2056
+ }
2057
+
2058
+ /** @since AIStreamKit 1.0.0 */
2059
+ export interface AudioBody {
2060
+ /**
2061
+ * 接收数据通道 Code
2062
+ * @since AIStreamKit 1.0.0
2063
+ */
2064
+ dataChannel: string
2065
+ /**
2066
+ * 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束
2067
+ * @since AIStreamKit 1.0.0
2068
+ */
2069
+ streamFlag: number
2070
+ /**
2071
+ * 音频缓存路径
2072
+ * @since AIStreamKit 1.0.0
2073
+ */
2074
+ path: string
2075
+ /**
2076
+ * 扩展属性。已废弃,请使用 userDataJson
2077
+ * @since AIStreamKit 1.0.0
2078
+ */
2079
+ userData?: Attribute[]
2080
+ /**
2081
+ * 扩展属性
2082
+ * @since AIStreamKit 2.0.0
2083
+ */
2084
+ userDataJson?: string
2085
+ /**
2086
+ * SessionId 列表, 云端返回,可能为空
2087
+ * @since AIStreamKit 1.0.0
2088
+ */
2089
+ sessionIdList?: string[]
2090
+ /**
2091
+ * 微秒级时间戳
2092
+ * 用于音频回放时的同步
2093
+ * @since AIStreamKit 1.0.0
2094
+ */
2095
+ pts?: number
2096
+ /**
2097
+ * 音频编码类型,表示音频数据的编码格式
2098
+ * - 100: ADPCM
2099
+ * - 101: PCM
2100
+ * - 102: AACRaw
2101
+ * - 103: AACADTS
2102
+ * - 104: AACLATM
2103
+ * - 105: G711U
2104
+ * - 106: G711A
2105
+ * - 107: G726
2106
+ * - 108: SPEEX
2107
+ * - 109: MP3
2108
+ * - 110: G722
2109
+ * - 111: Opus
2110
+ * 仅 streamFlag == 0 || == 1 时有值
2111
+ * @since AIStreamKit 1.0.0
2112
+ */
2113
+ codecType?: number
2114
+ /**
2115
+ * 音频采样率,单位Hz
2116
+ * 表示每秒采样次数,常见值:8000, 16000, 22050, 24000, 44100等
2117
+ * 仅 streamFlag == 0 || == 1 时有值
2118
+ * @since AIStreamKit 1.0.0
2119
+ */
2120
+ sampleRate?: number
2121
+ /**
2122
+ * 音频通道数
2123
+ * - 0: 单声道
2124
+ * - 1: 立体声
2125
+ * 仅 streamFlag == 0 || == 1 时有值
2126
+ * @since AIStreamKit 1.0.0
2127
+ */
2128
+ channels?: number
2129
+ /**
2130
+ * 音频位深,表示每个采样点的位数
2131
+ * 常见值:8, 16, 24, 32等
2132
+ * 仅 streamFlag == 0 || == 1 时有值
2133
+ * @since AIStreamKit 1.0.0
2134
+ */
2135
+ bitDepth?: number
2136
+ }
2137
+
2138
+ /** @since AIStreamKit 1.0.0 */
2139
+ export interface ImageBody {
2140
+ /**
2141
+ * 接收数据通道 Code
2142
+ * @since AIStreamKit 1.0.0
2143
+ */
2144
+ dataChannel: string
2145
+ /**
2146
+ * 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束
2147
+ * @since AIStreamKit 1.0.0
2148
+ */
2149
+ streamFlag: number
2150
+ /**
2151
+ * 图片缓存路径,传输结束后可访问(streamFlag == 1 || StreamFlag == 3)
2152
+ * @since AIStreamKit 1.0.0
2153
+ */
2154
+ path: string
2155
+ /**
2156
+ * 图片类型: 1-JPEG, 2-PNG
2157
+ * @since AIStreamKit 1.0.0
2158
+ */
2159
+ format: number
2160
+ /**
2161
+ * 图片宽度
2162
+ * @since AIStreamKit 1.0.0
2163
+ */
2164
+ width: number
2165
+ /**
2166
+ * 图片高度
2167
+ * @since AIStreamKit 1.0.0
2168
+ */
2169
+ height: number
2170
+ /**
2171
+ * 扩展属性。已废弃,请使用 userDataJson
2172
+ * @since AIStreamKit 1.0.0
2173
+ */
2174
+ userData?: Attribute[]
2175
+ /**
2176
+ * 扩展属性
2177
+ * @since AIStreamKit 2.0.0
2178
+ */
2179
+ userDataJson?: string
2180
+ /**
2181
+ * SessionId 列表, 云端返回,可能为空
2182
+ * @since AIStreamKit 1.0.0
2183
+ */
2184
+ sessionIdList?: string[]
2185
+ }
2186
+
2187
+ /** @since AIStreamKit 1.0.0 */
2188
+ export interface TextBody {
2189
+ /**
2190
+ * 接收数据通道 Code
2191
+ * @since AIStreamKit 1.0.0
2192
+ */
2193
+ dataChannel: string
2194
+ /**
2195
+ * 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束
2196
+ * @since AIStreamKit 1.0.0
2197
+ */
2198
+ streamFlag: number
2199
+ /**
2200
+ * 文本内容(JSON String,见云端文档定义)
2201
+ * @since AIStreamKit 1.0.0
2202
+ */
2203
+ text: string
2204
+ /**
2205
+ * 扩展属性。已废弃,请使用 userDataJson
2206
+ * @since AIStreamKit 1.0.0
2207
+ */
2208
+ userData?: Attribute[]
2209
+ /**
2210
+ * 扩展属性
2211
+ * @since AIStreamKit 2.0.0
2212
+ */
2213
+ userDataJson?: string
2214
+ /**
2215
+ * SessionId 列表, 云端返回,可能为空
2216
+ * @since AIStreamKit 1.0.0
2217
+ */
2218
+ sessionIdList?: string[]
2219
+ }
2220
+
2221
+ /** @since AIStreamKit 1.0.0 */
2222
+ export interface ConnectStateBody {
2223
+ /**
2224
+ * connection id
2225
+ * @since AIStreamKit 1.0.0
2226
+ */
2227
+ connectionId: string
2228
+ /**
2229
+ * 连接状态: 0-初始化,1-连接中,2-鉴权中,3-已连接,4-被云端断开,5-主动关闭
2230
+ * @since AIStreamKit 1.0.0
2231
+ */
2232
+ connectState: number
2233
+ /**
2234
+ * 被云端断开错误码
2235
+ * @since AIStreamKit 1.0.0
2236
+ */
2237
+ code?: number
2238
+ }
2239
+
2240
+ /** @since AIStreamKit 1.0.0 */
2241
+ export interface SessionStateBody {
2242
+ /**
2243
+ * 会话 id
2244
+ * @since AIStreamKit 1.0.0
2245
+ */
2246
+ sessionId: string
2247
+ /**
2248
+ * 会话状态: 0-会话创建成功, 1-会话创建失败, 2-会话被云端关闭
2249
+ * @since AIStreamKit 1.0.0
2250
+ */
2251
+ sessionState: number
2252
+ /**
2253
+ * 会话被关闭原因
2254
+ * @since AIStreamKit 1.0.0
2255
+ */
2256
+ code?: number
2257
+ }
2258
+
2259
+ /** @since AIStreamKit 1.0.0 */
2260
+ export interface RecordListParams {
2261
+ /**
2262
+ * 自增ID
2263
+ * @since AIStreamKit 1.0.0
2264
+ */
2265
+ id?: number[]
2266
+ /**
2267
+ * biz Code 大类目,可搜索
2268
+ * @since AIStreamKit 1.0.0
2269
+ */
2270
+ bizCode?: number[]
2271
+ /**
2272
+ * 智能解决方案 code, 可搜索
2273
+ * @since AIStreamKit 1.0.0
2274
+ */
2275
+ solutionCode?: string[]
2276
+ /**
2277
+ * 设备 id,可搜索
2278
+ * @since AIStreamKit 1.0.0
2279
+ */
2280
+ devId?: string[]
2281
+ /**
2282
+ * 家庭 id, 可搜索
2283
+ * @since AIStreamKit 1.0.0
2284
+ */
2285
+ homeId?: number[]
2286
+ /**
2287
+ * type, 业务自行决定,可搜索
2288
+ * @since AIStreamKit 1.0.0
2289
+ */
2290
+ type?: string[]
2291
+ /**
2292
+ * 索引, 业务自行决定,可搜索
2293
+ * @since AIStreamKit 1.0.0
2294
+ */
2295
+ index?: string[]
2296
+ /**
2297
+ * 扩展索引1, 业务自行决定,可搜索
2298
+ * @since AIStreamKit 1.0.0
2299
+ */
2300
+ index1?: string[]
2301
+ /**
2302
+ * 扩展索引2, 业务自行决定,可搜索
2303
+ * @since AIStreamKit 1.0.0
2304
+ */
2305
+ index2?: string[]
2306
+ /**
2307
+ * offset 分页偏移量(删除时无需传递)
2308
+ * @since AIStreamKit 1.0.0
2309
+ */
2310
+ offset?: number
2311
+ /**
2312
+ * limit 分页大小, 不传或传0则不分页(删除时无需传递)
2313
+ * @since AIStreamKit 1.0.0
2314
+ */
2315
+ limit?: number
2316
+ /**
2317
+ * 排序方式,仅用于 `queryRecordList`
2318
+ * - 0: 按 id 降序(默认)
2319
+ * - 1: 按 id 升序
2320
+ * @since AIStreamKit 1.0.0
2321
+ */
2322
+ sortType?: number
2323
+ }
2324
+
2325
+ /** @since AIStreamKit 1.0.0 */
2326
+ export interface RecordBody {
2327
+ /**
2328
+ * 记录ID, 自增. (insertRecord 不传, updateRecord 必传, 作为 Response 返回时必有值)
2329
+ * @since AIStreamKit 1.0.0
2330
+ */
2331
+ id?: number
2332
+ /**
2333
+ * biz Code 大类目,可搜索
2334
+ * @since AIStreamKit 1.0.0
2335
+ */
2336
+ bizCode?: number
2337
+ /**
2338
+ * 智能解决方案 code, 可搜索
2339
+ * @since AIStreamKit 1.0.0
2340
+ */
2341
+ solutionCode?: string
2342
+ /**
2343
+ * 设备 id,可搜索
2344
+ * @since AIStreamKit 1.0.0
2345
+ */
2346
+ devId?: string
2347
+ /**
2348
+ * 家庭 id, 可搜索
2349
+ * @since AIStreamKit 1.0.0
2350
+ */
2351
+ homeId?: number
2352
+ /**
2353
+ * type, 业务自行决定,可搜索
2354
+ * @since AIStreamKit 1.0.0
2355
+ */
2356
+ type?: string
2357
+ /**
2358
+ * 索引, 业务自行决定,可搜索
2359
+ * @since AIStreamKit 1.0.0
2360
+ */
2361
+ index?: string
2362
+ /**
2363
+ * 扩展索引1, 业务自行决定,可搜索
2364
+ * @since AIStreamKit 1.0.0
2365
+ */
2366
+ index1?: string
2367
+ /**
2368
+ * 扩展索引2, 业务自行决定,可搜索
2369
+ * @since AIStreamKit 1.0.0
2370
+ */
2371
+ index2?: string
2372
+ /**
2373
+ * 缓存数据,JSON格式,不可搜索
2374
+ * @since AIStreamKit 1.0.0
2375
+ */
2376
+ data?: string
2377
+ /**
2378
+ * 值,不可搜索
2379
+ * @since AIStreamKit 1.0.0
2380
+ */
2381
+ value?: string
2382
+ /**
2383
+ * 扩展值1,不可搜索
2384
+ * @since AIStreamKit 1.0.0
2385
+ */
2386
+ value1?: string
2387
+ /**
2388
+ * 扩展值2,不可搜索
2389
+ * @since AIStreamKit 1.0.0
2390
+ */
2391
+ value2?: string
2392
+ }
2393
+
2394
+ /** @since AIStreamKit 1.0.0 */
2395
+ export interface RecordListResponse {
2396
+ /**
2397
+ * 记录列表
2398
+ * @since AIStreamKit 1.0.0
2399
+ */
2400
+ records: RecordBody[]
2401
+ /**
2402
+ * 记录总数
2403
+ * @since AIStreamKit 1.0.0
2404
+ */
2405
+ total: number
2406
+ }
2407
+
2408
+ /** @since AIStreamKit 1.0.0 */
2409
+ export interface InsertRecordResponse {
2410
+ /**
2411
+ * 记录ID
2412
+ * @since AIStreamKit 1.0.0
2413
+ */
2414
+ id: number
2415
+ }
2416
+
2417
+ /** @since AIStreamKit 1.0.0 */
2418
+ export interface RecordAmplitudesParams {
2419
+ /**
2420
+ * 振幅柱状数据数量
2421
+ * @since AIStreamKit 1.0.0
2422
+ */
2423
+ count: number
2424
+ }
2425
+
2426
+ /** @since AIStreamKit 1.0.0 */
2427
+ export interface RecordAmplitudesBody {
2428
+ /**
2429
+ * 振幅数据
2430
+ * @since AIStreamKit 1.0.0
2431
+ */
2432
+ amplitudes: number[]
2433
+ }
2434
+
2435
+ /** @since AIStreamKit 1.0.0 */
2436
+ export interface PlayAudioParams {
2437
+ /**
2438
+ * 音频缓存路径
2439
+ * @since AIStreamKit 1.0.0
2440
+ */
2441
+ path: string
2442
+ /**
2443
+ * 音频编码类型,表示音频数据的编码格式。目前仅支持 `PCM`, `MP3`, `WAV(PCM)` 播放
2444
+ * - 101: PCM
2445
+ * - 109: MP3
2446
+ * - 1000: WAV(PCM) App本地定义
2447
+ * @since AIStreamKit 1.0.0
2448
+ */
2449
+ codecType: number
2450
+ /**
2451
+ * 音频采样率,单位Hz
2452
+ * 表示每秒采样次数,常见值:8000, 16000, 22050, 24000, 44100等
2453
+ * @since AIStreamKit 1.0.0
2454
+ */
2455
+ sampleRate: number
2456
+ /**
2457
+ * 音频通道数
2458
+ * - 0: 单声道
2459
+ * - 1: 立体声
2460
+ * @since AIStreamKit 1.0.0
2461
+ */
2462
+ channels: number
2463
+ /**
2464
+ * 音频位深,表示每个采样点的位数
2465
+ * 常见值:8, 16, 24, 32等
2466
+ * @since AIStreamKit 1.0.0
2467
+ */
2468
+ bitDepth: number
2469
+ /**
2470
+ * 微秒级时间戳
2471
+ * 用于音频回放时的同步
2472
+ * @since AIStreamKit 1.0.0
2473
+ */
2474
+ pts?: number
2475
+ }
2476
+
2477
+ /** @since AIStreamKit 1.0.0 */
2478
+ export interface AudioPlayChangedBody {
2479
+ /**
2480
+ * 播放文件路径
2481
+ * @since AIStreamKit 1.0.0
2482
+ */
2483
+ path: string
2484
+ /**
2485
+ * 播放状态: 1-播放开始, 2-缓冲中, 3-缓存完成即将继续播放, 4-播放完成, 5-播放中止(详细原因在 code 中)
2486
+ * @since AIStreamKit 1.0.0
2487
+ */
2488
+ state: number
2489
+ /**
2490
+ * 播放中止原因: 1-主动停止播放, 2-播放被异常中断
2491
+ * @since AIStreamKit 1.0.0
2492
+ */
2493
+ code?: number
2494
+ }
2495
+
2496
+ /** @since AIStreamKit 1.0.0 */
2497
+ export interface RecordAndSendAudioFailBody {
2498
+ /**
2499
+ * 录制发送异常: 1-发送数据异常, 2-录制音频异常
2500
+ * @since AIStreamKit 1.0.0
2501
+ */
2502
+ code: number
2503
+ }
2504
+
2505
+ /** @since AIStreamKit 1.0.0 */
2506
+ export interface SendVideoParams {
2507
+ /**
2508
+ * 会话 id
2509
+ * @since AIStreamKit 1.0.0
2510
+ */
2511
+ sessionId: string
2512
+ /**
2513
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
2514
+ * @since AIStreamKit 1.0.0
2515
+ */
2516
+ dataChannel?: string
2517
+ /**
2518
+ * 摄像头类型
2519
+ * 1-前置摄像头, 2-后置摄像头
2520
+ * @since AIStreamKit 1.0.0
2521
+ */
2522
+ cameraType: number
2523
+ /**
2524
+ * 扩展属性。已废弃,请使用 userDataJson
2525
+ * @since AIStreamKit 1.0.0
2526
+ */
2527
+ userData?: Attribute[]
2528
+ /**
2529
+ * 扩展属性
2530
+ * @since AIStreamKit 2.0.0
2531
+ */
2532
+ userDataJson?: string
2533
+ }
2534
+
2535
+ /** @since AIStreamKit 1.0.0 */
2536
+ export interface SendFileDataParams {
2537
+ /**
2538
+ * 会话 id
2539
+ * @since AIStreamKit 1.0.0
2540
+ */
2541
+ sessionId: string
2542
+ /**
2543
+ * 下发数据通道 Code,当音频只有单路的时候,可以不传
2544
+ * @since AIStreamKit 1.0.0
2545
+ */
2546
+ dataChannel?: string
2547
+ /**
2548
+ * 文件路径
2549
+ * @since AIStreamKit 1.0.0
2550
+ */
2551
+ path: string
2552
+ /**
2553
+ * 文件类型: 1 - MP4, 2 - OGG_OPUS, 3 - PDF, 4 - JSON, 5 - IPC_LOG, 6 - SweeperMap
2554
+ * @since AIStreamKit 1.0.0
2555
+ */
2556
+ format: number
2557
+ /**
2558
+ * 扩展属性。已废弃,请使用 userDataJson
2559
+ * @since AIStreamKit 1.0.0
2560
+ */
2561
+ userData?: Attribute[]
2562
+ /**
2563
+ * 扩展属性
2564
+ * @since AIStreamKit 2.0.0
2565
+ */
2566
+ userDataJson?: string
2567
+ }
2568
+
2569
+ /** @since AIStreamKit 1.0.0 */
2570
+ export interface VideoBody {
2571
+ /**
2572
+ * 接收数据通道 Code
2573
+ * @since AIStreamKit 1.0.0
2574
+ */
2575
+ dataChannel: string
2576
+ /**
2577
+ * 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束
2578
+ * @since AIStreamKit 1.0.0
2579
+ */
2580
+ streamFlag: number
2581
+ /**
2582
+ * 视频缓存路径,传输结束后可访问(streamFlag == 1 || StreamFlag == 3)
2583
+ * @since AIStreamKit 1.0.0
2584
+ */
2585
+ path: string
2586
+ /**
2587
+ * 扩展属性。已废弃,请使用 userDataJson
2588
+ * @since AIStreamKit 1.0.0
2589
+ */
2590
+ userData?: Attribute[]
2591
+ /**
2592
+ * 扩展属性
2593
+ * @since AIStreamKit 2.0.0
2594
+ */
2595
+ userDataJson?: string
2596
+ /**
2597
+ * SessionId 列表, 云端返回,可能为空
2598
+ * @since AIStreamKit 1.0.0
2599
+ */
2600
+ sessionIdList?: string[]
2601
+ }
2602
+
2603
+ /** @since AIStreamKit 1.0.0 */
2604
+ export interface FileBody {
2605
+ /**
2606
+ * 接收数据通道 Code
2607
+ * @since AIStreamKit 1.0.0
2608
+ */
2609
+ dataChannel: string
2610
+ /**
2611
+ * 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束
2612
+ * @since AIStreamKit 1.0.0
2613
+ */
2614
+ streamFlag: number
2615
+ /**
2616
+ * 文件缓存路径,传输结束后可访问(streamFlag == 1 || StreamFlag == 3)
2617
+ * @since AIStreamKit 1.0.0
2618
+ */
2619
+ path: string
2620
+ /**
2621
+ * 文件类型: 1 - MP4, 2 - OGG_OPUS, 3 - PDF, 4 - JSON, 5 - IPC_LOG, 6 - SweeperMap
2622
+ * @since AIStreamKit 1.0.0
2623
+ */
2624
+ format: number
2625
+ /**
2626
+ * 扩展属性。已废弃,请使用 userDataJson
2627
+ * @since AIStreamKit 1.0.0
2628
+ */
2629
+ userData?: Attribute[]
2630
+ /**
2631
+ * 扩展属性
2632
+ * @since AIStreamKit 2.0.0
2633
+ */
2634
+ userDataJson?: string
2635
+ /**
2636
+ * SessionId 列表, 云端返回,可能为空
2637
+ * @since AIStreamKit 1.0.0
2638
+ */
2639
+ sessionIdList?: string[]
2640
+ }
2641
+ }