sudmgp-sdk-js 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/package.json +4 -1
- package/type.d.ts +50 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sudmgp-sdk-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@babel/plugin-transform-modules-umd": "^7.18.6",
|
|
27
27
|
"@babel/preset-env": "^7.18.6",
|
|
28
28
|
"@types/blueimp-md5": "^2.18.0",
|
|
29
|
+
"@types/crypto-js": "^4.2.2",
|
|
29
30
|
"@types/uuid": "^8.3.4",
|
|
30
31
|
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
31
32
|
"@typescript-eslint/parser": "^5.29.0",
|
|
@@ -49,6 +50,8 @@
|
|
|
49
50
|
"webpack-merge": "^5.8.0"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
53
|
+
"crypto-js": "^4.2.0",
|
|
54
|
+
"jsencrypt": "^3.3.2",
|
|
52
55
|
"microsoft-cognitiveservices-speech-sdk": "^1.27.0"
|
|
53
56
|
}
|
|
54
57
|
}
|
package/type.d.ts
CHANGED
|
@@ -31,6 +31,21 @@ export interface ISudListenerGetMGInfo {
|
|
|
31
31
|
onFailure(retCode: number, retMsg: string): void;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export interface ISudListenerAiAgent {
|
|
35
|
+
|
|
36
|
+
/** 房间聊天消息 */
|
|
37
|
+
onRoomChatMessage(json: string): void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 大模型AI玩家
|
|
41
|
+
export interface IModelAIPlayers {
|
|
42
|
+
userId: string // 玩家id
|
|
43
|
+
avatar: string // 头像url
|
|
44
|
+
name: string // 名字
|
|
45
|
+
gender: string // 性别 male:男,female:女
|
|
46
|
+
aiId: number // ai性格 目前支持1~20
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
// SudMGP 接口
|
|
35
50
|
export interface ISudMGP {
|
|
36
51
|
getVersion(): string
|
|
@@ -61,6 +76,8 @@ export interface ISudMGP {
|
|
|
61
76
|
setUserId(userId: string):void
|
|
62
77
|
setLogLevel(logLevel: number):void
|
|
63
78
|
setLogger(logger: ISudLogger):void
|
|
79
|
+
|
|
80
|
+
isWebGLAvailable(): boolean
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
export interface ISudFSTAPP {
|
|
@@ -124,6 +141,8 @@ export interface ISudFSTAPP {
|
|
|
124
141
|
*/
|
|
125
142
|
reloadMG(): void;
|
|
126
143
|
pushAudio?: (data: ArrayBuffer, dataLength: number) => void
|
|
144
|
+
|
|
145
|
+
getAiAgent(): ISudAiAgent
|
|
127
146
|
}
|
|
128
147
|
|
|
129
148
|
export interface ISudFSMMG {
|
|
@@ -131,7 +150,7 @@ export interface ISudFSMMG {
|
|
|
131
150
|
* 游戏日志
|
|
132
151
|
* 最低版本:v1.1.30.xx
|
|
133
152
|
*/
|
|
134
|
-
onGameLog(
|
|
153
|
+
onGameLog(...args: any): void;
|
|
135
154
|
|
|
136
155
|
/**
|
|
137
156
|
* 游戏加载进度(loadMG)
|
|
@@ -238,6 +257,9 @@ export interface ISudCfg {
|
|
|
238
257
|
|
|
239
258
|
getTouchEnable (): boolean
|
|
240
259
|
setTouchEnable(value: boolean): void
|
|
260
|
+
|
|
261
|
+
// 高级配置
|
|
262
|
+
getAdvancedConfigMap (): Map<string, any>;
|
|
241
263
|
}
|
|
242
264
|
|
|
243
265
|
export interface ISudLogger {
|
|
@@ -272,3 +294,30 @@ export class Log {
|
|
|
272
294
|
*/
|
|
273
295
|
static ASSERT = 7
|
|
274
296
|
}
|
|
297
|
+
|
|
298
|
+
export interface ISudAiAgent {
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* 传入的音频切片是从RTC获取的PCM数据
|
|
302
|
+
* PCM数据格式必须是:采样率:16000, 采样位数:16, 声道数: MONO
|
|
303
|
+
* PCM数据长度可以根据效果调整,长度大: 精确度好但延时长 长度小:延时短但牺牲精确度
|
|
304
|
+
*/
|
|
305
|
+
pushAudio(data: Buffer, dataLength: number): void;
|
|
306
|
+
|
|
307
|
+
/** 发送文本内容 */
|
|
308
|
+
sendText(text: string): void;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* 暂停语音识别,暂时不调用pushAudio了
|
|
312
|
+
* 调用之后会对末define的识别直接变为define
|
|
313
|
+
*/
|
|
314
|
+
pauseAudio(): void;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* 关闭语音识别
|
|
318
|
+
*/
|
|
319
|
+
stopAudio(): void;
|
|
320
|
+
|
|
321
|
+
/** 设置回调 */
|
|
322
|
+
setISudListenerAiAgent(listener: ISudListenerAiAgent): void;
|
|
323
|
+
}
|