omnirtc-web 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/aigc.d.ts +124 -0
- package/dist/aigc.js +6 -1
- package/dist/es-aigc.d.ts +124 -0
- package/dist/es-aigc.js +6 -1
- package/dist/es-omnirtc-web.js +2 -2
- package/dist/omni.d.ts +1543 -0
- package/dist/omnirtc-web.js +2 -2
- package/package.json +2 -1
- package/src/omni.d.ts +1 -1
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ AIGC能力是RTC能力的扩展,要正常使用AIGC能力,需要先保证RTC
|
|
|
95
95
|
## 引入AIGC模块
|
|
96
96
|
- ES Module引入
|
|
97
97
|
```javascript
|
|
98
|
-
import { Aigc } from 'omnirtc-web';
|
|
98
|
+
import { Aigc } from 'omnirtc-web/aigc';
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
## 初始化
|
|
@@ -131,7 +131,7 @@ aigc.start('voicechat', aigcConfig, robotId, otherConfig);
|
|
|
131
131
|
## 对话中更新配置
|
|
132
132
|
|
|
133
133
|
```javascript
|
|
134
|
-
import { TaskTypeEnum } from 'omnirtc-web'
|
|
134
|
+
import { TaskTypeEnum } from 'omnirtc-web/aigc'
|
|
135
135
|
// 更细提示词
|
|
136
136
|
const data = {
|
|
137
137
|
prompt: '你是一个一对一英语老师,接下来的对话使用英语回复我,并且纠正我的语法和单词错误'
|
package/dist/aigc.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
declare class Request {
|
|
4
|
+
private axios;
|
|
5
|
+
constructor(baseURL: string, appId: string);
|
|
6
|
+
get(url: string, config?: AxiosRequestConfig): Record<string, any>;
|
|
7
|
+
post(url: string, data: any, config?: AxiosRequestConfig): Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type TaskType = 'asr' | 'voicechat' | 'visionchat' | 'avatarchat';
|
|
11
|
+
interface AsrConfig {
|
|
12
|
+
vendor: number;
|
|
13
|
+
}
|
|
14
|
+
interface ChatConfig {
|
|
15
|
+
/**
|
|
16
|
+
* asr配置ID
|
|
17
|
+
*/
|
|
18
|
+
asrConfig?: number;
|
|
19
|
+
/**
|
|
20
|
+
* llm配置ID
|
|
21
|
+
*/
|
|
22
|
+
llmConfig?: number;
|
|
23
|
+
/**
|
|
24
|
+
* tts配置ID
|
|
25
|
+
*/
|
|
26
|
+
ttsConfig?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 聊天提示词
|
|
29
|
+
*/
|
|
30
|
+
prompt?: string;
|
|
31
|
+
/**
|
|
32
|
+
* 欢迎语
|
|
33
|
+
*/
|
|
34
|
+
welcome?: string;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}
|
|
37
|
+
interface AvatarConfig extends ChatConfig {
|
|
38
|
+
/**
|
|
39
|
+
* 数字人配置ID
|
|
40
|
+
*/
|
|
41
|
+
avatarConfig?: number;
|
|
42
|
+
}
|
|
43
|
+
declare enum TaskTypeEnum {
|
|
44
|
+
/**
|
|
45
|
+
* 更新系统提示词
|
|
46
|
+
*/
|
|
47
|
+
UPDATE_PROMPT = 1,
|
|
48
|
+
/**
|
|
49
|
+
* 打断AI回复
|
|
50
|
+
*/
|
|
51
|
+
BREAK_AI_RESPONSE = 2,
|
|
52
|
+
/**
|
|
53
|
+
* 播报指定内容
|
|
54
|
+
*/
|
|
55
|
+
BROADCAST_CONTENT = 3,
|
|
56
|
+
/**
|
|
57
|
+
* 指定内容调大模型
|
|
58
|
+
*/
|
|
59
|
+
SEND_CONTENT_TO_LLM = 4,
|
|
60
|
+
/**
|
|
61
|
+
* 手动提交语音内容给大模型回复(仅手动提交模式任务下有效)
|
|
62
|
+
*/
|
|
63
|
+
SUBMIT_VOICE_TO_LLM = 5,
|
|
64
|
+
/**
|
|
65
|
+
* 业务自定义信令推送到客户端,端上会收到onStreamMessage(uid, msg)回调
|
|
66
|
+
*/
|
|
67
|
+
SEND_SIGNALING_TO_CLIENT = 6
|
|
68
|
+
}
|
|
69
|
+
interface SendPrompt {
|
|
70
|
+
prompt: string;
|
|
71
|
+
}
|
|
72
|
+
interface BroadcastContent {
|
|
73
|
+
content: string;
|
|
74
|
+
}
|
|
75
|
+
interface CustomSignaling {
|
|
76
|
+
message: string;
|
|
77
|
+
}
|
|
78
|
+
declare class Aigc {
|
|
79
|
+
static BASE_URL: string;
|
|
80
|
+
static DICTIONARY: string;
|
|
81
|
+
request: Request;
|
|
82
|
+
config: Record<string, any>;
|
|
83
|
+
taskId?: string;
|
|
84
|
+
taskType?: TaskType;
|
|
85
|
+
constructor(token: string);
|
|
86
|
+
/**
|
|
87
|
+
* 查询当前应用的AIGC配置
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
query(): Record<string, any>;
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param taskType 使用的aigc类型
|
|
94
|
+
* @param config 启动任务的参数
|
|
95
|
+
* @param robotId 机器人id,纯数字字符串
|
|
96
|
+
* @param options 附带信息
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
start(taskType: 'asr', config: AsrConfig, robotId: string, options?: Record<string, any>): any;
|
|
100
|
+
start(taskType: 'voicechat' | 'visionchat', config: ChatConfig, robotId: string, options?: Record<string, any>): any;
|
|
101
|
+
start(taskType: 'avatarchat', config: AvatarConfig, robotId: string, options?: Record<string, any>): any;
|
|
102
|
+
/**
|
|
103
|
+
* 停止当前aigc任务
|
|
104
|
+
* @param options 附带信息
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
stop(options?: Record<string, any>): Record<string, any>;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* @param type 更新类型
|
|
111
|
+
* @param config
|
|
112
|
+
* @param options
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
update(type: TaskTypeEnum.UPDATE_PROMPT, config: SendPrompt, options?: Record<string, any>): any;
|
|
116
|
+
update(type: TaskTypeEnum.BREAK_AI_RESPONSE, config: null, options?: Record<string, any>): any;
|
|
117
|
+
update(type: TaskTypeEnum.BROADCAST_CONTENT, config: BroadcastContent, options?: Record<string, any>): any;
|
|
118
|
+
update(type: TaskTypeEnum.SEND_CONTENT_TO_LLM, config: SendPrompt, options?: Record<string, any>): any;
|
|
119
|
+
update(type: TaskTypeEnum.SUBMIT_VOICE_TO_LLM, config: null, options?: Record<string, any>): any;
|
|
120
|
+
update(type: TaskTypeEnum.SEND_SIGNALING_TO_CLIENT, config: CustomSignaling, options?: Record<string, any>): any;
|
|
121
|
+
generateTaskId(len?: number): string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { Aigc, AsrConfig, AvatarConfig, BroadcastContent, ChatConfig, CustomSignaling, SendPrompt, TaskType, TaskTypeEnum };
|
package/dist/aigc.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Aigc = {}));
|
|
5
5
|
}(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
9
9
|
|
|
10
10
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
return t;
|
|
29
29
|
};
|
|
30
30
|
return __assign.apply(this, arguments);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
34
|
+
var e = new Error(message);
|
|
35
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
|
|
3
|
+
declare class Request {
|
|
4
|
+
private axios;
|
|
5
|
+
constructor(baseURL: string, appId: string);
|
|
6
|
+
get(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
|
|
7
|
+
post(url: string, data: any, config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type TaskType = 'asr' | 'voicechat' | 'visionchat' | 'avatarchat';
|
|
11
|
+
interface AsrConfig {
|
|
12
|
+
vendor: number;
|
|
13
|
+
}
|
|
14
|
+
interface ChatConfig {
|
|
15
|
+
/**
|
|
16
|
+
* asr配置ID
|
|
17
|
+
*/
|
|
18
|
+
asrConfig?: number;
|
|
19
|
+
/**
|
|
20
|
+
* llm配置ID
|
|
21
|
+
*/
|
|
22
|
+
llmConfig?: number;
|
|
23
|
+
/**
|
|
24
|
+
* tts配置ID
|
|
25
|
+
*/
|
|
26
|
+
ttsConfig?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 聊天提示词
|
|
29
|
+
*/
|
|
30
|
+
prompt?: string;
|
|
31
|
+
/**
|
|
32
|
+
* 欢迎语
|
|
33
|
+
*/
|
|
34
|
+
welcome?: string;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}
|
|
37
|
+
interface AvatarConfig extends ChatConfig {
|
|
38
|
+
/**
|
|
39
|
+
* 数字人配置ID
|
|
40
|
+
*/
|
|
41
|
+
avatarConfig?: number;
|
|
42
|
+
}
|
|
43
|
+
declare enum TaskTypeEnum {
|
|
44
|
+
/**
|
|
45
|
+
* 更新系统提示词
|
|
46
|
+
*/
|
|
47
|
+
UPDATE_PROMPT = 1,
|
|
48
|
+
/**
|
|
49
|
+
* 打断AI回复
|
|
50
|
+
*/
|
|
51
|
+
BREAK_AI_RESPONSE = 2,
|
|
52
|
+
/**
|
|
53
|
+
* 播报指定内容
|
|
54
|
+
*/
|
|
55
|
+
BROADCAST_CONTENT = 3,
|
|
56
|
+
/**
|
|
57
|
+
* 指定内容调大模型
|
|
58
|
+
*/
|
|
59
|
+
SEND_CONTENT_TO_LLM = 4,
|
|
60
|
+
/**
|
|
61
|
+
* 手动提交语音内容给大模型回复(仅手动提交模式任务下有效)
|
|
62
|
+
*/
|
|
63
|
+
SUBMIT_VOICE_TO_LLM = 5,
|
|
64
|
+
/**
|
|
65
|
+
* 业务自定义信令推送到客户端,端上会收到onStreamMessage(uid, msg)回调
|
|
66
|
+
*/
|
|
67
|
+
SEND_SIGNALING_TO_CLIENT = 6
|
|
68
|
+
}
|
|
69
|
+
interface SendPrompt {
|
|
70
|
+
prompt: string;
|
|
71
|
+
}
|
|
72
|
+
interface BroadcastContent {
|
|
73
|
+
content: string;
|
|
74
|
+
}
|
|
75
|
+
interface CustomSignaling {
|
|
76
|
+
message: string;
|
|
77
|
+
}
|
|
78
|
+
declare class Aigc {
|
|
79
|
+
static BASE_URL: string;
|
|
80
|
+
static DICTIONARY: string;
|
|
81
|
+
request: Request;
|
|
82
|
+
config: Record<string, any>;
|
|
83
|
+
taskId?: string;
|
|
84
|
+
taskType?: TaskType;
|
|
85
|
+
constructor(token: string);
|
|
86
|
+
/**
|
|
87
|
+
* 查询当前应用的AIGC配置
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
query(): Promise<AxiosResponse<any, any>>;
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param taskType 使用的aigc类型
|
|
94
|
+
* @param config 启动任务的参数
|
|
95
|
+
* @param robotId 机器人id,纯数字字符串
|
|
96
|
+
* @param options 附带信息
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
start(taskType: 'asr', config: AsrConfig, robotId: string, options?: Record<string, any>): any;
|
|
100
|
+
start(taskType: 'voicechat' | 'visionchat', config: ChatConfig, robotId: string, options?: Record<string, any>): any;
|
|
101
|
+
start(taskType: 'avatarchat', config: AvatarConfig, robotId: string, options?: Record<string, any>): any;
|
|
102
|
+
/**
|
|
103
|
+
* 停止当前aigc任务
|
|
104
|
+
* @param options 附带信息
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
stop(options?: Record<string, any>): Promise<AxiosResponse<any, any>>;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* @param type 更新类型
|
|
111
|
+
* @param config
|
|
112
|
+
* @param options
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
update(type: TaskTypeEnum.UPDATE_PROMPT, config: SendPrompt, options?: Record<string, any>): any;
|
|
116
|
+
update(type: TaskTypeEnum.BREAK_AI_RESPONSE, config: null, options?: Record<string, any>): any;
|
|
117
|
+
update(type: TaskTypeEnum.BROADCAST_CONTENT, config: BroadcastContent, options?: Record<string, any>): any;
|
|
118
|
+
update(type: TaskTypeEnum.SEND_CONTENT_TO_LLM, config: SendPrompt, options?: Record<string, any>): any;
|
|
119
|
+
update(type: TaskTypeEnum.SUBMIT_VOICE_TO_LLM, config: null, options?: Record<string, any>): any;
|
|
120
|
+
update(type: TaskTypeEnum.SEND_SIGNALING_TO_CLIENT, config: CustomSignaling, options?: Record<string, any>): any;
|
|
121
|
+
generateTaskId(len?: number): string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { Aigc, AsrConfig, AvatarConfig, BroadcastContent, ChatConfig, CustomSignaling, SendPrompt, TaskType, TaskTypeEnum };
|
package/dist/es-aigc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/******************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -22,6 +22,11 @@ var __assign = function() {
|
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
24
|
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
28
|
+
var e = new Error(message);
|
|
29
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
package/dist/es-omnirtc-web.js
CHANGED
|
@@ -5432,7 +5432,7 @@ _stream.addTrack(track.track);context=getAudioContext();source=context.createMed
|
|
|
5432
5432
|
*/function getAudioBuffer(source,cacheOnlineFile){return __awaiter$1(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee228(){var arrayBuffer,cacheAudioBuffer,getFileArrayBuffer,audioBuffer;return regenerator.wrap(function _callee228$(_context243){while(1)switch(_context243.prev=_context243.next){case 0:if(!('string'==typeof source)){_context243.next=15;break;}cacheAudioBuffer=cacheMap.get(source);if(!cacheAudioBuffer){_context243.next=4;break;}return _context243.abrupt("return",cacheAudioBuffer);case 4:_context243.prev=4;_context243.next=7;return getStringArrayBuffer(source);case 7:arrayBuffer=_context243.sent;_context243.next=13;break;case 10:_context243.prev=10;_context243.t0=_context243["catch"](4);throw new CoreRTCError(CoreRTCErrorCode.CHECK_VIDEO_TRACK_ERROR,typeof _context243.t0==='string'?_context243.t0:'fetch audio file failed');case 13:_context243.next=19;break;case 15:getFileArrayBuffer=new Promise(function(resolve,reject){var fileReader=new FileReader();fileReader.addEventListener('load',function(res){if(res.target){resolve(res.target.result);}else {reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));}});fileReader.addEventListener('error',function(){reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));});fileReader.readAsArrayBuffer(source);});_context243.next=18;return getFileArrayBuffer;case 18:arrayBuffer=_context243.sent;case 19:_context243.next=21;return decodeAudioData(arrayBuffer);case 21:audioBuffer=_context243.sent;if('string'==typeof source&&cacheOnlineFile)cacheMap.set(source,audioBuffer);return _context243.abrupt("return",audioBuffer);case 24:case"end":return _context243.stop();}},_callee228,null,[[4,10]]);}));}
|
|
5433
5433
|
|
|
5434
5434
|
var StaticConfig = {
|
|
5435
|
-
agentVersion: "OmniRTC_Web_V1.5.
|
|
5435
|
+
agentVersion: "OmniRTC_Web_V1.5.1",
|
|
5436
5436
|
logVersion: 1,
|
|
5437
5437
|
serviceType: 320,
|
|
5438
5438
|
logBackendUrl: "https://rtc-logs.magic-school.com/stream.gif"
|
|
@@ -8360,7 +8360,7 @@ function log(clsName) {
|
|
|
8360
8360
|
sdk_api_name: '中间层-函数调用',
|
|
8361
8361
|
message: "\u4E2D\u95F4\u5C42-".concat(clsName, ".").concat(name),
|
|
8362
8362
|
from_encapsulation_layer: true,
|
|
8363
|
-
encapsulation_layer_built_timestamp: '2025/12/18
|
|
8363
|
+
encapsulation_layer_built_timestamp: '2025/12/18 17:49:55',
|
|
8364
8364
|
});
|
|
8365
8365
|
}
|
|
8366
8366
|
}
|