ibi-ai-talk 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibi-ai-talk",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "基于vue的智能语音交互组件",
5
5
  "main": "dist/index.umd.js",
6
6
  "scripts": {
package/src/index.vue CHANGED
@@ -22,10 +22,14 @@ export default {
22
22
  type: String,
23
23
  default: "wakeup",
24
24
  },
25
- otaUrl: {
25
+ agentId: {
26
26
  type: String,
27
27
  default: "",
28
28
  },
29
+ env: {
30
+ type: String,
31
+ default: "test",
32
+ },
29
33
  macAddress: {
30
34
  type: String,
31
35
  default: "",
@@ -33,8 +37,27 @@ export default {
33
37
  },
34
38
  async mounted() {
35
39
  localStorage.setItem("MAC", this.macAddress);
36
- localStorage.setItem("otaUrl", this.otaUrl);
37
40
  localStorage.setItem("listenMode", this.listenMode);
41
+ localStorage.setItem("agentId", this.agentId);
42
+ let envUrl = "";
43
+ if (this.env === "test") {
44
+ envUrl = "https://test-ai-talk-manage.ptdplat.com";
45
+ } else if (this.env === "prod") {
46
+ envUrl = "https://ai-talk-manage.ptdcloud.com";
47
+ }
48
+ const res = await fetch(`${envUrl}/device/addByAgent`, {
49
+ method: "POST",
50
+ headers: {
51
+ "Content-Type": "application/json",
52
+ "authorization":"Bearer " + 'z6frotkj-8vdw-moy1-vc6j-manpewkvob48'
53
+ },
54
+ body: JSON.stringify({
55
+ macAddress: this.macAddress,
56
+ agentId: this.agentId,
57
+ }),
58
+ });
59
+ console.log(res, "添加设备");
60
+ localStorage.setItem("otaUrl", `${envUrl}/xiaozhi/ota/`);
38
61
  checkOpusLoaded();
39
62
  initOpusEncoder();
40
63
  initMcpTools();