omnirtc-web 1.4.3-peiyou.2 → 1.5.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/README.md +54 -14
- package/dist/aigc.js +36 -2
- package/dist/es-aigc.js +38 -3
- package/dist/es-omnirtc-web.js +3998 -4692
- package/dist/omnirtc-web.js +4002 -4696
- package/package.json +17 -4
- package/src/omni.d.ts +9 -11
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
## 引入SDK
|
|
5
5
|
- ES Module引入
|
|
6
6
|
```javascript
|
|
7
|
-
import
|
|
7
|
+
import { getRTCInstance } from 'omnirtc-web';
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
## 加入RTC房间
|
|
@@ -88,21 +88,61 @@ import getRTCEngine from 'omnirtc-web';
|
|
|
88
88
|
}
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
#v1.0.0 - 2024.2.22
|
|
93
|
-
首次交付版本
|
|
91
|
+
# AIGC能力使用
|
|
94
92
|
|
|
95
|
-
|
|
96
|
-
修复 VolcLocalAudioTrack.setPlaybackDeivce() 问题
|
|
93
|
+
AIGC能力是RTC能力的扩展,要正常使用AIGC能力,需要先保证RTC能力正常使用
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
## 引入AIGC模块
|
|
96
|
+
- ES Module引入
|
|
97
|
+
```javascript
|
|
98
|
+
import { Aigc } from 'omnirtc-web';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 初始化
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
// 与getRTCInstance使用同一个token !important
|
|
105
|
+
const aigc = new Aigc(token);
|
|
106
|
+
```
|
|
100
107
|
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
## 查询Aigc默认配置
|
|
109
|
+
```javascript
|
|
110
|
+
const configs = aigc.query();
|
|
111
|
+
console.log('应用的默认配置:', configs)
|
|
112
|
+
```
|
|
103
113
|
|
|
104
|
-
|
|
105
|
-
修复第二次共享屏幕报错
|
|
114
|
+
## 开始Aigc
|
|
106
115
|
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
```javascript
|
|
117
|
+
const robotId = Math.random().toString().substring(2,10);
|
|
118
|
+
|
|
119
|
+
// 可以为空对象{},这样就使用后台配置的默认设置
|
|
120
|
+
const aigcConfig = {
|
|
121
|
+
prompt: '你是一个一对一数学老师,协助我完成家庭作业'
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 可以不传
|
|
125
|
+
const otherConfig = {
|
|
126
|
+
extenParams: {}
|
|
127
|
+
}
|
|
128
|
+
aigc.start('voicechat', aigcConfig, robotId, otherConfig);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 对话中更新配置
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
import { TaskTypeEnum } from 'omnirtc-web'
|
|
135
|
+
// 更细提示词
|
|
136
|
+
const data = {
|
|
137
|
+
prompt: '你是一个一对一英语老师,接下来的对话使用英语回复我,并且纠正我的语法和单词错误'
|
|
138
|
+
}
|
|
139
|
+
aigc.update(TaskTypeEnum.UPDATE_PROMPT, data)
|
|
140
|
+
|
|
141
|
+
// 更多功能可以查看TaskTypeEnum的定义
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 停止Aigc
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
aigc.stop()
|
|
148
|
+
```
|
package/dist/aigc.js
CHANGED
|
@@ -6483,7 +6483,7 @@
|
|
|
6483
6483
|
config.headers['Content-Type'] = 'application/json';
|
|
6484
6484
|
config.headers['X-Auth-Appid'] = appId;
|
|
6485
6485
|
config.headers['X-Auth-TimeStamp'] = ts;
|
|
6486
|
-
config.headers['X-Auth-Sign'] = md5(appId
|
|
6486
|
+
config.headers['X-Auth-Sign'] = md5("".concat(appId, "&").concat(ts, "60439d96cfbecc2de2872641aea204f2")).toLocaleLowerCase();
|
|
6487
6487
|
return config;
|
|
6488
6488
|
}, function (error) {
|
|
6489
6489
|
return Promise.reject(error);
|
|
@@ -6593,6 +6593,32 @@
|
|
|
6593
6593
|
var InvalidTokenError_1 = InvalidTokenError;
|
|
6594
6594
|
lib.InvalidTokenError = InvalidTokenError_1;
|
|
6595
6595
|
|
|
6596
|
+
(function (TaskTypeEnum) {
|
|
6597
|
+
/**
|
|
6598
|
+
* 更新系统提示词
|
|
6599
|
+
*/
|
|
6600
|
+
TaskTypeEnum[TaskTypeEnum["UPDATE_PROMPT"] = 1] = "UPDATE_PROMPT";
|
|
6601
|
+
/**
|
|
6602
|
+
* 打断AI回复
|
|
6603
|
+
*/
|
|
6604
|
+
TaskTypeEnum[TaskTypeEnum["BREAK_AI_RESPONSE"] = 2] = "BREAK_AI_RESPONSE";
|
|
6605
|
+
/**
|
|
6606
|
+
* 播报指定内容
|
|
6607
|
+
*/
|
|
6608
|
+
TaskTypeEnum[TaskTypeEnum["BROADCAST_CONTENT"] = 3] = "BROADCAST_CONTENT";
|
|
6609
|
+
/**
|
|
6610
|
+
* 指定内容调大模型
|
|
6611
|
+
*/
|
|
6612
|
+
TaskTypeEnum[TaskTypeEnum["SEND_CONTENT_TO_LLM"] = 4] = "SEND_CONTENT_TO_LLM";
|
|
6613
|
+
/**
|
|
6614
|
+
* 手动提交语音内容给大模型回复(仅手动提交模式任务下有效)
|
|
6615
|
+
*/
|
|
6616
|
+
TaskTypeEnum[TaskTypeEnum["SUBMIT_VOICE_TO_LLM"] = 5] = "SUBMIT_VOICE_TO_LLM";
|
|
6617
|
+
/**
|
|
6618
|
+
* 业务自定义信令推送到客户端,端上会收到onStreamMessage(uid, msg)回调
|
|
6619
|
+
*/
|
|
6620
|
+
TaskTypeEnum[TaskTypeEnum["SEND_SIGNALING_TO_CLIENT"] = 6] = "SEND_SIGNALING_TO_CLIENT";
|
|
6621
|
+
})(exports.TaskTypeEnum || (exports.TaskTypeEnum = {}));
|
|
6596
6622
|
var Aigc = /** @class */ (function () {
|
|
6597
6623
|
function Aigc(token) {
|
|
6598
6624
|
this.config = lib(token);
|
|
@@ -6601,6 +6627,10 @@
|
|
|
6601
6627
|
}
|
|
6602
6628
|
this.request = new Request$1(Aigc.BASE_URL, this.config.engineConfig.adaptAppId);
|
|
6603
6629
|
}
|
|
6630
|
+
/**
|
|
6631
|
+
* 查询当前应用的AIGC配置
|
|
6632
|
+
* @returns
|
|
6633
|
+
*/
|
|
6604
6634
|
Aigc.prototype.query = function () {
|
|
6605
6635
|
return this.request.get('/api/aigc/config?appId=' + this.config.engineConfig.adaptAppId);
|
|
6606
6636
|
};
|
|
@@ -6619,6 +6649,11 @@
|
|
|
6619
6649
|
}
|
|
6620
6650
|
});
|
|
6621
6651
|
};
|
|
6652
|
+
/**
|
|
6653
|
+
* 停止当前aigc任务
|
|
6654
|
+
* @param options 附带信息
|
|
6655
|
+
* @returns
|
|
6656
|
+
*/
|
|
6622
6657
|
Aigc.prototype.stop = function (options) {
|
|
6623
6658
|
var ts = Date.now().toString();
|
|
6624
6659
|
var data = __assign({ appId: this.config.engineConfig.adaptAppId, taskId: this.taskId, taskType: this.taskType, ts: ts }, options);
|
|
@@ -6631,7 +6666,6 @@
|
|
|
6631
6666
|
});
|
|
6632
6667
|
};
|
|
6633
6668
|
Aigc.prototype.update = function (type, config, options) {
|
|
6634
|
-
if (config === void 0) { config = {}; }
|
|
6635
6669
|
var data = __assign({ appId: this.config.engineConfig.adaptAppId, taskId: this.taskId, type: type, data: config }, options);
|
|
6636
6670
|
return this.request.post('/api/aigc/update', data);
|
|
6637
6671
|
};
|
package/dist/es-aigc.js
CHANGED
|
@@ -6477,7 +6477,7 @@ var Request$1 = /** @class */ (function () {
|
|
|
6477
6477
|
config.headers['Content-Type'] = 'application/json';
|
|
6478
6478
|
config.headers['X-Auth-Appid'] = appId;
|
|
6479
6479
|
config.headers['X-Auth-TimeStamp'] = ts;
|
|
6480
|
-
config.headers['X-Auth-Sign'] = md5(appId
|
|
6480
|
+
config.headers['X-Auth-Sign'] = md5("".concat(appId, "&").concat(ts, "60439d96cfbecc2de2872641aea204f2")).toLocaleLowerCase();
|
|
6481
6481
|
return config;
|
|
6482
6482
|
}, function (error) {
|
|
6483
6483
|
return Promise.reject(error);
|
|
@@ -6587,6 +6587,33 @@ var lib = function lib(token, options) {
|
|
|
6587
6587
|
var InvalidTokenError_1 = InvalidTokenError;
|
|
6588
6588
|
lib.InvalidTokenError = InvalidTokenError_1;
|
|
6589
6589
|
|
|
6590
|
+
var TaskTypeEnum;
|
|
6591
|
+
(function (TaskTypeEnum) {
|
|
6592
|
+
/**
|
|
6593
|
+
* 更新系统提示词
|
|
6594
|
+
*/
|
|
6595
|
+
TaskTypeEnum[TaskTypeEnum["UPDATE_PROMPT"] = 1] = "UPDATE_PROMPT";
|
|
6596
|
+
/**
|
|
6597
|
+
* 打断AI回复
|
|
6598
|
+
*/
|
|
6599
|
+
TaskTypeEnum[TaskTypeEnum["BREAK_AI_RESPONSE"] = 2] = "BREAK_AI_RESPONSE";
|
|
6600
|
+
/**
|
|
6601
|
+
* 播报指定内容
|
|
6602
|
+
*/
|
|
6603
|
+
TaskTypeEnum[TaskTypeEnum["BROADCAST_CONTENT"] = 3] = "BROADCAST_CONTENT";
|
|
6604
|
+
/**
|
|
6605
|
+
* 指定内容调大模型
|
|
6606
|
+
*/
|
|
6607
|
+
TaskTypeEnum[TaskTypeEnum["SEND_CONTENT_TO_LLM"] = 4] = "SEND_CONTENT_TO_LLM";
|
|
6608
|
+
/**
|
|
6609
|
+
* 手动提交语音内容给大模型回复(仅手动提交模式任务下有效)
|
|
6610
|
+
*/
|
|
6611
|
+
TaskTypeEnum[TaskTypeEnum["SUBMIT_VOICE_TO_LLM"] = 5] = "SUBMIT_VOICE_TO_LLM";
|
|
6612
|
+
/**
|
|
6613
|
+
* 业务自定义信令推送到客户端,端上会收到onStreamMessage(uid, msg)回调
|
|
6614
|
+
*/
|
|
6615
|
+
TaskTypeEnum[TaskTypeEnum["SEND_SIGNALING_TO_CLIENT"] = 6] = "SEND_SIGNALING_TO_CLIENT";
|
|
6616
|
+
})(TaskTypeEnum || (TaskTypeEnum = {}));
|
|
6590
6617
|
var Aigc = /** @class */ (function () {
|
|
6591
6618
|
function Aigc(token) {
|
|
6592
6619
|
this.config = lib(token);
|
|
@@ -6595,6 +6622,10 @@ var Aigc = /** @class */ (function () {
|
|
|
6595
6622
|
}
|
|
6596
6623
|
this.request = new Request$1(Aigc.BASE_URL, this.config.engineConfig.adaptAppId);
|
|
6597
6624
|
}
|
|
6625
|
+
/**
|
|
6626
|
+
* 查询当前应用的AIGC配置
|
|
6627
|
+
* @returns
|
|
6628
|
+
*/
|
|
6598
6629
|
Aigc.prototype.query = function () {
|
|
6599
6630
|
return this.request.get('/api/aigc/config?appId=' + this.config.engineConfig.adaptAppId);
|
|
6600
6631
|
};
|
|
@@ -6613,6 +6644,11 @@ var Aigc = /** @class */ (function () {
|
|
|
6613
6644
|
}
|
|
6614
6645
|
});
|
|
6615
6646
|
};
|
|
6647
|
+
/**
|
|
6648
|
+
* 停止当前aigc任务
|
|
6649
|
+
* @param options 附带信息
|
|
6650
|
+
* @returns
|
|
6651
|
+
*/
|
|
6616
6652
|
Aigc.prototype.stop = function (options) {
|
|
6617
6653
|
var ts = Date.now().toString();
|
|
6618
6654
|
var data = __assign({ appId: this.config.engineConfig.adaptAppId, taskId: this.taskId, taskType: this.taskType, ts: ts }, options);
|
|
@@ -6625,7 +6661,6 @@ var Aigc = /** @class */ (function () {
|
|
|
6625
6661
|
});
|
|
6626
6662
|
};
|
|
6627
6663
|
Aigc.prototype.update = function (type, config, options) {
|
|
6628
|
-
if (config === void 0) { config = {}; }
|
|
6629
6664
|
var data = __assign({ appId: this.config.engineConfig.adaptAppId, taskId: this.taskId, type: type, data: config }, options);
|
|
6630
6665
|
return this.request.post('/api/aigc/update', data);
|
|
6631
6666
|
};
|
|
@@ -6642,4 +6677,4 @@ var Aigc = /** @class */ (function () {
|
|
|
6642
6677
|
return Aigc;
|
|
6643
6678
|
}());
|
|
6644
6679
|
|
|
6645
|
-
export { Aigc };
|
|
6680
|
+
export { Aigc, TaskTypeEnum };
|