@digipair/skill-web-chatbot 0.37.5 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs2.js +656 -31
- package/index.esm2.js +651 -26
- package/libs/skill-web-chatbot/src/lib/chat.element.d.ts +1 -1
- package/libs/skill-web-chatbot/src/lib/digipair-full.element.d.ts +3 -1
- package/libs/skill-web-chatbot/src/lib/digipair.element.d.ts +3 -1
- package/package.json +1 -1
- package/debug.html +0 -18
package/index.cjs2.js
CHANGED
|
@@ -43,6 +43,526 @@ typeof SuppressedError === "function" ? SuppressedError : function _SuppressedEr
|
|
|
43
43
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
function asyncGeneratorStep$l(gen, resolve, reject, _next, _throw, key, arg) {
|
|
47
|
+
try {
|
|
48
|
+
var info = gen[key](arg);
|
|
49
|
+
var value = info.value;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
reject(error);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (info.done) {
|
|
55
|
+
resolve(value);
|
|
56
|
+
} else {
|
|
57
|
+
Promise.resolve(value).then(_next, _throw);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function _async_to_generator$l(fn) {
|
|
61
|
+
return function() {
|
|
62
|
+
var self = this, args = arguments;
|
|
63
|
+
return new Promise(function(resolve, reject) {
|
|
64
|
+
var gen = fn.apply(self, args);
|
|
65
|
+
function _next(value) {
|
|
66
|
+
asyncGeneratorStep$l(gen, resolve, reject, _next, _throw, "next", value);
|
|
67
|
+
}
|
|
68
|
+
function _throw(err) {
|
|
69
|
+
asyncGeneratorStep$l(gen, resolve, reject, _next, _throw, "throw", err);
|
|
70
|
+
}
|
|
71
|
+
_next(undefined);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function _ts_generator$m(thisArg, body) {
|
|
76
|
+
var f, y, t, g, _ = {
|
|
77
|
+
label: 0,
|
|
78
|
+
sent: function() {
|
|
79
|
+
if (t[0] & 1) throw t[1];
|
|
80
|
+
return t[1];
|
|
81
|
+
},
|
|
82
|
+
trys: [],
|
|
83
|
+
ops: []
|
|
84
|
+
};
|
|
85
|
+
return g = {
|
|
86
|
+
next: verb(0),
|
|
87
|
+
"throw": verb(1),
|
|
88
|
+
"return": verb(2)
|
|
89
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
90
|
+
return this;
|
|
91
|
+
}), g;
|
|
92
|
+
function verb(n) {
|
|
93
|
+
return function(v) {
|
|
94
|
+
return step([
|
|
95
|
+
n,
|
|
96
|
+
v
|
|
97
|
+
]);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function step(op) {
|
|
101
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
102
|
+
while(_)try {
|
|
103
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
104
|
+
if (y = 0, t) op = [
|
|
105
|
+
op[0] & 2,
|
|
106
|
+
t.value
|
|
107
|
+
];
|
|
108
|
+
switch(op[0]){
|
|
109
|
+
case 0:
|
|
110
|
+
case 1:
|
|
111
|
+
t = op;
|
|
112
|
+
break;
|
|
113
|
+
case 4:
|
|
114
|
+
_.label++;
|
|
115
|
+
return {
|
|
116
|
+
value: op[1],
|
|
117
|
+
done: false
|
|
118
|
+
};
|
|
119
|
+
case 5:
|
|
120
|
+
_.label++;
|
|
121
|
+
y = op[1];
|
|
122
|
+
op = [
|
|
123
|
+
0
|
|
124
|
+
];
|
|
125
|
+
continue;
|
|
126
|
+
case 7:
|
|
127
|
+
op = _.ops.pop();
|
|
128
|
+
_.trys.pop();
|
|
129
|
+
continue;
|
|
130
|
+
default:
|
|
131
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
132
|
+
_ = 0;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
136
|
+
_.label = op[1];
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
140
|
+
_.label = t[1];
|
|
141
|
+
t = op;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
if (t && _.label < t[2]) {
|
|
145
|
+
_.label = t[2];
|
|
146
|
+
_.ops.push(op);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
if (t[2]) _.ops.pop();
|
|
150
|
+
_.trys.pop();
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
op = body.call(thisArg, _);
|
|
154
|
+
} catch (e) {
|
|
155
|
+
op = [
|
|
156
|
+
6,
|
|
157
|
+
e
|
|
158
|
+
];
|
|
159
|
+
y = 0;
|
|
160
|
+
} finally{
|
|
161
|
+
f = t = 0;
|
|
162
|
+
}
|
|
163
|
+
if (op[0] & 5) throw op[1];
|
|
164
|
+
return {
|
|
165
|
+
value: op[0] ? op[1] : void 0,
|
|
166
|
+
done: true
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function getBytes(stream, onChunk) {
|
|
171
|
+
return _getBytes.apply(this, arguments);
|
|
172
|
+
}
|
|
173
|
+
function _getBytes() {
|
|
174
|
+
_getBytes = _async_to_generator$l(function(stream, onChunk) {
|
|
175
|
+
var reader, result;
|
|
176
|
+
return _ts_generator$m(this, function(_state) {
|
|
177
|
+
switch(_state.label){
|
|
178
|
+
case 0:
|
|
179
|
+
reader = stream.getReader();
|
|
180
|
+
_state.label = 1;
|
|
181
|
+
case 1:
|
|
182
|
+
return [
|
|
183
|
+
4,
|
|
184
|
+
reader.read()
|
|
185
|
+
];
|
|
186
|
+
case 2:
|
|
187
|
+
if (!!(result = _state.sent()).done) return [
|
|
188
|
+
3,
|
|
189
|
+
3
|
|
190
|
+
];
|
|
191
|
+
onChunk(result.value);
|
|
192
|
+
return [
|
|
193
|
+
3,
|
|
194
|
+
1
|
|
195
|
+
];
|
|
196
|
+
case 3:
|
|
197
|
+
return [
|
|
198
|
+
2
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
return _getBytes.apply(this, arguments);
|
|
204
|
+
}
|
|
205
|
+
function getLines(onLine) {
|
|
206
|
+
var buffer;
|
|
207
|
+
var position;
|
|
208
|
+
var fieldLength;
|
|
209
|
+
var discardTrailingNewline = false;
|
|
210
|
+
return function onChunk(arr) {
|
|
211
|
+
if (buffer === undefined) {
|
|
212
|
+
buffer = arr;
|
|
213
|
+
position = 0;
|
|
214
|
+
fieldLength = -1;
|
|
215
|
+
} else {
|
|
216
|
+
buffer = concat(buffer, arr);
|
|
217
|
+
}
|
|
218
|
+
var bufLength = buffer.length;
|
|
219
|
+
var lineStart = 0;
|
|
220
|
+
while(position < bufLength){
|
|
221
|
+
if (discardTrailingNewline) {
|
|
222
|
+
if (buffer[position] === 10) {
|
|
223
|
+
lineStart = ++position;
|
|
224
|
+
}
|
|
225
|
+
discardTrailingNewline = false;
|
|
226
|
+
}
|
|
227
|
+
var lineEnd = -1;
|
|
228
|
+
for(; position < bufLength && lineEnd === -1; ++position){
|
|
229
|
+
switch(buffer[position]){
|
|
230
|
+
case 58:
|
|
231
|
+
if (fieldLength === -1) {
|
|
232
|
+
fieldLength = position - lineStart;
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
case 13:
|
|
236
|
+
discardTrailingNewline = true;
|
|
237
|
+
case 10:
|
|
238
|
+
lineEnd = position;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (lineEnd === -1) {
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
onLine(buffer.subarray(lineStart, lineEnd), fieldLength);
|
|
246
|
+
lineStart = position;
|
|
247
|
+
fieldLength = -1;
|
|
248
|
+
}
|
|
249
|
+
if (lineStart === bufLength) {
|
|
250
|
+
buffer = undefined;
|
|
251
|
+
} else if (lineStart !== 0) {
|
|
252
|
+
buffer = buffer.subarray(lineStart);
|
|
253
|
+
position -= lineStart;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function getMessages(onId, onRetry, onMessage) {
|
|
258
|
+
var message = newMessage();
|
|
259
|
+
var decoder = new TextDecoder();
|
|
260
|
+
return function onLine(line, fieldLength) {
|
|
261
|
+
if (line.length === 0) {
|
|
262
|
+
onMessage === null || onMessage === void 0 ? void 0 : onMessage(message);
|
|
263
|
+
message = newMessage();
|
|
264
|
+
} else if (fieldLength > 0) {
|
|
265
|
+
var field = decoder.decode(line.subarray(0, fieldLength));
|
|
266
|
+
var valueOffset = fieldLength + (line[fieldLength + 1] === 32 ? 2 : 1);
|
|
267
|
+
var value = decoder.decode(line.subarray(valueOffset));
|
|
268
|
+
switch(field){
|
|
269
|
+
case "data":
|
|
270
|
+
message.data = message.data ? message.data + "\n" + value : value;
|
|
271
|
+
break;
|
|
272
|
+
case "event":
|
|
273
|
+
message.event = value;
|
|
274
|
+
break;
|
|
275
|
+
case "id":
|
|
276
|
+
onId(message.id = value);
|
|
277
|
+
break;
|
|
278
|
+
case "retry":
|
|
279
|
+
var retry = parseInt(value, 10);
|
|
280
|
+
if (!isNaN(retry)) {
|
|
281
|
+
onRetry(message.retry = retry);
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function concat(a, b) {
|
|
289
|
+
var res = new Uint8Array(a.length + b.length);
|
|
290
|
+
res.set(a);
|
|
291
|
+
res.set(b, a.length);
|
|
292
|
+
return res;
|
|
293
|
+
}
|
|
294
|
+
function newMessage() {
|
|
295
|
+
return {
|
|
296
|
+
data: "",
|
|
297
|
+
event: "",
|
|
298
|
+
id: "",
|
|
299
|
+
retry: undefined
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function asyncGeneratorStep$k(gen, resolve, reject, _next, _throw, key, arg) {
|
|
304
|
+
try {
|
|
305
|
+
var info = gen[key](arg);
|
|
306
|
+
var value = info.value;
|
|
307
|
+
} catch (error) {
|
|
308
|
+
reject(error);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (info.done) {
|
|
312
|
+
resolve(value);
|
|
313
|
+
} else {
|
|
314
|
+
Promise.resolve(value).then(_next, _throw);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function _async_to_generator$k(fn) {
|
|
318
|
+
return function() {
|
|
319
|
+
var self = this, args = arguments;
|
|
320
|
+
return new Promise(function(resolve, reject) {
|
|
321
|
+
var gen = fn.apply(self, args);
|
|
322
|
+
function _next(value) {
|
|
323
|
+
asyncGeneratorStep$k(gen, resolve, reject, _next, _throw, "next", value);
|
|
324
|
+
}
|
|
325
|
+
function _throw(err) {
|
|
326
|
+
asyncGeneratorStep$k(gen, resolve, reject, _next, _throw, "throw", err);
|
|
327
|
+
}
|
|
328
|
+
_next(undefined);
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function _ts_generator$l(thisArg, body) {
|
|
333
|
+
var f, y, t, g, _ = {
|
|
334
|
+
label: 0,
|
|
335
|
+
sent: function() {
|
|
336
|
+
if (t[0] & 1) throw t[1];
|
|
337
|
+
return t[1];
|
|
338
|
+
},
|
|
339
|
+
trys: [],
|
|
340
|
+
ops: []
|
|
341
|
+
};
|
|
342
|
+
return g = {
|
|
343
|
+
next: verb(0),
|
|
344
|
+
"throw": verb(1),
|
|
345
|
+
"return": verb(2)
|
|
346
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
347
|
+
return this;
|
|
348
|
+
}), g;
|
|
349
|
+
function verb(n) {
|
|
350
|
+
return function(v) {
|
|
351
|
+
return step([
|
|
352
|
+
n,
|
|
353
|
+
v
|
|
354
|
+
]);
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function step(op) {
|
|
358
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
359
|
+
while(_)try {
|
|
360
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
361
|
+
if (y = 0, t) op = [
|
|
362
|
+
op[0] & 2,
|
|
363
|
+
t.value
|
|
364
|
+
];
|
|
365
|
+
switch(op[0]){
|
|
366
|
+
case 0:
|
|
367
|
+
case 1:
|
|
368
|
+
t = op;
|
|
369
|
+
break;
|
|
370
|
+
case 4:
|
|
371
|
+
_.label++;
|
|
372
|
+
return {
|
|
373
|
+
value: op[1],
|
|
374
|
+
done: false
|
|
375
|
+
};
|
|
376
|
+
case 5:
|
|
377
|
+
_.label++;
|
|
378
|
+
y = op[1];
|
|
379
|
+
op = [
|
|
380
|
+
0
|
|
381
|
+
];
|
|
382
|
+
continue;
|
|
383
|
+
case 7:
|
|
384
|
+
op = _.ops.pop();
|
|
385
|
+
_.trys.pop();
|
|
386
|
+
continue;
|
|
387
|
+
default:
|
|
388
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
389
|
+
_ = 0;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
393
|
+
_.label = op[1];
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
397
|
+
_.label = t[1];
|
|
398
|
+
t = op;
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
if (t && _.label < t[2]) {
|
|
402
|
+
_.label = t[2];
|
|
403
|
+
_.ops.push(op);
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
if (t[2]) _.ops.pop();
|
|
407
|
+
_.trys.pop();
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
op = body.call(thisArg, _);
|
|
411
|
+
} catch (e) {
|
|
412
|
+
op = [
|
|
413
|
+
6,
|
|
414
|
+
e
|
|
415
|
+
];
|
|
416
|
+
y = 0;
|
|
417
|
+
} finally{
|
|
418
|
+
f = t = 0;
|
|
419
|
+
}
|
|
420
|
+
if (op[0] & 5) throw op[1];
|
|
421
|
+
return {
|
|
422
|
+
value: op[0] ? op[1] : void 0,
|
|
423
|
+
done: true
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
var __rest = undefined && undefined.__rest || function(s, e) {
|
|
428
|
+
var t = {};
|
|
429
|
+
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
430
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++){
|
|
431
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
432
|
+
}
|
|
433
|
+
return t;
|
|
434
|
+
};
|
|
435
|
+
var EventStreamContentType = "text/event-stream";
|
|
436
|
+
var DefaultRetryInterval = 1000;
|
|
437
|
+
var LastEventId = "last-event-id";
|
|
438
|
+
function fetchEventSource(input, _a) {
|
|
439
|
+
var inputSignal = _a.signal, inputHeaders = _a.headers, inputOnOpen = _a.onopen, onmessage = _a.onmessage, onclose = _a.onclose, onerror = _a.onerror, openWhenHidden = _a.openWhenHidden, inputFetch = _a.fetch, rest = __rest(_a, [
|
|
440
|
+
"signal",
|
|
441
|
+
"headers",
|
|
442
|
+
"onopen",
|
|
443
|
+
"onmessage",
|
|
444
|
+
"onclose",
|
|
445
|
+
"onerror",
|
|
446
|
+
"openWhenHidden",
|
|
447
|
+
"fetch"
|
|
448
|
+
]);
|
|
449
|
+
return new Promise(function(resolve, reject) {
|
|
450
|
+
var onVisibilityChange = function onVisibilityChange() {
|
|
451
|
+
curRequestController.abort();
|
|
452
|
+
if (!document.hidden) {
|
|
453
|
+
create();
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
var dispose = function dispose() {
|
|
457
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
458
|
+
window.clearTimeout(retryTimer);
|
|
459
|
+
curRequestController.abort();
|
|
460
|
+
};
|
|
461
|
+
var create = function create() {
|
|
462
|
+
return _create.apply(this, arguments);
|
|
463
|
+
};
|
|
464
|
+
var headers = Object.assign({}, inputHeaders);
|
|
465
|
+
if (!headers.accept) {
|
|
466
|
+
headers.accept = EventStreamContentType;
|
|
467
|
+
}
|
|
468
|
+
var curRequestController;
|
|
469
|
+
if (!openWhenHidden) {
|
|
470
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
471
|
+
}
|
|
472
|
+
var retryInterval = DefaultRetryInterval;
|
|
473
|
+
var retryTimer = 0;
|
|
474
|
+
inputSignal === null || inputSignal === void 0 ? void 0 : inputSignal.addEventListener("abort", function() {
|
|
475
|
+
dispose();
|
|
476
|
+
resolve();
|
|
477
|
+
});
|
|
478
|
+
var fetch = inputFetch !== null && inputFetch !== void 0 ? inputFetch : window.fetch;
|
|
479
|
+
var onopen = inputOnOpen !== null && inputOnOpen !== void 0 ? inputOnOpen : defaultOnOpen;
|
|
480
|
+
function _create() {
|
|
481
|
+
_create = _async_to_generator$k(function() {
|
|
482
|
+
var _$_a, response, err, interval;
|
|
483
|
+
return _ts_generator$l(this, function(_state) {
|
|
484
|
+
switch(_state.label){
|
|
485
|
+
case 0:
|
|
486
|
+
curRequestController = new AbortController();
|
|
487
|
+
_state.label = 1;
|
|
488
|
+
case 1:
|
|
489
|
+
_state.trys.push([
|
|
490
|
+
1,
|
|
491
|
+
5,
|
|
492
|
+
,
|
|
493
|
+
6
|
|
494
|
+
]);
|
|
495
|
+
return [
|
|
496
|
+
4,
|
|
497
|
+
fetch(input, Object.assign(Object.assign({}, rest), {
|
|
498
|
+
headers: headers,
|
|
499
|
+
signal: curRequestController.signal
|
|
500
|
+
}))
|
|
501
|
+
];
|
|
502
|
+
case 2:
|
|
503
|
+
response = _state.sent();
|
|
504
|
+
return [
|
|
505
|
+
4,
|
|
506
|
+
onopen(response)
|
|
507
|
+
];
|
|
508
|
+
case 3:
|
|
509
|
+
_state.sent();
|
|
510
|
+
return [
|
|
511
|
+
4,
|
|
512
|
+
getBytes(response.body, getLines(getMessages(function(id) {
|
|
513
|
+
if (id) {
|
|
514
|
+
headers[LastEventId] = id;
|
|
515
|
+
} else {
|
|
516
|
+
delete headers[LastEventId];
|
|
517
|
+
}
|
|
518
|
+
}, function(retry) {
|
|
519
|
+
retryInterval = retry;
|
|
520
|
+
}, onmessage)))
|
|
521
|
+
];
|
|
522
|
+
case 4:
|
|
523
|
+
_state.sent();
|
|
524
|
+
onclose === null || onclose === void 0 ? void 0 : onclose();
|
|
525
|
+
dispose();
|
|
526
|
+
resolve();
|
|
527
|
+
return [
|
|
528
|
+
3,
|
|
529
|
+
6
|
|
530
|
+
];
|
|
531
|
+
case 5:
|
|
532
|
+
err = _state.sent();
|
|
533
|
+
if (!curRequestController.signal.aborted) {
|
|
534
|
+
try {
|
|
535
|
+
interval = (_$_a = onerror === null || onerror === void 0 ? void 0 : onerror(err)) !== null && _$_a !== void 0 ? _$_a : retryInterval;
|
|
536
|
+
window.clearTimeout(retryTimer);
|
|
537
|
+
retryTimer = window.setTimeout(create, interval);
|
|
538
|
+
} catch (innerErr) {
|
|
539
|
+
dispose();
|
|
540
|
+
reject(innerErr);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return [
|
|
544
|
+
3,
|
|
545
|
+
6
|
|
546
|
+
];
|
|
547
|
+
case 6:
|
|
548
|
+
return [
|
|
549
|
+
2
|
|
550
|
+
];
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
return _create.apply(this, arguments);
|
|
555
|
+
}
|
|
556
|
+
create();
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
function defaultOnOpen(response) {
|
|
560
|
+
var contentType = response.headers.get("content-type");
|
|
561
|
+
if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith(EventStreamContentType))) {
|
|
562
|
+
throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(contentType));
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
46
566
|
/**
|
|
47
567
|
* Returns a singleton HTML element, inserted in given parent element of HTML page,
|
|
48
568
|
* used mostly to store and share global resources between multiple UI5 Web Components runtimes.
|
|
@@ -36822,14 +37342,14 @@ function indent(str, spaces) {
|
|
|
36822
37342
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
36823
37343
|
// match is required
|
|
36824
37344
|
if (!match) {
|
|
36825
|
-
return
|
|
37345
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
36826
37346
|
v: nextMatch1
|
|
36827
37347
|
};
|
|
36828
37348
|
}
|
|
36829
37349
|
var token = match.token, offset = match.offset;
|
|
36830
37350
|
i1 += offset;
|
|
36831
37351
|
if (token === " ") {
|
|
36832
|
-
return
|
|
37352
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
36833
37353
|
}
|
|
36834
37354
|
tokens1 = _to_consumable_array$c(tokens1).concat([
|
|
36835
37355
|
token
|
|
@@ -36848,7 +37368,7 @@ function indent(str, spaces) {
|
|
|
36848
37368
|
if (contextKeys.some(function(el) {
|
|
36849
37369
|
return el.startsWith(name);
|
|
36850
37370
|
})) {
|
|
36851
|
-
return
|
|
37371
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
36852
37372
|
}
|
|
36853
37373
|
if (dateTimeIdentifiers.some(function(el) {
|
|
36854
37374
|
return el === name;
|
|
@@ -36867,9 +37387,9 @@ function indent(str, spaces) {
|
|
|
36867
37387
|
if (dateTimeIdentifiers.some(function(el) {
|
|
36868
37388
|
return el.startsWith(name);
|
|
36869
37389
|
})) {
|
|
36870
|
-
return
|
|
37390
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
36871
37391
|
}
|
|
36872
|
-
return
|
|
37392
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
36873
37393
|
v: nextMatch1
|
|
36874
37394
|
};
|
|
36875
37395
|
};
|
|
@@ -56870,7 +57390,9 @@ class ChatElement extends s$3 {
|
|
|
56870
57390
|
.context=${_extends({}, this.context, ((_this_currentBoost1 = this.currentBoost) == null ? void 0 : _this_currentBoost1.context) || {})}
|
|
56871
57391
|
></digipair-chatbot-inputs>
|
|
56872
57392
|
|
|
56873
|
-
${!this.loading ? T : x`<section class="loading"
|
|
57393
|
+
${!this.loading ? T : x`<section class="loading">
|
|
57394
|
+
<span class="step">${this.loadingStep}</span><img src=${WRITTING_IMAGE} />
|
|
57395
|
+
</section>`}
|
|
56874
57396
|
</section>
|
|
56875
57397
|
|
|
56876
57398
|
<section class="input-container ${this.currentBoost ? 'with-boost' : ''}">
|
|
@@ -56913,7 +57435,6 @@ class ChatElement extends s$3 {
|
|
|
56913
57435
|
constructor(...args){
|
|
56914
57436
|
super(...args);
|
|
56915
57437
|
this.previousMessages = '';
|
|
56916
|
-
this.previousCurrentBoostText = undefined;
|
|
56917
57438
|
}
|
|
56918
57439
|
}
|
|
56919
57440
|
ChatElement.styles = [
|
|
@@ -57106,6 +57627,7 @@ ChatElement.styles = [
|
|
|
57106
57627
|
max-width: 100%;
|
|
57107
57628
|
width: 235px;
|
|
57108
57629
|
overflow: hidden;
|
|
57630
|
+
opacity: 0.3;
|
|
57109
57631
|
}
|
|
57110
57632
|
|
|
57111
57633
|
.input .assistant p {
|
|
@@ -57117,6 +57639,21 @@ ChatElement.styles = [
|
|
|
57117
57639
|
.button.action {
|
|
57118
57640
|
float: right;
|
|
57119
57641
|
}
|
|
57642
|
+
|
|
57643
|
+
.loading {
|
|
57644
|
+
overflow: visible;
|
|
57645
|
+
}
|
|
57646
|
+
|
|
57647
|
+
.loading .step {
|
|
57648
|
+
color: #bfc1c3;
|
|
57649
|
+
margin-left: 45px;
|
|
57650
|
+
padding-top: 15px;
|
|
57651
|
+
display: block;
|
|
57652
|
+
}
|
|
57653
|
+
|
|
57654
|
+
.loading img {
|
|
57655
|
+
float: left;
|
|
57656
|
+
}
|
|
57120
57657
|
`
|
|
57121
57658
|
];
|
|
57122
57659
|
__decorate$3([
|
|
@@ -57151,6 +57688,10 @@ __decorate$3([
|
|
|
57151
57688
|
__metadata("design:paramtypes", []),
|
|
57152
57689
|
__metadata("design:returntype", Array)
|
|
57153
57690
|
], ChatElement.prototype, "inputs", null);
|
|
57691
|
+
__decorate$3([
|
|
57692
|
+
n$3(),
|
|
57693
|
+
__metadata("design:type", String)
|
|
57694
|
+
], ChatElement.prototype, "loadingStep", void 0);
|
|
57154
57695
|
__decorate$3([
|
|
57155
57696
|
e$2('#messageInput'),
|
|
57156
57697
|
__metadata("design:type", typeof HTMLInputElement === "undefined" ? Object : HTMLInputElement)
|
|
@@ -58614,14 +59155,24 @@ const config = {
|
|
|
58614
59155
|
}
|
|
58615
59156
|
};
|
|
58616
59157
|
|
|
58617
|
-
let API_URL$1;
|
|
58618
59158
|
class ChatbotElement extends s$3 {
|
|
59159
|
+
CHAT_COMMAND(digipair, reasoning) {
|
|
59160
|
+
return {
|
|
59161
|
+
library: '@digipair/actions-chatbot',
|
|
59162
|
+
element: 'executeRemoteReasoning',
|
|
59163
|
+
properties: {
|
|
59164
|
+
digipair,
|
|
59165
|
+
reasoning: reasoning != null ? reasoning : 'conversation',
|
|
59166
|
+
apiUrl: this.apiUrl
|
|
59167
|
+
}
|
|
59168
|
+
};
|
|
59169
|
+
}
|
|
58619
59170
|
connectedCallback() {
|
|
58620
|
-
API_URL$1 = this.apiUrl;
|
|
58621
59171
|
super.connectedCallback();
|
|
58622
59172
|
this.loadUser();
|
|
58623
59173
|
this.boostListener();
|
|
58624
59174
|
this.externalBoostListener();
|
|
59175
|
+
this.initializeSSE();
|
|
58625
59176
|
document.addEventListener('click', this.blurEvent);
|
|
58626
59177
|
}
|
|
58627
59178
|
disconnectedCallback() {
|
|
@@ -58634,6 +59185,40 @@ class ChatbotElement extends s$3 {
|
|
|
58634
59185
|
}, detail)), 1);
|
|
58635
59186
|
});
|
|
58636
59187
|
}
|
|
59188
|
+
initializeSSE() {
|
|
59189
|
+
const digipair = this.code;
|
|
59190
|
+
const reasoning = 'notification';
|
|
59191
|
+
fetchEventSource(`${this.apiUrl}/${digipair}/${reasoning}`, {
|
|
59192
|
+
method: 'POST',
|
|
59193
|
+
headers: {
|
|
59194
|
+
'Content-Type': 'application/json'
|
|
59195
|
+
},
|
|
59196
|
+
onmessage: (message)=>{
|
|
59197
|
+
if (message.event !== 'message') {
|
|
59198
|
+
return;
|
|
59199
|
+
}
|
|
59200
|
+
const data = JSON.parse(message.data);
|
|
59201
|
+
if (data.type === 'step') {
|
|
59202
|
+
this.loadingStep = message.content.step;
|
|
59203
|
+
}
|
|
59204
|
+
if (data.type === 'message') {
|
|
59205
|
+
this.pushMessage(data.content);
|
|
59206
|
+
}
|
|
59207
|
+
},
|
|
59208
|
+
body: JSON.stringify({
|
|
59209
|
+
userId: this.userId
|
|
59210
|
+
}),
|
|
59211
|
+
async onopen (response) {
|
|
59212
|
+
console.log('open', response);
|
|
59213
|
+
},
|
|
59214
|
+
onclose () {
|
|
59215
|
+
console.log('close');
|
|
59216
|
+
},
|
|
59217
|
+
onerror (err) {
|
|
59218
|
+
console.error('Error:', err);
|
|
59219
|
+
}
|
|
59220
|
+
});
|
|
59221
|
+
}
|
|
58637
59222
|
loadUser() {
|
|
58638
59223
|
this.newUser = false;
|
|
58639
59224
|
if (this.userId) {
|
|
@@ -58726,6 +59311,7 @@ class ChatbotElement extends s$3 {
|
|
|
58726
59311
|
}
|
|
58727
59312
|
async execute(boost, message) {
|
|
58728
59313
|
var _boost_command_properties_input, _boost_command_properties, _boost_command;
|
|
59314
|
+
this.loadingStep = '';
|
|
58729
59315
|
this.loading = true;
|
|
58730
59316
|
if (message || (boost == null ? void 0 : (_boost_command = boost.command) == null ? void 0 : (_boost_command_properties = _boost_command.properties) == null ? void 0 : (_boost_command_properties_input = _boost_command_properties.input) == null ? void 0 : _boost_command_properties_input.prompt)) {
|
|
58731
59317
|
this.messages.push({
|
|
@@ -58780,6 +59366,7 @@ class ChatbotElement extends s$3 {
|
|
|
58780
59366
|
content: 'Oops...'
|
|
58781
59367
|
});
|
|
58782
59368
|
}
|
|
59369
|
+
this.loadingStep = '';
|
|
58783
59370
|
this.loading = false;
|
|
58784
59371
|
}
|
|
58785
59372
|
executeBoost(boost) {
|
|
@@ -58838,6 +59425,7 @@ class ChatbotElement extends s$3 {
|
|
|
58838
59425
|
config: this.metadata.config,
|
|
58839
59426
|
variables: this.metadata.variables
|
|
58840
59427
|
}}
|
|
59428
|
+
currentStep=${this.loadingStep}
|
|
58841
59429
|
@prompt=${(event)=>this.execute(this.currentBoost, event.detail.prompt)}
|
|
58842
59430
|
@boost=${(event)=>this.setBoost(event.detail)}
|
|
58843
59431
|
></digipair-chatbot-chat>
|
|
@@ -58877,15 +59465,7 @@ class ChatbotElement extends s$3 {
|
|
|
58877
59465
|
this.resultState = 'open';
|
|
58878
59466
|
this.currentBoost = null;
|
|
58879
59467
|
this.messages = [];
|
|
58880
|
-
this.
|
|
58881
|
-
library: '@digipair/actions-chatbot',
|
|
58882
|
-
element: 'executeRemoteReasoning',
|
|
58883
|
-
properties: {
|
|
58884
|
-
digipair,
|
|
58885
|
-
reasoning: reasoning != null ? reasoning : 'conversation',
|
|
58886
|
-
apiUrl: API_URL$1
|
|
58887
|
-
}
|
|
58888
|
-
});
|
|
59468
|
+
this.loadingStep = '';
|
|
58889
59469
|
this.alreadyOpened = false;
|
|
58890
59470
|
this.isDigipairLoading = false;
|
|
58891
59471
|
this.blurEvent = (event)=>{
|
|
@@ -58897,7 +59477,7 @@ class ChatbotElement extends s$3 {
|
|
|
58897
59477
|
};
|
|
58898
59478
|
this.executeScene = async (reasoning, input = {})=>{
|
|
58899
59479
|
const digipair = this.code;
|
|
58900
|
-
const response = await fetch(`${
|
|
59480
|
+
const response = await fetch(`${this.apiUrl}/${digipair}/${reasoning}`, {
|
|
58901
59481
|
method: 'POST',
|
|
58902
59482
|
headers: {
|
|
58903
59483
|
'Content-Type': 'application/json'
|
|
@@ -58940,6 +59520,9 @@ __decorate$3([
|
|
|
58940
59520
|
r$1(),
|
|
58941
59521
|
__metadata("design:type", Array)
|
|
58942
59522
|
], ChatbotElement.prototype, "messages", void 0);
|
|
59523
|
+
__decorate$3([
|
|
59524
|
+
r$1()
|
|
59525
|
+
], ChatbotElement.prototype, "loadingStep", void 0);
|
|
58943
59526
|
__decorate$3([
|
|
58944
59527
|
e$2('digipair-chatbot-chat'),
|
|
58945
59528
|
__metadata("design:type", typeof ChatElement === "undefined" ? Object : ChatElement)
|
|
@@ -59091,13 +59674,57 @@ const styles = i$5`
|
|
|
59091
59674
|
|
|
59092
59675
|
*/
|
|
59093
59676
|
|
|
59094
|
-
let API_URL;
|
|
59095
59677
|
class DigipairFullElement extends s$3 {
|
|
59678
|
+
CHAT_COMMAND(digipair, reasoning) {
|
|
59679
|
+
return {
|
|
59680
|
+
library: '@digipair/actions-chatbot',
|
|
59681
|
+
element: 'executeRemoteReasoning',
|
|
59682
|
+
properties: {
|
|
59683
|
+
digipair,
|
|
59684
|
+
reasoning: reasoning != null ? reasoning : 'conversation',
|
|
59685
|
+
apiUrl: this.apiUrl
|
|
59686
|
+
}
|
|
59687
|
+
};
|
|
59688
|
+
}
|
|
59096
59689
|
connectedCallback() {
|
|
59097
|
-
API_URL = this.apiUrl;
|
|
59098
59690
|
super.connectedCallback();
|
|
59099
59691
|
this.loadUser();
|
|
59100
59692
|
this.loadBoosters();
|
|
59693
|
+
this.initializeSSE();
|
|
59694
|
+
}
|
|
59695
|
+
initializeSSE() {
|
|
59696
|
+
const digipair = this.code;
|
|
59697
|
+
const reasoning = 'notification';
|
|
59698
|
+
fetchEventSource(`${this.apiUrl}/${digipair}/${reasoning}`, {
|
|
59699
|
+
method: 'POST',
|
|
59700
|
+
headers: {
|
|
59701
|
+
'Content-Type': 'application/json'
|
|
59702
|
+
},
|
|
59703
|
+
onmessage: (message)=>{
|
|
59704
|
+
if (message.event !== 'message') {
|
|
59705
|
+
return;
|
|
59706
|
+
}
|
|
59707
|
+
const data = JSON.parse(message.data);
|
|
59708
|
+
if (data.type === 'step') {
|
|
59709
|
+
this.loadingStep = message.content.step;
|
|
59710
|
+
}
|
|
59711
|
+
if (data.type === 'message') {
|
|
59712
|
+
this.pushMessage(data.content);
|
|
59713
|
+
}
|
|
59714
|
+
},
|
|
59715
|
+
body: JSON.stringify({
|
|
59716
|
+
userId: this.userId
|
|
59717
|
+
}),
|
|
59718
|
+
async onopen (response) {
|
|
59719
|
+
console.log('open', response);
|
|
59720
|
+
},
|
|
59721
|
+
onclose () {
|
|
59722
|
+
console.log('close');
|
|
59723
|
+
},
|
|
59724
|
+
onerror (err) {
|
|
59725
|
+
console.error('Error:', err);
|
|
59726
|
+
}
|
|
59727
|
+
});
|
|
59101
59728
|
}
|
|
59102
59729
|
loadUser() {
|
|
59103
59730
|
if (this.userId) {
|
|
@@ -59152,6 +59779,7 @@ class DigipairFullElement extends s$3 {
|
|
|
59152
59779
|
}
|
|
59153
59780
|
async execute(boost, message) {
|
|
59154
59781
|
var _boost_command_properties_input, _boost_command_properties, _boost_command;
|
|
59782
|
+
this.loadingStep = '';
|
|
59155
59783
|
this.loading = true;
|
|
59156
59784
|
if (message || (boost == null ? void 0 : (_boost_command = boost.command) == null ? void 0 : (_boost_command_properties = _boost_command.properties) == null ? void 0 : (_boost_command_properties_input = _boost_command_properties.input) == null ? void 0 : _boost_command_properties_input.prompt)) {
|
|
59157
59785
|
this.messages.push({
|
|
@@ -59213,6 +59841,7 @@ class DigipairFullElement extends s$3 {
|
|
|
59213
59841
|
content: 'Oops...'
|
|
59214
59842
|
});
|
|
59215
59843
|
}
|
|
59844
|
+
this.loadingStep = '';
|
|
59216
59845
|
this.loading = false;
|
|
59217
59846
|
}
|
|
59218
59847
|
executeBoost(boost) {
|
|
@@ -59268,6 +59897,7 @@ class DigipairFullElement extends s$3 {
|
|
|
59268
59897
|
config: this.metadata.config,
|
|
59269
59898
|
variables: this.metadata.variables
|
|
59270
59899
|
}}
|
|
59900
|
+
currentStep=${this.loadingStep}
|
|
59271
59901
|
@prompt=${(event)=>this.execute(this.currentBoost, event.detail.prompt)}
|
|
59272
59902
|
@boost=${(event)=>this.setBoost(event.detail)}
|
|
59273
59903
|
></digipair-chatbot-chat>
|
|
@@ -59319,20 +59949,12 @@ class DigipairFullElement extends s$3 {
|
|
|
59319
59949
|
this.loading = false;
|
|
59320
59950
|
this.currentBoost = null;
|
|
59321
59951
|
this.messages = [];
|
|
59322
|
-
this.
|
|
59323
|
-
library: '@digipair/actions-chatbot',
|
|
59324
|
-
element: 'executeRemoteReasoning',
|
|
59325
|
-
properties: {
|
|
59326
|
-
digipair,
|
|
59327
|
-
reasoning: reasoning != null ? reasoning : 'conversation',
|
|
59328
|
-
apiUrl: API_URL
|
|
59329
|
-
}
|
|
59330
|
-
});
|
|
59952
|
+
this.loadingStep = '';
|
|
59331
59953
|
this.cacheBoosters = [];
|
|
59332
59954
|
this.isDigipairLoading = false;
|
|
59333
59955
|
this.executeScene = async (reasoning, input = {})=>{
|
|
59334
59956
|
const digipair = this.code;
|
|
59335
|
-
const response = await fetch(`${
|
|
59957
|
+
const response = await fetch(`${this.apiUrl}/${digipair}/${reasoning}`, {
|
|
59336
59958
|
method: 'POST',
|
|
59337
59959
|
headers: {
|
|
59338
59960
|
'Content-Type': 'application/json'
|
|
@@ -59369,6 +59991,9 @@ __decorate$3([
|
|
|
59369
59991
|
r$1(),
|
|
59370
59992
|
__metadata("design:type", Array)
|
|
59371
59993
|
], DigipairFullElement.prototype, "messages", void 0);
|
|
59994
|
+
__decorate$3([
|
|
59995
|
+
r$1()
|
|
59996
|
+
], DigipairFullElement.prototype, "loadingStep", void 0);
|
|
59372
59997
|
__decorate$3([
|
|
59373
59998
|
e$2('digipair-chatbot-chat'),
|
|
59374
59999
|
__metadata("design:type", typeof ChatElement === "undefined" ? Object : ChatElement)
|