@servicetitan/titan-chatbot-api 6.1.0 → 7.0.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/CHANGELOG.md +24 -0
- package/dist/api-client/__mocks__/chatbot-api-client.mock.d.ts +1 -1
- package/dist/api-client/__mocks__/chatbot-api-client.mock.d.ts.map +1 -1
- package/dist/api-client/__mocks__/chatbot-api-client.mock.js +6 -6
- package/dist/api-client/__mocks__/chatbot-api-client.mock.js.map +1 -1
- package/dist/api-client/base/chatbot-api-client.d.ts +1 -1
- package/dist/api-client/base/chatbot-api-client.d.ts.map +1 -1
- package/dist/api-client/help-center/chatbot-api-client.d.ts +1 -1
- package/dist/api-client/help-center/chatbot-api-client.d.ts.map +1 -1
- package/dist/api-client/help-center/chatbot-api-client.js +7 -4
- package/dist/api-client/help-center/chatbot-api-client.js.map +1 -1
- package/dist/api-client/titan-chat/__tests__/native-client.test.d.ts +2 -0
- package/dist/api-client/titan-chat/__tests__/native-client.test.d.ts.map +1 -0
- package/dist/api-client/titan-chat/__tests__/native-client.test.js +36 -0
- package/dist/api-client/titan-chat/__tests__/native-client.test.js.map +1 -0
- package/dist/api-client/titan-chat/chatbot-api-client.d.ts +2 -2
- package/dist/api-client/titan-chat/chatbot-api-client.d.ts.map +1 -1
- package/dist/api-client/titan-chat/chatbot-api-client.js +5 -5
- package/dist/api-client/titan-chat/chatbot-api-client.js.map +1 -1
- package/dist/api-client/titan-chat/native-client.d.ts +98 -40
- package/dist/api-client/titan-chat/native-client.d.ts.map +1 -1
- package/dist/api-client/titan-chat/native-client.js +436 -384
- package/dist/api-client/titan-chat/native-client.js.map +1 -1
- package/dist/stores/chatbot-ui-backend.store.d.ts.map +1 -1
- package/dist/stores/chatbot-ui-backend.store.js +17 -16
- package/dist/stores/chatbot-ui-backend.store.js.map +1 -1
- package/dist/stores/chatbot-ui.store.d.ts +5 -4
- package/dist/stores/chatbot-ui.store.d.ts.map +1 -1
- package/dist/stores/chatbot-ui.store.js +4 -6
- package/dist/stores/chatbot-ui.store.js.map +1 -1
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/message-feedback-base.store.d.ts +2 -1
- package/dist/stores/message-feedback-base.store.d.ts.map +1 -1
- package/dist/stores/message-feedback-guardrail.store.d.ts +2 -3
- package/dist/stores/message-feedback-guardrail.store.d.ts.map +1 -1
- package/dist/stores/message-feedback-guardrail.store.js +4 -10
- package/dist/stores/message-feedback-guardrail.store.js.map +1 -1
- package/dist/stores/message-feedback.store.d.ts +2 -3
- package/dist/stores/message-feedback.store.d.ts.map +1 -1
- package/dist/stores/message-feedback.store.js +3 -6
- package/dist/stores/message-feedback.store.js.map +1 -1
- package/dist/stores/session-feedback.store.d.ts +2 -2
- package/dist/stores/session-feedback.store.d.ts.map +1 -1
- package/dist/stores/session-feedback.store.js +3 -3
- package/dist/stores/session-feedback.store.js.map +1 -1
- package/package.json +4 -4
- package/src/api-client/__mocks__/chatbot-api-client.mock.ts +1 -1
- package/src/api-client/base/chatbot-api-client.ts +4 -1
- package/src/api-client/help-center/chatbot-api-client.ts +9 -5
- package/src/api-client/titan-chat/__tests__/native-client.test.ts +37 -0
- package/src/api-client/titan-chat/chatbot-api-client.ts +7 -7
- package/src/api-client/titan-chat/native-client.ts +622 -424
- package/src/stores/chatbot-ui-backend.store.ts +19 -16
- package/src/stores/chatbot-ui.store.ts +7 -10
- package/src/stores/index.ts +1 -1
- package/src/stores/message-feedback-base.store.ts +7 -1
- package/src/stores/message-feedback-guardrail.store.ts +6 -12
- package/src/stores/message-feedback.store.ts +5 -8
- package/src/stores/session-feedback.store.ts +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
/* tslint:disable */
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
// ReSharper disable InconsistentNaming
|
|
9
|
-
import axios from 'axios';
|
|
10
9
|
export class Client {
|
|
11
|
-
constructor(baseUrl,
|
|
12
|
-
Object.defineProperty(this, "
|
|
10
|
+
constructor(baseUrl, http) {
|
|
11
|
+
Object.defineProperty(this, "http", {
|
|
13
12
|
enumerable: true,
|
|
14
13
|
configurable: true,
|
|
15
14
|
writable: true,
|
|
@@ -27,7 +26,7 @@ export class Client {
|
|
|
27
26
|
writable: true,
|
|
28
27
|
value: undefined
|
|
29
28
|
});
|
|
30
|
-
this.
|
|
29
|
+
this.http = http ? http : window;
|
|
31
30
|
this.baseUrl = baseUrl !== null && baseUrl !== void 0 ? baseUrl : '';
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
@@ -43,50 +42,37 @@ export class Client {
|
|
|
43
42
|
url_ = url_.replace(/[?&]$/, '');
|
|
44
43
|
const content_ = JSON.stringify(body);
|
|
45
44
|
let options_ = {
|
|
46
|
-
|
|
45
|
+
body: content_,
|
|
47
46
|
method: 'POST',
|
|
48
|
-
|
|
47
|
+
signal,
|
|
49
48
|
headers: {
|
|
50
49
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
51
50
|
'Content-Type': 'application/json',
|
|
52
51
|
'Accept': 'text/plain',
|
|
53
52
|
},
|
|
54
|
-
signal,
|
|
55
53
|
};
|
|
56
|
-
return this.
|
|
57
|
-
.request(options_)
|
|
58
|
-
.catch((_error) => {
|
|
59
|
-
if (isAxiosError(_error) && _error.response) {
|
|
60
|
-
return _error.response;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
throw _error;
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
.then((_response) => {
|
|
54
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
67
55
|
return this.processFeedback(_response);
|
|
68
56
|
});
|
|
69
57
|
}
|
|
70
58
|
processFeedback(response) {
|
|
71
59
|
const status = response.status;
|
|
72
60
|
let _headers = {};
|
|
73
|
-
if (response.headers &&
|
|
74
|
-
|
|
75
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
76
|
-
_headers[k] = response.headers[k];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
61
|
+
if (response.headers && response.headers.forEach) {
|
|
62
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
79
63
|
}
|
|
80
64
|
if (status === 200) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
return response.text().then(_responseText => {
|
|
66
|
+
let result200 = null;
|
|
67
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
68
|
+
result200 = Feedback.fromJS(resultData200);
|
|
69
|
+
return result200;
|
|
70
|
+
});
|
|
86
71
|
}
|
|
87
72
|
else if (status !== 200 && status !== 204) {
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
return response.text().then(_responseText => {
|
|
74
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
75
|
+
});
|
|
90
76
|
}
|
|
91
77
|
return Promise.resolve(null);
|
|
92
78
|
}
|
|
@@ -103,62 +89,52 @@ export class Client {
|
|
|
103
89
|
url_ = url_.replace(/[?&]$/, '');
|
|
104
90
|
const content_ = JSON.stringify(body);
|
|
105
91
|
let options_ = {
|
|
106
|
-
|
|
92
|
+
body: content_,
|
|
107
93
|
method: 'POST',
|
|
108
|
-
|
|
94
|
+
signal,
|
|
109
95
|
headers: {
|
|
110
96
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
111
97
|
'Content-Type': 'application/json',
|
|
112
98
|
'Accept': 'text/plain',
|
|
113
99
|
},
|
|
114
|
-
signal,
|
|
115
100
|
};
|
|
116
|
-
return this.
|
|
117
|
-
.request(options_)
|
|
118
|
-
.catch((_error) => {
|
|
119
|
-
if (isAxiosError(_error) && _error.response) {
|
|
120
|
-
return _error.response;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
throw _error;
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
.then((_response) => {
|
|
101
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
127
102
|
return this.processFollowUpEmail(_response);
|
|
128
103
|
});
|
|
129
104
|
}
|
|
130
105
|
processFollowUpEmail(response) {
|
|
131
106
|
const status = response.status;
|
|
132
107
|
let _headers = {};
|
|
133
|
-
if (response.headers &&
|
|
134
|
-
|
|
135
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
136
|
-
_headers[k] = response.headers[k];
|
|
137
|
-
}
|
|
138
|
-
}
|
|
108
|
+
if (response.headers && response.headers.forEach) {
|
|
109
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
139
110
|
}
|
|
140
111
|
if (status === 200) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
112
|
+
return response.text().then(_responseText => {
|
|
113
|
+
let result200 = null;
|
|
114
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
115
|
+
result200 = BotMessage.fromJS(resultData200);
|
|
116
|
+
return result200;
|
|
117
|
+
});
|
|
146
118
|
}
|
|
147
119
|
else if (status === 500) {
|
|
148
|
-
|
|
149
|
-
|
|
120
|
+
return response.text().then(_responseText => {
|
|
121
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
122
|
+
});
|
|
150
123
|
}
|
|
151
124
|
else if (status === 502) {
|
|
152
|
-
|
|
153
|
-
|
|
125
|
+
return response.text().then(_responseText => {
|
|
126
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
127
|
+
});
|
|
154
128
|
}
|
|
155
129
|
else if (status === 504) {
|
|
156
|
-
|
|
157
|
-
|
|
130
|
+
return response.text().then(_responseText => {
|
|
131
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
132
|
+
});
|
|
158
133
|
}
|
|
159
134
|
else if (status !== 200 && status !== 204) {
|
|
160
|
-
|
|
161
|
-
|
|
135
|
+
return response.text().then(_responseText => {
|
|
136
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
137
|
+
});
|
|
162
138
|
}
|
|
163
139
|
return Promise.resolve(null);
|
|
164
140
|
}
|
|
@@ -175,62 +151,52 @@ export class Client {
|
|
|
175
151
|
url_ = url_.replace(/[?&]$/, '');
|
|
176
152
|
const content_ = JSON.stringify(body);
|
|
177
153
|
let options_ = {
|
|
178
|
-
|
|
154
|
+
body: content_,
|
|
179
155
|
method: 'POST',
|
|
180
|
-
|
|
156
|
+
signal,
|
|
181
157
|
headers: {
|
|
182
158
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
183
159
|
'Content-Type': 'application/json',
|
|
184
160
|
'Accept': 'text/plain',
|
|
185
161
|
},
|
|
186
|
-
signal,
|
|
187
162
|
};
|
|
188
|
-
return this.
|
|
189
|
-
.request(options_)
|
|
190
|
-
.catch((_error) => {
|
|
191
|
-
if (isAxiosError(_error) && _error.response) {
|
|
192
|
-
return _error.response;
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
throw _error;
|
|
196
|
-
}
|
|
197
|
-
})
|
|
198
|
-
.then((_response) => {
|
|
163
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
199
164
|
return this.processMessage(_response);
|
|
200
165
|
});
|
|
201
166
|
}
|
|
202
167
|
processMessage(response) {
|
|
203
168
|
const status = response.status;
|
|
204
169
|
let _headers = {};
|
|
205
|
-
if (response.headers &&
|
|
206
|
-
|
|
207
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
208
|
-
_headers[k] = response.headers[k];
|
|
209
|
-
}
|
|
210
|
-
}
|
|
170
|
+
if (response.headers && response.headers.forEach) {
|
|
171
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
211
172
|
}
|
|
212
173
|
if (status === 200) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
174
|
+
return response.text().then(_responseText => {
|
|
175
|
+
let result200 = null;
|
|
176
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
177
|
+
result200 = BotMessage.fromJS(resultData200);
|
|
178
|
+
return result200;
|
|
179
|
+
});
|
|
218
180
|
}
|
|
219
181
|
else if (status === 500) {
|
|
220
|
-
|
|
221
|
-
|
|
182
|
+
return response.text().then(_responseText => {
|
|
183
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
184
|
+
});
|
|
222
185
|
}
|
|
223
186
|
else if (status === 502) {
|
|
224
|
-
|
|
225
|
-
|
|
187
|
+
return response.text().then(_responseText => {
|
|
188
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
189
|
+
});
|
|
226
190
|
}
|
|
227
191
|
else if (status === 504) {
|
|
228
|
-
|
|
229
|
-
|
|
192
|
+
return response.text().then(_responseText => {
|
|
193
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
194
|
+
});
|
|
230
195
|
}
|
|
231
196
|
else if (status !== 200 && status !== 204) {
|
|
232
|
-
|
|
233
|
-
|
|
197
|
+
return response.text().then(_responseText => {
|
|
198
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
199
|
+
});
|
|
234
200
|
}
|
|
235
201
|
return Promise.resolve(null);
|
|
236
202
|
}
|
|
@@ -246,47 +212,34 @@ export class Client {
|
|
|
246
212
|
url_ = url_.replace(/[?&]$/, '');
|
|
247
213
|
let options_ = {
|
|
248
214
|
method: 'GET',
|
|
249
|
-
|
|
215
|
+
signal,
|
|
250
216
|
headers: {
|
|
251
217
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
252
218
|
'Accept': 'text/plain',
|
|
253
219
|
},
|
|
254
|
-
signal,
|
|
255
220
|
};
|
|
256
|
-
return this.
|
|
257
|
-
.request(options_)
|
|
258
|
-
.catch((_error) => {
|
|
259
|
-
if (isAxiosError(_error) && _error.response) {
|
|
260
|
-
return _error.response;
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
throw _error;
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
.then((_response) => {
|
|
221
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
267
222
|
return this.processOptions(_response);
|
|
268
223
|
});
|
|
269
224
|
}
|
|
270
225
|
processOptions(response) {
|
|
271
226
|
const status = response.status;
|
|
272
227
|
let _headers = {};
|
|
273
|
-
if (response.headers &&
|
|
274
|
-
|
|
275
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
276
|
-
_headers[k] = response.headers[k];
|
|
277
|
-
}
|
|
278
|
-
}
|
|
228
|
+
if (response.headers && response.headers.forEach) {
|
|
229
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
279
230
|
}
|
|
280
231
|
if (status === 200) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
232
|
+
return response.text().then(_responseText => {
|
|
233
|
+
let result200 = null;
|
|
234
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
235
|
+
result200 = FrontendModel.fromJS(resultData200);
|
|
236
|
+
return result200;
|
|
237
|
+
});
|
|
286
238
|
}
|
|
287
239
|
else if (status !== 200 && status !== 204) {
|
|
288
|
-
|
|
289
|
-
|
|
240
|
+
return response.text().then(_responseText => {
|
|
241
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
242
|
+
});
|
|
290
243
|
}
|
|
291
244
|
return Promise.resolve(null);
|
|
292
245
|
}
|
|
@@ -303,50 +256,37 @@ export class Client {
|
|
|
303
256
|
url_ = url_.replace(/[?&]$/, '');
|
|
304
257
|
const content_ = JSON.stringify(body);
|
|
305
258
|
let options_ = {
|
|
306
|
-
|
|
259
|
+
body: content_,
|
|
307
260
|
method: 'POST',
|
|
308
|
-
|
|
261
|
+
signal,
|
|
309
262
|
headers: {
|
|
310
263
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
311
264
|
'Content-Type': 'application/json',
|
|
312
265
|
'Accept': 'text/plain',
|
|
313
266
|
},
|
|
314
|
-
signal,
|
|
315
267
|
};
|
|
316
|
-
return this.
|
|
317
|
-
.request(options_)
|
|
318
|
-
.catch((_error) => {
|
|
319
|
-
if (isAxiosError(_error) && _error.response) {
|
|
320
|
-
return _error.response;
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
throw _error;
|
|
324
|
-
}
|
|
325
|
-
})
|
|
326
|
-
.then((_response) => {
|
|
268
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
327
269
|
return this.processSessionPOST(_response);
|
|
328
270
|
});
|
|
329
271
|
}
|
|
330
272
|
processSessionPOST(response) {
|
|
331
273
|
const status = response.status;
|
|
332
274
|
let _headers = {};
|
|
333
|
-
if (response.headers &&
|
|
334
|
-
|
|
335
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
336
|
-
_headers[k] = response.headers[k];
|
|
337
|
-
}
|
|
338
|
-
}
|
|
275
|
+
if (response.headers && response.headers.forEach) {
|
|
276
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
339
277
|
}
|
|
340
278
|
if (status === 200) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
279
|
+
return response.text().then(_responseText => {
|
|
280
|
+
let result200 = null;
|
|
281
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
282
|
+
result200 = Session.fromJS(resultData200);
|
|
283
|
+
return result200;
|
|
284
|
+
});
|
|
346
285
|
}
|
|
347
286
|
else if (status !== 200 && status !== 204) {
|
|
348
|
-
|
|
349
|
-
|
|
287
|
+
return response.text().then(_responseText => {
|
|
288
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
289
|
+
});
|
|
350
290
|
}
|
|
351
291
|
return Promise.resolve(null);
|
|
352
292
|
}
|
|
@@ -363,50 +303,37 @@ export class Client {
|
|
|
363
303
|
url_ = url_.replace(/[?&]$/, '');
|
|
364
304
|
const content_ = JSON.stringify(body);
|
|
365
305
|
let options_ = {
|
|
366
|
-
|
|
306
|
+
body: content_,
|
|
367
307
|
method: 'PATCH',
|
|
368
|
-
|
|
308
|
+
signal,
|
|
369
309
|
headers: {
|
|
370
310
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
371
311
|
'Content-Type': 'application/json',
|
|
372
312
|
'Accept': 'text/plain',
|
|
373
313
|
},
|
|
374
|
-
signal,
|
|
375
314
|
};
|
|
376
|
-
return this.
|
|
377
|
-
.request(options_)
|
|
378
|
-
.catch((_error) => {
|
|
379
|
-
if (isAxiosError(_error) && _error.response) {
|
|
380
|
-
return _error.response;
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
throw _error;
|
|
384
|
-
}
|
|
385
|
-
})
|
|
386
|
-
.then((_response) => {
|
|
315
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
387
316
|
return this.processSessionPATCH(_response);
|
|
388
317
|
});
|
|
389
318
|
}
|
|
390
319
|
processSessionPATCH(response) {
|
|
391
320
|
const status = response.status;
|
|
392
321
|
let _headers = {};
|
|
393
|
-
if (response.headers &&
|
|
394
|
-
|
|
395
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
396
|
-
_headers[k] = response.headers[k];
|
|
397
|
-
}
|
|
398
|
-
}
|
|
322
|
+
if (response.headers && response.headers.forEach) {
|
|
323
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
399
324
|
}
|
|
400
325
|
if (status === 200) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
326
|
+
return response.text().then(_responseText => {
|
|
327
|
+
let result200 = null;
|
|
328
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
329
|
+
result200 = Session.fromJS(resultData200);
|
|
330
|
+
return result200;
|
|
331
|
+
});
|
|
406
332
|
}
|
|
407
333
|
else if (status !== 200 && status !== 204) {
|
|
408
|
-
|
|
409
|
-
|
|
334
|
+
return response.text().then(_responseText => {
|
|
335
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
336
|
+
});
|
|
410
337
|
}
|
|
411
338
|
return Promise.resolve(null);
|
|
412
339
|
}
|
|
@@ -423,267 +350,334 @@ export class Client {
|
|
|
423
350
|
url_ = url_.replace(/[?&]$/, '');
|
|
424
351
|
const content_ = JSON.stringify(body);
|
|
425
352
|
let options_ = {
|
|
426
|
-
|
|
353
|
+
body: content_,
|
|
427
354
|
method: 'DELETE',
|
|
428
|
-
|
|
355
|
+
signal,
|
|
429
356
|
headers: {
|
|
430
357
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
431
358
|
'Content-Type': 'application/json',
|
|
432
359
|
'Accept': 'text/plain',
|
|
433
360
|
},
|
|
434
|
-
signal,
|
|
435
361
|
};
|
|
436
|
-
return this.
|
|
437
|
-
.request(options_)
|
|
438
|
-
.catch((_error) => {
|
|
439
|
-
if (isAxiosError(_error) && _error.response) {
|
|
440
|
-
return _error.response;
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
throw _error;
|
|
444
|
-
}
|
|
445
|
-
})
|
|
446
|
-
.then((_response) => {
|
|
362
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
447
363
|
return this.processSessionDELETE(_response);
|
|
448
364
|
});
|
|
449
365
|
}
|
|
450
366
|
processSessionDELETE(response) {
|
|
451
367
|
const status = response.status;
|
|
452
368
|
let _headers = {};
|
|
453
|
-
if (response.headers &&
|
|
454
|
-
|
|
455
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
456
|
-
_headers[k] = response.headers[k];
|
|
457
|
-
}
|
|
458
|
-
}
|
|
369
|
+
if (response.headers && response.headers.forEach) {
|
|
370
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
459
371
|
}
|
|
460
372
|
if (status === 200) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
373
|
+
return response.text().then(_responseText => {
|
|
374
|
+
let result200 = null;
|
|
375
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
376
|
+
result200 = Session.fromJS(resultData200);
|
|
377
|
+
return result200;
|
|
378
|
+
});
|
|
466
379
|
}
|
|
467
380
|
else if (status !== 200 && status !== 204) {
|
|
468
|
-
|
|
469
|
-
|
|
381
|
+
return response.text().then(_responseText => {
|
|
382
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
383
|
+
});
|
|
470
384
|
}
|
|
471
385
|
return Promise.resolve(null);
|
|
472
386
|
}
|
|
473
387
|
/**
|
|
474
|
-
* @param start (optional)
|
|
475
|
-
* @param end (optional)
|
|
476
388
|
* @param x_Client_ID (optional)
|
|
477
389
|
* @return Success
|
|
478
390
|
*/
|
|
479
|
-
|
|
480
|
-
let url_ = this.baseUrl + '/api/v{version}/
|
|
391
|
+
sessionGET(sessionId, version, x_Client_ID, signal) {
|
|
392
|
+
let url_ = this.baseUrl + '/api/v{version}/session/{sessionId}';
|
|
393
|
+
if (sessionId === undefined || sessionId === null)
|
|
394
|
+
throw new Error("The parameter 'sessionId' must be defined.");
|
|
395
|
+
url_ = url_.replace('{sessionId}', encodeURIComponent('' + sessionId));
|
|
481
396
|
if (version === undefined || version === null)
|
|
482
397
|
throw new Error("The parameter 'version' must be defined.");
|
|
483
398
|
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
484
|
-
if (start === null)
|
|
485
|
-
throw new Error("The parameter 'start' cannot be null.");
|
|
486
|
-
else if (start !== undefined)
|
|
487
|
-
url_ += 'start=' + encodeURIComponent(start ? '' + start.toISOString() : '') + '&';
|
|
488
|
-
if (end === null)
|
|
489
|
-
throw new Error("The parameter 'end' cannot be null.");
|
|
490
|
-
else if (end !== undefined)
|
|
491
|
-
url_ += 'end=' + encodeURIComponent(end ? '' + end.toISOString() : '') + '&';
|
|
492
399
|
url_ = url_.replace(/[?&]$/, '');
|
|
493
400
|
let options_ = {
|
|
494
401
|
method: 'GET',
|
|
495
|
-
|
|
402
|
+
signal,
|
|
496
403
|
headers: {
|
|
497
404
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
498
405
|
'Accept': 'text/plain',
|
|
499
406
|
},
|
|
407
|
+
};
|
|
408
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
409
|
+
return this.processSessionGET(_response);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
processSessionGET(response) {
|
|
413
|
+
const status = response.status;
|
|
414
|
+
let _headers = {};
|
|
415
|
+
if (response.headers && response.headers.forEach) {
|
|
416
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
417
|
+
}
|
|
418
|
+
if (status === 200) {
|
|
419
|
+
return response.text().then(_responseText => {
|
|
420
|
+
let result200 = null;
|
|
421
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
422
|
+
result200 = Session.fromJS(resultData200);
|
|
423
|
+
return result200;
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
else if (status !== 200 && status !== 204) {
|
|
427
|
+
return response.text().then(_responseText => {
|
|
428
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
return Promise.resolve(null);
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* @param x_Client_ID (optional)
|
|
435
|
+
* @return Success
|
|
436
|
+
*/
|
|
437
|
+
messages(sessionId, version, x_Client_ID, signal) {
|
|
438
|
+
let url_ = this.baseUrl + '/api/v{version}/session/{sessionId}/messages';
|
|
439
|
+
if (sessionId === undefined || sessionId === null)
|
|
440
|
+
throw new Error("The parameter 'sessionId' must be defined.");
|
|
441
|
+
url_ = url_.replace('{sessionId}', encodeURIComponent('' + sessionId));
|
|
442
|
+
if (version === undefined || version === null)
|
|
443
|
+
throw new Error("The parameter 'version' must be defined.");
|
|
444
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
445
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
446
|
+
let options_ = {
|
|
447
|
+
method: 'GET',
|
|
500
448
|
signal,
|
|
449
|
+
headers: {
|
|
450
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
451
|
+
'Accept': 'text/plain',
|
|
452
|
+
},
|
|
501
453
|
};
|
|
502
|
-
return this.
|
|
503
|
-
.
|
|
504
|
-
.catch((_error) => {
|
|
505
|
-
if (isAxiosError(_error) && _error.response) {
|
|
506
|
-
return _error.response;
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
throw _error;
|
|
510
|
-
}
|
|
511
|
-
})
|
|
512
|
-
.then((_response) => {
|
|
513
|
-
return this.processTranscripts(_response);
|
|
454
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
455
|
+
return this.processMessages(_response);
|
|
514
456
|
});
|
|
515
457
|
}
|
|
516
|
-
|
|
458
|
+
processMessages(response) {
|
|
517
459
|
const status = response.status;
|
|
518
460
|
let _headers = {};
|
|
519
|
-
if (response.headers &&
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
461
|
+
if (response.headers && response.headers.forEach) {
|
|
462
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
463
|
+
}
|
|
464
|
+
if (status === 200) {
|
|
465
|
+
return response.text().then(_responseText => {
|
|
466
|
+
let result200 = null;
|
|
467
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
468
|
+
if (Array.isArray(resultData200)) {
|
|
469
|
+
result200 = [];
|
|
470
|
+
for (let item of resultData200)
|
|
471
|
+
result200.push(Message.fromJS(item));
|
|
523
472
|
}
|
|
524
|
-
|
|
473
|
+
else {
|
|
474
|
+
result200 = null;
|
|
475
|
+
}
|
|
476
|
+
return result200;
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
else if (status !== 200 && status !== 204) {
|
|
480
|
+
return response.text().then(_responseText => {
|
|
481
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
return Promise.resolve(null);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* @param x_Client_ID (optional)
|
|
488
|
+
* @param body (optional)
|
|
489
|
+
* @return Success
|
|
490
|
+
*/
|
|
491
|
+
summarize(version, x_Client_ID, body, signal) {
|
|
492
|
+
let url_ = this.baseUrl + '/api/v{version}/summarize';
|
|
493
|
+
if (version === undefined || version === null)
|
|
494
|
+
throw new Error("The parameter 'version' must be defined.");
|
|
495
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
496
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
497
|
+
const content_ = JSON.stringify(body);
|
|
498
|
+
let options_ = {
|
|
499
|
+
body: content_,
|
|
500
|
+
method: 'POST',
|
|
501
|
+
signal,
|
|
502
|
+
headers: {
|
|
503
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
504
|
+
'Content-Type': 'application/json',
|
|
505
|
+
'Accept': 'text/plain',
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
509
|
+
return this.processSummarize(_response);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
processSummarize(response) {
|
|
513
|
+
const status = response.status;
|
|
514
|
+
let _headers = {};
|
|
515
|
+
if (response.headers && response.headers.forEach) {
|
|
516
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
525
517
|
}
|
|
526
518
|
if (status === 200) {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
result200
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
}
|
|
538
|
-
|
|
519
|
+
return response.text().then(_responseText => {
|
|
520
|
+
let result200 = null;
|
|
521
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
522
|
+
result200 = SummarizeResponse.fromJS(resultData200);
|
|
523
|
+
return result200;
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
else if (status === 500) {
|
|
527
|
+
return response.text().then(_responseText => {
|
|
528
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
else if (status === 502) {
|
|
532
|
+
return response.text().then(_responseText => {
|
|
533
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
else if (status === 504) {
|
|
537
|
+
return response.text().then(_responseText => {
|
|
538
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
539
|
+
});
|
|
539
540
|
}
|
|
540
541
|
else if (status !== 200 && status !== 204) {
|
|
541
|
-
|
|
542
|
-
|
|
542
|
+
return response.text().then(_responseText => {
|
|
543
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
544
|
+
});
|
|
543
545
|
}
|
|
544
546
|
return Promise.resolve(null);
|
|
545
547
|
}
|
|
546
548
|
/**
|
|
547
|
-
* @param
|
|
549
|
+
* @param start (optional)
|
|
550
|
+
* @param end (optional)
|
|
548
551
|
* @param x_Client_ID (optional)
|
|
549
552
|
* @return Success
|
|
550
553
|
*/
|
|
551
|
-
|
|
552
|
-
let url_ = this.baseUrl + '/api/v{version}/transcripts
|
|
554
|
+
transcripts(start, end, version, x_Client_ID, signal) {
|
|
555
|
+
let url_ = this.baseUrl + '/api/v{version}/transcripts?';
|
|
553
556
|
if (version === undefined || version === null)
|
|
554
557
|
throw new Error("The parameter 'version' must be defined.");
|
|
555
558
|
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
556
|
-
if (
|
|
557
|
-
throw new Error("The parameter '
|
|
558
|
-
else if (
|
|
559
|
-
url_ += '
|
|
559
|
+
if (start === null)
|
|
560
|
+
throw new Error("The parameter 'start' cannot be null.");
|
|
561
|
+
else if (start !== undefined)
|
|
562
|
+
url_ += 'start=' + encodeURIComponent(start ? '' + start.toISOString() : '') + '&';
|
|
563
|
+
if (end === null)
|
|
564
|
+
throw new Error("The parameter 'end' cannot be null.");
|
|
565
|
+
else if (end !== undefined)
|
|
566
|
+
url_ += 'end=' + encodeURIComponent(end ? '' + end.toISOString() : '') + '&';
|
|
560
567
|
url_ = url_.replace(/[?&]$/, '');
|
|
561
568
|
let options_ = {
|
|
562
569
|
method: 'GET',
|
|
563
|
-
|
|
570
|
+
signal,
|
|
564
571
|
headers: {
|
|
565
572
|
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
566
573
|
'Accept': 'text/plain',
|
|
567
574
|
},
|
|
568
|
-
signal,
|
|
569
575
|
};
|
|
570
|
-
return this.
|
|
571
|
-
.
|
|
572
|
-
.catch((_error) => {
|
|
573
|
-
if (isAxiosError(_error) && _error.response) {
|
|
574
|
-
return _error.response;
|
|
575
|
-
}
|
|
576
|
-
else {
|
|
577
|
-
throw _error;
|
|
578
|
-
}
|
|
579
|
-
})
|
|
580
|
-
.then((_response) => {
|
|
581
|
-
return this.processSummary(_response);
|
|
576
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
577
|
+
return this.processTranscripts(_response);
|
|
582
578
|
});
|
|
583
579
|
}
|
|
584
|
-
|
|
580
|
+
processTranscripts(response) {
|
|
585
581
|
const status = response.status;
|
|
586
582
|
let _headers = {};
|
|
587
|
-
if (response.headers &&
|
|
588
|
-
|
|
589
|
-
if (response.headers.hasOwnProperty(k)) {
|
|
590
|
-
_headers[k] = response.headers[k];
|
|
591
|
-
}
|
|
592
|
-
}
|
|
583
|
+
if (response.headers && response.headers.forEach) {
|
|
584
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
593
585
|
}
|
|
594
586
|
if (status === 200) {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
587
|
+
return response.text().then(_responseText => {
|
|
588
|
+
let result200 = null;
|
|
589
|
+
let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver);
|
|
590
|
+
if (Array.isArray(resultData200)) {
|
|
591
|
+
result200 = [];
|
|
592
|
+
for (let item of resultData200)
|
|
593
|
+
result200.push(ExportHistoryMessage.fromJS(item));
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
result200 = null;
|
|
597
|
+
}
|
|
598
|
+
return result200;
|
|
599
|
+
});
|
|
600
600
|
}
|
|
601
601
|
else if (status !== 200 && status !== 204) {
|
|
602
|
-
|
|
603
|
-
|
|
602
|
+
return response.text().then(_responseText => {
|
|
603
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
604
|
+
});
|
|
604
605
|
}
|
|
605
606
|
return Promise.resolve(null);
|
|
606
607
|
}
|
|
607
608
|
}
|
|
608
|
-
/**
|
|
609
|
-
export class
|
|
609
|
+
/** One selectable agentic action choice. */
|
|
610
|
+
export class AgentOption {
|
|
610
611
|
constructor(data) {
|
|
611
|
-
|
|
612
|
-
Object.defineProperty(this, "id", {
|
|
613
|
-
enumerable: true,
|
|
614
|
-
configurable: true,
|
|
615
|
-
writable: true,
|
|
616
|
-
value: void 0
|
|
617
|
-
});
|
|
618
|
-
/** Session ID. Required in multi-turn conversations after the session is created. */
|
|
619
|
-
Object.defineProperty(this, "sessionId", {
|
|
620
|
-
enumerable: true,
|
|
621
|
-
configurable: true,
|
|
622
|
-
writable: true,
|
|
623
|
-
value: void 0
|
|
624
|
-
});
|
|
625
|
-
Object.defineProperty(this, "timeStamp", {
|
|
626
|
-
enumerable: true,
|
|
627
|
-
configurable: true,
|
|
628
|
-
writable: true,
|
|
629
|
-
value: void 0
|
|
630
|
-
});
|
|
631
|
-
/** Chatbot answer. */
|
|
632
|
-
Object.defineProperty(this, "answer", {
|
|
633
|
-
enumerable: true,
|
|
634
|
-
configurable: true,
|
|
635
|
-
writable: true,
|
|
636
|
-
value: void 0
|
|
637
|
-
});
|
|
638
|
-
/** Ordered list of relevant Knowledge Base links. */
|
|
639
|
-
Object.defineProperty(this, "scoredUrls", {
|
|
612
|
+
Object.defineProperty(this, "agentId", {
|
|
640
613
|
enumerable: true,
|
|
641
614
|
configurable: true,
|
|
642
615
|
writable: true,
|
|
643
616
|
value: void 0
|
|
644
617
|
});
|
|
645
|
-
|
|
646
|
-
- N - "none" or "normal", a successful response
|
|
647
|
-
- A - "agent", user wants to talk to a support agent
|
|
648
|
-
- C - "conversation", user attempted to continue a conversation in a single-turn message
|
|
649
|
-
- OI - "offensive input"
|
|
650
|
-
Client may handle these conditions in different ways. */
|
|
651
|
-
Object.defineProperty(this, "guardFlag", {
|
|
618
|
+
Object.defineProperty(this, "passPhrase", {
|
|
652
619
|
enumerable: true,
|
|
653
620
|
configurable: true,
|
|
654
621
|
writable: true,
|
|
655
622
|
value: void 0
|
|
656
623
|
});
|
|
657
|
-
|
|
658
|
-
Object.defineProperty(this, "isGuardrailed", {
|
|
624
|
+
Object.defineProperty(this, "caption", {
|
|
659
625
|
enumerable: true,
|
|
660
626
|
configurable: true,
|
|
661
627
|
writable: true,
|
|
662
628
|
value: void 0
|
|
663
629
|
});
|
|
664
|
-
|
|
665
|
-
|
|
630
|
+
if (data) {
|
|
631
|
+
for (var property in data) {
|
|
632
|
+
if (data.hasOwnProperty(property))
|
|
633
|
+
this[property] = data[property];
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
init(_data) {
|
|
638
|
+
if (_data) {
|
|
639
|
+
this.agentId = _data['agentId'];
|
|
640
|
+
this.passPhrase = _data['passPhrase'];
|
|
641
|
+
this.caption = _data['caption'];
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
static fromJS(data) {
|
|
645
|
+
data = typeof data === 'object' ? data : {};
|
|
646
|
+
let result = new AgentOption();
|
|
647
|
+
result.init(data);
|
|
648
|
+
return result;
|
|
649
|
+
}
|
|
650
|
+
toJSON(data) {
|
|
651
|
+
data = typeof data === 'object' ? data : {};
|
|
652
|
+
data['agentId'] = this.agentId;
|
|
653
|
+
data['passPhrase'] = this.passPhrase;
|
|
654
|
+
data['caption'] = this.caption;
|
|
655
|
+
return data;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
export class Message {
|
|
659
|
+
constructor(data) {
|
|
660
|
+
/** Primary key. */
|
|
661
|
+
Object.defineProperty(this, "id", {
|
|
666
662
|
enumerable: true,
|
|
667
663
|
configurable: true,
|
|
668
664
|
writable: true,
|
|
669
665
|
value: void 0
|
|
670
666
|
});
|
|
671
|
-
/**
|
|
672
|
-
Object.defineProperty(this, "
|
|
667
|
+
/** Session ID. Required in multi-turn conversations after the session is created. */
|
|
668
|
+
Object.defineProperty(this, "sessionId", {
|
|
673
669
|
enumerable: true,
|
|
674
670
|
configurable: true,
|
|
675
671
|
writable: true,
|
|
676
672
|
value: void 0
|
|
677
673
|
});
|
|
678
|
-
|
|
679
|
-
Object.defineProperty(this, "meta", {
|
|
674
|
+
Object.defineProperty(this, "timeStamp", {
|
|
680
675
|
enumerable: true,
|
|
681
676
|
configurable: true,
|
|
682
677
|
writable: true,
|
|
683
678
|
value: void 0
|
|
684
679
|
});
|
|
685
|
-
|
|
686
|
-
Object.defineProperty(this, "confidenceScore", {
|
|
680
|
+
Object.defineProperty(this, "_discriminator", {
|
|
687
681
|
enumerable: true,
|
|
688
682
|
configurable: true,
|
|
689
683
|
writable: true,
|
|
@@ -695,6 +689,7 @@ export class BotMessage {
|
|
|
695
689
|
this[property] = data[property];
|
|
696
690
|
}
|
|
697
691
|
}
|
|
692
|
+
this._discriminator = 'Message';
|
|
698
693
|
}
|
|
699
694
|
init(_data) {
|
|
700
695
|
if (_data) {
|
|
@@ -703,6 +698,42 @@ export class BotMessage {
|
|
|
703
698
|
this.timeStamp = _data['timeStamp']
|
|
704
699
|
? new Date(_data['timeStamp'].toString())
|
|
705
700
|
: undefined;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
static fromJS(data) {
|
|
704
|
+
data = typeof data === 'object' ? data : {};
|
|
705
|
+
if (data['$type'] === 'UserMessage') {
|
|
706
|
+
let result = new UserMessage();
|
|
707
|
+
result.init(data);
|
|
708
|
+
return result;
|
|
709
|
+
}
|
|
710
|
+
if (data['$type'] === 'BotMessage') {
|
|
711
|
+
let result = new BotMessage();
|
|
712
|
+
result.init(data);
|
|
713
|
+
return result;
|
|
714
|
+
}
|
|
715
|
+
let result = new Message();
|
|
716
|
+
result.init(data);
|
|
717
|
+
return result;
|
|
718
|
+
}
|
|
719
|
+
toJSON(data) {
|
|
720
|
+
data = typeof data === 'object' ? data : {};
|
|
721
|
+
data['$type'] = this._discriminator;
|
|
722
|
+
data['id'] = this.id;
|
|
723
|
+
data['sessionId'] = this.sessionId;
|
|
724
|
+
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : undefined;
|
|
725
|
+
return data;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
/** Chatbot response message. */
|
|
729
|
+
export class BotMessage extends Message {
|
|
730
|
+
constructor(data) {
|
|
731
|
+
super(data);
|
|
732
|
+
this._discriminator = 'BotMessage';
|
|
733
|
+
}
|
|
734
|
+
init(_data) {
|
|
735
|
+
super.init(_data);
|
|
736
|
+
if (_data) {
|
|
706
737
|
this.answer = _data['answer'];
|
|
707
738
|
if (Array.isArray(_data['scoredUrls'])) {
|
|
708
739
|
this.scoredUrls = [];
|
|
@@ -715,6 +746,11 @@ export class BotMessage {
|
|
|
715
746
|
this.modelVersion = _data['modelVersion'];
|
|
716
747
|
this.meta = _data['meta'];
|
|
717
748
|
this.confidenceScore = _data['confidenceScore'];
|
|
749
|
+
if (Array.isArray(_data['agentOptions'])) {
|
|
750
|
+
this.agentOptions = [];
|
|
751
|
+
for (let item of _data['agentOptions'])
|
|
752
|
+
this.agentOptions.push(AgentOption.fromJS(item));
|
|
753
|
+
}
|
|
718
754
|
}
|
|
719
755
|
}
|
|
720
756
|
static fromJS(data) {
|
|
@@ -725,9 +761,6 @@ export class BotMessage {
|
|
|
725
761
|
}
|
|
726
762
|
toJSON(data) {
|
|
727
763
|
data = typeof data === 'object' ? data : {};
|
|
728
|
-
data['id'] = this.id;
|
|
729
|
-
data['sessionId'] = this.sessionId;
|
|
730
|
-
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : undefined;
|
|
731
764
|
data['answer'] = this.answer;
|
|
732
765
|
if (Array.isArray(this.scoredUrls)) {
|
|
733
766
|
data['scoredUrls'] = [];
|
|
@@ -740,6 +773,12 @@ export class BotMessage {
|
|
|
740
773
|
data['modelVersion'] = this.modelVersion;
|
|
741
774
|
data['meta'] = this.meta;
|
|
742
775
|
data['confidenceScore'] = this.confidenceScore;
|
|
776
|
+
if (Array.isArray(this.agentOptions)) {
|
|
777
|
+
data['agentOptions'] = [];
|
|
778
|
+
for (let item of this.agentOptions)
|
|
779
|
+
data['agentOptions'].push(item.toJSON());
|
|
780
|
+
}
|
|
781
|
+
super.toJSON(data);
|
|
743
782
|
return data;
|
|
744
783
|
}
|
|
745
784
|
}
|
|
@@ -770,6 +809,12 @@ export class ExportHistoryMessage {
|
|
|
770
809
|
writable: true,
|
|
771
810
|
value: void 0
|
|
772
811
|
});
|
|
812
|
+
Object.defineProperty(this, "clientId", {
|
|
813
|
+
enumerable: true,
|
|
814
|
+
configurable: true,
|
|
815
|
+
writable: true,
|
|
816
|
+
value: void 0
|
|
817
|
+
});
|
|
773
818
|
Object.defineProperty(this, "userId", {
|
|
774
819
|
enumerable: true,
|
|
775
820
|
configurable: true,
|
|
@@ -874,6 +919,7 @@ export class ExportHistoryMessage {
|
|
|
874
919
|
this.timeStamp = _data['timeStamp']
|
|
875
920
|
? new Date(_data['timeStamp'].toString())
|
|
876
921
|
: undefined;
|
|
922
|
+
this.clientId = _data['clientId'];
|
|
877
923
|
this.userId = _data['userId'];
|
|
878
924
|
this.sessionStartTime = _data['sessionStartTime']
|
|
879
925
|
? new Date(_data['sessionStartTime'].toString())
|
|
@@ -908,6 +954,7 @@ export class ExportHistoryMessage {
|
|
|
908
954
|
data['id'] = this.id;
|
|
909
955
|
data['sessionId'] = this.sessionId;
|
|
910
956
|
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : undefined;
|
|
957
|
+
data['clientId'] = this.clientId;
|
|
911
958
|
data['userId'] = this.userId;
|
|
912
959
|
data['sessionStartTime'] = this.sessionStartTime
|
|
913
960
|
? this.sessionStartTime.toISOString()
|
|
@@ -1312,50 +1359,41 @@ export class Session {
|
|
|
1312
1359
|
return data;
|
|
1313
1360
|
}
|
|
1314
1361
|
}
|
|
1315
|
-
|
|
1316
|
-
export class UserMessage {
|
|
1362
|
+
export class SummarizeRequest {
|
|
1317
1363
|
constructor(data) {
|
|
1318
|
-
|
|
1319
|
-
Object.defineProperty(this, "id", {
|
|
1320
|
-
enumerable: true,
|
|
1321
|
-
configurable: true,
|
|
1322
|
-
writable: true,
|
|
1323
|
-
value: void 0
|
|
1324
|
-
});
|
|
1325
|
-
/** Session ID. Required in multi-turn conversations after the session is created. */
|
|
1326
|
-
Object.defineProperty(this, "sessionId", {
|
|
1327
|
-
enumerable: true,
|
|
1328
|
-
configurable: true,
|
|
1329
|
-
writable: true,
|
|
1330
|
-
value: void 0
|
|
1331
|
-
});
|
|
1332
|
-
Object.defineProperty(this, "timeStamp", {
|
|
1333
|
-
enumerable: true,
|
|
1334
|
-
configurable: true,
|
|
1335
|
-
writable: true,
|
|
1336
|
-
value: void 0
|
|
1337
|
-
});
|
|
1338
|
-
/** User question. */
|
|
1339
|
-
Object.defineProperty(this, "question", {
|
|
1340
|
-
enumerable: true,
|
|
1341
|
-
configurable: true,
|
|
1342
|
-
writable: true,
|
|
1343
|
-
value: void 0
|
|
1344
|
-
});
|
|
1345
|
-
Object.defineProperty(this, "experience", {
|
|
1346
|
-
enumerable: true,
|
|
1347
|
-
configurable: true,
|
|
1348
|
-
writable: true,
|
|
1349
|
-
value: void 0
|
|
1350
|
-
});
|
|
1351
|
-
Object.defineProperty(this, "selections", {
|
|
1364
|
+
Object.defineProperty(this, "text", {
|
|
1352
1365
|
enumerable: true,
|
|
1353
1366
|
configurable: true,
|
|
1354
1367
|
writable: true,
|
|
1355
1368
|
value: void 0
|
|
1356
1369
|
});
|
|
1357
|
-
|
|
1358
|
-
|
|
1370
|
+
if (data) {
|
|
1371
|
+
for (var property in data) {
|
|
1372
|
+
if (data.hasOwnProperty(property))
|
|
1373
|
+
this[property] = data[property];
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
init(_data) {
|
|
1378
|
+
if (_data) {
|
|
1379
|
+
this.text = _data['text'];
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
static fromJS(data) {
|
|
1383
|
+
data = typeof data === 'object' ? data : {};
|
|
1384
|
+
let result = new SummarizeRequest();
|
|
1385
|
+
result.init(data);
|
|
1386
|
+
return result;
|
|
1387
|
+
}
|
|
1388
|
+
toJSON(data) {
|
|
1389
|
+
data = typeof data === 'object' ? data : {};
|
|
1390
|
+
data['text'] = this.text;
|
|
1391
|
+
return data;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
export class SummarizeResponse {
|
|
1395
|
+
constructor(data) {
|
|
1396
|
+
Object.defineProperty(this, "summary", {
|
|
1359
1397
|
enumerable: true,
|
|
1360
1398
|
configurable: true,
|
|
1361
1399
|
writable: true,
|
|
@@ -1370,11 +1408,30 @@ export class UserMessage {
|
|
|
1370
1408
|
}
|
|
1371
1409
|
init(_data) {
|
|
1372
1410
|
if (_data) {
|
|
1373
|
-
this.
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1411
|
+
this.summary = _data['summary'];
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
static fromJS(data) {
|
|
1415
|
+
data = typeof data === 'object' ? data : {};
|
|
1416
|
+
let result = new SummarizeResponse();
|
|
1417
|
+
result.init(data);
|
|
1418
|
+
return result;
|
|
1419
|
+
}
|
|
1420
|
+
toJSON(data) {
|
|
1421
|
+
data = typeof data === 'object' ? data : {};
|
|
1422
|
+
data['summary'] = this.summary;
|
|
1423
|
+
return data;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
/** User request message. */
|
|
1427
|
+
export class UserMessage extends Message {
|
|
1428
|
+
constructor(data) {
|
|
1429
|
+
super(data);
|
|
1430
|
+
this._discriminator = 'UserMessage';
|
|
1431
|
+
}
|
|
1432
|
+
init(_data) {
|
|
1433
|
+
super.init(_data);
|
|
1434
|
+
if (_data) {
|
|
1378
1435
|
this.question = _data['question'];
|
|
1379
1436
|
this.experience = _data['experience'];
|
|
1380
1437
|
this.selections = _data['selections']
|
|
@@ -1397,9 +1454,6 @@ export class UserMessage {
|
|
|
1397
1454
|
}
|
|
1398
1455
|
toJSON(data) {
|
|
1399
1456
|
data = typeof data === 'object' ? data : {};
|
|
1400
|
-
data['id'] = this.id;
|
|
1401
|
-
data['sessionId'] = this.sessionId;
|
|
1402
|
-
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : undefined;
|
|
1403
1457
|
data['question'] = this.question;
|
|
1404
1458
|
data['experience'] = this.experience;
|
|
1405
1459
|
data['selections'] = this.selections ? this.selections.toJSON() : undefined;
|
|
@@ -1410,6 +1464,7 @@ export class UserMessage {
|
|
|
1410
1464
|
data['context'][key] = this.context[key];
|
|
1411
1465
|
}
|
|
1412
1466
|
}
|
|
1467
|
+
super.toJSON(data);
|
|
1413
1468
|
return data;
|
|
1414
1469
|
}
|
|
1415
1470
|
}
|
|
@@ -1468,7 +1523,4 @@ function throwException(message, status, response, headers, result) {
|
|
|
1468
1523
|
else
|
|
1469
1524
|
throw new ApiException(message, status, response, headers, null);
|
|
1470
1525
|
}
|
|
1471
|
-
function isAxiosError(obj) {
|
|
1472
|
-
return obj && obj.isAxiosError === true;
|
|
1473
|
-
}
|
|
1474
1526
|
//# sourceMappingURL=native-client.js.map
|