@ray-js/t-agent-plugin-aistream 0.2.0-beta-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.
Files changed (46) hide show
  1. package/LICENSE.md +21 -0
  2. package/README-zh_CN.md +12 -0
  3. package/README.md +12 -0
  4. package/dist/AIStreamTypes.d.ts +1413 -0
  5. package/dist/AIStreamTypes.js +216 -0
  6. package/dist/ChatHistoryStore.d.ts +66 -0
  7. package/dist/ChatHistoryStore.js +160 -0
  8. package/dist/global.d.ts +4 -0
  9. package/dist/global.js +4 -0
  10. package/dist/index.d.ts +4 -0
  11. package/dist/index.js +4 -0
  12. package/dist/polyfill.d.ts +1 -0
  13. package/dist/polyfill.js +8 -0
  14. package/dist/utils/AIStream.d.ts +137 -0
  15. package/dist/utils/AIStream.js +486 -0
  16. package/dist/utils/abort.d.ts +38 -0
  17. package/dist/utils/abort.js +177 -0
  18. package/dist/utils/actions.d.ts +48 -0
  19. package/dist/utils/actions.js +76 -0
  20. package/dist/utils/apis.d.ts +15 -0
  21. package/dist/utils/apis.js +10 -0
  22. package/dist/utils/defaultMock.d.ts +1 -0
  23. package/dist/utils/defaultMock.js +429 -0
  24. package/dist/utils/index.d.ts +11 -0
  25. package/dist/utils/index.js +11 -0
  26. package/dist/utils/logger.d.ts +2 -0
  27. package/dist/utils/logger.js +3 -0
  28. package/dist/utils/mock.d.ts +48 -0
  29. package/dist/utils/mock.js +72 -0
  30. package/dist/utils/observer.d.ts +61 -0
  31. package/dist/utils/observer.js +152 -0
  32. package/dist/utils/parsers.d.ts +10 -0
  33. package/dist/utils/parsers.js +13 -0
  34. package/dist/utils/promisify.d.ts +18 -0
  35. package/dist/utils/promisify.js +82 -0
  36. package/dist/utils/sendMessage.d.ts +21 -0
  37. package/dist/utils/sendMessage.js +241 -0
  38. package/dist/utils/ttt.d.ts +99 -0
  39. package/dist/utils/ttt.js +97 -0
  40. package/dist/utils/url.d.ts +11 -0
  41. package/dist/utils/url.js +31 -0
  42. package/dist/utils/version.d.ts +1 -0
  43. package/dist/utils/version.js +63 -0
  44. package/dist/withAIStream.d.ts +64 -0
  45. package/dist/withAIStream.js +420 -0
  46. package/package.json +39 -0
@@ -0,0 +1,1413 @@
1
+ export declare enum ButtonRouterType {
2
+ /**
3
+ * 创建场景
4
+ */
5
+ CREATE_SCENE = "routeSceneCreate",
6
+ /**
7
+ * 设置家庭地址
8
+ */
9
+ HOME_LOCATION = "routeHomeLocation",
10
+ /**
11
+ * 使用指南
12
+ */
13
+ HELP_DOC = "routeHelpDoc",
14
+ /**
15
+ * 支持的设备列表
16
+ */
17
+ SUPPORT_DEVICES = "routeSupportDevices",
18
+ /**
19
+ * 家庭管理
20
+ */
21
+ FAMILY_MANAGE = "routeHomeManage",
22
+ /**
23
+ * 房间管理
24
+ */
25
+ ROOM_MANAGE = "routeRoomManage",
26
+ /**
27
+ * 告警消息列表
28
+ */
29
+ MESSAGE_WARN = "routeWarnMessage",
30
+ /**
31
+ * 家庭消息列表
32
+ */
33
+ MESSAGE_HOME = "routeHomeMessage",
34
+ /**
35
+ * 通知列表
36
+ */
37
+ MESSAGE_NOTICE = "routeNotice",
38
+ /**
39
+ * 消息设置
40
+ */
41
+ MESSAGE_SETTING = "routeMessageSetting",
42
+ /**
43
+ * 个人资料
44
+ */
45
+ USER_INFO = "routeUserInfo",
46
+ /**
47
+ * 账号与安全
48
+ */
49
+ ACCOUNT_SECURITY = "routeAccountSecurity",
50
+ /**
51
+ * 通用设置
52
+ */
53
+ SETTING = "routeSetting",
54
+ /**
55
+ * 语音等三方服务
56
+ */
57
+ VOICE_SERVICE = "routeVoiceOrThirdService",
58
+ /**
59
+ * 问题工单
60
+ */
61
+ TICKETS = "routeProblemTickets",
62
+ /**
63
+ * 问卷
64
+ */
65
+ QUESTIONNAIRE = "routeAiQuestionnaire",
66
+ /**
67
+ * 设备配网
68
+ */
69
+ PARING = "routeAddDevice",
70
+ /**
71
+ * 设备分享
72
+ */
73
+ DEVICE_SHARE = "routeDeviceShare"
74
+ }
75
+ export type TextInputBlock = {
76
+ type: 'text';
77
+ text: string;
78
+ };
79
+ export type ImageUrlInputBlock = {
80
+ type: 'image_url';
81
+ image_url: {
82
+ url: string;
83
+ };
84
+ };
85
+ export type ImagePathInputBlock = {
86
+ type: 'image_path';
87
+ image_path: {
88
+ path: string;
89
+ };
90
+ };
91
+ export type FileUrlInputBlock = {
92
+ type: 'file_url';
93
+ file_url: {
94
+ mimeType: string;
95
+ url?: string;
96
+ path?: string;
97
+ };
98
+ };
99
+ export type FilePathInputBlock = {
100
+ type: 'file_path';
101
+ file_path: {
102
+ mimeType: string;
103
+ path: string;
104
+ };
105
+ };
106
+ export type VideoPathInputBlock = {
107
+ type: 'video_path';
108
+ video_path: {
109
+ path: string;
110
+ };
111
+ };
112
+ /**
113
+ * 发送 type 是 AI 多模态时,block 参数需要传递的JSON格式
114
+ */
115
+ export type InputBlock = ImageUrlInputBlock | TextInputBlock | FileUrlInputBlock | ImagePathInputBlock | FilePathInputBlock | VideoPathInputBlock;
116
+ export interface Recommendation {
117
+ text: string;
118
+ type: 1 | 2 | 3 | 4;
119
+ h5Url?: string;
120
+ miniProgramUrl?: string;
121
+ nativeUrl?: string;
122
+ }
123
+ export interface ProjectConfig {
124
+ test?: boolean;
125
+ aiPtCode: string;
126
+ aiAssistant?: boolean;
127
+ scene: 'chat' | 'rule';
128
+ nameColor: string;
129
+ powerCode: Record<string, string>;
130
+ bgImg: string;
131
+ welcome: {
132
+ guide: string;
133
+ guideRecommendation: Recommendation[];
134
+ daily: string;
135
+ dailyRecommendation: Recommendation[];
136
+ };
137
+ inputMethods: {
138
+ init: 'text' | 'voice';
139
+ text: boolean;
140
+ voice: boolean;
141
+ };
142
+ feedback?: {
143
+ enabled: boolean;
144
+ };
145
+ boardMenu: {
146
+ switchToOld: {
147
+ enabled: boolean;
148
+ iconPathLight: string;
149
+ iconPathDark: string;
150
+ };
151
+ supportDevices: {
152
+ enabled: boolean;
153
+ iconPathLight: string;
154
+ iconPathDark: string;
155
+ };
156
+ usageGuide: {
157
+ enabled: boolean;
158
+ iconPathLight: string;
159
+ iconPathDark: string;
160
+ h5Url: string;
161
+ };
162
+ };
163
+ vas: {
164
+ free: boolean;
165
+ catalogCode: string;
166
+ externalCode: string;
167
+ deductType: 'home' | 'account';
168
+ title: string;
169
+ logo: string;
170
+ trialBtnText: string;
171
+ purchaseBtnText: string;
172
+ };
173
+ atop?: {
174
+ deviceList: {
175
+ api: string;
176
+ version: string;
177
+ };
178
+ };
179
+ }
180
+ /**
181
+ * 获取小程序自定义配置
182
+ */
183
+ export type GetMiniAppConfigParams = {
184
+ complete?: () => void;
185
+ success?: (params: {
186
+ /** 小程序自定义配置 */
187
+ config: any;
188
+ }) => void;
189
+ fail?: (params: {
190
+ errorMsg: string;
191
+ errorCode: string | number;
192
+ innerError: {
193
+ errorCode: string | number;
194
+ errorMsg: string;
195
+ };
196
+ }) => void;
197
+ };
198
+ export type MiniProgramAccountInfo = {
199
+ /** 小程序 appId */
200
+ appId: string;
201
+ /**
202
+ * 小程序版本
203
+ * develop: 开发版
204
+ * trail: 体验版
205
+ * release: 正式版
206
+ */
207
+ envVersion: string;
208
+ /** 小程序版本号 */
209
+ version: string;
210
+ /** 小程序名称 */
211
+ appName: string;
212
+ /** 小程序图标 */
213
+ appIcon: string;
214
+ };
215
+ /**
216
+ * 获取小程序账号信息
217
+ */
218
+ export type GetAccountInfoParams = {
219
+ complete?: () => void;
220
+ success?: (params: {
221
+ miniProgram: MiniProgramAccountInfo;
222
+ }) => void;
223
+ fail?: (params: {
224
+ errorMsg: string;
225
+ errorCode: string | number;
226
+ }) => void;
227
+ };
228
+ /**
229
+ * atop接口
230
+ */
231
+ export type ApiRequestByAtopParams = {
232
+ /**
233
+ * atop入参数据模型
234
+ * api api名称
235
+ */
236
+ api: string;
237
+ /** version api版本号 */
238
+ version?: string;
239
+ /** postData 入参结构体 */
240
+ postData: Record<string, any>;
241
+ /**
242
+ * extData 额外参数,当前只支持传递gid
243
+ * 数据格式:{"gid":"xxxx"}
244
+ */
245
+ extData?: Record<string, any>;
246
+ complete?: () => void;
247
+ success?: (params: {
248
+ /**
249
+ * 请求结果
250
+ * thing_data_ 出参结构体, JSON序列化
251
+ */
252
+ thing_json_?: any;
253
+ /** 元数据 */
254
+ data: string;
255
+ }) => void;
256
+ fail?: (params: {
257
+ errorMsg: string;
258
+ errorCode: string | number;
259
+ innerError: {
260
+ errorCode: string | number;
261
+ errorMsg: string;
262
+ };
263
+ }) => void;
264
+ };
265
+ export declare enum HighwayMethod {
266
+ /** HTTP 请求 OPTIONS */
267
+ OPTIONS = "OPTIONS",
268
+ /** HTTP 请求 GET */
269
+ GET = "GET",
270
+ /** HTTP 请求 HEAD */
271
+ HEAD = "HEAD",
272
+ /** HTTP 请求 POST */
273
+ POST = "POST",
274
+ /** HTTP 请求 PUT */
275
+ PUT = "PUT",
276
+ /** HTTP 请求 DELETE */
277
+ DELETE = "DELETE",
278
+ /** HTTP 请求 TRACE */
279
+ TRACE = "TRACE",
280
+ /** HTTP 请求 TRACE */
281
+ CONNECT = "CONNECT"
282
+ }
283
+ /**
284
+ * Highway接口
285
+ */
286
+ export type ApiRequestByHighwayParams = {
287
+ /**
288
+ * api api名称
289
+ */
290
+ api: string;
291
+ /** 入参结构体 */
292
+ data: Record<string, any>;
293
+ method: HighwayMethod;
294
+ complete?: () => void;
295
+ success?: (params: {
296
+ /**
297
+ * 请求结果
298
+ * thing_data_ 出参结构体, JSON序列化
299
+ */
300
+ thingjson?: any;
301
+ /** 元数据 */
302
+ data: string;
303
+ }) => void;
304
+ fail?: (params: {
305
+ errorMsg: string;
306
+ errorCode: string | number;
307
+ }) => void;
308
+ };
309
+ export type GetCurrentHomeInfoParams = {
310
+ complete?: () => void;
311
+ success?: (params: {
312
+ /** 家庭名称 */
313
+ homeName: string;
314
+ /** 家庭id */
315
+ homeId: string;
316
+ /** 经度 */
317
+ longitude: string;
318
+ /** 维度 */
319
+ latitude: string;
320
+ /** 详细地址 */
321
+ address: string;
322
+ /**
323
+ * 是否是管理员
324
+ * true 是管理员; false 非管理员
325
+ */
326
+ admin: boolean;
327
+ }) => void;
328
+ fail?: (params: {
329
+ errorMsg: string;
330
+ errorCode: string | number;
331
+ innerError: {
332
+ errorCode: string | number;
333
+ errorMsg: string;
334
+ };
335
+ }) => void;
336
+ };
337
+ export interface AuthorizeParams {
338
+ /**
339
+ * scope 权限名称
340
+ * 举例子:
341
+ * scope.bluetooth 蓝牙权限
342
+ * scope.writePhotosAlbum 写入相册权限
343
+ * scope.userLocationBackground 后台定位权限
344
+ * scope.record 麦克风权限
345
+ * scope.camera 摄像头权限
346
+ * scope.userLocation 低精度定位权限
347
+ * scope.userPreciseLocation 高精度定位权限
348
+ * scope.userInfo 用户信息
349
+ */
350
+ scope: string;
351
+ complete?: () => void;
352
+ success?: (params: null) => void;
353
+ fail?: (params: {
354
+ errorMsg: string;
355
+ errorCode: string | number;
356
+ innerError: {
357
+ errorCode: string | number;
358
+ errorMsg: string;
359
+ };
360
+ }) => void;
361
+ }
362
+ export interface GetAppInfoParams {
363
+ complete?: () => void;
364
+ success?: (params: {
365
+ /**
366
+ * App信息
367
+ * serverTimestamp 云端时间戳
368
+ * appVersion app版本
369
+ * language app语言包
370
+ * countryCode 国家码
371
+ * regionCode 地区码, 在RN Api中被当作“service”字段
372
+ */
373
+ serverTimestamp: number;
374
+ appVersion: string;
375
+ language: string;
376
+ countryCode: string;
377
+ regionCode: string;
378
+ /** appName app名称 */
379
+ appName: string;
380
+ /** appIcon app图标 */
381
+ appIcon: string;
382
+ /**
383
+ * app环境
384
+ * 0: 日常
385
+ * 1: 预发
386
+ * 2: 线上
387
+ */
388
+ appEnv?: number;
389
+ /** app包名 */
390
+ appBundleId: string;
391
+ /** app scheme */
392
+ appScheme: string;
393
+ /** app id */
394
+ appId: string;
395
+ /** app clientId */
396
+ clientId?: string;
397
+ }) => void;
398
+ fail?: (params: {
399
+ errorMsg: string;
400
+ errorCode: string | number;
401
+ innerError: {
402
+ errorCode: string | number;
403
+ errorMsg: string;
404
+ };
405
+ }) => void;
406
+ }
407
+ export interface CanIUseRouterParams {
408
+ /** 路由链接 */
409
+ url: string;
410
+ complete?: () => void;
411
+ success?: (params: {
412
+ /** 路由是否可用 */
413
+ result: boolean;
414
+ }) => void;
415
+ fail?: (params: {
416
+ errorMsg: string;
417
+ errorCode: string | number;
418
+ innerError: {
419
+ errorCode: string | number;
420
+ errorMsg: string;
421
+ };
422
+ }) => void;
423
+ }
424
+ export interface RouterParams {
425
+ /** 路由链接 */
426
+ url: string;
427
+ complete?: () => void;
428
+ success?: (params: null) => void;
429
+ fail?: (params: {
430
+ errorMsg: string;
431
+ errorCode: string | number;
432
+ innerError: {
433
+ errorCode: string | number;
434
+ errorMsg: string;
435
+ };
436
+ }) => void;
437
+ }
438
+ export interface NavigateToMiniProgramParams {
439
+ /** 要打开的小程序appId */
440
+ appId?: string;
441
+ /** 要打开的智能体小程序的智能体Id */
442
+ aiPtChannel?: string;
443
+ /**
444
+ * 要打开的小程序智能体的版本。
445
+ * preview:体验版
446
+ * release:正式版
447
+ */
448
+ aiPtType?: string;
449
+ /** 打开的页面路径,如果为空则打开首页,path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数 */
450
+ path?: string;
451
+ /** 打开小程序的转场方式,分为right|bottom,指代水平和竖直方向 */
452
+ position?: string;
453
+ /** 传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据 */
454
+ extraData?: Record<string, any>;
455
+ /**
456
+ * 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版
457
+ * trial:体验版
458
+ * release:正式版
459
+ */
460
+ envVersion?: string;
461
+ /** 小程序链接,当传递该参数后,可以不传 appId 和 path */
462
+ shortLink?: string;
463
+ complete?: () => void;
464
+ success?: (params: null) => void;
465
+ fail?: (params: {
466
+ errorMsg: string;
467
+ errorCode: string | number;
468
+ innerError: {
469
+ errorCode: string | number;
470
+ errorMsg: string;
471
+ };
472
+ }) => void;
473
+ }
474
+ export interface OpenInnerH5Params {
475
+ /** url H5链接地址 */
476
+ url: string;
477
+ /** title H5标题 */
478
+ title?: string;
479
+ complete?: () => void;
480
+ success?: (params: null) => void;
481
+ fail?: (params: {
482
+ errorMsg: string;
483
+ errorCode: string | number;
484
+ innerError: {
485
+ errorCode: string | number;
486
+ errorMsg: string;
487
+ };
488
+ }) => void;
489
+ }
490
+ export declare enum AuthorizePolicySign {
491
+ /** 未授权 */
492
+ UNAUTHORIZED = 0,
493
+ /** 需重新授权 */
494
+ REAUTHORIZATION = 1,
495
+ /** 已授权 */
496
+ AUTHORIZED = 2
497
+ }
498
+ export interface AuthorizePolicyStatusParams {
499
+ type: string;
500
+ complete?: () => void;
501
+ success?: (params: {
502
+ sign: AuthorizePolicySign;
503
+ }) => void;
504
+ fail?: (params: {
505
+ errorMsg: string;
506
+ errorCode: string | number;
507
+ innerError: {
508
+ errorCode: string | number;
509
+ errorMsg: string;
510
+ };
511
+ }) => void;
512
+ }
513
+ export interface RegisterChannelParams {
514
+ /** 事件名称 */
515
+ eventName: string;
516
+ complete?: () => void;
517
+ success?: (params: null) => void;
518
+ fail?: (params: {
519
+ errorMsg: string;
520
+ errorCode: string | number;
521
+ innerError: {
522
+ errorCode: string | number;
523
+ errorMsg: string;
524
+ };
525
+ }) => void;
526
+ }
527
+ export type EventChannelMessageParams = {
528
+ /** 事件id */
529
+ eventId: string;
530
+ /** 传递事件对象 */
531
+ event?: any;
532
+ };
533
+ export declare enum WidgetVersionType {
534
+ /** 线上版本 */
535
+ release = "release",
536
+ /** 预发版本 */
537
+ preview = "preview"
538
+ }
539
+ export declare enum WidgetPosition {
540
+ /** 居底展示 */
541
+ bottom = "bottom",
542
+ /** 居顶展示 */
543
+ top = "top",
544
+ /** 居中展示 */
545
+ center = "center"
546
+ }
547
+ export type OpenMiniWidgetParams = {
548
+ /** 要打开的小部件appid */
549
+ appId: string;
550
+ /** 对应的小部件页面相对url, 如果为空则打开首页,path 中 ? 后面的部分会成为 query */
551
+ pagePath?: string;
552
+ /** 面板类型设备id */
553
+ deviceId?: string;
554
+ /** 面板群组类型群组id */
555
+ groupId?: string;
556
+ /** 小部件样式,默认middle */
557
+ style?: string;
558
+ /** 版本类型,默认release */
559
+ versionType?: WidgetVersionType;
560
+ /** 版本号 */
561
+ version?: string;
562
+ /** 展示位置,默认bottom */
563
+ position?: WidgetPosition;
564
+ /** 点击空白处是否关闭 */
565
+ autoDismiss?: boolean;
566
+ /**
567
+ * 是否优先展示默认缓存
568
+ * 对应属性在小程序容器3.1.0生效
569
+ */
570
+ autoCache?: boolean;
571
+ /** 是否支持深色模式 */
572
+ supportDark?: boolean;
573
+ success?: (params: null) => void;
574
+ fail?: (params: {
575
+ errorMsg: string;
576
+ errorCode: string | number;
577
+ innerError: {
578
+ errorCode: string | number;
579
+ errorMsg: string;
580
+ };
581
+ }) => void;
582
+ complete?: () => void;
583
+ };
584
+ /**
585
+ * AIStream 相关
586
+ */
587
+ export declare enum ConnectState {
588
+ /** 初始化 */
589
+ INIT = 0,
590
+ /** 连接中 */
591
+ CONNECTING = 1,
592
+ /** 鉴权中 */
593
+ AUTHORIZING = 2,
594
+ /** 已连接 */
595
+ CONNECTED = 3,
596
+ /** 被云端断开 */
597
+ DISCONNECTED = 4,
598
+ /** 主动关闭 */
599
+ CLOSED = 5
600
+ }
601
+ export declare enum SessionState {
602
+ /** 会话创建成功 */
603
+ CREATED = 0,
604
+ /** 会话创建失败 */
605
+ CREATE_FAILED = 1,
606
+ /** 会话被云端关闭 */
607
+ CLOSED = 2
608
+ }
609
+ export declare enum ConnectClientType {
610
+ /** 作为设备代理 */
611
+ DEVICE = 1,
612
+ /** 作为 App */
613
+ APP = 2
614
+ }
615
+ export declare enum EventType {
616
+ /** 事件开始 */
617
+ EVENT_START = 0,
618
+ /** 事件数据结束 */
619
+ EVENT_PAYLOAD_END = 1,
620
+ /** 事件结束 */
621
+ EVENT_END = 2,
622
+ /** 一次性事件 */
623
+ ONE_SHOT = 3,
624
+ /** 聊天中断 */
625
+ CHAT_BREAK = 4,
626
+ /** 服务端 VAD */
627
+ SERVER_VAD = 5
628
+ }
629
+ export declare enum StreamFlag {
630
+ /** 仅一包 */
631
+ ONLY_ONE = 0,
632
+ /** 传输开始 */
633
+ START = 1,
634
+ /** 传输中 */
635
+ IN_PROGRESS = 2,
636
+ /** 传输结束 */
637
+ END = 3
638
+ }
639
+ export declare enum FileFormat {
640
+ /** MP4 */
641
+ MP4 = 1,
642
+ /** OGG_OPUS */
643
+ OGG_OPUS = 2,
644
+ /** PDF */
645
+ PDF = 3,
646
+ /** JSON */
647
+ JSON = 4,
648
+ /** IPC_LOG */
649
+ IPC_LOG = 5,
650
+ /** SweeperMap */
651
+ SWEEPER_MAP = 6
652
+ }
653
+ export declare enum AIStreamErrorCode {
654
+ OK = 200,
655
+ BadRequest = 400,
656
+ Unauthenticated = 401,
657
+ NotFound = 404,
658
+ RequestTimeout = 408,
659
+ InternalServerError = 500,
660
+ GatewayTimeout = 504,
661
+ CloseByClient = 601,
662
+ CloseByReuse = 602,
663
+ CloseByIO = 603,
664
+ CloseByKeepalive = 604,
665
+ CloseByExpire = 605
666
+ }
667
+ export declare enum BizCode {
668
+ CHAT = 65537
669
+ }
670
+ export declare enum BizTag {
671
+ DEFAULT = 0
672
+ }
673
+ export type BizConfig = {
674
+ /** 业务 code */
675
+ bizCode: number;
676
+ /**
677
+ * 发送数据 code 约定
678
+ * 例如 ["audio", "video", "text", "image"}
679
+ */
680
+ sendData: string[];
681
+ /**
682
+ * 接收数据 code 约定
683
+ * 例如 ["text", "audio"]
684
+ */
685
+ revData: string[];
686
+ };
687
+ export declare enum AIStreamAttributeType {
688
+ AI_CHAT = 1003
689
+ }
690
+ export declare enum AIStreamAttributePayloadType {
691
+ U_INT8 = 1,
692
+ U_INT16 = 2,
693
+ U_INT32 = 3,
694
+ U_INT64 = 4,
695
+ BYTES = 5,
696
+ STRING = 6
697
+ }
698
+ export declare enum AIStreamChatSysWorkflow {
699
+ ASR_LLM_TTS = "asr-llm-tts",
700
+ ASR_LLM = "asr-llm",
701
+ ASR = "asr",
702
+ LLM = "llm",
703
+ LLM_TTS = "llm-tts"
704
+ }
705
+ export interface AIStreamChatAttribute {
706
+ 'asr.enableVad'?: 'true' | 'false';
707
+ 'processing.interrupt'?: 'true' | 'false';
708
+ 'sys.workflow'?: AIStreamChatSysWorkflow;
709
+ [key: string]: string;
710
+ }
711
+ export type Attribute = {
712
+ /** Attribute 类型 */
713
+ type: AIStreamAttributeType;
714
+ /** 数据类型:0x01-UInt8, 0x02-UInt16, 0x03-UInt32, 0x04-UInt64, 0x05-Bytes, 0x06-String */
715
+ payloadType: AIStreamAttributePayloadType;
716
+ /** 数据:UInt8~UInt64 数字用字符串传递,Bytes 用 HexString传递, */
717
+ value: string;
718
+ };
719
+ export type EventBody = {
720
+ /** 事件 id */
721
+ eventId: string;
722
+ /** 会话 id */
723
+ sessionId: string;
724
+ /** 事件类型: 0-Event Start, 1-Event Payload End, 2-Event End, 3 - OneShot, 4-Chat Break, 5-Server VAD */
725
+ eventType: EventType;
726
+ /** 属性列表 */
727
+ userData?: Attribute[];
728
+ };
729
+ export type AudioBody = {
730
+ /** 接收数据通道 */
731
+ dataChannel: string;
732
+ /** 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束 */
733
+ streamFlag: StreamFlag;
734
+ /** 音频缓存路径,传输结束后可访问(streamFlag == 1 || StreamFlag == 3) */
735
+ path: string;
736
+ /** 扩展属性 */
737
+ userData?: Attribute[];
738
+ /** SessionId 列表, 云端返回,可能为空 */
739
+ sessionIdList?: string[];
740
+ };
741
+ export type VideoBody = {
742
+ /** 接收数据通道 */
743
+ dataChannel: string;
744
+ /** 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束 */
745
+ streamFlag: StreamFlag;
746
+ /** 视频缓存路径,传输结束后可访问(streamFlag == 1 || StreamFlag == 3) */
747
+ path: string;
748
+ /** 扩展属性 */
749
+ userData?: Attribute[];
750
+ /** SessionId 列表, 云端返回,可能为空 */
751
+ sessionIdList?: string[];
752
+ };
753
+ export type ImageBody = {
754
+ /** 接收数据通道 */
755
+ dataChannel: string;
756
+ /** 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束 */
757
+ streamFlag: StreamFlag;
758
+ /** 图片缓存路径,传输结束后可访问(streamFlag == 1 || StreamFlag == 3) */
759
+ path: string;
760
+ /** 图片宽度 */
761
+ width: number;
762
+ /** 图片高度 */
763
+ height: number;
764
+ /** 扩展属性 */
765
+ userData?: Attribute[];
766
+ /** SessionId 列表, 云端返回,可能为空 */
767
+ sessionIdList?: string[];
768
+ };
769
+ export type TextBody = {
770
+ /** 接收数据通道 */
771
+ dataChannel: string;
772
+ /** 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束 */
773
+ streamFlag: StreamFlag;
774
+ /** 文本内容(JSON String,见云端文档定义) */
775
+ text: string;
776
+ /** 扩展属性 */
777
+ userData?: Attribute[];
778
+ /** SessionId 列表, 云端返回,可能为空 */
779
+ sessionIdList?: string[];
780
+ };
781
+ export type FileBody = {
782
+ /** 接收数据通道 */
783
+ dataChannel: string;
784
+ /** 数据流类型: 0-仅一包, 1-传输开始, 2-传输中, 3-传输结束 */
785
+ streamFlag: StreamFlag;
786
+ /** 文件缓存路径,传输结束后可访问(streamFlag == 1 || StreamFlag == 3) */
787
+ path: string;
788
+ /** 文件类型: 1 - MP4, 2 - OGG_OPUS, 3 - PDF, 4 - JSON, 5 - IPC_LOG, 6 - SweeperMap */
789
+ format: FileFormat;
790
+ /** 扩展属性 */
791
+ userData?: Attribute[];
792
+ /** SessionId 列表, 云端返回,可能为空 */
793
+ sessionIdList?: string[];
794
+ };
795
+ export type ConnectStateBody = {
796
+ /** connection id */
797
+ connectionId: string;
798
+ /** 连接状态: 0-初始化,1-连接中,2-鉴权中,3-已连接,4-被云端断开,5-主动关闭 */
799
+ connectState: ConnectState;
800
+ /** 被云端断开错误码 */
801
+ code?: AIStreamErrorCode;
802
+ };
803
+ export type SessionStateBody = {
804
+ /** 会话 id */
805
+ sessionId: string;
806
+ /** 会话状态: 0-会话创建成功, 1-会话创建失败, 2-会话被云端关闭 */
807
+ sessionState: SessionState;
808
+ /** 会话被关闭原因 */
809
+ code?: AIStreamErrorCode;
810
+ };
811
+ export type RecordAmplitudesBody = {
812
+ /** 振幅数据 */
813
+ amplitudes: number[];
814
+ };
815
+ export type CheckConnectParams = {
816
+ /** client 类型: 1-作为设备代理, 2-作为 App */
817
+ clientType: ConnectClientType;
818
+ /** 代理的设备ID, clientType == 1 时必传 */
819
+ deviceId?: string;
820
+ };
821
+ export type CheckConnectResult = {
822
+ /** 是否已连接 */
823
+ connected: boolean;
824
+ /** 通道连接状态: 0-初始化,1-连接中,2-鉴权中,3-已连接,4-被云端断开,5-主动关闭 */
825
+ state: ConnectState;
826
+ /** client 类型: 1-作为设备代理, 2-作为 App. */
827
+ clientType?: ConnectClientType;
828
+ /** 连接的唯一标识 */
829
+ connectionId?: string;
830
+ };
831
+ /**
832
+ *@description 发起通道连接,若此前已连接会直接回调成功
833
+ */
834
+ export type ConnectParams = {
835
+ /** client 类型: 1-作为设备代理, 2-作为 App */
836
+ clientType: ConnectClientType;
837
+ /** 代理的设备ID, clientType == 1 时必传 */
838
+ deviceId?: string;
839
+ success?: (params: {
840
+ /** 连接的唯一标识 */
841
+ connectionId: string;
842
+ }) => void;
843
+ fail?: (params: {
844
+ errorMsg: string;
845
+ errorCode: string | number;
846
+ innerError: {
847
+ errorCode: string | number;
848
+ errorMsg: string;
849
+ };
850
+ }) => void;
851
+ complete?: () => void;
852
+ };
853
+ /**
854
+ *@description 查询智能体 token,传递给 createSession
855
+ */
856
+ export type QueryAgentTokenParams = {
857
+ /** Owner ID: HomeID 或 设备id */
858
+ ownerId: string;
859
+ /** 智能解决方案 code */
860
+ solutionCode: string;
861
+ /** 业务接口 */
862
+ api: string;
863
+ /** 接口版本 */
864
+ apiVersion: string;
865
+ /** 业务额外参数 */
866
+ extParams: any;
867
+ success?: (params: {
868
+ /** 智能体 token */
869
+ agentToken: string;
870
+ /** 业务配置 */
871
+ bizConfig: BizConfig;
872
+ }) => void;
873
+ fail?: (params: {
874
+ errorMsg: string;
875
+ errorCode: string | number;
876
+ innerError: {
877
+ errorCode: string | number;
878
+ errorMsg: string;
879
+ };
880
+ }) => void;
881
+ complete?: () => void;
882
+ };
883
+ /**
884
+ *@description 创建会话
885
+ */
886
+ export type CreateSessionParams = {
887
+ /** 业务 tag */
888
+ bizTag?: BizTag;
889
+ /** 智能体 token */
890
+ agentToken: string;
891
+ /** 会话 id. 不传递则自动生成,传递则使用传递的 */
892
+ sessionId?: string;
893
+ /** 业务配置定义(通过 queryAgentToken 传递) */
894
+ bizConfig: BizConfig;
895
+ /** 扩展属性 */
896
+ userData?: Attribute[];
897
+ /** 是否复用数据通道,默认不复用 */
898
+ reuseDataChannel?: boolean;
899
+ success?: (params: {
900
+ /** 会话 id */
901
+ sessionId: string;
902
+ /**
903
+ * 下发数据通道 列表. (下发数据时,需要使用该列表中的 Code)
904
+ * 音频视频图片文件都只有一路时,例如 bizCode 65537 ["audio", "video", "text", "image"]
905
+ * 有多路重复时,例如 双路音视频:["audio_0", "audio_1", "video_0", "video_1", "text", "image"]
906
+ */
907
+ sendDataChannels: string[];
908
+ /**
909
+ * 接收数据通道 列表. (接收数据时,数据中会使用该列表中的 Code)
910
+ * 音频视频图片文件都只有一路时,例如 bizCode 65537,接收只有 文本、音频 ["text", "audio"]
911
+ */
912
+ revDataChannels: string[];
913
+ }) => void;
914
+ fail?: (params: {
915
+ errorMsg: string;
916
+ errorCode: string | number;
917
+ innerError: {
918
+ errorCode: string | number;
919
+ errorMsg: string;
920
+ };
921
+ }) => void;
922
+ complete?: () => void;
923
+ };
924
+ /**
925
+ *@description 关闭会话
926
+ */
927
+ export type CloseSessionParams = {
928
+ /** 会话 id */
929
+ sessionId: string;
930
+ /** 关闭原因, 非异常则使用 200 来关闭 */
931
+ code: AIStreamErrorCode;
932
+ success?: (params: null) => void;
933
+ fail?: (params: {
934
+ errorMsg: string;
935
+ errorCode: string | number;
936
+ innerError: {
937
+ errorCode: string | number;
938
+ errorMsg: string;
939
+ };
940
+ }) => void;
941
+ complete?: () => void;
942
+ };
943
+ /**
944
+ *@description 关闭连接,主要针对作为设备代理的情况,以App身份使用时不需要调用
945
+ */
946
+ export type DisconnectParams = {
947
+ /** 需要断连的 connection Id */
948
+ connectionId: string;
949
+ success?: (params: null) => void;
950
+ fail?: (params: {
951
+ errorMsg: string;
952
+ errorCode: string | number;
953
+ innerError: {
954
+ errorCode: string | number;
955
+ errorMsg: string;
956
+ };
957
+ }) => void;
958
+ complete?: () => void;
959
+ };
960
+ export type SendEventStartParams = {
961
+ /** 会话 id */
962
+ sessionId: string;
963
+ /** 扩展属性 */
964
+ userData?: Attribute[];
965
+ success?: (params: {
966
+ /** 事件 id。此后 sendEventPayloadEnd、sendEventEnd、sendEventChatBreak 都需要使用该 eventId 直到下发一次 sendEventStart 生成新 eventId 之前。 */
967
+ eventId: string;
968
+ }) => void;
969
+ fail?: (params: {
970
+ errorMsg: string;
971
+ errorCode: string | number;
972
+ innerError: {
973
+ errorCode: string | number;
974
+ errorMsg: string;
975
+ };
976
+ }) => void;
977
+ complete?: () => void;
978
+ };
979
+ /**
980
+ *@description 某个数据流传输结束事件
981
+ */
982
+ export type SendEventPayloadEndParams = {
983
+ /** 事件 id */
984
+ eventId: string;
985
+ /** 会话 id */
986
+ sessionId: string;
987
+ /** 发送结束 的 dataChannel */
988
+ dataChannel: string;
989
+ /** 扩展属性 */
990
+ userData?: Attribute[];
991
+ success?: (params: null) => void;
992
+ fail?: (params: {
993
+ errorMsg: string;
994
+ errorCode: string | number;
995
+ innerError: {
996
+ errorCode: string | number;
997
+ errorMsg: string;
998
+ };
999
+ }) => void;
1000
+ complete?: () => void;
1001
+ };
1002
+ /**
1003
+ *@description 结束事件
1004
+ */
1005
+ export type SendEventEndParams = {
1006
+ /** 事件 id */
1007
+ eventId: string;
1008
+ /** 会话 id */
1009
+ sessionId: string;
1010
+ /** 扩展属性 */
1011
+ userData?: Attribute[];
1012
+ success?: (params: null) => void;
1013
+ fail?: (params: {
1014
+ errorMsg: string;
1015
+ errorCode: string | number;
1016
+ innerError: {
1017
+ errorCode: string | number;
1018
+ errorMsg: string;
1019
+ };
1020
+ }) => void;
1021
+ complete?: () => void;
1022
+ };
1023
+ /**
1024
+ *@description 打断事件。用于:1. 中止自己的发送,2. 中止接收云端的回复
1025
+ */
1026
+ export type SendEventChatBreakParams = {
1027
+ /** 事件 id, */
1028
+ eventId: string;
1029
+ /** 会话 id */
1030
+ sessionId: string;
1031
+ /** 扩展属性 */
1032
+ userData?: Attribute[];
1033
+ success?: (params: null) => void;
1034
+ fail?: (params: {
1035
+ errorMsg: string;
1036
+ errorCode: string | number;
1037
+ innerError: {
1038
+ errorCode: string | number;
1039
+ errorMsg: string;
1040
+ };
1041
+ }) => void;
1042
+ complete?: () => void;
1043
+ };
1044
+ /**
1045
+ *@description 开始录制并发送音频数据
1046
+ */
1047
+ export type StartRecordAndSendAudioDataParams = {
1048
+ /** 会话 id */
1049
+ sessionId: string;
1050
+ /** 下发数据通道,当音频只有单路的时候,可以不传 */
1051
+ dataChannel?: string;
1052
+ /** 扩展属性 */
1053
+ userData?: Attribute[];
1054
+ success?: (params: null) => void;
1055
+ fail?: (params: {
1056
+ errorMsg: string;
1057
+ errorCode: string | number;
1058
+ innerError: {
1059
+ errorCode: string | number;
1060
+ errorMsg: string;
1061
+ };
1062
+ }) => void;
1063
+ complete?: () => void;
1064
+ };
1065
+ export type StopRecordAndSendAudioDataParams = {
1066
+ /** 会话 id */
1067
+ sessionId: string;
1068
+ /** 下发数据通道,当音频只有单路的时候,可以不传 */
1069
+ dataChannel?: string;
1070
+ /** 扩展属性 */
1071
+ userData?: Attribute[];
1072
+ success?: (params: null) => void;
1073
+ fail?: (params: {
1074
+ errorMsg: string;
1075
+ errorCode: string | number;
1076
+ innerError: {
1077
+ errorCode: string | number;
1078
+ errorMsg: string;
1079
+ };
1080
+ }) => void;
1081
+ complete?: () => void;
1082
+ };
1083
+ export declare enum VideoCameraType {
1084
+ FRONT = 1,
1085
+ BACK = 2
1086
+ }
1087
+ export type StartRecordAndSendVideoDataParams = {
1088
+ /** 会话 id */
1089
+ sessionId: string;
1090
+ /** 下发数据通道,当音频只有单路的时候,可以不传 */
1091
+ dataChannel?: string;
1092
+ /**
1093
+ * 摄像头类型
1094
+ * 1-前置摄像头, 2-后置摄像头
1095
+ */
1096
+ cameraType: VideoCameraType;
1097
+ /** 扩展属性 */
1098
+ userData?: Attribute[];
1099
+ success?: (params: null) => void;
1100
+ fail?: (params: {
1101
+ errorMsg: string;
1102
+ errorCode: string | number;
1103
+ innerError: {
1104
+ errorCode: string | number;
1105
+ errorMsg: string;
1106
+ };
1107
+ }) => void;
1108
+ complete?: () => void;
1109
+ };
1110
+ export type StopRecordAndSendVideoDataParams = {
1111
+ /** 会话 id */
1112
+ sessionId: string;
1113
+ /** 下发数据通道,当音频只有单路的时候,可以不传 */
1114
+ dataChannel?: string;
1115
+ /**
1116
+ * 摄像头类型
1117
+ * 1-前置摄像头, 2-后置摄像头
1118
+ */
1119
+ cameraType: VideoCameraType;
1120
+ /** 扩展属性 */
1121
+ userData?: Attribute[];
1122
+ success?: (params: null) => void;
1123
+ fail?: (params: {
1124
+ errorMsg: string;
1125
+ errorCode: string | number;
1126
+ innerError: {
1127
+ errorCode: string | number;
1128
+ errorMsg: string;
1129
+ };
1130
+ }) => void;
1131
+ complete?: () => void;
1132
+ };
1133
+ export type SendImageDataParams = {
1134
+ /** 会话 id */
1135
+ sessionId: string;
1136
+ /** 下发数据通道,当音频只有单路的时候,可以不传 */
1137
+ dataChannel?: string;
1138
+ /** 图片路径 */
1139
+ path: string;
1140
+ /** 扩展属性 */
1141
+ userData?: Attribute[];
1142
+ success?: (params: null) => void;
1143
+ fail?: (params: {
1144
+ errorMsg: string;
1145
+ errorCode: string | number;
1146
+ innerError: {
1147
+ errorCode: string | number;
1148
+ errorMsg: string;
1149
+ };
1150
+ }) => void;
1151
+ complete?: () => void;
1152
+ };
1153
+ export type SendTextDataParams = {
1154
+ /** 会话 id */
1155
+ sessionId: string;
1156
+ /** 下发数据通道,当音频只有单路的时候,可以不传 */
1157
+ dataChannel?: string;
1158
+ /** 文本内容 */
1159
+ text: string;
1160
+ /** 扩展属性 */
1161
+ userData?: Attribute[];
1162
+ success?: (params: null) => void;
1163
+ fail?: (params: {
1164
+ errorMsg: string;
1165
+ errorCode: string | number;
1166
+ innerError: {
1167
+ errorCode: string | number;
1168
+ errorMsg: string;
1169
+ };
1170
+ }) => void;
1171
+ complete?: () => void;
1172
+ };
1173
+ export type SendFileDataParams = {
1174
+ /** 会话 id */
1175
+ sessionId: string;
1176
+ /** 下发数据通道,当音频只有单路的时候,可以不传 */
1177
+ dataChannel?: string;
1178
+ /** 文件路径 */
1179
+ path: string;
1180
+ /** 文件类型: 1 - MP4, 2 - OGG_OPUS, 3 - PDF, 4 - JSON, 5 - IPC_LOG, 6 - SweeperMap */
1181
+ format: FileFormat;
1182
+ /** 扩展属性 */
1183
+ userData?: Attribute[];
1184
+ success?: (params: null) => void;
1185
+ fail?: (params: {
1186
+ errorMsg: string;
1187
+ errorCode: string | number;
1188
+ innerError: {
1189
+ errorCode: string | number;
1190
+ errorMsg: string;
1191
+ };
1192
+ }) => void;
1193
+ complete?: () => void;
1194
+ };
1195
+ export type RecordBody = {
1196
+ /** 记录ID, 自增. (insertRecord 不传, updateRecord 必传, 作为 Response 返回时必有值) */
1197
+ id: number;
1198
+ /** biz Code 大类目,可搜索 */
1199
+ bizCode?: number;
1200
+ /** 智能解决方案 code, 可搜索 */
1201
+ solutionCode?: string;
1202
+ /** 设备 id,可搜索 */
1203
+ devId?: string;
1204
+ /** 家庭 id, 可搜索 */
1205
+ homeId?: number;
1206
+ /** type, 业务自行决定,可搜索 */
1207
+ type?: string;
1208
+ /** 索引, 业务自行决定,可搜索 */
1209
+ index?: string;
1210
+ /** 扩展索引1, 业务自行决定,可搜索 */
1211
+ index1?: string;
1212
+ /** 扩展索引2, 业务自行决定,可搜索 */
1213
+ index2?: string;
1214
+ /** 缓存数据,JSON格式,不可搜索 */
1215
+ data?: string;
1216
+ /** 值,不可搜索 */
1217
+ value?: string;
1218
+ /** 扩展值1,不可搜索 */
1219
+ value1?: string;
1220
+ /** 扩展值2,不可搜索 */
1221
+ value2?: string;
1222
+ };
1223
+ export type QueryRecordListParams = {
1224
+ /** 自增ID */
1225
+ id?: number[];
1226
+ /** biz Code 大类目,可搜索 */
1227
+ bizCode?: BizCode[];
1228
+ /** 智能解决方案 code, 可搜索 */
1229
+ solutionCode?: string[];
1230
+ /** 设备 id,可搜索 */
1231
+ devId?: string[];
1232
+ /** 家庭 id, 可搜索 */
1233
+ homeId?: number[];
1234
+ /** type, 业务自行决定,可搜索 */
1235
+ type?: string[];
1236
+ /** 索引, 业务自行决定,可搜索 */
1237
+ index?: string[];
1238
+ /** 扩展索引1, 业务自行决定,可搜索 */
1239
+ index1?: string[];
1240
+ /** 扩展索引2, 业务自行决定,可搜索 */
1241
+ index2?: string[];
1242
+ /** offset 分页偏移量(删除时无需传递) */
1243
+ offset?: number;
1244
+ /** limit 分页大小, 不传或传0则不分页(删除时无需传递) */
1245
+ limit?: number;
1246
+ /**
1247
+ * 排序方式,仅用于 `queryRecordList`
1248
+ * - 0: 按 id 降序(默认)
1249
+ * - 1: 按 id 升序
1250
+ */
1251
+ sortType?: number;
1252
+ success?: (params: {
1253
+ /** 记录列表 */
1254
+ records: RecordBody[];
1255
+ /** 记录总数 */
1256
+ total: number;
1257
+ }) => void;
1258
+ fail?: (params: {
1259
+ errorMsg: string;
1260
+ errorCode: string | number;
1261
+ innerError: {
1262
+ errorCode: string | number;
1263
+ errorMsg: string;
1264
+ };
1265
+ }) => void;
1266
+ complete?: () => void;
1267
+ };
1268
+ export type DeleteRecordListParams = {
1269
+ /** 自增ID */
1270
+ id?: number[];
1271
+ /** biz Code 大类目,可搜索 */
1272
+ bizCode?: BizCode[];
1273
+ /** 智能解决方案 code, 可搜索 */
1274
+ solutionCode?: string[];
1275
+ /** 设备 id,可搜索 */
1276
+ devId?: string[];
1277
+ /** 家庭 id, 可搜索 */
1278
+ homeId?: number[];
1279
+ /** type, 业务自行决定,可搜索 */
1280
+ type?: string[];
1281
+ /** 索引, 业务自行决定,可搜索 */
1282
+ index?: string[];
1283
+ /** 扩展索引1, 业务自行决定,可搜索 */
1284
+ index1?: string[];
1285
+ /** 扩展索引2, 业务自行决定,可搜索 */
1286
+ index2?: string[];
1287
+ /** offset 分页偏移量(删除时无需传递) */
1288
+ offset?: number;
1289
+ /** limit 分页大小, 不传或传0则不分页(删除时无需传递) */
1290
+ limit?: number;
1291
+ success?: (params: null) => void;
1292
+ fail?: (params: {
1293
+ errorMsg: string;
1294
+ errorCode: string | number;
1295
+ innerError: {
1296
+ errorCode: string | number;
1297
+ errorMsg: string;
1298
+ };
1299
+ }) => void;
1300
+ complete?: () => void;
1301
+ };
1302
+ export type UpdateRecordParams = {
1303
+ /** 记录ID, 自增. (insertRecord 不传, updateRecord 必传, 作为 Response 返回时必有值) */
1304
+ id?: number;
1305
+ /** biz Code 大类目,可搜索 */
1306
+ bizCode?: BizCode;
1307
+ /** 智能解决方案 code, 可搜索 */
1308
+ solutionCode?: string;
1309
+ /** 设备 id,可搜索 */
1310
+ devId?: string;
1311
+ /** 家庭 id, 可搜索 */
1312
+ homeId?: number;
1313
+ /** type, 业务自行决定,可搜索 */
1314
+ type?: string;
1315
+ /** 索引, 业务自行决定,可搜索 */
1316
+ index?: string;
1317
+ /** 扩展索引1, 业务自行决定,可搜索 */
1318
+ index1?: string;
1319
+ /** 扩展索引2, 业务自行决定,可搜索 */
1320
+ index2?: string;
1321
+ /** 缓存数据,JSON格式,不可搜索 */
1322
+ data?: string;
1323
+ /** 值,不可搜索 */
1324
+ value?: string;
1325
+ /** 扩展值1,不可搜索 */
1326
+ value1?: string;
1327
+ /** 扩展值2,不可搜索 */
1328
+ value2?: string;
1329
+ success?: (params: null) => void;
1330
+ fail?: (params: {
1331
+ errorMsg: string;
1332
+ errorCode: string | number;
1333
+ innerError: {
1334
+ errorCode: string | number;
1335
+ errorMsg: string;
1336
+ };
1337
+ }) => void;
1338
+ complete?: () => void;
1339
+ };
1340
+ export type InsertRecordParams = {
1341
+ /** 记录ID, 自增. (insertRecord 不传, updateRecord 必传, 作为 Response 返回时必有值) */
1342
+ id?: number;
1343
+ /** biz Code 大类目,可搜索 */
1344
+ bizCode?: BizCode;
1345
+ /** 智能解决方案 code, 可搜索 */
1346
+ solutionCode?: string;
1347
+ /** 设备 id,可搜索 */
1348
+ devId?: string;
1349
+ /** 家庭 id, 可搜索 */
1350
+ homeId?: number;
1351
+ /** type, 业务自行决定,可搜索 */
1352
+ type?: string;
1353
+ /** 索引, 业务自行决定,可搜索 */
1354
+ index?: string;
1355
+ /** 扩展索引1, 业务自行决定,可搜索 */
1356
+ index1?: string;
1357
+ /** 扩展索引2, 业务自行决定,可搜索 */
1358
+ index2?: string;
1359
+ /** 缓存数据,JSON格式,不可搜索 */
1360
+ data?: string;
1361
+ /** 值,不可搜索 */
1362
+ value?: string;
1363
+ /** 扩展值1,不可搜索 */
1364
+ value1?: string;
1365
+ /** 扩展值2,不可搜索 */
1366
+ value2?: string;
1367
+ success?: (params: {
1368
+ /** 记录ID */
1369
+ id: number;
1370
+ }) => void;
1371
+ fail?: (params: {
1372
+ errorMsg: string;
1373
+ errorCode: string | number;
1374
+ innerError: {
1375
+ errorCode: string | number;
1376
+ errorMsg: string;
1377
+ };
1378
+ }) => void;
1379
+ complete?: () => void;
1380
+ };
1381
+ export declare enum ReceivedTextPacketType {
1382
+ ASR = "ASR",
1383
+ SKILL = "SKILL",
1384
+ NLG = "NLG"
1385
+ }
1386
+ export declare enum ReceivedTextPacketEof {
1387
+ CONTINUE = 0,
1388
+ END = 1
1389
+ }
1390
+ export interface ReceivedTextPacketBase<T extends ReceivedTextPacketType, D> {
1391
+ /** 业务 ID */
1392
+ bizId: string;
1393
+ /** 业务类型 */
1394
+ bizType: T;
1395
+ /** 是否结束 */
1396
+ eof: ReceivedTextPacketEof;
1397
+ /** 真实数据 */
1398
+ data: D;
1399
+ }
1400
+ export type ReceivedTextAsrPacket = ReceivedTextPacketBase<ReceivedTextPacketType.ASR, {
1401
+ text: string;
1402
+ }>;
1403
+ export type ReceivedTextNlgPacket = ReceivedTextPacketBase<ReceivedTextPacketType.NLG, {
1404
+ content: string;
1405
+ appendMode: 'append';
1406
+ finish: boolean;
1407
+ }>;
1408
+ export type ReceivedTextSkillPacket<T = any> = ReceivedTextPacketBase<ReceivedTextPacketType.SKILL, {
1409
+ code: string;
1410
+ skillContent: T;
1411
+ text: string[];
1412
+ }>;
1413
+ export type ReceivedTextPacket = ReceivedTextAsrPacket | ReceivedTextNlgPacket | ReceivedTextSkillPacket;