@d-id/client-sdk 1.0.19-beta.46 → 1.0.19-beta.48
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/dist/index.js +540 -369
- package/dist/index.umd.cjs +701 -1
- package/dist/src/types/entities/agents/agent.d.ts +1 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,526 +1,697 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const didApiUrl = "https://api-dev.d-id.com";
|
|
2
|
+
const didSocketApiUrl = "wss://notifications-dev.d-id.com";
|
|
3
|
+
function getExternalId() {
|
|
4
|
+
let key = window.localStorage.getItem("did_external_key_id");
|
|
5
|
+
if (!key) {
|
|
6
|
+
key = Math.random().toString(16).slice(2);
|
|
7
|
+
window.localStorage.setItem("did_external_key_id", key);
|
|
8
|
+
}
|
|
9
|
+
return key;
|
|
5
10
|
}
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
return `Bearer ${
|
|
9
|
-
if (
|
|
10
|
-
return `Basic ${btoa(`${
|
|
11
|
-
if (
|
|
12
|
-
return `Client-Key ${
|
|
13
|
-
|
|
11
|
+
function getAuthHeader(auth) {
|
|
12
|
+
if (auth.type === "bearer") {
|
|
13
|
+
return `Bearer ${auth.token}`;
|
|
14
|
+
} else if (auth.type === "basic") {
|
|
15
|
+
return `Basic ${btoa(`${auth.username}:${auth.password}`)}`;
|
|
16
|
+
} else if (auth.type === "key") {
|
|
17
|
+
return `Client-Key ${auth.clientKey}.${getExternalId()}`;
|
|
18
|
+
} else {
|
|
19
|
+
throw new Error(`Unknown auth type: ${auth}`);
|
|
20
|
+
}
|
|
14
21
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
...
|
|
22
|
+
function createClient(auth, host = didApiUrl) {
|
|
23
|
+
const client = async (url, options) => {
|
|
24
|
+
const request = await fetch(host + ((url == null ? void 0 : url.startsWith("/")) ? url : `/${url}`), {
|
|
25
|
+
...options,
|
|
19
26
|
headers: {
|
|
20
|
-
...
|
|
21
|
-
Authorization:
|
|
27
|
+
...options == null ? void 0 : options.headers,
|
|
28
|
+
Authorization: getAuthHeader(auth),
|
|
22
29
|
"Content-Type": "application/json"
|
|
23
30
|
}
|
|
24
31
|
});
|
|
25
|
-
if (!
|
|
26
|
-
let
|
|
27
|
-
throw new Error(
|
|
32
|
+
if (!request.ok) {
|
|
33
|
+
let error = await request.text().catch(() => "Failed to fetch");
|
|
34
|
+
throw new Error(error);
|
|
28
35
|
}
|
|
29
|
-
return
|
|
36
|
+
return request.json();
|
|
30
37
|
};
|
|
31
38
|
return {
|
|
32
|
-
get(
|
|
33
|
-
return
|
|
34
|
-
...
|
|
39
|
+
get(url, options) {
|
|
40
|
+
return client(url, {
|
|
41
|
+
...options,
|
|
35
42
|
method: "GET"
|
|
36
43
|
});
|
|
37
44
|
},
|
|
38
|
-
post(
|
|
39
|
-
return
|
|
40
|
-
...
|
|
41
|
-
body: JSON.stringify(
|
|
45
|
+
post(url, body, options) {
|
|
46
|
+
return client(url, {
|
|
47
|
+
...options,
|
|
48
|
+
body: JSON.stringify(body),
|
|
42
49
|
method: "POST"
|
|
43
50
|
});
|
|
44
51
|
},
|
|
45
|
-
delete(
|
|
46
|
-
return
|
|
47
|
-
...
|
|
48
|
-
body: JSON.stringify(
|
|
52
|
+
delete(url, body, options) {
|
|
53
|
+
return client(url, {
|
|
54
|
+
...options,
|
|
55
|
+
body: JSON.stringify(body),
|
|
49
56
|
method: "DELETE"
|
|
50
57
|
});
|
|
51
58
|
},
|
|
52
|
-
patch(
|
|
53
|
-
return
|
|
54
|
-
...
|
|
55
|
-
body: JSON.stringify(
|
|
59
|
+
patch(url, body, options) {
|
|
60
|
+
return client(url, {
|
|
61
|
+
...options,
|
|
62
|
+
body: JSON.stringify(body),
|
|
56
63
|
method: "PATCH"
|
|
57
64
|
});
|
|
58
65
|
}
|
|
59
66
|
};
|
|
60
67
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
68
|
+
function createAgentsApi(auth, host = didApiUrl) {
|
|
69
|
+
const client = createClient(auth, `${host}/agents`);
|
|
63
70
|
return {
|
|
64
|
-
create(
|
|
65
|
-
return
|
|
71
|
+
create(payload, options) {
|
|
72
|
+
return client.post(`/`, payload, options);
|
|
66
73
|
},
|
|
67
|
-
getAgents(
|
|
68
|
-
return
|
|
74
|
+
getAgents(tag, options) {
|
|
75
|
+
return client.get(`/${tag ? `?tag=${tag}` : ""}`, options).then((agents) => agents ?? []);
|
|
69
76
|
},
|
|
70
|
-
getById(
|
|
71
|
-
return
|
|
77
|
+
getById(id, options) {
|
|
78
|
+
return client.get(`/${id}`, options);
|
|
72
79
|
},
|
|
73
|
-
delete(
|
|
74
|
-
return
|
|
80
|
+
delete(id, options) {
|
|
81
|
+
return client.delete(`/${id}`, void 0, options);
|
|
75
82
|
},
|
|
76
|
-
update(
|
|
77
|
-
return
|
|
83
|
+
update(id, payload, options) {
|
|
84
|
+
return client.patch(`/${id}`, payload, options);
|
|
78
85
|
},
|
|
79
|
-
newChat(
|
|
80
|
-
return
|
|
86
|
+
newChat(agentId, options) {
|
|
87
|
+
return client.post(`/${agentId}/chat`, void 0, options);
|
|
81
88
|
},
|
|
82
|
-
chat(
|
|
83
|
-
return
|
|
89
|
+
chat(agentId, chatId, payload, options) {
|
|
90
|
+
return client.post(`/${agentId}/chat/${chatId}`, payload, options);
|
|
84
91
|
}
|
|
85
92
|
};
|
|
86
93
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
94
|
+
function createKnowledgeApi(auth, host = didApiUrl) {
|
|
95
|
+
const client = createClient(auth, `${host}/knowledge`);
|
|
89
96
|
return {
|
|
90
|
-
createKnowledge(
|
|
91
|
-
return
|
|
97
|
+
createKnowledge(payload, options) {
|
|
98
|
+
return client.post(`/`, payload, options);
|
|
92
99
|
},
|
|
93
|
-
getKnowledgeBase(
|
|
94
|
-
return
|
|
100
|
+
getKnowledgeBase(options) {
|
|
101
|
+
return client.get(`/`, options);
|
|
95
102
|
},
|
|
96
|
-
getKnowledge(
|
|
97
|
-
return
|
|
103
|
+
getKnowledge(knowledgeId, options) {
|
|
104
|
+
return client.get(`/${knowledgeId}`, options);
|
|
98
105
|
},
|
|
99
|
-
deleteKnowledge(
|
|
100
|
-
return
|
|
106
|
+
deleteKnowledge(knowledgeId, options) {
|
|
107
|
+
return client.delete(`/${knowledgeId}`, void 0, options);
|
|
101
108
|
},
|
|
102
|
-
createDocument(
|
|
103
|
-
return
|
|
109
|
+
createDocument(knowledgeId, payload, options) {
|
|
110
|
+
return client.post(`/${knowledgeId}/documents`, payload, options);
|
|
104
111
|
},
|
|
105
|
-
deleteDocument(
|
|
106
|
-
return
|
|
112
|
+
deleteDocument(knowledgeId, documentId, options) {
|
|
113
|
+
return client.delete(`/${knowledgeId}/documents/${documentId}`, void 0, options);
|
|
107
114
|
},
|
|
108
|
-
getDocuments(
|
|
109
|
-
return
|
|
115
|
+
getDocuments(knowledgeId, options) {
|
|
116
|
+
return client.get(`/${knowledgeId}/documents`, options);
|
|
110
117
|
},
|
|
111
|
-
getDocument(
|
|
112
|
-
return
|
|
118
|
+
getDocument(knowledgeId, documentId, options) {
|
|
119
|
+
return client.get(`/${knowledgeId}/documents/${documentId}`, options);
|
|
113
120
|
},
|
|
114
|
-
getRecords(
|
|
115
|
-
return
|
|
121
|
+
getRecords(knowledgeId, documentId, options) {
|
|
122
|
+
return client.get(`/${knowledgeId}/documents/${documentId}/records`, options);
|
|
116
123
|
},
|
|
117
|
-
query(
|
|
118
|
-
return
|
|
119
|
-
query
|
|
120
|
-
},
|
|
124
|
+
query(knowledgeId, query, options) {
|
|
125
|
+
return client.post(`/${knowledgeId}/query`, {
|
|
126
|
+
query
|
|
127
|
+
}, options);
|
|
121
128
|
}
|
|
122
129
|
};
|
|
123
130
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
131
|
+
function createRatingsApi(auth, host = didApiUrl) {
|
|
132
|
+
const client = createClient(auth, `${host}/chats/ratings`);
|
|
126
133
|
return {
|
|
127
|
-
create(
|
|
128
|
-
return
|
|
134
|
+
create(payload, options) {
|
|
135
|
+
return client.post(`/`, payload, options);
|
|
129
136
|
},
|
|
130
|
-
getByKnowledge(
|
|
131
|
-
return
|
|
137
|
+
getByKnowledge(knowledgeId, options) {
|
|
138
|
+
return client.get(`/${knowledgeId}`, options).then((ratings) => ratings ?? []);
|
|
132
139
|
},
|
|
133
|
-
update(
|
|
134
|
-
return
|
|
140
|
+
update(id, payload, options) {
|
|
141
|
+
return client.patch(`/${id}`, payload, options);
|
|
135
142
|
},
|
|
136
|
-
delete(
|
|
137
|
-
return
|
|
143
|
+
delete(id, options) {
|
|
144
|
+
return client.delete(`/${id}`, options);
|
|
138
145
|
}
|
|
139
146
|
};
|
|
140
147
|
}
|
|
141
|
-
const
|
|
142
|
-
function
|
|
143
|
-
return new Promise((
|
|
148
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
149
|
+
function connect(options) {
|
|
150
|
+
return new Promise((resolve, reject) => {
|
|
144
151
|
const {
|
|
145
|
-
callbacks
|
|
146
|
-
host
|
|
147
|
-
auth
|
|
148
|
-
} =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
callbacks,
|
|
153
|
+
host,
|
|
154
|
+
auth
|
|
155
|
+
} = options;
|
|
156
|
+
const {
|
|
157
|
+
onMessage = null,
|
|
158
|
+
onOpen = null,
|
|
159
|
+
onClose = null,
|
|
160
|
+
onError = null
|
|
161
|
+
} = callbacks || {};
|
|
162
|
+
const socket = new WebSocket(`${host}?authorization=${getAuthHeader(auth)}`);
|
|
163
|
+
socket.onmessage = onMessage;
|
|
164
|
+
socket.onclose = onClose;
|
|
165
|
+
socket.onerror = (e) => {
|
|
166
|
+
console.error(e);
|
|
167
|
+
onError == null ? void 0 : onError(e);
|
|
168
|
+
reject(e);
|
|
169
|
+
};
|
|
170
|
+
socket.onopen = (e) => {
|
|
171
|
+
onOpen == null ? void 0 : onOpen(e);
|
|
172
|
+
resolve(socket);
|
|
158
173
|
};
|
|
159
174
|
});
|
|
160
175
|
}
|
|
161
|
-
async function
|
|
176
|
+
async function connectWithRetries(options) {
|
|
162
177
|
const {
|
|
163
|
-
retries
|
|
164
|
-
} =
|
|
165
|
-
let
|
|
166
|
-
for (let
|
|
178
|
+
retries = 1
|
|
179
|
+
} = options;
|
|
180
|
+
let socket = null;
|
|
181
|
+
for (let attempt = 0; (socket == null ? void 0 : socket.readyState) !== WebSocket.OPEN; attempt++) {
|
|
167
182
|
try {
|
|
168
|
-
|
|
169
|
-
} catch (
|
|
170
|
-
if (
|
|
171
|
-
throw
|
|
172
|
-
|
|
183
|
+
socket = await connect(options);
|
|
184
|
+
} catch (e) {
|
|
185
|
+
if (attempt === retries) {
|
|
186
|
+
throw e;
|
|
187
|
+
}
|
|
188
|
+
await sleep(attempt * 500);
|
|
173
189
|
}
|
|
174
|
-
|
|
190
|
+
}
|
|
191
|
+
return socket;
|
|
175
192
|
}
|
|
176
|
-
async function
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
193
|
+
async function SocketManager(auth, host, onMessage) {
|
|
194
|
+
const messageCallbacks = onMessage ? [onMessage] : [];
|
|
195
|
+
const socket = await connectWithRetries({
|
|
196
|
+
auth,
|
|
197
|
+
host,
|
|
180
198
|
callbacks: {
|
|
181
|
-
onMessage: (
|
|
182
|
-
const
|
|
183
|
-
|
|
199
|
+
onMessage: (event) => {
|
|
200
|
+
const parsedData = JSON.parse(event.data);
|
|
201
|
+
messageCallbacks.forEach((callback) => callback(parsedData.event, parsedData));
|
|
184
202
|
}
|
|
185
203
|
}
|
|
186
204
|
});
|
|
187
205
|
return {
|
|
188
|
-
socket
|
|
189
|
-
terminate: () =>
|
|
190
|
-
subscribeToEvents: (
|
|
206
|
+
socket,
|
|
207
|
+
terminate: () => socket.close(),
|
|
208
|
+
subscribeToEvents: (callback) => messageCallbacks.push(callback)
|
|
191
209
|
};
|
|
192
210
|
}
|
|
193
|
-
var
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
211
|
+
var Providers = /* @__PURE__ */ ((Providers2) => {
|
|
212
|
+
Providers2["Amazon"] = "amazon";
|
|
213
|
+
Providers2["Microsoft"] = "microsoft";
|
|
214
|
+
Providers2["Afflorithmics"] = "afflorithmics";
|
|
215
|
+
Providers2["Elevenlabs"] = "elevenlabs";
|
|
216
|
+
return Providers2;
|
|
217
|
+
})(Providers || {});
|
|
218
|
+
var VoiceAccess = /* @__PURE__ */ ((VoiceAccess2) => {
|
|
219
|
+
VoiceAccess2["Public"] = "public";
|
|
220
|
+
VoiceAccess2["Premium"] = "premium";
|
|
221
|
+
VoiceAccess2["Private"] = "private";
|
|
222
|
+
return VoiceAccess2;
|
|
223
|
+
})(VoiceAccess || {});
|
|
224
|
+
var StreamingState = /* @__PURE__ */ ((StreamingState2) => {
|
|
225
|
+
StreamingState2["Start"] = "START";
|
|
226
|
+
StreamingState2["Stop"] = "STOP";
|
|
227
|
+
return StreamingState2;
|
|
228
|
+
})(StreamingState || {});
|
|
229
|
+
var StreamEvents = /* @__PURE__ */ ((StreamEvents2) => {
|
|
230
|
+
StreamEvents2["ChatAnswer"] = "chat/answer";
|
|
231
|
+
StreamEvents2["ChatPartial"] = "chat/partial";
|
|
232
|
+
StreamEvents2["StreamDone"] = "stream/done";
|
|
233
|
+
StreamEvents2["StreamStarted"] = "stream/started";
|
|
234
|
+
StreamEvents2["StreamFailed"] = "stream/error";
|
|
235
|
+
return StreamEvents2;
|
|
236
|
+
})(StreamEvents || {});
|
|
237
|
+
var RateState = /* @__PURE__ */ ((RateState2) => {
|
|
238
|
+
RateState2["Unrated"] = "Unrated";
|
|
239
|
+
RateState2["Positive"] = "Positive";
|
|
240
|
+
RateState2["Negative"] = "Negative";
|
|
241
|
+
return RateState2;
|
|
242
|
+
})(RateState || {});
|
|
243
|
+
var ChatMode = /* @__PURE__ */ ((ChatMode2) => {
|
|
244
|
+
ChatMode2["Functional"] = "Functional";
|
|
245
|
+
ChatMode2["TextOnly"] = "TextOnly";
|
|
246
|
+
ChatMode2["Maintenance"] = "Maintenance";
|
|
247
|
+
return ChatMode2;
|
|
248
|
+
})(ChatMode || {});
|
|
249
|
+
var ChatProgress = /* @__PURE__ */ ((ChatProgress2) => {
|
|
250
|
+
ChatProgress2["Embed"] = "embed";
|
|
251
|
+
ChatProgress2["Query"] = "query";
|
|
252
|
+
ChatProgress2["Partial"] = "partial";
|
|
253
|
+
ChatProgress2["Answer"] = "answer";
|
|
254
|
+
ChatProgress2["Complete"] = "done";
|
|
255
|
+
return ChatProgress2;
|
|
256
|
+
})(ChatProgress || {});
|
|
257
|
+
var Subject = /* @__PURE__ */ ((Subject2) => {
|
|
258
|
+
Subject2["KnowledgeProcessing"] = "knowledge/processing";
|
|
259
|
+
Subject2["KnowledgeIndexing"] = "knowledge/indexing";
|
|
260
|
+
Subject2["KnowledgeFailed"] = "knowledge/error";
|
|
261
|
+
Subject2["KnowledgeDone"] = "knowledge/done";
|
|
262
|
+
return Subject2;
|
|
263
|
+
})(Subject || {});
|
|
264
|
+
var KnowledgeType = /* @__PURE__ */ ((KnowledgeType2) => {
|
|
265
|
+
KnowledgeType2["Knowledge"] = "knowledge";
|
|
266
|
+
KnowledgeType2["Document"] = "document";
|
|
267
|
+
KnowledgeType2["Record"] = "record";
|
|
268
|
+
return KnowledgeType2;
|
|
269
|
+
})(KnowledgeType || {});
|
|
270
|
+
var DocumentType = /* @__PURE__ */ ((DocumentType2) => {
|
|
271
|
+
DocumentType2["Pdf"] = "pdf";
|
|
272
|
+
DocumentType2["Text"] = "text";
|
|
273
|
+
DocumentType2["Html"] = "html";
|
|
274
|
+
DocumentType2["Word"] = "word";
|
|
275
|
+
DocumentType2["Json"] = "json";
|
|
276
|
+
DocumentType2["Markdown"] = "markdown";
|
|
277
|
+
DocumentType2["Csv"] = "csv";
|
|
278
|
+
DocumentType2["Excel"] = "excel";
|
|
279
|
+
DocumentType2["Powerpoint"] = "powerpoint";
|
|
280
|
+
DocumentType2["Archive"] = "archive";
|
|
281
|
+
DocumentType2["Image"] = "image";
|
|
282
|
+
DocumentType2["Audio"] = "audio";
|
|
283
|
+
DocumentType2["Video"] = "video";
|
|
284
|
+
return DocumentType2;
|
|
285
|
+
})(DocumentType || {});
|
|
286
|
+
var VideoType = /* @__PURE__ */ ((VideoType2) => {
|
|
287
|
+
VideoType2["Clip"] = "clip";
|
|
288
|
+
VideoType2["Talk"] = "talk";
|
|
289
|
+
return VideoType2;
|
|
290
|
+
})(VideoType || {});
|
|
291
|
+
function getAgentStreamArgs(agent) {
|
|
292
|
+
if (agent.presenter.type === VideoType.Clip) {
|
|
293
|
+
return {
|
|
294
|
+
videoType: VideoType.Clip,
|
|
295
|
+
driver_id: agent.presenter.driver_id,
|
|
296
|
+
presenter_id: agent.presenter.presenter_id
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
videoType: VideoType.Talk,
|
|
301
|
+
source_url: agent.presenter.source_url
|
|
202
302
|
};
|
|
203
303
|
}
|
|
204
|
-
function
|
|
205
|
-
return new Promise(async (
|
|
206
|
-
const
|
|
207
|
-
...
|
|
304
|
+
function initializeStreamAndChat(agent, options, agentsApi, chat) {
|
|
305
|
+
return new Promise(async (resolve, reject) => {
|
|
306
|
+
const streamingManager = await createStreamingManager(getAgentStreamArgs(agent), {
|
|
307
|
+
...options,
|
|
208
308
|
callbacks: {
|
|
209
|
-
...
|
|
210
|
-
onConnectionStateChange: async (
|
|
211
|
-
var
|
|
212
|
-
if (
|
|
309
|
+
...options.callbacks,
|
|
310
|
+
onConnectionStateChange: async (state) => {
|
|
311
|
+
var _a, _b;
|
|
312
|
+
if (state === "connected") {
|
|
213
313
|
try {
|
|
214
|
-
|
|
215
|
-
chat
|
|
216
|
-
|
|
314
|
+
if (!chat) {
|
|
315
|
+
chat = await agentsApi.newChat(agent.id);
|
|
316
|
+
}
|
|
317
|
+
resolve({
|
|
318
|
+
chat,
|
|
319
|
+
streamingManager
|
|
217
320
|
});
|
|
218
|
-
} catch (
|
|
219
|
-
console.error(
|
|
321
|
+
} catch (error) {
|
|
322
|
+
console.error(error);
|
|
323
|
+
reject(new Error("Cannot create new chat"));
|
|
220
324
|
}
|
|
221
|
-
else
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// TODO remove when webscoket will return partial
|
|
226
|
-
onMessage: (u, c) => {
|
|
227
|
-
var m, d;
|
|
228
|
-
u === y.ChatAnswer && (console.log("ChatAnswer", u, c), (d = (m = a.callbacks).onChatEvents) == null || d.call(m, P.Answer, {
|
|
229
|
-
content: c,
|
|
230
|
-
event: P.Answer
|
|
231
|
-
}));
|
|
325
|
+
} else if (state === "failed") {
|
|
326
|
+
reject(new Error("Cannot create connection"));
|
|
327
|
+
}
|
|
328
|
+
(_b = (_a = options.callbacks).onConnectionStateChange) == null ? void 0 : _b.call(_a, state);
|
|
232
329
|
}
|
|
233
330
|
}
|
|
234
331
|
});
|
|
235
332
|
});
|
|
236
333
|
}
|
|
237
|
-
function
|
|
238
|
-
|
|
334
|
+
function getAgent(agentId, auth, baseURL) {
|
|
335
|
+
const url = baseURL || didApiUrl;
|
|
336
|
+
const agentsApi = createAgentsApi(auth, url);
|
|
337
|
+
return agentsApi.getById(agentId);
|
|
239
338
|
}
|
|
240
|
-
async function
|
|
241
|
-
var
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
const
|
|
339
|
+
async function createAgentManager(agent, options) {
|
|
340
|
+
var _a, _b;
|
|
341
|
+
const baseURL = options.baseURL || didApiUrl;
|
|
342
|
+
const wsURL = options.wsURL || didSocketApiUrl;
|
|
343
|
+
const abortController = new AbortController();
|
|
344
|
+
const agentsApi = createAgentsApi(options.auth, baseURL);
|
|
345
|
+
const ratingsAPI = createRatingsApi(options.auth, baseURL);
|
|
346
|
+
const knowledgeApi = createKnowledgeApi(options.auth, baseURL);
|
|
347
|
+
const agentInstance = typeof agent === "string" ? await agentsApi.getById(agent) : agent;
|
|
348
|
+
(_b = (_a = options.callbacks) == null ? void 0 : _a.onAgentReady) == null ? void 0 : _b.call(_a, agentInstance);
|
|
349
|
+
const socketManager = await SocketManager(options.auth, wsURL, options.callbacks.onChatEvents);
|
|
245
350
|
let {
|
|
246
|
-
chat
|
|
247
|
-
streamingManager
|
|
248
|
-
} = await
|
|
351
|
+
chat,
|
|
352
|
+
streamingManager
|
|
353
|
+
} = await initializeStreamAndChat(agentInstance, options, agentsApi);
|
|
249
354
|
return {
|
|
250
|
-
agent:
|
|
251
|
-
chatId:
|
|
355
|
+
agent: agentInstance,
|
|
356
|
+
chatId: chat.id,
|
|
252
357
|
async reconnectToChat() {
|
|
253
358
|
const {
|
|
254
|
-
streamingManager:
|
|
255
|
-
} = await
|
|
256
|
-
|
|
359
|
+
streamingManager: newStreamingManager
|
|
360
|
+
} = await initializeStreamAndChat(agentInstance, options, agentsApi, chat);
|
|
361
|
+
streamingManager = newStreamingManager;
|
|
257
362
|
},
|
|
258
363
|
terminate() {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
364
|
+
abortController.abort();
|
|
365
|
+
socketManager.terminate();
|
|
366
|
+
return streamingManager.terminate();
|
|
367
|
+
},
|
|
368
|
+
chat(messages) {
|
|
369
|
+
return agentsApi.chat(agentInstance.id, chat.id, {
|
|
370
|
+
sessionId: streamingManager.sessionId,
|
|
371
|
+
streamId: streamingManager.streamId,
|
|
372
|
+
messages
|
|
266
373
|
}, {
|
|
267
|
-
signal:
|
|
374
|
+
signal: abortController.signal
|
|
268
375
|
});
|
|
269
376
|
},
|
|
270
|
-
rate(
|
|
271
|
-
|
|
377
|
+
rate(payload, id) {
|
|
378
|
+
if (id) {
|
|
379
|
+
return ratingsAPI.update(id, payload);
|
|
380
|
+
}
|
|
381
|
+
return ratingsAPI.create(payload);
|
|
272
382
|
},
|
|
273
|
-
deleteRate(
|
|
274
|
-
return
|
|
383
|
+
deleteRate(id) {
|
|
384
|
+
return ratingsAPI.delete(id);
|
|
275
385
|
},
|
|
276
|
-
speak(
|
|
277
|
-
function
|
|
278
|
-
if (
|
|
386
|
+
speak(payload) {
|
|
387
|
+
function getScript() {
|
|
388
|
+
if (payload.type === "text") {
|
|
279
389
|
return {
|
|
280
390
|
type: "text",
|
|
281
|
-
provider:
|
|
282
|
-
input:
|
|
283
|
-
ssml:
|
|
391
|
+
provider: payload.provider,
|
|
392
|
+
input: payload.input,
|
|
393
|
+
ssml: payload.ssml || false
|
|
284
394
|
};
|
|
285
|
-
if (
|
|
395
|
+
} else if (payload.type === "audio") {
|
|
286
396
|
return {
|
|
287
397
|
type: "audio",
|
|
288
|
-
audio_url:
|
|
398
|
+
audio_url: payload.audio_url
|
|
289
399
|
};
|
|
400
|
+
}
|
|
290
401
|
throw new Error("Invalid payload");
|
|
291
402
|
}
|
|
292
|
-
return
|
|
293
|
-
script:
|
|
403
|
+
return streamingManager.speak({
|
|
404
|
+
script: getScript()
|
|
294
405
|
});
|
|
295
406
|
},
|
|
296
407
|
async getStarterMessages() {
|
|
297
|
-
var
|
|
298
|
-
|
|
408
|
+
var _a2;
|
|
409
|
+
if (!((_a2 = agentInstance.knowledge) == null ? void 0 : _a2.id)) {
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
return knowledgeApi.getKnowledge(agentInstance.knowledge.id).then((knowledge) => (knowledge == null ? void 0 : knowledge.starter_message) || []);
|
|
299
413
|
}
|
|
300
414
|
};
|
|
301
415
|
}
|
|
302
|
-
function
|
|
303
|
-
const
|
|
416
|
+
function createApi$1(auth, host) {
|
|
417
|
+
const client = createClient(auth, host);
|
|
304
418
|
return {
|
|
305
|
-
createStream(
|
|
306
|
-
return
|
|
307
|
-
driver_id:
|
|
308
|
-
presenter_id:
|
|
309
|
-
compatibility_mode:
|
|
419
|
+
createStream(options) {
|
|
420
|
+
return client.post("/clips/streams", {
|
|
421
|
+
driver_id: options.driver_id,
|
|
422
|
+
presenter_id: options.presenter_id,
|
|
423
|
+
compatibility_mode: options.compatibility_mode
|
|
310
424
|
});
|
|
311
425
|
},
|
|
312
|
-
startConnection(
|
|
313
|
-
return
|
|
314
|
-
session_id:
|
|
315
|
-
answer
|
|
426
|
+
startConnection(streamId, answer, sessionId) {
|
|
427
|
+
return client.post(`/clips/streams/${streamId}/sdp`, {
|
|
428
|
+
session_id: sessionId,
|
|
429
|
+
answer
|
|
316
430
|
});
|
|
317
431
|
},
|
|
318
|
-
addIceCandidate(
|
|
319
|
-
return
|
|
320
|
-
session_id:
|
|
321
|
-
...
|
|
432
|
+
addIceCandidate(streamId, candidate, sessionId) {
|
|
433
|
+
return client.post(`/clips/streams/${streamId}/ice`, {
|
|
434
|
+
session_id: sessionId,
|
|
435
|
+
...candidate
|
|
322
436
|
});
|
|
323
437
|
},
|
|
324
|
-
sendStreamRequest(
|
|
325
|
-
return
|
|
326
|
-
session_id:
|
|
327
|
-
...
|
|
438
|
+
sendStreamRequest(streamId, sessionId, payload) {
|
|
439
|
+
return client.post(`/clips/streams/${streamId}`, {
|
|
440
|
+
session_id: sessionId,
|
|
441
|
+
...payload
|
|
328
442
|
});
|
|
329
443
|
},
|
|
330
|
-
close(
|
|
331
|
-
return
|
|
332
|
-
session_id:
|
|
444
|
+
close(streamId, sessionId) {
|
|
445
|
+
return client.delete(`/clips/streams/${streamId}`, {
|
|
446
|
+
session_id: sessionId
|
|
333
447
|
});
|
|
334
448
|
}
|
|
335
449
|
};
|
|
336
450
|
}
|
|
337
|
-
function
|
|
338
|
-
const
|
|
451
|
+
function createApi(auth, host) {
|
|
452
|
+
const client = createClient(auth, host);
|
|
339
453
|
return {
|
|
340
|
-
createStream(
|
|
341
|
-
return
|
|
342
|
-
source_url:
|
|
343
|
-
driver_url:
|
|
344
|
-
face:
|
|
345
|
-
config:
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
startConnection(
|
|
349
|
-
return
|
|
350
|
-
session_id:
|
|
351
|
-
answer
|
|
352
|
-
},
|
|
353
|
-
},
|
|
354
|
-
addIceCandidate(
|
|
355
|
-
return
|
|
356
|
-
session_id:
|
|
357
|
-
...
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
sendStreamRequest(
|
|
361
|
-
return
|
|
362
|
-
session_id:
|
|
363
|
-
...
|
|
364
|
-
},
|
|
365
|
-
},
|
|
366
|
-
close(
|
|
367
|
-
return
|
|
368
|
-
session_id:
|
|
369
|
-
},
|
|
454
|
+
createStream(streamOptions, options) {
|
|
455
|
+
return client.post("/talks/streams", {
|
|
456
|
+
source_url: streamOptions.source_url,
|
|
457
|
+
driver_url: streamOptions.driver_url,
|
|
458
|
+
face: streamOptions.face,
|
|
459
|
+
config: streamOptions.config
|
|
460
|
+
}, options);
|
|
461
|
+
},
|
|
462
|
+
startConnection(streamId, answer, sessionId, options) {
|
|
463
|
+
return client.post(`/talks/streams/${streamId}/sdp`, {
|
|
464
|
+
session_id: sessionId,
|
|
465
|
+
answer
|
|
466
|
+
}, options);
|
|
467
|
+
},
|
|
468
|
+
addIceCandidate(streamId, candidate, sessionId, options) {
|
|
469
|
+
return client.post(`/talks/streams/${streamId}/ice`, {
|
|
470
|
+
session_id: sessionId,
|
|
471
|
+
...candidate
|
|
472
|
+
}, options);
|
|
473
|
+
},
|
|
474
|
+
sendStreamRequest(streamId, sessionId, payload, options) {
|
|
475
|
+
return client.post(`/talks/streams/${streamId}`, {
|
|
476
|
+
session_id: sessionId,
|
|
477
|
+
...payload
|
|
478
|
+
}, options);
|
|
479
|
+
},
|
|
480
|
+
close(streamId, sessionId, options) {
|
|
481
|
+
return client.delete(`/talks/streams/${streamId}`, {
|
|
482
|
+
session_id: sessionId
|
|
483
|
+
}, options);
|
|
370
484
|
}
|
|
371
485
|
};
|
|
372
486
|
}
|
|
373
|
-
function
|
|
374
|
-
return
|
|
375
|
-
index
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
487
|
+
function createVideoStatsReport(stats, previousStats) {
|
|
488
|
+
return stats.map((report, index) => {
|
|
489
|
+
if (index === 0) {
|
|
490
|
+
if (!previousStats) {
|
|
491
|
+
return {
|
|
492
|
+
index,
|
|
493
|
+
timestamp: report.timestamp,
|
|
494
|
+
bytesReceived: report.bytesReceived,
|
|
495
|
+
packetsReceived: report.packetsReceived,
|
|
496
|
+
packetsLost: report.packetsLost,
|
|
497
|
+
jitter: report.jitter,
|
|
498
|
+
frameWidth: report.frameWidth,
|
|
499
|
+
frameHeight: report.frameHeight,
|
|
500
|
+
framesPerSecond: report.framesPerSecond
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
return {
|
|
504
|
+
index,
|
|
505
|
+
timestamp: report.timestamp,
|
|
506
|
+
bytesReceived: report.bytesReceived - previousStats.bytesReceived,
|
|
507
|
+
packetsReceived: report.packetsReceived - previousStats.packetsReceived,
|
|
508
|
+
packetsLost: report.packetsLost - previousStats.packetsLost,
|
|
509
|
+
jitter: report.jitter,
|
|
510
|
+
frameWidth: report.frameWidth,
|
|
511
|
+
frameHeight: report.frameHeight,
|
|
512
|
+
framesPerSecond: report.framesPerSecond
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
return {
|
|
516
|
+
index,
|
|
517
|
+
timestamp: report.timestamp,
|
|
518
|
+
bytesReceived: report.bytesReceived - stats[index - 1].bytesReceived,
|
|
519
|
+
packetsReceived: report.packetsReceived - stats[index - 1].packetsReceived,
|
|
520
|
+
packetsLost: report.packetsLost - stats[index - 1].packetsLost,
|
|
521
|
+
jitter: report.jitter,
|
|
522
|
+
frameWidth: report.frameWidth,
|
|
523
|
+
frameHeight: report.frameHeight,
|
|
524
|
+
framesPerSecond: report.framesPerSecond
|
|
525
|
+
};
|
|
404
526
|
});
|
|
405
527
|
}
|
|
406
|
-
let
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
528
|
+
let _debug = false;
|
|
529
|
+
const log = (message, extra) => _debug && console.log(message, extra);
|
|
530
|
+
const actualRTCPC = (window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection).bind(window);
|
|
531
|
+
function pollStats(peerConnection, onVideoStateChange) {
|
|
532
|
+
let videoStats = [];
|
|
533
|
+
let videoStatsStartIndex = 0;
|
|
534
|
+
let videoStatsLastIndex = 0;
|
|
535
|
+
let isPlaying;
|
|
410
536
|
return setInterval(() => {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
537
|
+
const stats = peerConnection.getStats();
|
|
538
|
+
stats.then((result) => {
|
|
539
|
+
result.forEach((report) => {
|
|
540
|
+
if (report.type === "inbound-rtp" && report.kind === "video") {
|
|
541
|
+
videoStatsLastIndex = videoStats.length - 1;
|
|
542
|
+
if (report && videoStats[videoStatsLastIndex]) {
|
|
543
|
+
const currBytesReceived = report.bytesReceived;
|
|
544
|
+
const lastBytesReceived = videoStats[videoStatsLastIndex].bytesReceived;
|
|
545
|
+
let prevPlaying = isPlaying;
|
|
546
|
+
isPlaying = currBytesReceived - lastBytesReceived > 0;
|
|
547
|
+
let videoStatsReport;
|
|
548
|
+
if (prevPlaying !== isPlaying) {
|
|
549
|
+
if (isPlaying) {
|
|
550
|
+
videoStatsStartIndex = videoStats.length;
|
|
551
|
+
} else {
|
|
552
|
+
const stats2 = videoStats.slice(videoStatsStartIndex);
|
|
553
|
+
const previousStats = videoStatsStartIndex === 0 ? void 0 : videoStats[videoStatsStartIndex - 1];
|
|
554
|
+
videoStatsReport = createVideoStatsReport(stats2, previousStats);
|
|
555
|
+
videoStatsReport = videoStatsReport.sort((a, b) => b.packetsLost - a.packetsLost).slice(0, 5);
|
|
425
556
|
}
|
|
426
|
-
|
|
557
|
+
onVideoStateChange == null ? void 0 : onVideoStateChange(isPlaying ? StreamingState.Start : StreamingState.Stop, videoStatsReport);
|
|
427
558
|
}
|
|
428
559
|
}
|
|
429
|
-
|
|
560
|
+
videoStats.push(report);
|
|
430
561
|
}
|
|
431
562
|
});
|
|
432
563
|
});
|
|
433
564
|
}, 500);
|
|
434
565
|
}
|
|
435
|
-
async function
|
|
436
|
-
debug
|
|
437
|
-
callbacks
|
|
438
|
-
auth
|
|
439
|
-
baseURL
|
|
566
|
+
async function createStreamingManager(agent, {
|
|
567
|
+
debug = false,
|
|
568
|
+
callbacks,
|
|
569
|
+
auth,
|
|
570
|
+
baseURL = didApiUrl
|
|
440
571
|
}) {
|
|
441
|
-
|
|
572
|
+
_debug = debug;
|
|
573
|
+
const {
|
|
574
|
+
startConnection,
|
|
575
|
+
sendStreamRequest,
|
|
576
|
+
close,
|
|
577
|
+
createStream,
|
|
578
|
+
addIceCandidate
|
|
579
|
+
} = agent.videoType === VideoType.Clip ? createApi$1(auth, baseURL) : createApi(auth, baseURL);
|
|
442
580
|
const {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
} = await c(e), s = new V({
|
|
454
|
-
iceServers: w
|
|
455
|
-
}), f = s.createDataChannel("JanusDataChannel");
|
|
456
|
-
if (!p)
|
|
581
|
+
id: streamIdFromServer,
|
|
582
|
+
offer,
|
|
583
|
+
ice_servers,
|
|
584
|
+
session_id
|
|
585
|
+
} = await createStream(agent);
|
|
586
|
+
const peerConnection = new actualRTCPC({
|
|
587
|
+
iceServers: ice_servers
|
|
588
|
+
});
|
|
589
|
+
const pcDataChannel = peerConnection.createDataChannel("JanusDataChannel");
|
|
590
|
+
if (!session_id) {
|
|
457
591
|
throw new Error("Could not create session_id");
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
592
|
+
}
|
|
593
|
+
const videoStatsInterval = pollStats(peerConnection, callbacks.onVideoStateChange);
|
|
594
|
+
peerConnection.onicecandidate = (event) => {
|
|
595
|
+
log("peerConnection.onicecandidate", event);
|
|
596
|
+
if (event.candidate && event.candidate.sdpMid && event.candidate.sdpMLineIndex !== null) {
|
|
597
|
+
addIceCandidate(streamIdFromServer, {
|
|
598
|
+
candidate: event.candidate.candidate,
|
|
599
|
+
sdpMid: event.candidate.sdpMid,
|
|
600
|
+
sdpMLineIndex: event.candidate.sdpMLineIndex
|
|
601
|
+
}, session_id);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
peerConnection.oniceconnectionstatechange = () => {
|
|
605
|
+
var _a;
|
|
606
|
+
log("peerConnection.oniceconnectionstatechange => " + peerConnection.iceConnectionState);
|
|
607
|
+
(_a = callbacks.onConnectionStateChange) == null ? void 0 : _a.call(callbacks, peerConnection.iceConnectionState);
|
|
608
|
+
};
|
|
609
|
+
peerConnection.ontrack = (event) => {
|
|
610
|
+
var _a;
|
|
611
|
+
log("peerConnection.ontrack", event);
|
|
612
|
+
(_a = callbacks.onSrcObjectReady) == null ? void 0 : _a.call(callbacks, event.streams[0]);
|
|
613
|
+
};
|
|
614
|
+
pcDataChannel.onmessage = (message) => {
|
|
615
|
+
var _a, _b;
|
|
616
|
+
if (pcDataChannel.readyState === "open") {
|
|
617
|
+
const [event, data] = message.data.split(":");
|
|
618
|
+
if (event === StreamEvents.StreamStarted) {
|
|
619
|
+
console.log("StreamStarted", event, data);
|
|
620
|
+
} else if (event === StreamEvents.StreamDone) {
|
|
621
|
+
console.log("StreamDone");
|
|
622
|
+
} else if (event === StreamEvents.StreamFailed) {
|
|
623
|
+
(_a = callbacks.onVideoStateChange) == null ? void 0 : _a.call(callbacks, StreamingState.Stop, {
|
|
624
|
+
event,
|
|
625
|
+
data
|
|
626
|
+
});
|
|
627
|
+
clearInterval(videoStatsInterval);
|
|
628
|
+
console.log("StreamFailed");
|
|
629
|
+
} else {
|
|
630
|
+
(_b = callbacks.onMessage) == null ? void 0 : _b.call(callbacks, event, decodeURIComponent(data));
|
|
631
|
+
}
|
|
479
632
|
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
633
|
+
};
|
|
634
|
+
await peerConnection.setRemoteDescription(offer);
|
|
635
|
+
log("set remote description OK");
|
|
636
|
+
const sessionClientAnswer = await peerConnection.createAnswer();
|
|
637
|
+
log("create answer OK");
|
|
638
|
+
await peerConnection.setLocalDescription(sessionClientAnswer);
|
|
639
|
+
log("set local description OK");
|
|
640
|
+
await startConnection(streamIdFromServer, sessionClientAnswer, session_id);
|
|
641
|
+
log("start connection OK");
|
|
642
|
+
return {
|
|
483
643
|
/**
|
|
484
644
|
* Method to send request to server to get clip or talk depend on you payload
|
|
485
645
|
* @param payload
|
|
486
646
|
*/
|
|
487
|
-
speak(
|
|
488
|
-
return
|
|
647
|
+
speak(payload) {
|
|
648
|
+
return sendStreamRequest(streamIdFromServer, session_id, payload);
|
|
489
649
|
},
|
|
490
650
|
/**
|
|
491
651
|
* Method to close RTC connection
|
|
492
652
|
*/
|
|
493
653
|
async terminate() {
|
|
494
|
-
var
|
|
495
|
-
|
|
496
|
-
|
|
654
|
+
var _a, _b;
|
|
655
|
+
if (streamIdFromServer) {
|
|
656
|
+
if (peerConnection) {
|
|
657
|
+
peerConnection.close();
|
|
658
|
+
peerConnection.oniceconnectionstatechange = null;
|
|
659
|
+
peerConnection.onnegotiationneeded = null;
|
|
660
|
+
peerConnection.onicecandidate = null;
|
|
661
|
+
peerConnection.ontrack = null;
|
|
662
|
+
}
|
|
663
|
+
await close(streamIdFromServer, session_id).catch((_) => {
|
|
664
|
+
});
|
|
665
|
+
(_a = callbacks.onConnectionStateChange) == null ? void 0 : _a.call(callbacks, "closed");
|
|
666
|
+
(_b = callbacks.onVideoStateChange) == null ? void 0 : _b.call(callbacks, StreamingState.Stop);
|
|
667
|
+
clearInterval(videoStatsInterval);
|
|
668
|
+
}
|
|
497
669
|
},
|
|
498
670
|
/**
|
|
499
671
|
* Session identifier information, should be returned in the body of all streaming requests
|
|
500
672
|
*/
|
|
501
|
-
sessionId:
|
|
673
|
+
sessionId: session_id,
|
|
502
674
|
/**
|
|
503
675
|
* Id of current RTC stream
|
|
504
676
|
*/
|
|
505
|
-
streamId:
|
|
677
|
+
streamId: streamIdFromServer
|
|
506
678
|
};
|
|
507
679
|
}
|
|
508
680
|
export {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
ne as getAgent
|
|
681
|
+
ChatMode,
|
|
682
|
+
ChatProgress,
|
|
683
|
+
DocumentType,
|
|
684
|
+
KnowledgeType,
|
|
685
|
+
Providers,
|
|
686
|
+
RateState,
|
|
687
|
+
SocketManager,
|
|
688
|
+
Subject,
|
|
689
|
+
VoiceAccess,
|
|
690
|
+
createAgentManager,
|
|
691
|
+
createAgentsApi,
|
|
692
|
+
createClient,
|
|
693
|
+
createKnowledgeApi,
|
|
694
|
+
createRatingsApi,
|
|
695
|
+
createStreamingManager,
|
|
696
|
+
getAgent
|
|
526
697
|
};
|