deep-chat-dev 9.0.3 → 9.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +1070 -1382
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +946 -874
- package/dist/services/serviceIO.d.ts +4 -3
- package/dist/services/serviceIO.d.ts.map +1 -1
- package/dist/services/utils/baseServiceIO.d.ts +0 -1
- package/dist/services/utils/baseServiceIO.d.ts.map +1 -1
- package/dist/types/handler.d.ts +9 -10
- package/dist/types/handler.d.ts.map +1 -1
- package/dist/types/request.d.ts +1 -2
- package/dist/types/request.d.ts.map +1 -1
- package/dist/utils/HTTP/customHandler.d.ts +7 -0
- package/dist/utils/HTTP/customHandler.d.ts.map +1 -1
- package/dist/utils/HTTP/websocket.d.ts +3 -1
- package/dist/utils/HTTP/websocket.d.ts.map +1 -1
- package/dist/views/chat/input/buttons/submit/submitButton.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +2 -2
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -319,130 +319,38 @@ function getInvalidResponseMessage(r, e, t, n) {
|
|
319
319
|
return "".concat(s + o, "Make sure the ").concat(e, " message is using the Response format: https://deepchat.dev/docs/connect/#Response \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
|
320
320
|
}
|
321
321
|
var ErrorMessages = {
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
function D() {
|
329
|
-
_classCallCheck(this, D);
|
330
|
-
}
|
331
|
-
_createClass(D, null, [{
|
332
|
-
key: "temporarilyRemoveHeader",
|
333
|
-
value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
|
334
|
-
// prettier-ignore
|
335
|
-
function () {
|
336
|
-
var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, t, n) {
|
337
|
-
var s;
|
338
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
339
|
-
while (1) switch (_context.prev = _context.next) {
|
340
|
-
case 0:
|
341
|
-
if (e != null && e.headers) {
|
342
|
-
_context.next = 2;
|
343
|
-
break;
|
344
|
-
}
|
345
|
-
throw new Error("Request settings have not been set up");
|
346
|
-
case 2:
|
347
|
-
s = e.headers[D.CONTENT_TYPE];
|
348
|
-
delete e.headers[D.CONTENT_TYPE];
|
349
|
-
_context.next = 6;
|
350
|
-
return t(n);
|
351
|
-
case 6:
|
352
|
-
e.headers[D.CONTENT_TYPE] = s;
|
353
|
-
case 7:
|
354
|
-
case "end":
|
355
|
-
return _context.stop();
|
356
|
-
}
|
357
|
-
}, _callee);
|
358
|
-
}));
|
359
|
-
function temporarilyRemoveHeader(_x, _x2, _x3) {
|
360
|
-
return _temporarilyRemoveHeader.apply(this, arguments);
|
361
|
-
}
|
362
|
-
return temporarilyRemoveHeader;
|
363
|
-
}()
|
364
|
-
}, {
|
365
|
-
key: "displayError",
|
366
|
-
value: function displayError(e, t) {
|
367
|
-
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
|
368
|
-
if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
|
369
|
-
e.addNewErrorMessage("service", t);
|
370
|
-
}
|
371
|
-
}, {
|
372
|
-
key: "processResponseByType",
|
373
|
-
value: function processResponseByType(e) {
|
374
|
-
var t = e.headers.get("content-type");
|
375
|
-
return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
|
376
|
-
}
|
377
|
-
}, {
|
378
|
-
key: "processRequestInterceptor",
|
379
|
-
value: function () {
|
380
|
-
var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
|
381
|
-
var a, n, s, o;
|
382
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
383
|
-
while (1) switch (_context2.prev = _context2.next) {
|
384
|
-
case 0:
|
385
|
-
_context2.next = 2;
|
386
|
-
return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
|
387
|
-
case 2:
|
388
|
-
_context2.t0 = _context2.sent;
|
389
|
-
if (_context2.t0) {
|
390
|
-
_context2.next = 5;
|
391
|
-
break;
|
392
|
-
}
|
393
|
-
_context2.t0 = t;
|
394
|
-
case 5:
|
395
|
-
n = _context2.t0;
|
396
|
-
s = n;
|
397
|
-
o = n;
|
398
|
-
return _context2.abrupt("return", {
|
399
|
-
body: s.body,
|
400
|
-
headers: s.headers,
|
401
|
-
error: o.error
|
402
|
-
});
|
403
|
-
case 9:
|
404
|
-
case "end":
|
405
|
-
return _context2.stop();
|
406
|
-
}
|
407
|
-
}, _callee2);
|
408
|
-
}));
|
409
|
-
function processRequestInterceptor(_x4, _x5) {
|
410
|
-
return _processRequestInterceptor.apply(this, arguments);
|
411
|
-
}
|
412
|
-
return processRequestInterceptor;
|
413
|
-
}()
|
414
|
-
}]);
|
415
|
-
return D;
|
416
|
-
}();
|
417
|
-
_RequestUtils.CONTENT_TYPE = "Content-Type";
|
418
|
-
var RequestUtils = _RequestUtils;
|
419
|
-
function getBytes(_x6, _x7) {
|
322
|
+
INVALID_KEY: "Invalid API Key",
|
323
|
+
CONNECTION_FAILED: "Failed to connect",
|
324
|
+
INVALID_RESPONSE: getInvalidResponseMessage,
|
325
|
+
INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
|
326
|
+
};
|
327
|
+
function getBytes(_x, _x2) {
|
420
328
|
return _getBytes.apply(this, arguments);
|
421
329
|
}
|
422
330
|
function _getBytes() {
|
423
|
-
_getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
331
|
+
_getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(r, e) {
|
424
332
|
var t, n;
|
425
|
-
return _regeneratorRuntime().wrap(function
|
426
|
-
while (1) switch (
|
333
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
334
|
+
while (1) switch (_context75.prev = _context75.next) {
|
427
335
|
case 0:
|
428
336
|
t = r.getReader();
|
429
337
|
case 1:
|
430
|
-
|
338
|
+
_context75.next = 3;
|
431
339
|
return t.read();
|
432
340
|
case 3:
|
433
|
-
if ((n =
|
434
|
-
|
341
|
+
if ((n = _context75.sent).done) {
|
342
|
+
_context75.next = 7;
|
435
343
|
break;
|
436
344
|
}
|
437
345
|
e(n.value);
|
438
346
|
case 5:
|
439
|
-
|
347
|
+
_context75.next = 1;
|
440
348
|
break;
|
441
349
|
case 7:
|
442
350
|
case "end":
|
443
|
-
return
|
351
|
+
return _context75.stop();
|
444
352
|
}
|
445
|
-
},
|
353
|
+
}, _callee75);
|
446
354
|
}));
|
447
355
|
return _getBytes.apply(this, arguments);
|
448
356
|
}
|
@@ -531,9 +439,9 @@ function fetchEventSource(r, e) {
|
|
531
439
|
c = e.openWhenHidden,
|
532
440
|
u = e.fetch,
|
533
441
|
d = __rest(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
534
|
-
return new Promise(function (h,
|
535
|
-
var
|
536
|
-
|
442
|
+
return new Promise(function (h, f) {
|
443
|
+
var p = Object.assign({}, n);
|
444
|
+
p.accept || (p.accept = EventStreamContentType);
|
537
445
|
var b;
|
538
446
|
function m() {
|
539
447
|
b.abort(), document.hidden || x();
|
@@ -550,29 +458,29 @@ function fetchEventSource(r, e) {
|
|
550
458
|
var S = u !== null && u !== void 0 ? u : window.fetch,
|
551
459
|
E = s !== null && s !== void 0 ? s : defaultOnOpen;
|
552
460
|
function x() {
|
553
|
-
return
|
461
|
+
return _x3.apply(this, arguments);
|
554
462
|
}
|
555
|
-
function
|
556
|
-
|
557
|
-
var R,
|
558
|
-
return _regeneratorRuntime().wrap(function
|
559
|
-
while (1) switch (
|
463
|
+
function _x3() {
|
464
|
+
_x3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
465
|
+
var R, C, _;
|
466
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
467
|
+
while (1) switch (_context.prev = _context.next) {
|
560
468
|
case 0:
|
561
469
|
b = new AbortController();
|
562
|
-
|
563
|
-
|
470
|
+
_context.prev = 1;
|
471
|
+
_context.next = 4;
|
564
472
|
return S(r, Object.assign(Object.assign({}, d), {
|
565
|
-
headers:
|
473
|
+
headers: p,
|
566
474
|
signal: b.signal
|
567
475
|
}));
|
568
476
|
case 4:
|
569
|
-
|
570
|
-
|
571
|
-
return E(
|
477
|
+
C = _context.sent;
|
478
|
+
_context.next = 7;
|
479
|
+
return E(C);
|
572
480
|
case 7:
|
573
|
-
|
574
|
-
return getBytes(
|
575
|
-
_ ?
|
481
|
+
_context.next = 9;
|
482
|
+
return getBytes(C.body, getLines(getMessages(function (_) {
|
483
|
+
_ ? p[LastEventId] = _ : delete p[LastEventId];
|
576
484
|
}, function (_) {
|
577
485
|
g = _;
|
578
486
|
}, o)));
|
@@ -580,24 +488,24 @@ function fetchEventSource(r, e) {
|
|
580
488
|
a == null || a();
|
581
489
|
y();
|
582
490
|
h();
|
583
|
-
|
491
|
+
_context.next = 17;
|
584
492
|
break;
|
585
493
|
case 14:
|
586
|
-
|
587
|
-
|
494
|
+
_context.prev = 14;
|
495
|
+
_context.t0 = _context["catch"](1);
|
588
496
|
if (!b.signal.aborted) try {
|
589
|
-
_ = (R = l == null ? void 0 : l(
|
497
|
+
_ = (R = l == null ? void 0 : l(_context.t0)) !== null && R !== void 0 ? R : g;
|
590
498
|
window.clearTimeout(v), v = window.setTimeout(x, _);
|
591
499
|
} catch (_) {
|
592
|
-
y(),
|
500
|
+
y(), f(_);
|
593
501
|
}
|
594
502
|
case 17:
|
595
503
|
case "end":
|
596
|
-
return
|
504
|
+
return _context.stop();
|
597
505
|
}
|
598
|
-
},
|
506
|
+
}, _callee, null, [[1, 14]]);
|
599
507
|
}));
|
600
|
-
return
|
508
|
+
return _x3.apply(this, arguments);
|
601
509
|
}
|
602
510
|
x();
|
603
511
|
});
|
@@ -606,6 +514,98 @@ function defaultOnOpen(r) {
|
|
606
514
|
var e = r.headers.get("content-type");
|
607
515
|
if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
|
608
516
|
}
|
517
|
+
var _RequestUtils = /*#__PURE__*/function () {
|
518
|
+
function D() {
|
519
|
+
_classCallCheck(this, D);
|
520
|
+
}
|
521
|
+
_createClass(D, null, [{
|
522
|
+
key: "temporarilyRemoveHeader",
|
523
|
+
value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
|
524
|
+
// prettier-ignore
|
525
|
+
function () {
|
526
|
+
var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t, n) {
|
527
|
+
var s;
|
528
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
529
|
+
while (1) switch (_context2.prev = _context2.next) {
|
530
|
+
case 0:
|
531
|
+
if (e != null && e.headers) {
|
532
|
+
_context2.next = 2;
|
533
|
+
break;
|
534
|
+
}
|
535
|
+
throw new Error("Request settings have not been set up");
|
536
|
+
case 2:
|
537
|
+
s = e.headers[D.CONTENT_TYPE];
|
538
|
+
delete e.headers[D.CONTENT_TYPE];
|
539
|
+
_context2.next = 6;
|
540
|
+
return t(n);
|
541
|
+
case 6:
|
542
|
+
e.headers[D.CONTENT_TYPE] = s;
|
543
|
+
case 7:
|
544
|
+
case "end":
|
545
|
+
return _context2.stop();
|
546
|
+
}
|
547
|
+
}, _callee2);
|
548
|
+
}));
|
549
|
+
function temporarilyRemoveHeader(_x4, _x5, _x6) {
|
550
|
+
return _temporarilyRemoveHeader.apply(this, arguments);
|
551
|
+
}
|
552
|
+
return temporarilyRemoveHeader;
|
553
|
+
}()
|
554
|
+
}, {
|
555
|
+
key: "displayError",
|
556
|
+
value: function displayError(e, t) {
|
557
|
+
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
|
558
|
+
if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
|
559
|
+
e.addNewErrorMessage("service", t);
|
560
|
+
}
|
561
|
+
}, {
|
562
|
+
key: "processResponseByType",
|
563
|
+
value: function processResponseByType(e) {
|
564
|
+
var t = e.headers.get("content-type");
|
565
|
+
return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
|
566
|
+
}
|
567
|
+
}, {
|
568
|
+
key: "processRequestInterceptor",
|
569
|
+
value: function () {
|
570
|
+
var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, t) {
|
571
|
+
var a, n, s, o;
|
572
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
573
|
+
while (1) switch (_context3.prev = _context3.next) {
|
574
|
+
case 0:
|
575
|
+
_context3.next = 2;
|
576
|
+
return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
|
577
|
+
case 2:
|
578
|
+
_context3.t0 = _context3.sent;
|
579
|
+
if (_context3.t0) {
|
580
|
+
_context3.next = 5;
|
581
|
+
break;
|
582
|
+
}
|
583
|
+
_context3.t0 = t;
|
584
|
+
case 5:
|
585
|
+
n = _context3.t0;
|
586
|
+
s = n;
|
587
|
+
o = n;
|
588
|
+
return _context3.abrupt("return", {
|
589
|
+
body: s.body,
|
590
|
+
headers: s.headers,
|
591
|
+
error: o.error
|
592
|
+
});
|
593
|
+
case 9:
|
594
|
+
case "end":
|
595
|
+
return _context3.stop();
|
596
|
+
}
|
597
|
+
}, _callee3);
|
598
|
+
}));
|
599
|
+
function processRequestInterceptor(_x7, _x8) {
|
600
|
+
return _processRequestInterceptor.apply(this, arguments);
|
601
|
+
}
|
602
|
+
return processRequestInterceptor;
|
603
|
+
}()
|
604
|
+
}]);
|
605
|
+
return D;
|
606
|
+
}();
|
607
|
+
_RequestUtils.CONTENT_TYPE = "Content-Type";
|
608
|
+
var RequestUtils = _RequestUtils;
|
609
609
|
var _Demo = /*#__PURE__*/function () {
|
610
610
|
function A() {
|
611
611
|
_classCallCheck(this, A);
|
@@ -697,7 +697,7 @@ var Stream = /*#__PURE__*/function () {
|
|
697
697
|
function () {
|
698
698
|
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, n) {
|
699
699
|
var s,
|
700
|
-
|
700
|
+
p,
|
701
701
|
b,
|
702
702
|
m,
|
703
703
|
g,
|
@@ -711,7 +711,7 @@ var Stream = /*#__PURE__*/function () {
|
|
711
711
|
u,
|
712
712
|
d,
|
713
713
|
h,
|
714
|
-
|
714
|
+
f,
|
715
715
|
_args6 = arguments;
|
716
716
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
717
717
|
while (1) switch (_context6.prev = _context6.next) {
|
@@ -719,7 +719,7 @@ var Stream = /*#__PURE__*/function () {
|
|
719
719
|
s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
|
720
720
|
o = {
|
721
721
|
body: t,
|
722
|
-
headers: (
|
722
|
+
headers: (p = e.requestSettings) == null ? void 0 : p.headers
|
723
723
|
};
|
724
724
|
_context6.next = 4;
|
725
725
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
@@ -738,7 +738,7 @@ var Stream = /*#__PURE__*/function () {
|
|
738
738
|
}
|
739
739
|
return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
|
740
740
|
case 14:
|
741
|
-
if (!((b = e.requestSettings) != null && b.
|
741
|
+
if (!((b = e.requestSettings) != null && b.handler)) {
|
742
742
|
_context6.next = 16;
|
743
743
|
break;
|
744
744
|
}
|
@@ -750,7 +750,7 @@ var Stream = /*#__PURE__*/function () {
|
|
750
750
|
}
|
751
751
|
return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
|
752
752
|
case 18:
|
753
|
-
|
753
|
+
f = null;
|
754
754
|
fetchEventSource(((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", {
|
755
755
|
method: ((v = e.requestSettings) == null ? void 0 : v.method) || "POST",
|
756
756
|
headers: l,
|
@@ -766,7 +766,7 @@ var Stream = /*#__PURE__*/function () {
|
|
766
766
|
_context5.next = 2;
|
767
767
|
break;
|
768
768
|
}
|
769
|
-
return _context5.abrupt("return", (
|
769
|
+
return _context5.abrupt("return", (f = n.addNewStreamedMessage(), u()));
|
770
770
|
case 2:
|
771
771
|
_context5.next = 4;
|
772
772
|
return RequestUtils.processResponseByType(y);
|
@@ -784,7 +784,7 @@ var Stream = /*#__PURE__*/function () {
|
|
784
784
|
if (JSON.stringify(y.data) !== JSON.stringify("[DONE]")) {
|
785
785
|
var E = JSON.parse(y.data);
|
786
786
|
(S = e.extractResultData) == null || S.call(e, E).then(function (x) {
|
787
|
-
(x == null ? void 0 : x.text) === void 0 ? console.error("Response data: ".concat(y.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) :
|
787
|
+
(x == null ? void 0 : x.text) === void 0 ? console.error("Response data: ".concat(y.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : f && n.updateStreamedMessage(x.text, f);
|
788
788
|
})["catch"](function (x) {
|
789
789
|
return RequestUtils.displayError(n, x);
|
790
790
|
});
|
@@ -861,57 +861,49 @@ var CustomHandler = /*#__PURE__*/function () {
|
|
861
861
|
key: "request",
|
862
862
|
value: function () {
|
863
863
|
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
|
864
|
-
var s, o;
|
864
|
+
var a, l, s, o;
|
865
865
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
866
866
|
while (1) switch (_context8.prev = _context8.next) {
|
867
867
|
case 0:
|
868
|
-
|
869
|
-
|
870
|
-
|
868
|
+
s = !0;
|
869
|
+
o = /*#__PURE__*/function () {
|
870
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(c) {
|
871
|
+
var d, h, u;
|
871
872
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
872
873
|
while (1) switch (_context7.prev = _context7.next) {
|
873
874
|
case 0:
|
874
|
-
if (
|
875
|
+
if (s) {
|
875
876
|
_context7.next = 2;
|
876
877
|
break;
|
877
878
|
}
|
878
879
|
return _context7.abrupt("return");
|
879
880
|
case 2:
|
880
881
|
_context7.next = 4;
|
881
|
-
return (
|
882
|
+
return (h = (d = e.deepChat).responseInterceptor) == null ? void 0 : h.call(d, c);
|
882
883
|
case 4:
|
883
884
|
_context7.t0 = _context7.sent;
|
884
885
|
if (_context7.t0) {
|
885
886
|
_context7.next = 7;
|
886
887
|
break;
|
887
888
|
}
|
888
|
-
_context7.t0 =
|
889
|
+
_context7.t0 = c;
|
889
890
|
case 7:
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
case 10:
|
894
|
-
c = _context7.sent;
|
895
|
-
if (!(!c || _typeof(c) != "object")) {
|
896
|
-
_context7.next = 13;
|
897
|
-
break;
|
898
|
-
}
|
899
|
-
throw Error(ErrorMessages.INVALID_RESPONSE(a, "response", !!e.deepChat.responseInterceptor, c));
|
900
|
-
case 13:
|
901
|
-
e.deepChat.stream && c.text ? Stream.simulate(n, e.streamHandlers, c.text) : (n.addNewMessage(c, !0, !0), e.completionsHandlers.onFinish());
|
902
|
-
case 14:
|
891
|
+
u = _context7.t0;
|
892
|
+
!u || _typeof(u) != "object" || typeof u.error != "string" && typeof u.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, u)), n.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish()) : typeof u.error == "string" ? (console.error(u.error), n.addNewErrorMessage("service", u.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : (n.addNewMessage(u, !0, !0), e.completionsHandlers.onFinish()), s = !1;
|
893
|
+
case 9:
|
903
894
|
case "end":
|
904
895
|
return _context7.stop();
|
905
896
|
}
|
906
897
|
}, _callee7);
|
907
898
|
}));
|
908
|
-
return function (_x15) {
|
899
|
+
return function o(_x15) {
|
909
900
|
return _ref2.apply(this, arguments);
|
910
901
|
};
|
911
|
-
}()
|
912
|
-
|
902
|
+
}();
|
903
|
+
(l = (a = e.requestSettings).handler) == null || l.call(a, t, {
|
904
|
+
onResponse: o
|
913
905
|
});
|
914
|
-
case
|
906
|
+
case 3:
|
915
907
|
case "end":
|
916
908
|
return _context8.stop();
|
917
909
|
}
|
@@ -926,7 +918,7 @@ var CustomHandler = /*#__PURE__*/function () {
|
|
926
918
|
key: "stream",
|
927
919
|
value: function () {
|
928
920
|
var _stream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, n) {
|
929
|
-
var
|
921
|
+
var h, f, s, o, a, l, c, u, d;
|
930
922
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
931
923
|
while (1) switch (_context9.prev = _context9.next) {
|
932
924
|
case 0:
|
@@ -936,17 +928,19 @@ var CustomHandler = /*#__PURE__*/function () {
|
|
936
928
|
}, c = function c() {
|
937
929
|
s && (n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1);
|
938
930
|
}, u = function u(p) {
|
939
|
-
s && (p.error ? (console.error(p.error), n.finaliseStreamedMessage(), e.streamHandlers.onClose(), n.addNewErrorMessage("service", p.error), s = !1) : p.text && a && n.updateStreamedMessage(p.text, a));
|
931
|
+
s && (!p || _typeof(p) != "object" || typeof p.error != "string" && typeof p.text != "string" ? console.error(ErrorMessages.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), n.finaliseStreamedMessage(), e.streamHandlers.onClose(), n.addNewErrorMessage("service", p.error), s = !1) : p.text && a && n.updateStreamedMessage(p.text, a));
|
940
932
|
};
|
941
933
|
e.streamHandlers.abortStream.abort = function () {
|
942
934
|
n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
|
943
|
-
}
|
935
|
+
};
|
936
|
+
d = {
|
944
937
|
onOpen: l,
|
945
|
-
|
938
|
+
onResponse: u,
|
946
939
|
onClose: c,
|
947
940
|
stopClicked: e.streamHandlers.stopClicked
|
948
|
-
}
|
949
|
-
|
941
|
+
};
|
942
|
+
(f = (h = e.requestSettings).handler) == null || f.call(h, t, d);
|
943
|
+
case 5:
|
950
944
|
case "end":
|
951
945
|
return _context9.stop();
|
952
946
|
}
|
@@ -957,6 +951,63 @@ var CustomHandler = /*#__PURE__*/function () {
|
|
957
951
|
}
|
958
952
|
return stream;
|
959
953
|
}()
|
954
|
+
}, {
|
955
|
+
key: "websocket",
|
956
|
+
value: function websocket(e, t) {
|
957
|
+
var c, u;
|
958
|
+
var n = {
|
959
|
+
isOpen: !1,
|
960
|
+
newUserMessage: {
|
961
|
+
listener: function listener() {}
|
962
|
+
}
|
963
|
+
};
|
964
|
+
e.websocket = n;
|
965
|
+
var l = {
|
966
|
+
onOpen: function onOpen() {
|
967
|
+
t.removeError(), n.isOpen = !0;
|
968
|
+
},
|
969
|
+
onResponse: function () {
|
970
|
+
var _onResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(d) {
|
971
|
+
var f, p, h;
|
972
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
973
|
+
while (1) switch (_context10.prev = _context10.next) {
|
974
|
+
case 0:
|
975
|
+
if (n.isOpen) {
|
976
|
+
_context10.next = 2;
|
977
|
+
break;
|
978
|
+
}
|
979
|
+
return _context10.abrupt("return");
|
980
|
+
case 2:
|
981
|
+
_context10.next = 4;
|
982
|
+
return (p = (f = e.deepChat).responseInterceptor) == null ? void 0 : p.call(f, d);
|
983
|
+
case 4:
|
984
|
+
_context10.t0 = _context10.sent;
|
985
|
+
if (_context10.t0) {
|
986
|
+
_context10.next = 7;
|
987
|
+
break;
|
988
|
+
}
|
989
|
+
_context10.t0 = d;
|
990
|
+
case 7:
|
991
|
+
h = _context10.t0;
|
992
|
+
!h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message")) : typeof h.error == "string" ? (console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error)) : e.deepChat.stream ? Stream.simulate(t, e.streamHandlers, h.text) : t.addNewMessage(h, !0, !0);
|
993
|
+
case 9:
|
994
|
+
case "end":
|
995
|
+
return _context10.stop();
|
996
|
+
}
|
997
|
+
}, _callee10);
|
998
|
+
}));
|
999
|
+
function onResponse(_x19) {
|
1000
|
+
return _onResponse.apply(this, arguments);
|
1001
|
+
}
|
1002
|
+
return onResponse;
|
1003
|
+
}(),
|
1004
|
+
onClose: function onClose() {
|
1005
|
+
n.isOpen = !1;
|
1006
|
+
},
|
1007
|
+
newUserMessage: n.newUserMessage
|
1008
|
+
};
|
1009
|
+
(u = (c = e.requestSettings).handler) == null || u.call(c, void 0, l);
|
1010
|
+
}
|
960
1011
|
}]);
|
961
1012
|
return CustomHandler;
|
962
1013
|
}();
|
@@ -968,11 +1019,11 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
968
1019
|
key: "request",
|
969
1020
|
value: // prettier-ignore
|
970
1021
|
function () {
|
971
|
-
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1022
|
+
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
|
972
1023
|
var s,
|
973
1024
|
h,
|
974
|
-
p,
|
975
1025
|
f,
|
1026
|
+
p,
|
976
1027
|
b,
|
977
1028
|
m,
|
978
1029
|
o,
|
@@ -982,40 +1033,40 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
982
1033
|
c,
|
983
1034
|
u,
|
984
1035
|
d,
|
985
|
-
|
986
|
-
return _regeneratorRuntime().wrap(function
|
987
|
-
while (1) switch (
|
1036
|
+
_args12 = arguments;
|
1037
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
1038
|
+
while (1) switch (_context12.prev = _context12.next) {
|
988
1039
|
case 0:
|
989
|
-
s =
|
1040
|
+
s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
|
990
1041
|
o = {
|
991
1042
|
body: t,
|
992
1043
|
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
993
1044
|
};
|
994
|
-
|
1045
|
+
_context12.next = 4;
|
995
1046
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
996
1047
|
case 4:
|
997
|
-
_yield$RequestUtils$p2 =
|
1048
|
+
_yield$RequestUtils$p2 = _context12.sent;
|
998
1049
|
a = _yield$RequestUtils$p2.body;
|
999
1050
|
l = _yield$RequestUtils$p2.headers;
|
1000
1051
|
c = _yield$RequestUtils$p2.error;
|
1001
1052
|
u = e.completionsHandlers.onFinish;
|
1002
1053
|
if (!c) {
|
1003
|
-
|
1054
|
+
_context12.next = 11;
|
1004
1055
|
break;
|
1005
1056
|
}
|
1006
|
-
return
|
1057
|
+
return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
|
1007
1058
|
case 11:
|
1008
|
-
if (!((
|
1009
|
-
|
1059
|
+
if (!((f = e.requestSettings) != null && f.handler)) {
|
1060
|
+
_context12.next = 13;
|
1010
1061
|
break;
|
1011
1062
|
}
|
1012
|
-
return
|
1063
|
+
return _context12.abrupt("return", CustomHandler.request(e, a, n));
|
1013
1064
|
case 13:
|
1014
|
-
if (!(((
|
1015
|
-
|
1065
|
+
if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
|
1066
|
+
_context12.next = 15;
|
1016
1067
|
break;
|
1017
1068
|
}
|
1018
|
-
return
|
1069
|
+
return _context12.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
|
1019
1070
|
case 15:
|
1020
1071
|
d = !0;
|
1021
1072
|
fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
|
@@ -1027,40 +1078,40 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1027
1078
|
}).then(function (g) {
|
1028
1079
|
return RequestUtils.processResponseByType(g);
|
1029
1080
|
}).then( /*#__PURE__*/function () {
|
1030
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1081
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(g) {
|
1031
1082
|
var S, E, v, y;
|
1032
|
-
return _regeneratorRuntime().wrap(function
|
1033
|
-
while (1) switch (
|
1083
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
1084
|
+
while (1) switch (_context11.prev = _context11.next) {
|
1034
1085
|
case 0:
|
1035
1086
|
if (e.extractResultData) {
|
1036
|
-
|
1087
|
+
_context11.next = 2;
|
1037
1088
|
break;
|
1038
1089
|
}
|
1039
|
-
return
|
1090
|
+
return _context11.abrupt("return");
|
1040
1091
|
case 2:
|
1041
|
-
|
1092
|
+
_context11.next = 4;
|
1042
1093
|
return (E = (S = e.deepChat).responseInterceptor) == null ? void 0 : E.call(S, g);
|
1043
1094
|
case 4:
|
1044
|
-
|
1045
|
-
if (
|
1046
|
-
|
1095
|
+
_context11.t0 = _context11.sent;
|
1096
|
+
if (_context11.t0) {
|
1097
|
+
_context11.next = 7;
|
1047
1098
|
break;
|
1048
1099
|
}
|
1049
|
-
|
1100
|
+
_context11.t0 = g;
|
1050
1101
|
case 7:
|
1051
|
-
v =
|
1052
|
-
|
1102
|
+
v = _context11.t0;
|
1103
|
+
_context11.next = 10;
|
1053
1104
|
return e.extractResultData(v);
|
1054
1105
|
case 10:
|
1055
|
-
y =
|
1106
|
+
y = _context11.sent;
|
1056
1107
|
if (d) {
|
1057
|
-
|
1108
|
+
_context11.next = 13;
|
1058
1109
|
break;
|
1059
1110
|
}
|
1060
1111
|
throw g;
|
1061
1112
|
case 13:
|
1062
1113
|
if (!(!y || _typeof(y) != "object")) {
|
1063
|
-
|
1114
|
+
_context11.next = 15;
|
1064
1115
|
break;
|
1065
1116
|
}
|
1066
1117
|
throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
|
@@ -1068,11 +1119,11 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1068
1119
|
y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
|
1069
1120
|
case 16:
|
1070
1121
|
case "end":
|
1071
|
-
return
|
1122
|
+
return _context11.stop();
|
1072
1123
|
}
|
1073
|
-
},
|
1124
|
+
}, _callee11);
|
1074
1125
|
}));
|
1075
|
-
return function (
|
1126
|
+
return function (_x23) {
|
1076
1127
|
return _ref3.apply(this, arguments);
|
1077
1128
|
};
|
1078
1129
|
}())["catch"](function (g) {
|
@@ -1080,11 +1131,11 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1080
1131
|
});
|
1081
1132
|
case 17:
|
1082
1133
|
case "end":
|
1083
|
-
return
|
1134
|
+
return _context12.stop();
|
1084
1135
|
}
|
1085
|
-
},
|
1136
|
+
}, _callee12);
|
1086
1137
|
}));
|
1087
|
-
function request(
|
1138
|
+
function request(_x20, _x21, _x22) {
|
1088
1139
|
return _request3.apply(this, arguments);
|
1089
1140
|
}
|
1090
1141
|
return request;
|
@@ -1097,43 +1148,43 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1097
1148
|
fetch(t, n).then(function (a) {
|
1098
1149
|
return a.json();
|
1099
1150
|
}).then( /*#__PURE__*/function () {
|
1100
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1151
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(a) {
|
1101
1152
|
var c, u, l;
|
1102
|
-
return _regeneratorRuntime().wrap(function
|
1103
|
-
while (1) switch (
|
1153
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
1154
|
+
while (1) switch (_context13.prev = _context13.next) {
|
1104
1155
|
case 0:
|
1105
1156
|
if (e.extractPollResultData) {
|
1106
|
-
|
1157
|
+
_context13.next = 2;
|
1107
1158
|
break;
|
1108
1159
|
}
|
1109
|
-
return
|
1160
|
+
return _context13.abrupt("return");
|
1110
1161
|
case 2:
|
1111
|
-
|
1112
|
-
|
1162
|
+
_context13.t0 = e;
|
1163
|
+
_context13.next = 5;
|
1113
1164
|
return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
|
1114
1165
|
case 5:
|
1115
|
-
|
1116
|
-
if (
|
1117
|
-
|
1166
|
+
_context13.t1 = _context13.sent;
|
1167
|
+
if (_context13.t1) {
|
1168
|
+
_context13.next = 8;
|
1118
1169
|
break;
|
1119
1170
|
}
|
1120
|
-
|
1171
|
+
_context13.t1 = a;
|
1121
1172
|
case 8:
|
1122
|
-
|
1123
|
-
|
1124
|
-
return
|
1173
|
+
_context13.t2 = _context13.t1;
|
1174
|
+
_context13.next = 11;
|
1175
|
+
return _context13.t0.extractPollResultData.call(_context13.t0, _context13.t2);
|
1125
1176
|
case 11:
|
1126
|
-
l =
|
1177
|
+
l = _context13.sent;
|
1127
1178
|
l.timeoutMS ? setTimeout(function () {
|
1128
1179
|
HTTPRequest.executePollRequest(e, t, n, s);
|
1129
1180
|
}, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
|
1130
1181
|
case 13:
|
1131
1182
|
case "end":
|
1132
|
-
return
|
1183
|
+
return _context13.stop();
|
1133
1184
|
}
|
1134
|
-
},
|
1185
|
+
}, _callee13);
|
1135
1186
|
}));
|
1136
|
-
return function (
|
1187
|
+
return function (_x24) {
|
1137
1188
|
return _ref4.apply(this, arguments);
|
1138
1189
|
};
|
1139
1190
|
}())["catch"](function (a) {
|
@@ -1144,9 +1195,9 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1144
1195
|
}, {
|
1145
1196
|
key: "poll",
|
1146
1197
|
value: function () {
|
1147
|
-
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1198
|
+
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n) {
|
1148
1199
|
var s,
|
1149
|
-
|
1200
|
+
p,
|
1150
1201
|
b,
|
1151
1202
|
m,
|
1152
1203
|
o,
|
@@ -1157,42 +1208,42 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1157
1208
|
u,
|
1158
1209
|
d,
|
1159
1210
|
h,
|
1160
|
-
|
1161
|
-
|
1162
|
-
return _regeneratorRuntime().wrap(function
|
1163
|
-
while (1) switch (
|
1211
|
+
f,
|
1212
|
+
_args14 = arguments;
|
1213
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
1214
|
+
while (1) switch (_context14.prev = _context14.next) {
|
1164
1215
|
case 0:
|
1165
|
-
s =
|
1216
|
+
s = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : !0;
|
1166
1217
|
o = {
|
1167
1218
|
body: t,
|
1168
|
-
headers: (
|
1219
|
+
headers: (p = e.requestSettings) == null ? void 0 : p.headers
|
1169
1220
|
};
|
1170
|
-
|
1221
|
+
_context14.next = 4;
|
1171
1222
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
1172
1223
|
case 4:
|
1173
|
-
_yield$RequestUtils$p3 =
|
1224
|
+
_yield$RequestUtils$p3 = _context14.sent;
|
1174
1225
|
a = _yield$RequestUtils$p3.body;
|
1175
1226
|
l = _yield$RequestUtils$p3.headers;
|
1176
1227
|
c = _yield$RequestUtils$p3.error;
|
1177
1228
|
if (!c) {
|
1178
|
-
|
1229
|
+
_context14.next = 10;
|
1179
1230
|
break;
|
1180
1231
|
}
|
1181
|
-
return
|
1232
|
+
return _context14.abrupt("return", HTTPRequest.onInterceptorError(n, c));
|
1182
1233
|
case 10:
|
1183
|
-
u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a,
|
1234
|
+
u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, f = {
|
1184
1235
|
method: d,
|
1185
1236
|
body: h,
|
1186
1237
|
headers: l
|
1187
1238
|
};
|
1188
|
-
HTTPRequest.executePollRequest(e, u,
|
1239
|
+
HTTPRequest.executePollRequest(e, u, f, n);
|
1189
1240
|
case 12:
|
1190
1241
|
case "end":
|
1191
|
-
return
|
1242
|
+
return _context14.stop();
|
1192
1243
|
}
|
1193
|
-
},
|
1244
|
+
}, _callee14);
|
1194
1245
|
}));
|
1195
|
-
function poll(
|
1246
|
+
function poll(_x25, _x26, _x27) {
|
1196
1247
|
return _poll.apply(this, arguments);
|
1197
1248
|
}
|
1198
1249
|
return poll;
|
@@ -1285,15 +1336,19 @@ var Websocket = /*#__PURE__*/function () {
|
|
1285
1336
|
value: function createConnection(e, t) {
|
1286
1337
|
if (!document.body.contains(e.deepChat)) return;
|
1287
1338
|
var n = e.requestSettings.websocket;
|
1288
|
-
if (n)
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1339
|
+
if (n) {
|
1340
|
+
if (e.requestSettings.handler) return CustomHandler.websocket(e, t);
|
1341
|
+
try {
|
1342
|
+
var _s = typeof n != "boolean" ? n : void 0,
|
1343
|
+
_o = new WebSocket(e.requestSettings.url || "", _s);
|
1344
|
+
e.websocket = _o, e.websocket.onopen = function () {
|
1345
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, _o, t);
|
1346
|
+
}, e.websocket.onerror = function (a) {
|
1347
|
+
console.error(a), Websocket.retryConnection(e, t);
|
1348
|
+
};
|
1349
|
+
} catch (s) {
|
1350
|
+
console.error(s), Websocket.retryConnection(e, t);
|
1351
|
+
}
|
1297
1352
|
}
|
1298
1353
|
}
|
1299
1354
|
}, {
|
@@ -1307,112 +1362,135 @@ var Websocket = /*#__PURE__*/function () {
|
|
1307
1362
|
key: "assignListeners",
|
1308
1363
|
value: function assignListeners(e, t, n) {
|
1309
1364
|
t.onmessage = /*#__PURE__*/function () {
|
1310
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1365
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
|
1311
1366
|
var o, a, l, c, u;
|
1312
|
-
return _regeneratorRuntime().wrap(function
|
1313
|
-
while (1) switch (
|
1367
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
1368
|
+
while (1) switch (_context15.prev = _context15.next) {
|
1314
1369
|
case 0:
|
1315
1370
|
if (!e.extractResultData) {
|
1316
|
-
|
1371
|
+
_context15.next = 20;
|
1317
1372
|
break;
|
1318
1373
|
}
|
1319
|
-
|
1374
|
+
_context15.prev = 1;
|
1320
1375
|
l = JSON.parse(s.data);
|
1321
|
-
|
1376
|
+
_context15.next = 5;
|
1322
1377
|
return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
|
1323
1378
|
case 5:
|
1324
|
-
|
1325
|
-
if (
|
1326
|
-
|
1379
|
+
_context15.t0 = _context15.sent;
|
1380
|
+
if (_context15.t0) {
|
1381
|
+
_context15.next = 8;
|
1327
1382
|
break;
|
1328
1383
|
}
|
1329
|
-
|
1384
|
+
_context15.t0 = l;
|
1330
1385
|
case 8:
|
1331
|
-
c =
|
1332
|
-
|
1386
|
+
c = _context15.t0;
|
1387
|
+
_context15.next = 11;
|
1333
1388
|
return e.extractResultData(c);
|
1334
1389
|
case 11:
|
1335
|
-
u =
|
1390
|
+
u = _context15.sent;
|
1336
1391
|
if (!(!u || _typeof(u) != "object")) {
|
1337
|
-
|
1392
|
+
_context15.next = 14;
|
1338
1393
|
break;
|
1339
1394
|
}
|
1340
1395
|
throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
1341
1396
|
case 14:
|
1342
1397
|
e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
|
1343
|
-
|
1398
|
+
_context15.next = 20;
|
1344
1399
|
break;
|
1345
1400
|
case 17:
|
1346
|
-
|
1347
|
-
|
1348
|
-
RequestUtils.displayError(n,
|
1401
|
+
_context15.prev = 17;
|
1402
|
+
_context15.t1 = _context15["catch"](1);
|
1403
|
+
RequestUtils.displayError(n, _context15.t1, "Error in server message");
|
1349
1404
|
case 20:
|
1350
1405
|
case "end":
|
1351
|
-
return
|
1406
|
+
return _context15.stop();
|
1352
1407
|
}
|
1353
|
-
},
|
1408
|
+
}, _callee15, null, [[1, 17]]);
|
1354
1409
|
}));
|
1355
|
-
return function (
|
1410
|
+
return function (_x28) {
|
1356
1411
|
return _ref5.apply(this, arguments);
|
1357
1412
|
};
|
1358
|
-
}(), t.
|
1359
|
-
console.error(s), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error");
|
1360
|
-
}, t.onclose = function () {
|
1413
|
+
}(), t.onclose = function () {
|
1361
1414
|
console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
|
1362
1415
|
};
|
1363
1416
|
}
|
1364
1417
|
}, {
|
1365
1418
|
key: "sendWebsocket",
|
1366
1419
|
value: function () {
|
1367
|
-
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1368
|
-
var
|
1420
|
+
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
|
1421
|
+
var s,
|
1369
1422
|
d,
|
1370
1423
|
h,
|
1424
|
+
o,
|
1371
1425
|
a,
|
1372
1426
|
_yield$RequestUtils$p4,
|
1373
1427
|
l,
|
1374
1428
|
c,
|
1375
1429
|
u,
|
1376
|
-
|
1377
|
-
return _regeneratorRuntime().wrap(function
|
1378
|
-
while (1) switch (
|
1430
|
+
_args16 = arguments;
|
1431
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
1432
|
+
while (1) switch (_context16.prev = _context16.next) {
|
1379
1433
|
case 0:
|
1380
|
-
|
1434
|
+
s = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : !0;
|
1435
|
+
o = e.websocket;
|
1436
|
+
if (!(!o || o === "pending")) {
|
1437
|
+
_context16.next = 4;
|
1438
|
+
break;
|
1439
|
+
}
|
1440
|
+
return _context16.abrupt("return");
|
1441
|
+
case 4:
|
1381
1442
|
a = {
|
1382
|
-
body:
|
1383
|
-
headers: (d =
|
1443
|
+
body: t,
|
1444
|
+
headers: (d = e.requestSettings) == null ? void 0 : d.headers
|
1384
1445
|
};
|
1385
|
-
|
1386
|
-
return RequestUtils.processRequestInterceptor(
|
1387
|
-
case
|
1388
|
-
_yield$RequestUtils$p4 =
|
1446
|
+
_context16.next = 7;
|
1447
|
+
return RequestUtils.processRequestInterceptor(e.deepChat, a);
|
1448
|
+
case 7:
|
1449
|
+
_yield$RequestUtils$p4 = _context16.sent;
|
1389
1450
|
l = _yield$RequestUtils$p4.body;
|
1390
1451
|
c = _yield$RequestUtils$p4.error;
|
1391
1452
|
if (!c) {
|
1392
|
-
|
1453
|
+
_context16.next = 12;
|
1393
1454
|
break;
|
1394
1455
|
}
|
1395
|
-
return
|
1396
|
-
case
|
1397
|
-
|
1398
|
-
|
1399
|
-
_context15.next = 12;
|
1456
|
+
return _context16.abrupt("return", n.addNewErrorMessage("service", c));
|
1457
|
+
case 12:
|
1458
|
+
if (Websocket.isWebSocket(o)) {
|
1459
|
+
_context16.next = 14;
|
1400
1460
|
break;
|
1401
1461
|
}
|
1402
|
-
return
|
1403
|
-
case
|
1404
|
-
|
1405
|
-
|
1462
|
+
return _context16.abrupt("return", o.newUserMessage.listener(l));
|
1463
|
+
case 14:
|
1464
|
+
u = s ? JSON.stringify(l) : l;
|
1465
|
+
if (!(((h = e.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
|
1466
|
+
_context16.next = 17;
|
1467
|
+
break;
|
1468
|
+
}
|
1469
|
+
return _context16.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
|
1470
|
+
case 17:
|
1471
|
+
o.readyState === void 0 || o.readyState !== o.OPEN ? (console.error("Connection is not open"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error")) : o.send(JSON.stringify(u));
|
1472
|
+
case 18:
|
1406
1473
|
case "end":
|
1407
|
-
return
|
1474
|
+
return _context16.stop();
|
1408
1475
|
}
|
1409
|
-
},
|
1476
|
+
}, _callee16);
|
1410
1477
|
}));
|
1411
|
-
function sendWebsocket(
|
1478
|
+
function sendWebsocket(_x29, _x30, _x31) {
|
1412
1479
|
return _sendWebsocket.apply(this, arguments);
|
1413
1480
|
}
|
1414
1481
|
return sendWebsocket;
|
1415
1482
|
}()
|
1483
|
+
}, {
|
1484
|
+
key: "canSendMessage",
|
1485
|
+
value: function canSendMessage(e) {
|
1486
|
+
return e ? e === "pending" ? !1 : Websocket.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
1487
|
+
}
|
1488
|
+
// if false then it is the internal websocket handler
|
1489
|
+
}, {
|
1490
|
+
key: "isWebSocket",
|
1491
|
+
value: function isWebSocket(e) {
|
1492
|
+
return e.send !== void 0;
|
1493
|
+
}
|
1416
1494
|
}]);
|
1417
1495
|
return Websocket;
|
1418
1496
|
}();
|
@@ -1903,13 +1981,13 @@ function normalizeReference(r) {
|
|
1903
1981
|
return r.trim().replace(/\s+/g, " ").toUpperCase();
|
1904
1982
|
}
|
1905
1983
|
function parseReference(r, e, t, n) {
|
1906
|
-
var s, o, a, l, c, u, d, h,
|
1984
|
+
var s, o, a, l, c, u, d, h, f;
|
1907
1985
|
if (r.charCodeAt(0) !== 91 || r.indexOf("]:") === -1 || (s = new StateInline(r, e, t, n, []), o = parseLinkLabel(s, 0), o < 0 || r.charCodeAt(o + 1) !== 58)) return -1;
|
1908
1986
|
for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
1909
1987
|
if (!parseLinkDestination(s, a)) return -1;
|
1910
1988
|
for (d = s.linkContent, a = s.pos, u = a, a = a + 1; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
1911
1989
|
for (a < l && u !== a && parseLinkTitle(s, a) ? (h = s.linkContent, a = s.pos) : (h = "", a = u); a < l && s.src.charCodeAt(a) === 32;) a++;
|
1912
|
-
return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (
|
1990
|
+
return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (f = normalizeReference(r.slice(1, o)), _typeof(n.references[f]) > "u" && (n.references[f] = {
|
1913
1991
|
title: h,
|
1914
1992
|
href: d
|
1915
1993
|
}), a);
|
@@ -1946,9 +2024,9 @@ function footnote_block(r) {
|
|
1946
2024
|
u,
|
1947
2025
|
d = 0,
|
1948
2026
|
h = !1,
|
1949
|
-
|
1950
|
-
if (r.env.footnotes && (r.tokens = r.tokens.filter(function (
|
1951
|
-
return
|
2027
|
+
f = {};
|
2028
|
+
if (r.env.footnotes && (r.tokens = r.tokens.filter(function (p) {
|
2029
|
+
return p.type === "footnote_reference_open" ? (h = !0, c = [], u = p.label, !1) : p.type === "footnote_reference_close" ? (h = !1, f[":" + u] = c, !1) : (h && c.push(p), !h);
|
1952
2030
|
}), !!r.env.footnotes.list)) {
|
1953
2031
|
for (a = r.env.footnotes.list, r.tokens.push({
|
1954
2032
|
type: "footnote_block_open",
|
@@ -1971,7 +2049,7 @@ function footnote_block(r) {
|
|
1971
2049
|
type: "paragraph_close",
|
1972
2050
|
tight: !1,
|
1973
2051
|
level: --d
|
1974
|
-
})) : a[e].label && (l =
|
2052
|
+
})) : a[e].label && (l = f[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
|
1975
2053
|
type: "footnote_anchor",
|
1976
2054
|
id: e,
|
1977
2055
|
subId: n,
|
@@ -2004,15 +2082,15 @@ function abbr2(r) {
|
|
2004
2082
|
u,
|
2005
2083
|
d,
|
2006
2084
|
h,
|
2007
|
-
|
2008
|
-
|
2085
|
+
f,
|
2086
|
+
p = r.tokens;
|
2009
2087
|
if (r.env.abbreviations) {
|
2010
|
-
for (r.env.abbrRegExp || (
|
2088
|
+
for (r.env.abbrRegExp || (f = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
|
2011
2089
|
return b.substr(1);
|
2012
2090
|
}).sort(function (b, m) {
|
2013
2091
|
return m.length - b.length;
|
2014
|
-
}).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(
|
2015
|
-
for (s =
|
2092
|
+
}).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(f, "g")), d = r.env.abbrRegExp, t = 0, n = p.length; t < n; t++) if (p[t].type === "inline") {
|
2093
|
+
for (s = p[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
|
2016
2094
|
for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
|
2017
2095
|
type: "text",
|
2018
2096
|
content: a.slice(c, h.index + h[1].length),
|
@@ -2033,7 +2111,7 @@ function abbr2(r) {
|
|
2033
2111
|
type: "text",
|
2034
2112
|
content: a.slice(c),
|
2035
2113
|
level: u
|
2036
|
-
}),
|
2114
|
+
}), p[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
|
2037
2115
|
}
|
2038
2116
|
}
|
2039
2117
|
}
|
@@ -2068,20 +2146,20 @@ function replaceAt(r, e, t) {
|
|
2068
2146
|
return r.substr(0, e) + t + r.substr(e + 1);
|
2069
2147
|
}
|
2070
2148
|
function smartquotes(r) {
|
2071
|
-
var e, t, n, s, o, a, l, c, u, d, h,
|
2149
|
+
var e, t, n, s, o, a, l, c, u, d, h, f, p, b, m, g, v;
|
2072
2150
|
if (r.options.typographer) {
|
2073
2151
|
for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
|
2074
2152
|
for (g = r.tokens[m].children, v.length = 0, e = 0; e < g.length; e++) if (t = g[e], !(t.type !== "text" || QUOTE_TEST_RE.test(t.text))) {
|
2075
|
-
for (l = g[e].level,
|
2076
|
-
v.length =
|
2153
|
+
for (l = g[e].level, p = v.length - 1; p >= 0 && !(v[p].level <= l); p--);
|
2154
|
+
v.length = p + 1, n = t.content, o = 0, a = n.length;
|
2077
2155
|
e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
|
2078
2156
|
if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
|
2079
2157
|
b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
|
2080
2158
|
continue;
|
2081
2159
|
}
|
2082
|
-
if (h = !u,
|
2083
|
-
for (
|
2084
|
-
d = v[
|
2160
|
+
if (h = !u, f = !c, f) {
|
2161
|
+
for (p = v.length - 1; p >= 0 && (d = v[p], !(v[p].level < l)); p--) if (d.single === b && v[p].level === l) {
|
2162
|
+
d = v[p], b ? (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), v.length = p;
|
2085
2163
|
continue e;
|
2086
2164
|
}
|
2087
2165
|
}
|
@@ -2090,7 +2168,7 @@ function smartquotes(r) {
|
|
2090
2168
|
pos: s.index,
|
2091
2169
|
single: b,
|
2092
2170
|
level: l
|
2093
|
-
}) :
|
2171
|
+
}) : f && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
|
2094
2172
|
}
|
2095
2173
|
}
|
2096
2174
|
}
|
@@ -2202,8 +2280,8 @@ function blockquote(r, e, t, n) {
|
|
2202
2280
|
u,
|
2203
2281
|
d,
|
2204
2282
|
h,
|
2205
|
-
p,
|
2206
2283
|
f,
|
2284
|
+
p,
|
2207
2285
|
b,
|
2208
2286
|
m = r.bMarks[e] + r.tShift[e],
|
2209
2287
|
g = r.eMarks[e];
|
@@ -2215,7 +2293,7 @@ function blockquote(r, e, t, n) {
|
|
2215
2293
|
continue;
|
2216
2294
|
}
|
2217
2295
|
if (o) break;
|
2218
|
-
for (b = !1,
|
2296
|
+
for (b = !1, f = 0, p = h.length; f < p; f++) if (h[f](r, s, t, !0)) {
|
2219
2297
|
b = !0;
|
2220
2298
|
break;
|
2221
2299
|
}
|
@@ -2229,7 +2307,7 @@ function blockquote(r, e, t, n) {
|
|
2229
2307
|
}), r.parser.tokenize(r, e, s), r.tokens.push({
|
2230
2308
|
type: "blockquote_close",
|
2231
2309
|
level: --r.level
|
2232
|
-
}), r.parentType = u, d[1] = r.line,
|
2310
|
+
}), r.parentType = u, d[1] = r.line, f = 0; f < a.length; f++) r.bMarks[f + e] = l[f], r.tShift[f + e] = a[f];
|
2233
2311
|
return r.blkIndent = c, !0;
|
2234
2312
|
}
|
2235
2313
|
function hr(r, e, t, n) {
|
@@ -2282,8 +2360,8 @@ function list(r, e, t, n) {
|
|
2282
2360
|
u,
|
2283
2361
|
d,
|
2284
2362
|
h,
|
2285
|
-
p,
|
2286
2363
|
f,
|
2364
|
+
p,
|
2287
2365
|
b,
|
2288
2366
|
m,
|
2289
2367
|
g,
|
@@ -2293,7 +2371,7 @@ function list(r, e, t, n) {
|
|
2293
2371
|
E,
|
2294
2372
|
x,
|
2295
2373
|
R = !0,
|
2296
|
-
|
2374
|
+
C,
|
2297
2375
|
_,
|
2298
2376
|
H,
|
2299
2377
|
F;
|
@@ -2309,7 +2387,7 @@ function list(r, e, t, n) {
|
|
2309
2387
|
type: "bullet_list_open",
|
2310
2388
|
lines: E = [e, 0],
|
2311
2389
|
level: r.level++
|
2312
|
-
}), s = e, S = !1,
|
2390
|
+
}), s = e, S = !1, C = r.parser.ruler.getRules("list"); s < t && (v = r.skipSpaces(h), f = r.eMarks[s], v >= f ? p = 1 : p = v - h, p > 4 && (p = 1), p < 1 && (p = 1), o = h - r.bMarks[s] + p, r.tokens.push({
|
2313
2391
|
type: "list_item_open",
|
2314
2392
|
lines: x = [e, 0],
|
2315
2393
|
level: r.level++
|
@@ -2317,7 +2395,7 @@ function list(r, e, t, n) {
|
|
2317
2395
|
type: "list_item_close",
|
2318
2396
|
level: --r.level
|
2319
2397
|
}), s = e = r.line, x[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
|
2320
|
-
for (F = !1, _ = 0, H =
|
2398
|
+
for (F = !1, _ = 0, H = C.length; _ < H; _++) if (C[_](r, s, t, !0)) {
|
2321
2399
|
F = !0;
|
2322
2400
|
break;
|
2323
2401
|
}
|
@@ -2442,21 +2520,21 @@ function getLine(r, e) {
|
|
2442
2520
|
return r.src.substr(t, n - t);
|
2443
2521
|
}
|
2444
2522
|
function table(r, e, t, n) {
|
2445
|
-
var s, o, a, l, c, u, d, h,
|
2523
|
+
var s, o, a, l, c, u, d, h, f, p, b;
|
2446
2524
|
if (e + 2 > t || (c = e + 1, r.tShift[c] < r.blkIndent) || (a = r.bMarks[c] + r.tShift[c], a >= r.eMarks[c]) || (s = r.src.charCodeAt(a), s !== 124 && s !== 45 && s !== 58) || (o = getLine(r, e + 1), !/^[-:| ]+$/.test(o)) || (u = o.split("|"), u <= 2)) return !1;
|
2447
2525
|
for (h = [], l = 0; l < u.length; l++) {
|
2448
|
-
if (
|
2526
|
+
if (f = u[l].trim(), !f) {
|
2449
2527
|
if (l === 0 || l === u.length - 1) continue;
|
2450
2528
|
return !1;
|
2451
2529
|
}
|
2452
|
-
if (!/^:?-+:?$/.test(
|
2453
|
-
|
2530
|
+
if (!/^:?-+:?$/.test(f)) return !1;
|
2531
|
+
f.charCodeAt(f.length - 1) === 58 ? h.push(f.charCodeAt(0) === 58 ? "center" : "right") : f.charCodeAt(0) === 58 ? h.push("left") : h.push("");
|
2454
2532
|
}
|
2455
2533
|
if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
|
2456
2534
|
if (n) return !0;
|
2457
2535
|
for (r.tokens.push({
|
2458
2536
|
type: "table_open",
|
2459
|
-
lines:
|
2537
|
+
lines: p = [e, 0],
|
2460
2538
|
level: r.level++
|
2461
2539
|
}), r.tokens.push({
|
2462
2540
|
type: "thead_open",
|
@@ -2519,7 +2597,7 @@ function table(r, e, t, n) {
|
|
2519
2597
|
}), r.tokens.push({
|
2520
2598
|
type: "table_close",
|
2521
2599
|
level: --r.level
|
2522
|
-
}),
|
2600
|
+
}), p[1] = b[1] = c, r.line = c, !0;
|
2523
2601
|
}
|
2524
2602
|
function skipMarker(r, e) {
|
2525
2603
|
var t,
|
@@ -2535,7 +2613,7 @@ function markTightParagraphs$1(r, e) {
|
|
2535
2613
|
for (t = e + 2, n = r.tokens.length - 2; t < n; t++) r.tokens[t].level === s && r.tokens[t].type === "paragraph_open" && (r.tokens[t + 2].tight = !0, r.tokens[t].tight = !0, t += 2);
|
2536
2614
|
}
|
2537
2615
|
function deflist(r, e, t, n) {
|
2538
|
-
var s, o, a, l, c, u, d, h,
|
2616
|
+
var s, o, a, l, c, u, d, h, f, p, b, m, g, v;
|
2539
2617
|
if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
|
2540
2618
|
if (d = e + 1, r.isEmpty(d) && ++d > t || r.tShift[d] < r.blkIndent || (s = skipMarker(r, d), s < 0) || r.level >= r.options.maxNesting) return !1;
|
2541
2619
|
u = r.tokens.length, r.tokens.push({
|
@@ -2562,7 +2640,7 @@ function deflist(r, e, t, n) {
|
|
2562
2640
|
type: "dd_open",
|
2563
2641
|
lines: l = [d, 0],
|
2564
2642
|
level: r.level++
|
2565
|
-
}), m = r.tight,
|
2643
|
+
}), m = r.tight, f = r.ddIndent, h = r.blkIndent, b = r.tShift[o], p = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || g) && (v = !1), g = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = p, r.blkIndent = h, r.ddIndent = f, r.tokens.push({
|
2566
2644
|
type: "dd_close",
|
2567
2645
|
level: --r.level
|
2568
2646
|
}), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
|
@@ -2939,21 +3017,21 @@ function links(r, e) {
|
|
2939
3017
|
u,
|
2940
3018
|
d = !1,
|
2941
3019
|
h = r.pos,
|
2942
|
-
|
2943
|
-
|
2944
|
-
b = r.src.charCodeAt(
|
2945
|
-
if (b === 33 && (d = !0, b = r.src.charCodeAt(++
|
2946
|
-
if (l = n + 1, l <
|
2947
|
-
for (l++; l <
|
2948
|
-
if (l >=
|
2949
|
-
for (
|
2950
|
-
if (l <
|
2951
|
-
if (l >=
|
3020
|
+
f = r.posMax,
|
3021
|
+
p = r.pos,
|
3022
|
+
b = r.src.charCodeAt(p);
|
3023
|
+
if (b === 33 && (d = !0, b = r.src.charCodeAt(++p)), b !== 91 || r.level >= r.options.maxNesting || (t = p + 1, n = parseLinkLabel(r, p), n < 0)) return !1;
|
3024
|
+
if (l = n + 1, l < f && r.src.charCodeAt(l) === 40) {
|
3025
|
+
for (l++; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
|
3026
|
+
if (l >= f) return !1;
|
3027
|
+
for (p = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", p = l; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
|
3028
|
+
if (l < f && p !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
|
3029
|
+
if (l >= f || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
|
2952
3030
|
l++;
|
2953
3031
|
} else {
|
2954
3032
|
if (r.linkLevel > 0) return !1;
|
2955
|
-
for (; l <
|
2956
|
-
if (l <
|
3033
|
+
for (; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
|
3034
|
+
if (l < f && r.src.charCodeAt(l) === 91 && (p = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(p, l++) : l = p - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
|
2957
3035
|
o = c.href, a = c.title;
|
2958
3036
|
}
|
2959
3037
|
return e || (r.pos = t, r.posMax = n, d ? r.push({
|
@@ -2970,7 +3048,7 @@ function links(r, e) {
|
|
2970
3048
|
}), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
|
2971
3049
|
type: "link_close",
|
2972
3050
|
level: --r.level
|
2973
|
-
}))), r.pos = l, r.posMax =
|
3051
|
+
}))), r.pos = l, r.posMax = f, !0;
|
2974
3052
|
}
|
2975
3053
|
function footnote_inline(r, e) {
|
2976
3054
|
var t,
|
@@ -3366,12 +3444,12 @@ var SetFileTypes = /*#__PURE__*/function () {
|
|
3366
3444
|
}, {
|
3367
3445
|
key: "processMicrophone",
|
3368
3446
|
value: function processMicrophone(e, t, n, s) {
|
3369
|
-
var _c$files,
|
3370
|
-
var l, c, u, d, h,
|
3447
|
+
var _c$files, _f$maxNumberOfFiles;
|
3448
|
+
var l, c, u, d, h, f;
|
3371
3449
|
var a = _objectSpread({
|
3372
3450
|
acceptedFormats: "audio/*"
|
3373
3451
|
}, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
|
3374
|
-
n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((
|
3452
|
+
n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_f$maxNumberOfFiles = (f = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _f$maxNumberOfFiles !== void 0 ? _f$maxNumberOfFiles : f.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
|
3375
3453
|
}
|
3376
3454
|
// prettier-ignore
|
3377
3455
|
}, {
|
@@ -3457,11 +3535,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3457
3535
|
}, {
|
3458
3536
|
key: "callServiceAPI",
|
3459
3537
|
value: function () {
|
3460
|
-
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3538
|
+
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
|
3461
3539
|
var _c$headers, _u$ContentType;
|
3462
3540
|
var l, c, u, d, s, o, a;
|
3463
|
-
return _regeneratorRuntime().wrap(function
|
3464
|
-
while (1) switch (
|
3541
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
3542
|
+
while (1) switch (_context17.prev = _context17.next) {
|
3465
3543
|
case 0:
|
3466
3544
|
s = _objectSpread({
|
3467
3545
|
messages: t
|
@@ -3470,24 +3548,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3470
3548
|
(l = this.requestSettings.headers) != null && l["Content-Type"] || ((_c$headers = (c = this.requestSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_u$ContentType = (u = this.requestSettings.headers)["Content-Type"]) !== null && _u$ContentType !== void 0 ? _u$ContentType : u["Content-Type"] = "application/json", o = !0);
|
3471
3549
|
a = this.deepChat.stream;
|
3472
3550
|
if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
|
3473
|
-
|
3551
|
+
_context17.next = 9;
|
3474
3552
|
break;
|
3475
3553
|
}
|
3476
|
-
|
3554
|
+
_context17.next = 7;
|
3477
3555
|
return Stream.request(this, s, e);
|
3478
3556
|
case 7:
|
3479
|
-
|
3557
|
+
_context17.next = 11;
|
3480
3558
|
break;
|
3481
3559
|
case 9:
|
3482
|
-
|
3560
|
+
_context17.next = 11;
|
3483
3561
|
return HTTPRequest.request(this, s, e);
|
3484
3562
|
case 11:
|
3485
3563
|
o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
|
3486
3564
|
case 12:
|
3487
3565
|
case "end":
|
3488
|
-
return
|
3566
|
+
return _context17.stop();
|
3489
3567
|
}
|
3490
|
-
},
|
3568
|
+
}, _callee17, this);
|
3491
3569
|
}));
|
3492
3570
|
function callServiceAPI(_x32, _x33, _x34) {
|
3493
3571
|
return _callServiceAPI.apply(this, arguments);
|
@@ -3497,22 +3575,22 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3497
3575
|
}, {
|
3498
3576
|
key: "callApiWithFiles",
|
3499
3577
|
value: function () {
|
3500
|
-
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3578
|
+
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n, s) {
|
3501
3579
|
var o, a, l;
|
3502
|
-
return _regeneratorRuntime().wrap(function
|
3503
|
-
while (1) switch (
|
3580
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
3581
|
+
while (1) switch (_context18.prev = _context18.next) {
|
3504
3582
|
case 0:
|
3505
3583
|
o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
|
3506
3584
|
this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
|
3507
|
-
|
3585
|
+
_context18.next = 4;
|
3508
3586
|
return HTTPRequest.request(this, o, t, !1);
|
3509
3587
|
case 4:
|
3510
3588
|
this.requestSettings = a;
|
3511
3589
|
case 5:
|
3512
3590
|
case "end":
|
3513
|
-
return
|
3591
|
+
return _context18.stop();
|
3514
3592
|
}
|
3515
|
-
},
|
3593
|
+
}, _callee18, this);
|
3516
3594
|
}));
|
3517
3595
|
function callApiWithFiles(_x35, _x36, _x37, _x38) {
|
3518
3596
|
return _callApiWithFiles.apply(this, arguments);
|
@@ -3522,29 +3600,29 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3522
3600
|
}, {
|
3523
3601
|
key: "callAPI",
|
3524
3602
|
value: function () {
|
3525
|
-
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3603
|
+
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t) {
|
3526
3604
|
var n, _s3;
|
3527
|
-
return _regeneratorRuntime().wrap(function
|
3528
|
-
while (1) switch (
|
3605
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
3606
|
+
while (1) switch (_context19.prev = _context19.next) {
|
3529
3607
|
case 0:
|
3530
3608
|
if (this.requestSettings) {
|
3531
|
-
|
3609
|
+
_context19.next = 2;
|
3532
3610
|
break;
|
3533
3611
|
}
|
3534
3612
|
throw new Error("Request settings have not been set up");
|
3535
3613
|
case 2:
|
3536
3614
|
n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
|
3537
|
-
if (this.websocket) {
|
3615
|
+
if (this.requestSettings.websocket) {
|
3538
3616
|
_s3 = _objectSpread({
|
3539
3617
|
messages: n
|
3540
3618
|
}, this.rawBody);
|
3541
|
-
Websocket.sendWebsocket(this
|
3619
|
+
Websocket.sendWebsocket(this, _s3, t, !1);
|
3542
3620
|
} else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
|
3543
3621
|
case 4:
|
3544
3622
|
case "end":
|
3545
|
-
return
|
3623
|
+
return _context19.stop();
|
3546
3624
|
}
|
3547
|
-
},
|
3625
|
+
}, _callee19, this);
|
3548
3626
|
}));
|
3549
3627
|
function callAPI(_x39, _x40) {
|
3550
3628
|
return _callAPI.apply(this, arguments);
|
@@ -3555,22 +3633,22 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3555
3633
|
}, {
|
3556
3634
|
key: "extractResultData",
|
3557
3635
|
value: function () {
|
3558
|
-
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3559
|
-
return _regeneratorRuntime().wrap(function
|
3560
|
-
while (1) switch (
|
3636
|
+
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
|
3637
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
3638
|
+
while (1) switch (_context20.prev = _context20.next) {
|
3561
3639
|
case 0:
|
3562
3640
|
if (!e.error) {
|
3563
|
-
|
3641
|
+
_context20.next = 2;
|
3564
3642
|
break;
|
3565
3643
|
}
|
3566
3644
|
throw e.error;
|
3567
3645
|
case 2:
|
3568
|
-
return
|
3646
|
+
return _context20.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
|
3569
3647
|
case 3:
|
3570
3648
|
case "end":
|
3571
|
-
return
|
3649
|
+
return _context20.stop();
|
3572
3650
|
}
|
3573
|
-
},
|
3651
|
+
}, _callee20);
|
3574
3652
|
}));
|
3575
3653
|
function extractResultData(_x41) {
|
3576
3654
|
return _extractResultData.apply(this, arguments);
|
@@ -3936,13 +4014,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3936
4014
|
}, {
|
3937
4015
|
key: "callServiceAPI",
|
3938
4016
|
value: function () {
|
3939
|
-
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4017
|
+
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
|
3940
4018
|
var s;
|
3941
|
-
return _regeneratorRuntime().wrap(function
|
3942
|
-
while (1) switch (
|
4019
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
4020
|
+
while (1) switch (_context21.prev = _context21.next) {
|
3943
4021
|
case 0:
|
3944
4022
|
if (this.requestSettings) {
|
3945
|
-
|
4023
|
+
_context21.next = 2;
|
3946
4024
|
break;
|
3947
4025
|
}
|
3948
4026
|
throw new Error("Request settings have not been set up");
|
@@ -3951,9 +4029,9 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3951
4029
|
HTTPRequest.request(this, s, e);
|
3952
4030
|
case 4:
|
3953
4031
|
case "end":
|
3954
|
-
return
|
4032
|
+
return _context21.stop();
|
3955
4033
|
}
|
3956
|
-
},
|
4034
|
+
}, _callee21, this);
|
3957
4035
|
}));
|
3958
4036
|
function callServiceAPI(_x42, _x43, _x44) {
|
3959
4037
|
return _callServiceAPI2.apply(this, arguments);
|
@@ -3984,18 +4062,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
3984
4062
|
}, {
|
3985
4063
|
key: "callServiceAPI",
|
3986
4064
|
value: function () {
|
3987
|
-
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3988
|
-
return _regeneratorRuntime().wrap(function
|
3989
|
-
while (1) switch (
|
4065
|
+
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e, t, n) {
|
4066
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
4067
|
+
while (1) switch (_context22.prev = _context22.next) {
|
3990
4068
|
case 0:
|
3991
4069
|
if (this.requestSettings) {
|
3992
|
-
|
4070
|
+
_context22.next = 2;
|
3993
4071
|
break;
|
3994
4072
|
}
|
3995
4073
|
throw new Error("Request settings have not been set up");
|
3996
4074
|
case 2:
|
3997
4075
|
if (n != null && n[0]) {
|
3998
|
-
|
4076
|
+
_context22.next = 4;
|
3999
4077
|
break;
|
4000
4078
|
}
|
4001
4079
|
throw new Error("No file was added");
|
@@ -4003,9 +4081,9 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
4003
4081
|
HTTPRequest.poll(this, n[0], e, !1);
|
4004
4082
|
case 5:
|
4005
4083
|
case "end":
|
4006
|
-
return
|
4084
|
+
return _context22.stop();
|
4007
4085
|
}
|
4008
|
-
},
|
4086
|
+
}, _callee22, this);
|
4009
4087
|
}));
|
4010
4088
|
function callServiceAPI(_x45, _x46, _x47) {
|
4011
4089
|
return _callServiceAPI3.apply(this, arguments);
|
@@ -4036,33 +4114,33 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
4036
4114
|
_createClass(HuggingFaceAudioClassificationIO, [{
|
4037
4115
|
key: "extractPollResultData",
|
4038
4116
|
value: function () {
|
4039
|
-
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4117
|
+
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
|
4040
4118
|
var t;
|
4041
|
-
return _regeneratorRuntime().wrap(function
|
4042
|
-
while (1) switch (
|
4119
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
4120
|
+
while (1) switch (_context23.prev = _context23.next) {
|
4043
4121
|
case 0:
|
4044
4122
|
if (!e.estimated_time) {
|
4045
|
-
|
4123
|
+
_context23.next = 2;
|
4046
4124
|
break;
|
4047
4125
|
}
|
4048
|
-
return
|
4126
|
+
return _context23.abrupt("return", {
|
4049
4127
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4050
4128
|
});
|
4051
4129
|
case 2:
|
4052
4130
|
if (!e.error) {
|
4053
|
-
|
4131
|
+
_context23.next = 4;
|
4054
4132
|
break;
|
4055
4133
|
}
|
4056
4134
|
throw e.error;
|
4057
4135
|
case 4:
|
4058
|
-
return
|
4136
|
+
return _context23.abrupt("return", {
|
4059
4137
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
4060
4138
|
});
|
4061
4139
|
case 5:
|
4062
4140
|
case "end":
|
4063
|
-
return
|
4141
|
+
return _context23.stop();
|
4064
4142
|
}
|
4065
|
-
},
|
4143
|
+
}, _callee23);
|
4066
4144
|
}));
|
4067
4145
|
function extractPollResultData(_x48) {
|
4068
4146
|
return _extractPollResultData.apply(this, arguments);
|
@@ -4087,33 +4165,33 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
4087
4165
|
_createClass(HuggingFaceImageClassificationIO, [{
|
4088
4166
|
key: "extractPollResultData",
|
4089
4167
|
value: function () {
|
4090
|
-
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4168
|
+
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
|
4091
4169
|
var t;
|
4092
|
-
return _regeneratorRuntime().wrap(function
|
4093
|
-
while (1) switch (
|
4170
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
4171
|
+
while (1) switch (_context24.prev = _context24.next) {
|
4094
4172
|
case 0:
|
4095
4173
|
if (!e.estimated_time) {
|
4096
|
-
|
4174
|
+
_context24.next = 2;
|
4097
4175
|
break;
|
4098
4176
|
}
|
4099
|
-
return
|
4177
|
+
return _context24.abrupt("return", {
|
4100
4178
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4101
4179
|
});
|
4102
4180
|
case 2:
|
4103
4181
|
if (!e.error) {
|
4104
|
-
|
4182
|
+
_context24.next = 4;
|
4105
4183
|
break;
|
4106
4184
|
}
|
4107
4185
|
throw e.error;
|
4108
4186
|
case 4:
|
4109
|
-
return
|
4187
|
+
return _context24.abrupt("return", {
|
4110
4188
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
4111
4189
|
});
|
4112
4190
|
case 5:
|
4113
4191
|
case "end":
|
4114
|
-
return
|
4192
|
+
return _context24.stop();
|
4115
4193
|
}
|
4116
|
-
},
|
4194
|
+
}, _callee24);
|
4117
4195
|
}));
|
4118
4196
|
function extractPollResultData(_x49) {
|
4119
4197
|
return _extractPollResultData2.apply(this, arguments);
|
@@ -4200,19 +4278,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4200
4278
|
}, {
|
4201
4279
|
key: "callServiceAPI",
|
4202
4280
|
value: function () {
|
4203
|
-
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4281
|
+
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
|
4204
4282
|
var s;
|
4205
|
-
return _regeneratorRuntime().wrap(function
|
4206
|
-
while (1) switch (
|
4283
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
4284
|
+
while (1) switch (_context25.prev = _context25.next) {
|
4207
4285
|
case 0:
|
4208
4286
|
if (this.requestSettings) {
|
4209
|
-
|
4287
|
+
_context25.next = 2;
|
4210
4288
|
break;
|
4211
4289
|
}
|
4212
4290
|
throw new Error("Request settings have not been set up");
|
4213
4291
|
case 2:
|
4214
4292
|
if (n) {
|
4215
|
-
|
4293
|
+
_context25.next = 4;
|
4216
4294
|
break;
|
4217
4295
|
}
|
4218
4296
|
throw new Error("Image was not found");
|
@@ -4221,9 +4299,9 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4221
4299
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
4222
4300
|
case 6:
|
4223
4301
|
case "end":
|
4224
|
-
return
|
4302
|
+
return _context25.stop();
|
4225
4303
|
}
|
4226
|
-
},
|
4304
|
+
}, _callee25, this);
|
4227
4305
|
}));
|
4228
4306
|
function callServiceAPI(_x50, _x51, _x52) {
|
4229
4307
|
return _callServiceAPI4.apply(this, arguments);
|
@@ -4233,17 +4311,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4233
4311
|
}, {
|
4234
4312
|
key: "extractResultData",
|
4235
4313
|
value: function () {
|
4236
|
-
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4237
|
-
return _regeneratorRuntime().wrap(function
|
4238
|
-
while (1) switch (
|
4314
|
+
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
|
4315
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
4316
|
+
while (1) switch (_context26.prev = _context26.next) {
|
4239
4317
|
case 0:
|
4240
4318
|
if (!e.message) {
|
4241
|
-
|
4319
|
+
_context26.next = 2;
|
4242
4320
|
break;
|
4243
4321
|
}
|
4244
4322
|
throw e.message;
|
4245
4323
|
case 2:
|
4246
|
-
return
|
4324
|
+
return _context26.abrupt("return", {
|
4247
4325
|
files: e.artifacts.map(function (n) {
|
4248
4326
|
return {
|
4249
4327
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4253,9 +4331,9 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4253
4331
|
});
|
4254
4332
|
case 3:
|
4255
4333
|
case "end":
|
4256
|
-
return
|
4334
|
+
return _context26.stop();
|
4257
4335
|
}
|
4258
|
-
},
|
4336
|
+
}, _callee26);
|
4259
4337
|
}));
|
4260
4338
|
function extractResultData(_x53) {
|
4261
4339
|
return _extractResultData2.apply(this, arguments);
|
@@ -4309,19 +4387,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4309
4387
|
}, {
|
4310
4388
|
key: "callServiceAPI",
|
4311
4389
|
value: function () {
|
4312
|
-
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4390
|
+
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e, t, n) {
|
4313
4391
|
var a, l, s, o;
|
4314
|
-
return _regeneratorRuntime().wrap(function
|
4315
|
-
while (1) switch (
|
4392
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
4393
|
+
while (1) switch (_context27.prev = _context27.next) {
|
4316
4394
|
case 0:
|
4317
4395
|
if (this.requestSettings) {
|
4318
|
-
|
4396
|
+
_context27.next = 2;
|
4319
4397
|
break;
|
4320
4398
|
}
|
4321
4399
|
throw new Error("Request settings have not been set up");
|
4322
4400
|
case 2:
|
4323
4401
|
if (!(!n || !n[0] || !n[1])) {
|
4324
|
-
|
4402
|
+
_context27.next = 4;
|
4325
4403
|
break;
|
4326
4404
|
}
|
4327
4405
|
throw new Error("Image was not found");
|
@@ -4330,9 +4408,9 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4330
4408
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4331
4409
|
case 6:
|
4332
4410
|
case "end":
|
4333
|
-
return
|
4411
|
+
return _context27.stop();
|
4334
4412
|
}
|
4335
|
-
},
|
4413
|
+
}, _callee27, this);
|
4336
4414
|
}));
|
4337
4415
|
function callServiceAPI(_x54, _x55, _x56) {
|
4338
4416
|
return _callServiceAPI5.apply(this, arguments);
|
@@ -4342,17 +4420,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4342
4420
|
}, {
|
4343
4421
|
key: "extractResultData",
|
4344
4422
|
value: function () {
|
4345
|
-
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4346
|
-
return _regeneratorRuntime().wrap(function
|
4347
|
-
while (1) switch (
|
4423
|
+
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
|
4424
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
4425
|
+
while (1) switch (_context28.prev = _context28.next) {
|
4348
4426
|
case 0:
|
4349
4427
|
if (!e.message) {
|
4350
|
-
|
4428
|
+
_context28.next = 2;
|
4351
4429
|
break;
|
4352
4430
|
}
|
4353
4431
|
throw e.message;
|
4354
4432
|
case 2:
|
4355
|
-
return
|
4433
|
+
return _context28.abrupt("return", {
|
4356
4434
|
files: e.artifacts.map(function (n) {
|
4357
4435
|
return {
|
4358
4436
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4362,9 +4440,9 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4362
4440
|
});
|
4363
4441
|
case 3:
|
4364
4442
|
case "end":
|
4365
|
-
return
|
4443
|
+
return _context28.stop();
|
4366
4444
|
}
|
4367
|
-
},
|
4445
|
+
}, _callee28);
|
4368
4446
|
}));
|
4369
4447
|
function extractResultData(_x57) {
|
4370
4448
|
return _extractResultData3.apply(this, arguments);
|
@@ -4399,32 +4477,32 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
|
|
4399
4477
|
_createClass(HuggingFaceAudioRecognitionIO, [{
|
4400
4478
|
key: "extractPollResultData",
|
4401
4479
|
value: function () {
|
4402
|
-
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4403
|
-
return _regeneratorRuntime().wrap(function
|
4404
|
-
while (1) switch (
|
4480
|
+
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
|
4481
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
4482
|
+
while (1) switch (_context29.prev = _context29.next) {
|
4405
4483
|
case 0:
|
4406
4484
|
if (!e.estimated_time) {
|
4407
|
-
|
4485
|
+
_context29.next = 2;
|
4408
4486
|
break;
|
4409
4487
|
}
|
4410
|
-
return
|
4488
|
+
return _context29.abrupt("return", {
|
4411
4489
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4412
4490
|
});
|
4413
4491
|
case 2:
|
4414
4492
|
if (!e.error) {
|
4415
|
-
|
4493
|
+
_context29.next = 4;
|
4416
4494
|
break;
|
4417
4495
|
}
|
4418
4496
|
throw e.error;
|
4419
4497
|
case 4:
|
4420
|
-
return
|
4498
|
+
return _context29.abrupt("return", {
|
4421
4499
|
text: e.text || ""
|
4422
4500
|
});
|
4423
4501
|
case 5:
|
4424
4502
|
case "end":
|
4425
|
-
return
|
4503
|
+
return _context29.stop();
|
4426
4504
|
}
|
4427
|
-
},
|
4505
|
+
}, _callee29);
|
4428
4506
|
}));
|
4429
4507
|
function extractPollResultData(_x58) {
|
4430
4508
|
return _extractPollResultData3.apply(this, arguments);
|
@@ -4447,24 +4525,24 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
|
|
4447
4525
|
_createClass(HuggingFaceTextGenerationIO, [{
|
4448
4526
|
key: "extractResultData",
|
4449
4527
|
value: function () {
|
4450
|
-
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4451
|
-
return _regeneratorRuntime().wrap(function
|
4452
|
-
while (1) switch (
|
4528
|
+
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
|
4529
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
4530
|
+
while (1) switch (_context30.prev = _context30.next) {
|
4453
4531
|
case 0:
|
4454
4532
|
if (!e.error) {
|
4455
|
-
|
4533
|
+
_context30.next = 2;
|
4456
4534
|
break;
|
4457
4535
|
}
|
4458
4536
|
throw e.error;
|
4459
4537
|
case 2:
|
4460
|
-
return
|
4538
|
+
return _context30.abrupt("return", {
|
4461
4539
|
text: e[0].generated_text || ""
|
4462
4540
|
});
|
4463
4541
|
case 3:
|
4464
4542
|
case "end":
|
4465
|
-
return
|
4543
|
+
return _context30.stop();
|
4466
4544
|
}
|
4467
|
-
},
|
4545
|
+
}, _callee30);
|
4468
4546
|
}));
|
4469
4547
|
function extractResultData(_x59) {
|
4470
4548
|
return _extractResultData4.apply(this, arguments);
|
@@ -4503,24 +4581,24 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
|
|
4503
4581
|
}, {
|
4504
4582
|
key: "extractResultData",
|
4505
4583
|
value: function () {
|
4506
|
-
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4507
|
-
return _regeneratorRuntime().wrap(function
|
4508
|
-
while (1) switch (
|
4584
|
+
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
|
4585
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
4586
|
+
while (1) switch (_context31.prev = _context31.next) {
|
4509
4587
|
case 0:
|
4510
4588
|
if (!e.error) {
|
4511
|
-
|
4589
|
+
_context31.next = 2;
|
4512
4590
|
break;
|
4513
4591
|
}
|
4514
4592
|
throw e.error;
|
4515
4593
|
case 2:
|
4516
|
-
return
|
4594
|
+
return _context31.abrupt("return", {
|
4517
4595
|
text: e.answer || ""
|
4518
4596
|
});
|
4519
4597
|
case 3:
|
4520
4598
|
case "end":
|
4521
|
-
return
|
4599
|
+
return _context31.stop();
|
4522
4600
|
}
|
4523
|
-
},
|
4601
|
+
}, _callee31);
|
4524
4602
|
}));
|
4525
4603
|
function extractResultData(_x60) {
|
4526
4604
|
return _extractResultData5.apply(this, arguments);
|
@@ -4543,24 +4621,24 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
|
|
4543
4621
|
_createClass(HuggingFaceSummarizationIO, [{
|
4544
4622
|
key: "extractResultData",
|
4545
4623
|
value: function () {
|
4546
|
-
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4547
|
-
return _regeneratorRuntime().wrap(function
|
4548
|
-
while (1) switch (
|
4624
|
+
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
|
4625
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
4626
|
+
while (1) switch (_context32.prev = _context32.next) {
|
4549
4627
|
case 0:
|
4550
4628
|
if (!e.error) {
|
4551
|
-
|
4629
|
+
_context32.next = 2;
|
4552
4630
|
break;
|
4553
4631
|
}
|
4554
4632
|
throw e.error;
|
4555
4633
|
case 2:
|
4556
|
-
return
|
4634
|
+
return _context32.abrupt("return", {
|
4557
4635
|
text: e[0].summary_text || ""
|
4558
4636
|
});
|
4559
4637
|
case 3:
|
4560
4638
|
case "end":
|
4561
|
-
return
|
4639
|
+
return _context32.stop();
|
4562
4640
|
}
|
4563
|
-
},
|
4641
|
+
}, _callee32);
|
4564
4642
|
}));
|
4565
4643
|
function extractResultData(_x61) {
|
4566
4644
|
return _extractResultData6.apply(this, arguments);
|
@@ -4623,24 +4701,24 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
|
|
4623
4701
|
}, {
|
4624
4702
|
key: "extractResultData",
|
4625
4703
|
value: function () {
|
4626
|
-
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4627
|
-
return _regeneratorRuntime().wrap(function
|
4628
|
-
while (1) switch (
|
4704
|
+
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e) {
|
4705
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
4706
|
+
while (1) switch (_context33.prev = _context33.next) {
|
4629
4707
|
case 0:
|
4630
4708
|
if (!e.error) {
|
4631
|
-
|
4709
|
+
_context33.next = 2;
|
4632
4710
|
break;
|
4633
4711
|
}
|
4634
4712
|
throw e.error;
|
4635
4713
|
case 2:
|
4636
|
-
return
|
4714
|
+
return _context33.abrupt("return", {
|
4637
4715
|
text: e.generated_text || ""
|
4638
4716
|
});
|
4639
4717
|
case 3:
|
4640
4718
|
case "end":
|
4641
|
-
return
|
4719
|
+
return _context33.stop();
|
4642
4720
|
}
|
4643
|
-
},
|
4721
|
+
}, _callee33);
|
4644
4722
|
}));
|
4645
4723
|
function extractResultData(_x62) {
|
4646
4724
|
return _extractResultData7.apply(this, arguments);
|
@@ -4684,19 +4762,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4684
4762
|
}, {
|
4685
4763
|
key: "callServiceAPI",
|
4686
4764
|
value: function () {
|
4687
|
-
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4765
|
+
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e, t, n) {
|
4688
4766
|
var a, l, s, o;
|
4689
|
-
return _regeneratorRuntime().wrap(function
|
4690
|
-
while (1) switch (
|
4767
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
4768
|
+
while (1) switch (_context34.prev = _context34.next) {
|
4691
4769
|
case 0:
|
4692
4770
|
if (this.requestSettings) {
|
4693
|
-
|
4771
|
+
_context34.next = 2;
|
4694
4772
|
break;
|
4695
4773
|
}
|
4696
4774
|
throw new Error("Request settings have not been set up");
|
4697
4775
|
case 2:
|
4698
4776
|
if (n) {
|
4699
|
-
|
4777
|
+
_context34.next = 4;
|
4700
4778
|
break;
|
4701
4779
|
}
|
4702
4780
|
throw new Error("Image was not found");
|
@@ -4705,9 +4783,9 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4705
4783
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4706
4784
|
case 6:
|
4707
4785
|
case "end":
|
4708
|
-
return
|
4786
|
+
return _context34.stop();
|
4709
4787
|
}
|
4710
|
-
},
|
4788
|
+
}, _callee34, this);
|
4711
4789
|
}));
|
4712
4790
|
function callServiceAPI(_x63, _x64, _x65) {
|
4713
4791
|
return _callServiceAPI6.apply(this, arguments);
|
@@ -4717,17 +4795,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4717
4795
|
}, {
|
4718
4796
|
key: "extractResultData",
|
4719
4797
|
value: function () {
|
4720
|
-
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4721
|
-
return _regeneratorRuntime().wrap(function
|
4722
|
-
while (1) switch (
|
4798
|
+
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
|
4799
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
4800
|
+
while (1) switch (_context35.prev = _context35.next) {
|
4723
4801
|
case 0:
|
4724
4802
|
if (!e.message) {
|
4725
|
-
|
4803
|
+
_context35.next = 2;
|
4726
4804
|
break;
|
4727
4805
|
}
|
4728
4806
|
throw e.message;
|
4729
4807
|
case 2:
|
4730
|
-
return
|
4808
|
+
return _context35.abrupt("return", {
|
4731
4809
|
files: e.artifacts.map(function (n) {
|
4732
4810
|
return {
|
4733
4811
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4737,9 +4815,9 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4737
4815
|
});
|
4738
4816
|
case 3:
|
4739
4817
|
case "end":
|
4740
|
-
return
|
4818
|
+
return _context35.stop();
|
4741
4819
|
}
|
4742
|
-
},
|
4820
|
+
}, _callee35);
|
4743
4821
|
}));
|
4744
4822
|
function extractResultData(_x66) {
|
4745
4823
|
return _extractResultData8.apply(this, arguments);
|
@@ -4772,24 +4850,24 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
|
|
4772
4850
|
_createClass(HuggingFaceTranslationIO, [{
|
4773
4851
|
key: "extractResultData",
|
4774
4852
|
value: function () {
|
4775
|
-
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4776
|
-
return _regeneratorRuntime().wrap(function
|
4777
|
-
while (1) switch (
|
4853
|
+
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e) {
|
4854
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
4855
|
+
while (1) switch (_context36.prev = _context36.next) {
|
4778
4856
|
case 0:
|
4779
4857
|
if (!e.error) {
|
4780
|
-
|
4858
|
+
_context36.next = 2;
|
4781
4859
|
break;
|
4782
4860
|
}
|
4783
4861
|
throw e.error;
|
4784
4862
|
case 2:
|
4785
|
-
return
|
4863
|
+
return _context36.abrupt("return", {
|
4786
4864
|
text: e[0].translation_text || ""
|
4787
4865
|
});
|
4788
4866
|
case 3:
|
4789
4867
|
case "end":
|
4790
|
-
return
|
4868
|
+
return _context36.stop();
|
4791
4869
|
}
|
4792
|
-
},
|
4870
|
+
}, _callee36);
|
4793
4871
|
}));
|
4794
4872
|
function extractResultData(_x67) {
|
4795
4873
|
return _extractResultData9.apply(this, arguments);
|
@@ -4825,13 +4903,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4825
4903
|
}, {
|
4826
4904
|
key: "callServiceAPI",
|
4827
4905
|
value: function () {
|
4828
|
-
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4906
|
+
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e, t) {
|
4829
4907
|
var n;
|
4830
|
-
return _regeneratorRuntime().wrap(function
|
4831
|
-
while (1) switch (
|
4908
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
4909
|
+
while (1) switch (_context37.prev = _context37.next) {
|
4832
4910
|
case 0:
|
4833
4911
|
if (this.requestSettings) {
|
4834
|
-
|
4912
|
+
_context37.next = 2;
|
4835
4913
|
break;
|
4836
4914
|
}
|
4837
4915
|
throw new Error("Request settings have not been set up");
|
@@ -4840,9 +4918,9 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4840
4918
|
HTTPRequest.request(this, n, e);
|
4841
4919
|
case 4:
|
4842
4920
|
case "end":
|
4843
|
-
return
|
4921
|
+
return _context37.stop();
|
4844
4922
|
}
|
4845
|
-
},
|
4923
|
+
}, _callee37, this);
|
4846
4924
|
}));
|
4847
4925
|
function callServiceAPI(_x68, _x69) {
|
4848
4926
|
return _callServiceAPI7.apply(this, arguments);
|
@@ -4852,17 +4930,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4852
4930
|
}, {
|
4853
4931
|
key: "extractResultData",
|
4854
4932
|
value: function () {
|
4855
|
-
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4856
|
-
return _regeneratorRuntime().wrap(function
|
4857
|
-
while (1) switch (
|
4933
|
+
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e) {
|
4934
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
4935
|
+
while (1) switch (_context38.prev = _context38.next) {
|
4858
4936
|
case 0:
|
4859
4937
|
if (!e.message) {
|
4860
|
-
|
4938
|
+
_context38.next = 2;
|
4861
4939
|
break;
|
4862
4940
|
}
|
4863
4941
|
throw e.message;
|
4864
4942
|
case 2:
|
4865
|
-
return
|
4943
|
+
return _context38.abrupt("return", {
|
4866
4944
|
files: e.artifacts.map(function (n) {
|
4867
4945
|
return {
|
4868
4946
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4872,9 +4950,9 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4872
4950
|
});
|
4873
4951
|
case 3:
|
4874
4952
|
case "end":
|
4875
|
-
return
|
4953
|
+
return _context38.stop();
|
4876
4954
|
}
|
4877
|
-
},
|
4955
|
+
}, _callee38);
|
4878
4956
|
}));
|
4879
4957
|
function extractResultData(_x70) {
|
4880
4958
|
return _extractResultData10.apply(this, arguments);
|
@@ -4909,24 +4987,24 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
|
|
4909
4987
|
_createClass(HuggingFaceFillMaskIO, [{
|
4910
4988
|
key: "extractResultData",
|
4911
4989
|
value: function () {
|
4912
|
-
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4913
|
-
return _regeneratorRuntime().wrap(function
|
4914
|
-
while (1) switch (
|
4990
|
+
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
|
4991
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
4992
|
+
while (1) switch (_context39.prev = _context39.next) {
|
4915
4993
|
case 0:
|
4916
4994
|
if (!e.error) {
|
4917
|
-
|
4995
|
+
_context39.next = 2;
|
4918
4996
|
break;
|
4919
4997
|
}
|
4920
4998
|
throw e.error;
|
4921
4999
|
case 2:
|
4922
|
-
return
|
5000
|
+
return _context39.abrupt("return", {
|
4923
5001
|
text: e[0].sequence || ""
|
4924
5002
|
});
|
4925
5003
|
case 3:
|
4926
5004
|
case "end":
|
4927
|
-
return
|
5005
|
+
return _context39.stop();
|
4928
5006
|
}
|
4929
|
-
},
|
5007
|
+
}, _callee39);
|
4930
5008
|
}));
|
4931
5009
|
function extractResultData(_x71) {
|
4932
5010
|
return _extractResultData11.apply(this, arguments);
|
@@ -5003,13 +5081,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5003
5081
|
}, {
|
5004
5082
|
key: "callServiceAPI",
|
5005
5083
|
value: function () {
|
5006
|
-
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5084
|
+
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
|
5007
5085
|
var n;
|
5008
|
-
return _regeneratorRuntime().wrap(function
|
5009
|
-
while (1) switch (
|
5086
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
5087
|
+
while (1) switch (_context40.prev = _context40.next) {
|
5010
5088
|
case 0:
|
5011
5089
|
if (this.requestSettings) {
|
5012
|
-
|
5090
|
+
_context40.next = 2;
|
5013
5091
|
break;
|
5014
5092
|
}
|
5015
5093
|
throw new Error("Request settings have not been set up");
|
@@ -5018,9 +5096,9 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5018
5096
|
HTTPRequest.request(this, n, e);
|
5019
5097
|
case 4:
|
5020
5098
|
case "end":
|
5021
|
-
return
|
5099
|
+
return _context40.stop();
|
5022
5100
|
}
|
5023
|
-
},
|
5101
|
+
}, _callee40, this);
|
5024
5102
|
}));
|
5025
5103
|
function callServiceAPI(_x72, _x73) {
|
5026
5104
|
return _callServiceAPI8.apply(this, arguments);
|
@@ -5030,25 +5108,25 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5030
5108
|
}, {
|
5031
5109
|
key: "extractResultData",
|
5032
5110
|
value: function () {
|
5033
|
-
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5111
|
+
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
|
5034
5112
|
var t;
|
5035
|
-
return _regeneratorRuntime().wrap(function
|
5036
|
-
while (1) switch (
|
5113
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
5114
|
+
while (1) switch (_context41.prev = _context41.next) {
|
5037
5115
|
case 0:
|
5038
5116
|
if (!e.message) {
|
5039
|
-
|
5117
|
+
_context41.next = 2;
|
5040
5118
|
break;
|
5041
5119
|
}
|
5042
5120
|
throw e.message;
|
5043
5121
|
case 2:
|
5044
|
-
return
|
5122
|
+
return _context41.abrupt("return", {
|
5045
5123
|
text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
|
5046
5124
|
});
|
5047
5125
|
case 3:
|
5048
5126
|
case "end":
|
5049
|
-
return
|
5127
|
+
return _context41.stop();
|
5050
5128
|
}
|
5051
|
-
},
|
5129
|
+
}, _callee41);
|
5052
5130
|
}));
|
5053
5131
|
function extractResultData(_x74) {
|
5054
5132
|
return _extractResultData12.apply(this, arguments);
|
@@ -5080,13 +5158,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5080
5158
|
}, {
|
5081
5159
|
key: "callServiceAPI",
|
5082
5160
|
value: function () {
|
5083
|
-
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5161
|
+
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
|
5084
5162
|
var n;
|
5085
|
-
return _regeneratorRuntime().wrap(function
|
5086
|
-
while (1) switch (
|
5163
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
5164
|
+
while (1) switch (_context42.prev = _context42.next) {
|
5087
5165
|
case 0:
|
5088
5166
|
if (this.requestSettings) {
|
5089
|
-
|
5167
|
+
_context42.next = 2;
|
5090
5168
|
break;
|
5091
5169
|
}
|
5092
5170
|
throw new Error("Request settings have not been set up");
|
@@ -5095,9 +5173,9 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5095
5173
|
HTTPRequest.request(this, n, e);
|
5096
5174
|
case 4:
|
5097
5175
|
case "end":
|
5098
|
-
return
|
5176
|
+
return _context42.stop();
|
5099
5177
|
}
|
5100
|
-
},
|
5178
|
+
}, _callee42, this);
|
5101
5179
|
}));
|
5102
5180
|
function callServiceAPI(_x75, _x76) {
|
5103
5181
|
return _callServiceAPI9.apply(this, arguments);
|
@@ -5107,24 +5185,24 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5107
5185
|
}, {
|
5108
5186
|
key: "extractResultData",
|
5109
5187
|
value: function () {
|
5110
|
-
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5111
|
-
return _regeneratorRuntime().wrap(function
|
5112
|
-
while (1) switch (
|
5188
|
+
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e) {
|
5189
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
5190
|
+
while (1) switch (_context43.prev = _context43.next) {
|
5113
5191
|
case 0:
|
5114
5192
|
if (!e.message) {
|
5115
|
-
|
5193
|
+
_context43.next = 2;
|
5116
5194
|
break;
|
5117
5195
|
}
|
5118
5196
|
throw e.message;
|
5119
5197
|
case 2:
|
5120
|
-
return
|
5198
|
+
return _context43.abrupt("return", {
|
5121
5199
|
text: e.summary || ""
|
5122
5200
|
});
|
5123
5201
|
case 3:
|
5124
5202
|
case "end":
|
5125
|
-
return
|
5203
|
+
return _context43.stop();
|
5126
5204
|
}
|
5127
|
-
},
|
5205
|
+
}, _callee43);
|
5128
5206
|
}));
|
5129
5207
|
function extractResultData(_x77) {
|
5130
5208
|
return _extractResultData13.apply(this, arguments);
|
@@ -5283,13 +5361,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5283
5361
|
}, {
|
5284
5362
|
key: "callServiceAPI",
|
5285
5363
|
value: function () {
|
5286
|
-
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5364
|
+
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e, t) {
|
5287
5365
|
var n;
|
5288
|
-
return _regeneratorRuntime().wrap(function
|
5289
|
-
while (1) switch (
|
5366
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
5367
|
+
while (1) switch (_context44.prev = _context44.next) {
|
5290
5368
|
case 0:
|
5291
5369
|
if (this.requestSettings) {
|
5292
|
-
|
5370
|
+
_context44.next = 2;
|
5293
5371
|
break;
|
5294
5372
|
}
|
5295
5373
|
throw new Error("Request settings have not been set up");
|
@@ -5298,9 +5376,9 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5298
5376
|
HTTPRequest.request(this, n, e), this.messages = e;
|
5299
5377
|
case 4:
|
5300
5378
|
case "end":
|
5301
|
-
return
|
5379
|
+
return _context44.stop();
|
5302
5380
|
}
|
5303
|
-
},
|
5381
|
+
}, _callee44, this);
|
5304
5382
|
}));
|
5305
5383
|
function callServiceAPI(_x78, _x79) {
|
5306
5384
|
return _callServiceAPI10.apply(this, arguments);
|
@@ -5310,13 +5388,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5310
5388
|
}, {
|
5311
5389
|
key: "extractResultData",
|
5312
5390
|
value: function () {
|
5313
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5391
|
+
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
|
5314
5392
|
var t, n, _s4;
|
5315
|
-
return _regeneratorRuntime().wrap(function
|
5316
|
-
while (1) switch (
|
5393
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
5394
|
+
while (1) switch (_context45.prev = _context45.next) {
|
5317
5395
|
case 0:
|
5318
5396
|
if (!e.error) {
|
5319
|
-
|
5397
|
+
_context45.next = 2;
|
5320
5398
|
break;
|
5321
5399
|
}
|
5322
5400
|
throw e.error.message;
|
@@ -5328,14 +5406,14 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5328
5406
|
};
|
5329
5407
|
HTTPRequest.executePollRequest(this, n, _s4, this.messages);
|
5330
5408
|
}
|
5331
|
-
return
|
5409
|
+
return _context45.abrupt("return", {
|
5332
5410
|
pollingInAnotherRequest: !0
|
5333
5411
|
});
|
5334
5412
|
case 4:
|
5335
5413
|
case "end":
|
5336
|
-
return
|
5414
|
+
return _context45.stop();
|
5337
5415
|
}
|
5338
|
-
},
|
5416
|
+
}, _callee45, this);
|
5339
5417
|
}));
|
5340
5418
|
function extractResultData(_x80) {
|
5341
5419
|
return _extractResultData14.apply(this, arguments);
|
@@ -5345,33 +5423,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5345
5423
|
}, {
|
5346
5424
|
key: "extractPollResultData",
|
5347
5425
|
value: function () {
|
5348
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5426
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
|
5349
5427
|
var t, _iterator, _step, n;
|
5350
|
-
return _regeneratorRuntime().wrap(function
|
5351
|
-
while (1) switch (
|
5428
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
5429
|
+
while (1) switch (_context46.prev = _context46.next) {
|
5352
5430
|
case 0:
|
5353
5431
|
if (!e.error) {
|
5354
|
-
|
5432
|
+
_context46.next = 2;
|
5355
5433
|
break;
|
5356
5434
|
}
|
5357
5435
|
throw e.error;
|
5358
5436
|
case 2:
|
5359
5437
|
if (!(e.status === "running")) {
|
5360
|
-
|
5438
|
+
_context46.next = 4;
|
5361
5439
|
break;
|
5362
5440
|
}
|
5363
|
-
return
|
5441
|
+
return _context46.abrupt("return", {
|
5364
5442
|
timeoutMS: 2e3
|
5365
5443
|
});
|
5366
5444
|
case 4:
|
5367
5445
|
if (!(e.errors.length > 0)) {
|
5368
|
-
|
5446
|
+
_context46.next = 6;
|
5369
5447
|
break;
|
5370
5448
|
}
|
5371
5449
|
throw e.errors[0];
|
5372
5450
|
case 6:
|
5373
5451
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
5374
|
-
|
5452
|
+
_context46.next = 8;
|
5375
5453
|
break;
|
5376
5454
|
}
|
5377
5455
|
throw e.tasks.items[0].results.errors[0];
|
@@ -5388,14 +5466,14 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5388
5466
|
} finally {
|
5389
5467
|
_iterator.f();
|
5390
5468
|
}
|
5391
|
-
return
|
5469
|
+
return _context46.abrupt("return", {
|
5392
5470
|
text: t || ""
|
5393
5471
|
});
|
5394
5472
|
case 12:
|
5395
5473
|
case "end":
|
5396
|
-
return
|
5474
|
+
return _context46.stop();
|
5397
5475
|
}
|
5398
|
-
},
|
5476
|
+
}, _callee46);
|
5399
5477
|
}));
|
5400
5478
|
function extractPollResultData(_x81) {
|
5401
5479
|
return _extractPollResultData4.apply(this, arguments);
|
@@ -5496,13 +5574,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5496
5574
|
}, {
|
5497
5575
|
key: "callServiceAPI",
|
5498
5576
|
value: function () {
|
5499
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5577
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
|
5500
5578
|
var n;
|
5501
|
-
return _regeneratorRuntime().wrap(function
|
5502
|
-
while (1) switch (
|
5579
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
5580
|
+
while (1) switch (_context47.prev = _context47.next) {
|
5503
5581
|
case 0:
|
5504
5582
|
if (this.requestSettings) {
|
5505
|
-
|
5583
|
+
_context47.next = 2;
|
5506
5584
|
break;
|
5507
5585
|
}
|
5508
5586
|
throw new Error("Request settings have not been set up");
|
@@ -5511,9 +5589,9 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5511
5589
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
5512
5590
|
case 4:
|
5513
5591
|
case "end":
|
5514
|
-
return
|
5592
|
+
return _context47.stop();
|
5515
5593
|
}
|
5516
|
-
},
|
5594
|
+
}, _callee47, this);
|
5517
5595
|
}));
|
5518
5596
|
function callServiceAPI(_x82, _x83) {
|
5519
5597
|
return _callServiceAPI11.apply(this, arguments);
|
@@ -5523,25 +5601,25 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5523
5601
|
}, {
|
5524
5602
|
key: "extractResultData",
|
5525
5603
|
value: function () {
|
5526
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5604
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e) {
|
5527
5605
|
var t;
|
5528
|
-
return _regeneratorRuntime().wrap(function
|
5529
|
-
while (1) switch (
|
5606
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
5607
|
+
while (1) switch (_context48.prev = _context48.next) {
|
5530
5608
|
case 0:
|
5531
5609
|
if (!e.error) {
|
5532
|
-
|
5610
|
+
_context48.next = 2;
|
5533
5611
|
break;
|
5534
5612
|
}
|
5535
5613
|
throw e.error.message;
|
5536
5614
|
case 2:
|
5537
|
-
return
|
5615
|
+
return _context48.abrupt("return", {
|
5538
5616
|
text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
|
5539
5617
|
});
|
5540
5618
|
case 3:
|
5541
5619
|
case "end":
|
5542
|
-
return
|
5620
|
+
return _context48.stop();
|
5543
5621
|
}
|
5544
|
-
},
|
5622
|
+
}, _callee48);
|
5545
5623
|
}));
|
5546
5624
|
function extractResultData(_x84) {
|
5547
5625
|
return _extractResultData15.apply(this, arguments);
|
@@ -5558,17 +5636,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5558
5636
|
_createClass(AssemblyAIUtils, null, [{
|
5559
5637
|
key: "poll",
|
5560
5638
|
value: function () {
|
5561
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5639
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t) {
|
5562
5640
|
var n, l, c, d;
|
5563
|
-
return _regeneratorRuntime().wrap(function
|
5564
|
-
while (1) switch (
|
5641
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
5642
|
+
while (1) switch (_context49.prev = _context49.next) {
|
5565
5643
|
case 0:
|
5566
5644
|
n = {
|
5567
5645
|
authorization: e,
|
5568
5646
|
"content-type": "application/json"
|
5569
5647
|
};
|
5570
|
-
|
5571
|
-
|
5648
|
+
_context49.t0 = "https://api.assemblyai.com/v2/transcript/";
|
5649
|
+
_context49.next = 4;
|
5572
5650
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
5573
5651
|
method: "POST",
|
5574
5652
|
body: JSON.stringify({
|
@@ -5577,53 +5655,53 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5577
5655
|
headers: n
|
5578
5656
|
});
|
5579
5657
|
case 4:
|
5580
|
-
|
5581
|
-
return
|
5658
|
+
_context49.next = 6;
|
5659
|
+
return _context49.sent.json();
|
5582
5660
|
case 6:
|
5583
|
-
|
5584
|
-
l =
|
5661
|
+
_context49.t1 = _context49.sent.id;
|
5662
|
+
l = _context49.t0.concat.call(_context49.t0, _context49.t1);
|
5585
5663
|
case 8:
|
5586
5664
|
if (c) {
|
5587
|
-
|
5665
|
+
_context49.next = 24;
|
5588
5666
|
break;
|
5589
5667
|
}
|
5590
|
-
|
5668
|
+
_context49.next = 11;
|
5591
5669
|
return fetch(l, {
|
5592
5670
|
headers: n
|
5593
5671
|
});
|
5594
5672
|
case 11:
|
5595
|
-
|
5596
|
-
return
|
5673
|
+
_context49.next = 13;
|
5674
|
+
return _context49.sent.json();
|
5597
5675
|
case 13:
|
5598
|
-
d =
|
5676
|
+
d = _context49.sent;
|
5599
5677
|
if (!(d.status === "completed")) {
|
5600
|
-
|
5678
|
+
_context49.next = 18;
|
5601
5679
|
break;
|
5602
5680
|
}
|
5603
5681
|
c = d;
|
5604
|
-
|
5682
|
+
_context49.next = 22;
|
5605
5683
|
break;
|
5606
5684
|
case 18:
|
5607
5685
|
if (!(d.status === "error")) {
|
5608
|
-
|
5686
|
+
_context49.next = 20;
|
5609
5687
|
break;
|
5610
5688
|
}
|
5611
5689
|
throw new Error("Transcription failed: ".concat(d.error));
|
5612
5690
|
case 20:
|
5613
|
-
|
5691
|
+
_context49.next = 22;
|
5614
5692
|
return new Promise(function (h) {
|
5615
5693
|
return setTimeout(h, 3e3);
|
5616
5694
|
});
|
5617
5695
|
case 22:
|
5618
|
-
|
5696
|
+
_context49.next = 8;
|
5619
5697
|
break;
|
5620
5698
|
case 24:
|
5621
|
-
return
|
5699
|
+
return _context49.abrupt("return", c);
|
5622
5700
|
case 25:
|
5623
5701
|
case "end":
|
5624
|
-
return
|
5702
|
+
return _context49.stop();
|
5625
5703
|
}
|
5626
|
-
},
|
5704
|
+
}, _callee49);
|
5627
5705
|
}));
|
5628
5706
|
function poll(_x85, _x86) {
|
5629
5707
|
return _poll2.apply(this, arguments);
|
@@ -5673,19 +5751,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5673
5751
|
_createClass(AssemblyAIAudioIO, [{
|
5674
5752
|
key: "callServiceAPI",
|
5675
5753
|
value: function () {
|
5676
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5754
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
|
5677
5755
|
var s;
|
5678
|
-
return _regeneratorRuntime().wrap(function
|
5679
|
-
while (1) switch (
|
5756
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
5757
|
+
while (1) switch (_context50.prev = _context50.next) {
|
5680
5758
|
case 0:
|
5681
5759
|
if ((s = this.requestSettings) != null && s.headers) {
|
5682
|
-
|
5760
|
+
_context50.next = 2;
|
5683
5761
|
break;
|
5684
5762
|
}
|
5685
5763
|
throw new Error("Request settings have not been set up");
|
5686
5764
|
case 2:
|
5687
5765
|
if (n != null && n[0]) {
|
5688
|
-
|
5766
|
+
_context50.next = 4;
|
5689
5767
|
break;
|
5690
5768
|
}
|
5691
5769
|
throw new Error("No file was added");
|
@@ -5693,9 +5771,9 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5693
5771
|
HTTPRequest.request(this, n[0], e, !1);
|
5694
5772
|
case 5:
|
5695
5773
|
case "end":
|
5696
|
-
return
|
5774
|
+
return _context50.stop();
|
5697
5775
|
}
|
5698
|
-
},
|
5776
|
+
}, _callee50, this);
|
5699
5777
|
}));
|
5700
5778
|
function callServiceAPI(_x87, _x88, _x89) {
|
5701
5779
|
return _callServiceAPI12.apply(this, arguments);
|
@@ -5705,30 +5783,30 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5705
5783
|
}, {
|
5706
5784
|
key: "extractResultData",
|
5707
5785
|
value: function () {
|
5708
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5786
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
|
5709
5787
|
var s, o, t;
|
5710
|
-
return _regeneratorRuntime().wrap(function
|
5711
|
-
while (1) switch (
|
5788
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
5789
|
+
while (1) switch (_context51.prev = _context51.next) {
|
5712
5790
|
case 0:
|
5713
5791
|
if (!e.error) {
|
5714
|
-
|
5792
|
+
_context51.next = 2;
|
5715
5793
|
break;
|
5716
5794
|
}
|
5717
5795
|
throw e.error;
|
5718
5796
|
case 2:
|
5719
5797
|
t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
|
5720
|
-
|
5798
|
+
_context51.next = 5;
|
5721
5799
|
return AssemblyAIUtils.poll(t, e.upload_url);
|
5722
5800
|
case 5:
|
5723
|
-
|
5724
|
-
return
|
5725
|
-
text:
|
5801
|
+
_context51.t0 = _context51.sent.text;
|
5802
|
+
return _context51.abrupt("return", {
|
5803
|
+
text: _context51.t0
|
5726
5804
|
});
|
5727
5805
|
case 7:
|
5728
5806
|
case "end":
|
5729
|
-
return
|
5807
|
+
return _context51.stop();
|
5730
5808
|
}
|
5731
|
-
},
|
5809
|
+
}, _callee51, this);
|
5732
5810
|
}));
|
5733
5811
|
function extractResultData(_x90) {
|
5734
5812
|
return _extractResultData16.apply(this, arguments);
|
@@ -5780,13 +5858,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5780
5858
|
}, {
|
5781
5859
|
key: "callServiceAPI",
|
5782
5860
|
value: function () {
|
5783
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5861
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
|
5784
5862
|
var n;
|
5785
|
-
return _regeneratorRuntime().wrap(function
|
5786
|
-
while (1) switch (
|
5863
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
5864
|
+
while (1) switch (_context52.prev = _context52.next) {
|
5787
5865
|
case 0:
|
5788
5866
|
if (this.requestSettings) {
|
5789
|
-
|
5867
|
+
_context52.next = 2;
|
5790
5868
|
break;
|
5791
5869
|
}
|
5792
5870
|
throw new Error("Request settings have not been set up");
|
@@ -5795,9 +5873,9 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5795
5873
|
HTTPRequest.request(this, n, e, !1);
|
5796
5874
|
case 4:
|
5797
5875
|
case "end":
|
5798
|
-
return
|
5876
|
+
return _context52.stop();
|
5799
5877
|
}
|
5800
|
-
},
|
5878
|
+
}, _callee52, this);
|
5801
5879
|
}));
|
5802
5880
|
function callServiceAPI(_x91, _x92) {
|
5803
5881
|
return _callServiceAPI13.apply(this, arguments);
|
@@ -5807,11 +5885,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5807
5885
|
}, {
|
5808
5886
|
key: "extractResultData",
|
5809
5887
|
value: function () {
|
5810
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5811
|
-
return _regeneratorRuntime().wrap(function
|
5812
|
-
while (1) switch (
|
5888
|
+
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
|
5889
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
5890
|
+
while (1) switch (_context53.prev = _context53.next) {
|
5813
5891
|
case 0:
|
5814
|
-
return
|
5892
|
+
return _context53.abrupt("return", new Promise(function (t) {
|
5815
5893
|
var n = new FileReader();
|
5816
5894
|
n.readAsDataURL(e), n.onload = function (s) {
|
5817
5895
|
t({
|
@@ -5824,9 +5902,9 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5824
5902
|
}));
|
5825
5903
|
case 1:
|
5826
5904
|
case "end":
|
5827
|
-
return
|
5905
|
+
return _context53.stop();
|
5828
5906
|
}
|
5829
|
-
},
|
5907
|
+
}, _callee53);
|
5830
5908
|
}));
|
5831
5909
|
function extractResultData(_x93) {
|
5832
5910
|
return _extractResultData17.apply(this, arguments);
|
@@ -5864,19 +5942,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5864
5942
|
_createClass(U, [{
|
5865
5943
|
key: "callServiceAPI",
|
5866
5944
|
value: function () {
|
5867
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5945
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
|
5868
5946
|
var s, o;
|
5869
|
-
return _regeneratorRuntime().wrap(function
|
5870
|
-
while (1) switch (
|
5947
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
5948
|
+
while (1) switch (_context54.prev = _context54.next) {
|
5871
5949
|
case 0:
|
5872
5950
|
if ((s = this.requestSettings) != null && s.headers) {
|
5873
|
-
|
5951
|
+
_context54.next = 2;
|
5874
5952
|
break;
|
5875
5953
|
}
|
5876
5954
|
throw new Error("Request settings have not been set up");
|
5877
5955
|
case 2:
|
5878
5956
|
if (n != null && n[0]) {
|
5879
|
-
|
5957
|
+
_context54.next = 4;
|
5880
5958
|
break;
|
5881
5959
|
}
|
5882
5960
|
throw new Error("No file was added");
|
@@ -5884,9 +5962,9 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5884
5962
|
(o = this.requestSettings) != null && o.headers && (this.requestSettings.headers["Content-Type"] = n[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), HTTPRequest.request(this, n[0], e, !1);
|
5885
5963
|
case 5:
|
5886
5964
|
case "end":
|
5887
|
-
return
|
5965
|
+
return _context54.stop();
|
5888
5966
|
}
|
5889
|
-
},
|
5967
|
+
}, _callee54, this);
|
5890
5968
|
}));
|
5891
5969
|
function callServiceAPI(_x94, _x95, _x96) {
|
5892
5970
|
return _callServiceAPI14.apply(this, arguments);
|
@@ -5896,24 +5974,24 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5896
5974
|
}, {
|
5897
5975
|
key: "extractResultData",
|
5898
5976
|
value: function () {
|
5899
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5900
|
-
return _regeneratorRuntime().wrap(function
|
5901
|
-
while (1) switch (
|
5977
|
+
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
|
5978
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
5979
|
+
while (1) switch (_context55.prev = _context55.next) {
|
5902
5980
|
case 0:
|
5903
5981
|
if (!e.error) {
|
5904
|
-
|
5982
|
+
_context55.next = 2;
|
5905
5983
|
break;
|
5906
5984
|
}
|
5907
5985
|
throw e.error;
|
5908
5986
|
case 2:
|
5909
|
-
return
|
5987
|
+
return _context55.abrupt("return", {
|
5910
5988
|
text: e.DisplayText || ""
|
5911
5989
|
});
|
5912
5990
|
case 3:
|
5913
5991
|
case "end":
|
5914
|
-
return
|
5992
|
+
return _context55.stop();
|
5915
5993
|
}
|
5916
|
-
},
|
5994
|
+
}, _callee55);
|
5917
5995
|
}));
|
5918
5996
|
function extractResultData(_x97) {
|
5919
5997
|
return _extractResultData18.apply(this, arguments);
|
@@ -5958,13 +6036,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5958
6036
|
}, {
|
5959
6037
|
key: "callServiceAPI",
|
5960
6038
|
value: function () {
|
5961
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6039
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t) {
|
5962
6040
|
var n;
|
5963
|
-
return _regeneratorRuntime().wrap(function
|
5964
|
-
while (1) switch (
|
6041
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
6042
|
+
while (1) switch (_context56.prev = _context56.next) {
|
5965
6043
|
case 0:
|
5966
6044
|
if (this.requestSettings) {
|
5967
|
-
|
6045
|
+
_context56.next = 2;
|
5968
6046
|
break;
|
5969
6047
|
}
|
5970
6048
|
throw new Error("Request settings have not been set up");
|
@@ -5973,9 +6051,9 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5973
6051
|
HTTPRequest.request(this, n, e);
|
5974
6052
|
case 4:
|
5975
6053
|
case "end":
|
5976
|
-
return
|
6054
|
+
return _context56.stop();
|
5977
6055
|
}
|
5978
|
-
},
|
6056
|
+
}, _callee56, this);
|
5979
6057
|
}));
|
5980
6058
|
function callServiceAPI(_x98, _x99) {
|
5981
6059
|
return _callServiceAPI15.apply(this, arguments);
|
@@ -5985,25 +6063,25 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5985
6063
|
}, {
|
5986
6064
|
key: "extractResultData",
|
5987
6065
|
value: function () {
|
5988
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6066
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
|
5989
6067
|
var t;
|
5990
|
-
return _regeneratorRuntime().wrap(function
|
5991
|
-
while (1) switch (
|
6068
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
6069
|
+
while (1) switch (_context57.prev = _context57.next) {
|
5992
6070
|
case 0:
|
5993
6071
|
if (!Array.isArray(e)) {
|
5994
|
-
|
6072
|
+
_context57.next = 2;
|
5995
6073
|
break;
|
5996
6074
|
}
|
5997
|
-
return
|
6075
|
+
return _context57.abrupt("return", {
|
5998
6076
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
5999
6077
|
});
|
6000
6078
|
case 2:
|
6001
6079
|
throw e.error;
|
6002
6080
|
case 3:
|
6003
6081
|
case "end":
|
6004
|
-
return
|
6082
|
+
return _context57.stop();
|
6005
6083
|
}
|
6006
|
-
},
|
6084
|
+
}, _callee57);
|
6007
6085
|
}));
|
6008
6086
|
function extractResultData(_x100) {
|
6009
6087
|
return _extractResultData19.apply(this, arguments);
|
@@ -6072,39 +6150,39 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6072
6150
|
}, {
|
6073
6151
|
key: "callServiceAPI",
|
6074
6152
|
value: function () {
|
6075
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6076
|
-
var s,
|
6077
|
-
return _regeneratorRuntime().wrap(function
|
6078
|
-
while (1) switch (
|
6153
|
+
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, n) {
|
6154
|
+
var s, _o2;
|
6155
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6156
|
+
while (1) switch (_context58.prev = _context58.next) {
|
6079
6157
|
case 0:
|
6080
6158
|
if ((s = this.requestSettings) != null && s.headers) {
|
6081
|
-
|
6159
|
+
_context58.next = 2;
|
6082
6160
|
break;
|
6083
6161
|
}
|
6084
6162
|
throw new Error("Request settings have not been set up");
|
6085
6163
|
case 2:
|
6086
6164
|
if (!(n != null && n[0])) {
|
6087
|
-
|
6165
|
+
_context58.next = 6;
|
6088
6166
|
break;
|
6089
6167
|
}
|
6090
6168
|
this.callApiWithImage(e, t, n);
|
6091
|
-
|
6169
|
+
_context58.next = 11;
|
6092
6170
|
break;
|
6093
6171
|
case 6:
|
6094
6172
|
if (this.requestSettings) {
|
6095
|
-
|
6173
|
+
_context58.next = 8;
|
6096
6174
|
break;
|
6097
6175
|
}
|
6098
6176
|
throw new Error("Request settings have not been set up");
|
6099
6177
|
case 8:
|
6100
6178
|
this.url = M.IMAGE_GENERATION_URL;
|
6101
|
-
|
6102
|
-
HTTPRequest.request(this,
|
6179
|
+
_o2 = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
6180
|
+
HTTPRequest.request(this, _o2, e);
|
6103
6181
|
case 11:
|
6104
6182
|
case "end":
|
6105
|
-
return
|
6183
|
+
return _context58.stop();
|
6106
6184
|
}
|
6107
|
-
},
|
6185
|
+
}, _callee58, this);
|
6108
6186
|
}));
|
6109
6187
|
function callServiceAPI(_x101, _x102, _x103) {
|
6110
6188
|
return _callServiceAPI16.apply(this, arguments);
|
@@ -6114,17 +6192,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6114
6192
|
}, {
|
6115
6193
|
key: "extractResultData",
|
6116
6194
|
value: function () {
|
6117
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6118
|
-
return _regeneratorRuntime().wrap(function
|
6119
|
-
while (1) switch (
|
6195
|
+
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
6196
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
6197
|
+
while (1) switch (_context59.prev = _context59.next) {
|
6120
6198
|
case 0:
|
6121
6199
|
if (!e.error) {
|
6122
|
-
|
6200
|
+
_context59.next = 2;
|
6123
6201
|
break;
|
6124
6202
|
}
|
6125
6203
|
throw e.error.message;
|
6126
6204
|
case 2:
|
6127
|
-
return
|
6205
|
+
return _context59.abrupt("return", {
|
6128
6206
|
files: e.data.map(function (n) {
|
6129
6207
|
return n.url ? {
|
6130
6208
|
src: n.url,
|
@@ -6137,9 +6215,9 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6137
6215
|
});
|
6138
6216
|
case 3:
|
6139
6217
|
case "end":
|
6140
|
-
return
|
6218
|
+
return _context59.stop();
|
6141
6219
|
}
|
6142
|
-
},
|
6220
|
+
}, _callee59);
|
6143
6221
|
}));
|
6144
6222
|
function extractResultData(_x104) {
|
6145
6223
|
return _extractResultData20.apply(this, arguments);
|
@@ -6213,19 +6291,19 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6213
6291
|
}, {
|
6214
6292
|
key: "callServiceAPI",
|
6215
6293
|
value: function () {
|
6216
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6294
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, n) {
|
6217
6295
|
var a, s, o;
|
6218
|
-
return _regeneratorRuntime().wrap(function
|
6219
|
-
while (1) switch (
|
6296
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
6297
|
+
while (1) switch (_context60.prev = _context60.next) {
|
6220
6298
|
case 0:
|
6221
6299
|
if ((a = this.requestSettings) != null && a.headers) {
|
6222
|
-
|
6300
|
+
_context60.next = 2;
|
6223
6301
|
break;
|
6224
6302
|
}
|
6225
6303
|
throw new Error("Request settings have not been set up");
|
6226
6304
|
case 2:
|
6227
6305
|
if (n != null && n[0]) {
|
6228
|
-
|
6306
|
+
_context60.next = 4;
|
6229
6307
|
break;
|
6230
6308
|
}
|
6231
6309
|
throw new Error("No file was added");
|
@@ -6235,9 +6313,9 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6235
6313
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
6236
6314
|
case 7:
|
6237
6315
|
case "end":
|
6238
|
-
return
|
6316
|
+
return _context60.stop();
|
6239
6317
|
}
|
6240
|
-
},
|
6318
|
+
}, _callee60, this);
|
6241
6319
|
}));
|
6242
6320
|
function callServiceAPI(_x105, _x106, _x107) {
|
6243
6321
|
return _callServiceAPI17.apply(this, arguments);
|
@@ -6247,24 +6325,24 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6247
6325
|
}, {
|
6248
6326
|
key: "extractResultData",
|
6249
6327
|
value: function () {
|
6250
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6251
|
-
return _regeneratorRuntime().wrap(function
|
6252
|
-
while (1) switch (
|
6328
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
|
6329
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
6330
|
+
while (1) switch (_context61.prev = _context61.next) {
|
6253
6331
|
case 0:
|
6254
6332
|
if (!e.error) {
|
6255
|
-
|
6333
|
+
_context61.next = 2;
|
6256
6334
|
break;
|
6257
6335
|
}
|
6258
6336
|
throw e.error.message;
|
6259
6337
|
case 2:
|
6260
|
-
return
|
6338
|
+
return _context61.abrupt("return", {
|
6261
6339
|
text: e.text
|
6262
6340
|
});
|
6263
6341
|
case 3:
|
6264
6342
|
case "end":
|
6265
|
-
return
|
6343
|
+
return _context61.stop();
|
6266
6344
|
}
|
6267
|
-
},
|
6345
|
+
}, _callee61);
|
6268
6346
|
}));
|
6269
6347
|
function extractResultData(_x108) {
|
6270
6348
|
return _extractResultData21.apply(this, arguments);
|
@@ -6332,13 +6410,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6332
6410
|
}, {
|
6333
6411
|
key: "callServiceAPI",
|
6334
6412
|
value: function () {
|
6335
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6413
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
|
6336
6414
|
var n;
|
6337
|
-
return _regeneratorRuntime().wrap(function
|
6338
|
-
while (1) switch (
|
6415
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
6416
|
+
while (1) switch (_context62.prev = _context62.next) {
|
6339
6417
|
case 0:
|
6340
6418
|
if (this.requestSettings) {
|
6341
|
-
|
6419
|
+
_context62.next = 2;
|
6342
6420
|
break;
|
6343
6421
|
}
|
6344
6422
|
throw new Error("Request settings have not been set up");
|
@@ -6347,9 +6425,9 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6347
6425
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
6348
6426
|
case 4:
|
6349
6427
|
case "end":
|
6350
|
-
return
|
6428
|
+
return _context62.stop();
|
6351
6429
|
}
|
6352
|
-
},
|
6430
|
+
}, _callee62, this);
|
6353
6431
|
}));
|
6354
6432
|
function callServiceAPI(_x109, _x110) {
|
6355
6433
|
return _callServiceAPI18.apply(this, arguments);
|
@@ -6359,17 +6437,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6359
6437
|
}, {
|
6360
6438
|
key: "extractResultData",
|
6361
6439
|
value: function () {
|
6362
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6363
|
-
return _regeneratorRuntime().wrap(function
|
6364
|
-
while (1) switch (
|
6440
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
6441
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
6442
|
+
while (1) switch (_context63.prev = _context63.next) {
|
6365
6443
|
case 0:
|
6366
6444
|
if (!e.error) {
|
6367
|
-
|
6445
|
+
_context63.next = 2;
|
6368
6446
|
break;
|
6369
6447
|
}
|
6370
6448
|
throw e.error.message;
|
6371
6449
|
case 2:
|
6372
|
-
return
|
6450
|
+
return _context63.abrupt("return", e.choices[0].delta ? {
|
6373
6451
|
text: e.choices[0].delta.content || ""
|
6374
6452
|
} : e.choices[0].message ? {
|
6375
6453
|
text: e.choices[0].message.content
|
@@ -6378,9 +6456,9 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6378
6456
|
});
|
6379
6457
|
case 3:
|
6380
6458
|
case "end":
|
6381
|
-
return
|
6459
|
+
return _context63.stop();
|
6382
6460
|
}
|
6383
|
-
},
|
6461
|
+
}, _callee63);
|
6384
6462
|
}));
|
6385
6463
|
function extractResultData(_x111) {
|
6386
6464
|
return _extractResultData22.apply(this, arguments);
|
@@ -6430,13 +6508,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6430
6508
|
}, {
|
6431
6509
|
key: "callServiceAPI",
|
6432
6510
|
value: function () {
|
6433
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6511
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t) {
|
6434
6512
|
var n;
|
6435
|
-
return _regeneratorRuntime().wrap(function
|
6436
|
-
while (1) switch (
|
6513
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
6514
|
+
while (1) switch (_context64.prev = _context64.next) {
|
6437
6515
|
case 0:
|
6438
6516
|
if (this.requestSettings) {
|
6439
|
-
|
6517
|
+
_context64.next = 2;
|
6440
6518
|
break;
|
6441
6519
|
}
|
6442
6520
|
throw new Error("Request settings have not been set up");
|
@@ -6445,9 +6523,9 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6445
6523
|
HTTPRequest.request(this, n, e);
|
6446
6524
|
case 4:
|
6447
6525
|
case "end":
|
6448
|
-
return
|
6526
|
+
return _context64.stop();
|
6449
6527
|
}
|
6450
|
-
},
|
6528
|
+
}, _callee64, this);
|
6451
6529
|
}));
|
6452
6530
|
function callServiceAPI(_x112, _x113) {
|
6453
6531
|
return _callServiceAPI19.apply(this, arguments);
|
@@ -6457,24 +6535,24 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6457
6535
|
}, {
|
6458
6536
|
key: "extractResultData",
|
6459
6537
|
value: function () {
|
6460
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6461
|
-
return _regeneratorRuntime().wrap(function
|
6462
|
-
while (1) switch (
|
6538
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e) {
|
6539
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
6540
|
+
while (1) switch (_context65.prev = _context65.next) {
|
6463
6541
|
case 0:
|
6464
6542
|
if (!e.message) {
|
6465
|
-
|
6543
|
+
_context65.next = 2;
|
6466
6544
|
break;
|
6467
6545
|
}
|
6468
6546
|
throw e.message;
|
6469
6547
|
case 2:
|
6470
|
-
return
|
6548
|
+
return _context65.abrupt("return", {
|
6471
6549
|
text: e.text
|
6472
6550
|
});
|
6473
6551
|
case 3:
|
6474
6552
|
case "end":
|
6475
|
-
return
|
6553
|
+
return _context65.stop();
|
6476
6554
|
}
|
6477
|
-
},
|
6555
|
+
}, _callee65);
|
6478
6556
|
}));
|
6479
6557
|
function extractResultData(_x114) {
|
6480
6558
|
return _extractResultData23.apply(this, arguments);
|
@@ -6690,8 +6768,8 @@ var MessageStyleUtils = /*#__PURE__*/function () {
|
|
6690
6768
|
value: function applyCustomStylesToElements(e, t, n) {
|
6691
6769
|
if (n && (Object.assign(e.outerContainer.style, n.outerContainer), Object.assign(e.innerContainer.style, n.innerContainer), Object.assign(e.bubbleElement.style, n.bubble), t)) {
|
6692
6770
|
var _s7 = e.bubbleElement.children[0],
|
6693
|
-
|
6694
|
-
Object.assign(
|
6771
|
+
_o3 = _s7.tagName.toLocaleLowerCase() !== "a" ? _s7 : _s7.children[0];
|
6772
|
+
Object.assign(_o3.style, n.media);
|
6695
6773
|
}
|
6696
6774
|
}
|
6697
6775
|
}, {
|
@@ -6834,22 +6912,22 @@ var FileMessages = /*#__PURE__*/function () {
|
|
6834
6912
|
}, {
|
6835
6913
|
key: "addNewImageMessage",
|
6836
6914
|
value: function () {
|
6837
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6915
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, n) {
|
6838
6916
|
var s,
|
6839
6917
|
o,
|
6840
6918
|
a,
|
6841
|
-
|
6842
|
-
return _regeneratorRuntime().wrap(function
|
6843
|
-
while (1) switch (
|
6919
|
+
_args66 = arguments;
|
6920
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
6921
|
+
while (1) switch (_context66.prev = _context66.next) {
|
6844
6922
|
case 0:
|
6845
|
-
s =
|
6923
|
+
s = _args66.length > 3 && _args66[3] !== undefined ? _args66[3] : !1;
|
6846
6924
|
o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
|
6847
6925
|
a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
|
6848
6926
|
case 3:
|
6849
6927
|
case "end":
|
6850
|
-
return
|
6928
|
+
return _context66.stop();
|
6851
6929
|
}
|
6852
|
-
},
|
6930
|
+
}, _callee66);
|
6853
6931
|
}));
|
6854
6932
|
function addNewImageMessage(_x115, _x116, _x117) {
|
6855
6933
|
return _addNewImageMessage.apply(this, arguments);
|
@@ -7187,12 +7265,12 @@ var Messages = /*#__PURE__*/function () {
|
|
7187
7265
|
}, {
|
7188
7266
|
key: "addMultipleFiles",
|
7189
7267
|
value: function () {
|
7190
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7268
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
|
7191
7269
|
var _this31 = this;
|
7192
|
-
return _regeneratorRuntime().wrap(function
|
7193
|
-
while (1) switch (
|
7270
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
7271
|
+
while (1) switch (_context67.prev = _context67.next) {
|
7194
7272
|
case 0:
|
7195
|
-
return
|
7273
|
+
return _context67.abrupt("return", Promise.all((e || []).map(function (t) {
|
7196
7274
|
return new Promise(function (n) {
|
7197
7275
|
if (!t.type || t.type === "any") {
|
7198
7276
|
var _s8 = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
|
@@ -7217,15 +7295,15 @@ var Messages = /*#__PURE__*/function () {
|
|
7217
7295
|
})));
|
7218
7296
|
case 1:
|
7219
7297
|
case "end":
|
7220
|
-
return
|
7298
|
+
return _context67.stop();
|
7221
7299
|
}
|
7222
|
-
},
|
7300
|
+
}, _callee67);
|
7223
7301
|
}));
|
7224
7302
|
function addMultipleFiles(_x118) {
|
7225
7303
|
return _addMultipleFiles.apply(this, arguments);
|
7226
7304
|
}
|
7227
7305
|
return addMultipleFiles;
|
7228
|
-
}()
|
7306
|
+
}() // WORK - need to clear the messages array
|
7229
7307
|
}, {
|
7230
7308
|
key: "clearMessages",
|
7231
7309
|
value: function clearMessages(e) {
|
@@ -7927,14 +8005,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
7927
8005
|
if (t === "") return !0;
|
7928
8006
|
var n = t.split(",");
|
7929
8007
|
for (var _s14 = 0; _s14 < n.length; _s14++) {
|
7930
|
-
var
|
7931
|
-
if (e.type ===
|
7932
|
-
if (
|
7933
|
-
var _a3 =
|
8008
|
+
var _o4 = n[_s14].trim();
|
8009
|
+
if (e.type === _o4) return !0;
|
8010
|
+
if (_o4.startsWith(".")) {
|
8011
|
+
var _a3 = _o4.slice(1);
|
7934
8012
|
if (e.name.endsWith(_a3)) return !0;
|
7935
8013
|
} else {
|
7936
|
-
if (e.name.endsWith(
|
7937
|
-
if (
|
8014
|
+
if (e.name.endsWith(_o4)) return !0;
|
8015
|
+
if (_o4.endsWith("/*") && e.type.startsWith(_o4.slice(0, -2))) return !0;
|
7938
8016
|
}
|
7939
8017
|
}
|
7940
8018
|
return !1;
|
@@ -8131,23 +8209,23 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8131
8209
|
}, {
|
8132
8210
|
key: "completePlaceholders",
|
8133
8211
|
value: function () {
|
8134
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8135
|
-
return _regeneratorRuntime().wrap(function
|
8136
|
-
while (1) switch (
|
8212
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
|
8213
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
8214
|
+
while (1) switch (_context69.prev = _context69.next) {
|
8137
8215
|
case 0:
|
8138
|
-
|
8216
|
+
_context69.next = 2;
|
8139
8217
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
8140
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8218
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
|
8141
8219
|
var t;
|
8142
|
-
return _regeneratorRuntime().wrap(function
|
8143
|
-
while (1) switch (
|
8220
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
8221
|
+
while (1) switch (_context68.prev = _context68.next) {
|
8144
8222
|
case 0:
|
8145
|
-
return
|
8223
|
+
return _context68.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
8146
8224
|
case 1:
|
8147
8225
|
case "end":
|
8148
|
-
return
|
8226
|
+
return _context68.stop();
|
8149
8227
|
}
|
8150
|
-
},
|
8228
|
+
}, _callee68);
|
8151
8229
|
}));
|
8152
8230
|
return function (_x119) {
|
8153
8231
|
return _ref6.apply(this, arguments);
|
@@ -8155,9 +8233,9 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8155
8233
|
}()));
|
8156
8234
|
case 2:
|
8157
8235
|
case "end":
|
8158
|
-
return
|
8236
|
+
return _context69.stop();
|
8159
8237
|
}
|
8160
|
-
},
|
8238
|
+
}, _callee69, this);
|
8161
8239
|
}));
|
8162
8240
|
function completePlaceholders() {
|
8163
8241
|
return _completePlaceholders.apply(this, arguments);
|
@@ -8195,11 +8273,11 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8195
8273
|
return FileAttachments;
|
8196
8274
|
}();
|
8197
8275
|
var _Modal = /*#__PURE__*/function () {
|
8198
|
-
function
|
8199
|
-
_classCallCheck(this,
|
8200
|
-
this._isOpen = !1, this._contentRef =
|
8276
|
+
function w(e, t, n) {
|
8277
|
+
_classCallCheck(this, w);
|
8278
|
+
this._isOpen = !1, this._contentRef = w.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = w.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = w.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = w.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
|
8201
8279
|
}
|
8202
|
-
_createClass(
|
8280
|
+
_createClass(w, [{
|
8203
8281
|
key: "isOpen",
|
8204
8282
|
value: function isOpen() {
|
8205
8283
|
return this._isOpen;
|
@@ -8221,7 +8299,7 @@ var _Modal = /*#__PURE__*/function () {
|
|
8221
8299
|
var _this40 = this;
|
8222
8300
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
8223
8301
|
_this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
|
8224
|
-
},
|
8302
|
+
}, w.MODAL_CLOSE_TIMEOUT_MS);
|
8225
8303
|
}
|
8226
8304
|
}, {
|
8227
8305
|
key: "displayModalElements",
|
@@ -8237,7 +8315,7 @@ var _Modal = /*#__PURE__*/function () {
|
|
8237
8315
|
key: "addCloseButton",
|
8238
8316
|
value: function addCloseButton(e, t, n) {
|
8239
8317
|
var _this41 = this;
|
8240
|
-
var s = t ?
|
8318
|
+
var s = t ? w.createSVGButton(e) : w.createTextButton(e);
|
8241
8319
|
return this.addButtons(s), s.onclick = function () {
|
8242
8320
|
_this41.close(), setTimeout(function () {
|
8243
8321
|
n == null || n();
|
@@ -8297,12 +8375,12 @@ var _Modal = /*#__PURE__*/function () {
|
|
8297
8375
|
value: function createTextModalFunc(e, t, n) {
|
8298
8376
|
var s;
|
8299
8377
|
if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
|
8300
|
-
var
|
8301
|
-
return
|
8378
|
+
var _o5 = new w(e, ["modal-content"], t.files.infoModal.containerStyle);
|
8379
|
+
return _o5.addCloseButton("OK", !1, n), _o5.openTextModal.bind(_o5, t.infoModalTextMarkUp || "");
|
8302
8380
|
}
|
8303
8381
|
}
|
8304
8382
|
}]);
|
8305
|
-
return
|
8383
|
+
return w;
|
8306
8384
|
}();
|
8307
8385
|
_Modal.MODAL_CLOSE_TIMEOUT_MS = 190;
|
8308
8386
|
var Modal = _Modal;
|
@@ -8313,10 +8391,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
|
|
8313
8391
|
function UploadFileButton(e, t, n, s, o, a) {
|
8314
8392
|
var _this43;
|
8315
8393
|
_classCallCheck(this, UploadFileButton);
|
8316
|
-
var c, u, d, h,
|
8394
|
+
var c, u, d, h, f, p;
|
8317
8395
|
_this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
|
8318
8396
|
var l = _this43.createInnerElements(s, o, _this43._customStyles);
|
8319
|
-
_this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (
|
8397
|
+
_this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (p = (f = n.files) == null ? void 0 : f.infoModal) == null ? void 0 : p.openModalOnce;
|
8320
8398
|
return _this43;
|
8321
8399
|
}
|
8322
8400
|
_createClass(UploadFileButton, [{
|
@@ -8583,9 +8661,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
|
|
8583
8661
|
key: "extract",
|
8584
8662
|
value: function extract(e, t, n) {
|
8585
8663
|
var s = "";
|
8586
|
-
for (var
|
8587
|
-
var _a5 = e.results[
|
8588
|
-
n && (_a5 = translate_1$1.Translate.translate(_a5, n)), e.results[
|
8664
|
+
for (var _o6 = e.resultIndex; _o6 < e.results.length; ++_o6) {
|
8665
|
+
var _a5 = e.results[_o6][0].transcript;
|
8666
|
+
n && (_a5 = translate_1$1.Translate.translate(_a5, n)), e.results[_o6].isFinal ? t += _a5 : s += _a5;
|
8589
8667
|
}
|
8590
8668
|
return {
|
8591
8669
|
interimTranscript: s,
|
@@ -8806,8 +8884,8 @@ var Cursor = /*#__PURE__*/function () {
|
|
8806
8884
|
value: function setOffsetForGeneric(e, t) {
|
8807
8885
|
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
8808
8886
|
var s = 0;
|
8809
|
-
for (var
|
8810
|
-
var _a7 = e.childNodes[
|
8887
|
+
for (var _o7 = 0; _o7 < e.childNodes.length; _o7 += 1) {
|
8888
|
+
var _a7 = e.childNodes[_o7];
|
8811
8889
|
if (_a7.childNodes.length > 0) {
|
8812
8890
|
var l = Cursor.setOffsetForGeneric(_a7, t, n);
|
8813
8891
|
if (l === -1) return -1;
|
@@ -8869,9 +8947,9 @@ var Cursor = /*#__PURE__*/function () {
|
|
8869
8947
|
value: function getGenericElementCursorOffset(e, t, n) {
|
8870
8948
|
var s = 0;
|
8871
8949
|
if (t.rangeCount > 0) {
|
8872
|
-
var
|
8873
|
-
_a8 =
|
8874
|
-
_a8.selectNodeContents(e), n ? _a8.setEnd(
|
8950
|
+
var _o8 = t.getRangeAt(0),
|
8951
|
+
_a8 = _o8.cloneRange();
|
8952
|
+
_a8.selectNodeContents(e), n ? _a8.setEnd(_o8.startContainer, _o8.startOffset) : _a8.setEnd(_o8.endContainer, _o8.endOffset), s = _a8.toString().length;
|
8875
8953
|
}
|
8876
8954
|
return s;
|
8877
8955
|
}
|
@@ -8934,8 +9012,8 @@ var CommandUtils = /*#__PURE__*/function () {
|
|
8934
9012
|
key: "checkIfMatchesWord",
|
8935
9013
|
value: function checkIfMatchesWord(e, t, n) {
|
8936
9014
|
var s = e;
|
8937
|
-
for (var
|
8938
|
-
var _a9 =
|
9015
|
+
for (var _o9 = n.length - 1; _o9 >= 0; _o9 -= 1) {
|
9016
|
+
var _a9 = _o9,
|
8939
9017
|
l = s.length - 1;
|
8940
9018
|
for (; n[_a9] === s[l] && l >= 0;) _a9 -= 1, l -= 1;
|
8941
9019
|
if (l < 0) return !0;
|
@@ -8951,31 +9029,31 @@ var CommandUtils = /*#__PURE__*/function () {
|
|
8951
9029
|
if (!u || !s || !n) return;
|
8952
9030
|
var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
|
8953
9031
|
h = text_1$2.Text.breakupIntoWordsArr(d),
|
8954
|
-
|
8955
|
-
if (u.commandMode &&
|
9032
|
+
f = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
|
9033
|
+
if (u.commandMode && f(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
8956
9034
|
return CommandUtils.toggleCommandModeOn(e);
|
8957
9035
|
}), {
|
8958
9036
|
doNotProcessTranscription: !1
|
8959
9037
|
};
|
8960
9038
|
if (!(u.commandMode && !e.isWaitingForCommand)) {
|
8961
|
-
if (u.stop &&
|
9039
|
+
if (u.stop && f(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
|
8962
9040
|
return e.stop();
|
8963
9041
|
}), {
|
8964
9042
|
doNotProcessTranscription: !1
|
8965
9043
|
};
|
8966
|
-
if (u.pause &&
|
8967
|
-
var
|
8968
|
-
e.isPaused = !0, (
|
9044
|
+
if (u.pause && f(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
9045
|
+
var p;
|
9046
|
+
e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
|
8969
9047
|
}), {
|
8970
9048
|
doNotProcessTranscription: !1
|
8971
9049
|
};
|
8972
|
-
if (u.resume &&
|
9050
|
+
if (u.resume && f(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
|
8973
9051
|
doNotProcessTranscription: !0
|
8974
9052
|
};
|
8975
|
-
if (u.reset &&
|
9053
|
+
if (u.reset && f(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
|
8976
9054
|
doNotProcessTranscription: !0
|
8977
9055
|
};
|
8978
|
-
if (u.removeAllText &&
|
9056
|
+
if (u.removeAllText && f(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
|
8979
9057
|
doNotProcessTranscription: !0
|
8980
9058
|
};
|
8981
9059
|
}
|
@@ -9007,8 +9085,8 @@ var Highlight = /*#__PURE__*/function () {
|
|
9007
9085
|
var n = window.getSelection();
|
9008
9086
|
if (n != null && n.focusNode) {
|
9009
9087
|
var _s18 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
|
9010
|
-
|
9011
|
-
e.isHighlighted = _s18 !==
|
9088
|
+
_o10 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
|
9089
|
+
e.isHighlighted = _s18 !== _o10;
|
9012
9090
|
}
|
9013
9091
|
}
|
9014
9092
|
}, {
|
@@ -9058,10 +9136,10 @@ var Padding = /*#__PURE__*/function () {
|
|
9058
9136
|
value: function setStateForPrimitiveElement(e, t) {
|
9059
9137
|
if (document.activeElement === t && t.selectionStart !== null) {
|
9060
9138
|
var _s20 = t.selectionStart,
|
9061
|
-
|
9139
|
+
_o11 = t.value[_s20 - 1],
|
9062
9140
|
_a11 = t.selectionEnd === null ? _s20 : t.selectionEnd,
|
9063
9141
|
l = t.value[_a11];
|
9064
|
-
text_1$1.Text.isCharDefined(
|
9142
|
+
text_1$1.Text.isCharDefined(_o11) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === _a11;
|
9065
9143
|
return;
|
9066
9144
|
}
|
9067
9145
|
var n = t.value[t.value.length - 1];
|
@@ -9132,11 +9210,11 @@ var Speech = /*#__PURE__*/function () {
|
|
9132
9210
|
value: function prepareBeforeStart(e) {
|
9133
9211
|
var t, n;
|
9134
9212
|
if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
|
9135
|
-
var
|
9213
|
+
var _o12 = e.element.find(function (a) {
|
9136
9214
|
return a === document.activeElement;
|
9137
9215
|
}) || e.element[0];
|
9138
|
-
if (!
|
9139
|
-
this.prepare(
|
9216
|
+
if (!_o12) return;
|
9217
|
+
this.prepare(_o12);
|
9140
9218
|
} else this.prepare(e.element);
|
9141
9219
|
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], elements_1.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((n = this._options) === null || n === void 0) && n.commands && (this.commands = commandUtils_1$1.CommandUtils.process(this._options.commands));
|
9142
9220
|
}
|
@@ -9179,8 +9257,8 @@ var Speech = /*#__PURE__*/function () {
|
|
9179
9257
|
this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
|
9180
9258
|
var s = this.startPadding + this.finalTranscript + t;
|
9181
9259
|
if (e.value = s + this.endPadding, !this.isTargetInShadow) {
|
9182
|
-
var
|
9183
|
-
cursor_1.Cursor.setOffsetForPrimitive(e,
|
9260
|
+
var _o13 = s.length + this.numberOfSpacesAfterNewText;
|
9261
|
+
cursor_1.Cursor.setOffsetForPrimitive(e, _o13, this.autoScroll);
|
9184
9262
|
}
|
9185
9263
|
this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
|
9186
9264
|
}
|
@@ -9377,24 +9455,24 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9377
9455
|
}, {
|
9378
9456
|
key: "getNewSpeechConfig",
|
9379
9457
|
value: function () {
|
9380
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9381
|
-
return _regeneratorRuntime().wrap(function
|
9382
|
-
while (1) switch (
|
9458
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
|
9459
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
9460
|
+
while (1) switch (_context70.prev = _context70.next) {
|
9383
9461
|
case 0:
|
9384
9462
|
if (!t.region) {
|
9385
|
-
|
9463
|
+
_context70.next = 2;
|
9386
9464
|
break;
|
9387
9465
|
}
|
9388
|
-
return
|
9466
|
+
return _context70.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
|
9389
9467
|
return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
|
9390
9468
|
})["catch"](function (n) {
|
9391
9469
|
return console.error(n), null;
|
9392
9470
|
}) : null);
|
9393
9471
|
case 2:
|
9394
9472
|
case "end":
|
9395
|
-
return
|
9473
|
+
return _context70.stop();
|
9396
9474
|
}
|
9397
|
-
},
|
9475
|
+
}, _callee70);
|
9398
9476
|
}));
|
9399
9477
|
function getNewSpeechConfig(_x120, _x121) {
|
9400
9478
|
return _getNewSpeechConfig.apply(this, arguments);
|
@@ -9409,21 +9487,21 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9409
9487
|
}, {
|
9410
9488
|
key: "get",
|
9411
9489
|
value: function () {
|
9412
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9490
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e, t) {
|
9413
9491
|
var n;
|
9414
|
-
return _regeneratorRuntime().wrap(function
|
9415
|
-
while (1) switch (
|
9492
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
9493
|
+
while (1) switch (_context71.prev = _context71.next) {
|
9416
9494
|
case 0:
|
9417
|
-
|
9495
|
+
_context71.next = 2;
|
9418
9496
|
return AzureSpeechConfig.getNewSpeechConfig(e, t);
|
9419
9497
|
case 2:
|
9420
|
-
n =
|
9421
|
-
return
|
9498
|
+
n = _context71.sent;
|
9499
|
+
return _context71.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
|
9422
9500
|
case 4:
|
9423
9501
|
case "end":
|
9424
|
-
return
|
9502
|
+
return _context71.stop();
|
9425
9503
|
}
|
9426
|
-
},
|
9504
|
+
}, _callee71);
|
9427
9505
|
}));
|
9428
9506
|
function get(_x122, _x123) {
|
9429
9507
|
return _get.apply(this, arguments);
|
@@ -9515,26 +9593,26 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9515
9593
|
}, {
|
9516
9594
|
key: "startAsync",
|
9517
9595
|
value: function () {
|
9518
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9596
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
|
9519
9597
|
var t;
|
9520
|
-
return _regeneratorRuntime().wrap(function
|
9521
|
-
while (1) switch (
|
9598
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
9599
|
+
while (1) switch (_context72.prev = _context72.next) {
|
9522
9600
|
case 0:
|
9523
|
-
|
9524
|
-
if (!
|
9525
|
-
|
9601
|
+
_context72.t0 = this.validate(e);
|
9602
|
+
if (!_context72.t0) {
|
9603
|
+
_context72.next = 6;
|
9526
9604
|
break;
|
9527
9605
|
}
|
9528
|
-
|
9606
|
+
_context72.next = 4;
|
9529
9607
|
return this.instantiateService(e);
|
9530
9608
|
case 4:
|
9531
9609
|
this._translations = e == null ? void 0 : e.translations;
|
9532
9610
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
9533
9611
|
case 6:
|
9534
9612
|
case "end":
|
9535
|
-
return
|
9613
|
+
return _context72.stop();
|
9536
9614
|
}
|
9537
|
-
},
|
9615
|
+
}, _callee72, this);
|
9538
9616
|
}));
|
9539
9617
|
function startAsync(_x124) {
|
9540
9618
|
return _startAsync.apply(this, arguments);
|
@@ -9549,26 +9627,26 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9549
9627
|
}, {
|
9550
9628
|
key: "instantiateService",
|
9551
9629
|
value: function () {
|
9552
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9553
|
-
var t, n, s,
|
9554
|
-
return _regeneratorRuntime().wrap(function
|
9555
|
-
while (1) switch (
|
9630
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e) {
|
9631
|
+
var t, n, s, _o14;
|
9632
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
9633
|
+
while (1) switch (_context73.prev = _context73.next) {
|
9556
9634
|
case 0:
|
9557
9635
|
t = Azure.getAPI();
|
9558
9636
|
n = t.AudioConfig.fromDefaultMicrophoneInput();
|
9559
|
-
|
9637
|
+
_context73.next = 4;
|
9560
9638
|
return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
|
9561
9639
|
case 4:
|
9562
|
-
s =
|
9640
|
+
s = _context73.sent;
|
9563
9641
|
if (s) {
|
9564
|
-
|
9565
|
-
this.setEvents(
|
9642
|
+
_o14 = new t.SpeechRecognizer(s, n);
|
9643
|
+
this.setEvents(_o14), this._service = _o14, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
9566
9644
|
} else this.error("Unable to contact Azure server");
|
9567
9645
|
case 6:
|
9568
9646
|
case "end":
|
9569
|
-
return
|
9647
|
+
return _context73.stop();
|
9570
9648
|
}
|
9571
|
-
},
|
9649
|
+
}, _callee73, this);
|
9572
9650
|
}));
|
9573
9651
|
function instantiateService(_x125) {
|
9574
9652
|
return _instantiateService.apply(this, arguments);
|
@@ -9608,9 +9686,9 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9608
9686
|
if (n.text && !this._stopping) {
|
9609
9687
|
var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
|
9610
9688
|
_s22 = _azureTranscript_1$Az2.interimTranscript,
|
9611
|
-
|
9689
|
+
_o15 = _azureTranscript_1$Az2.finalTranscript,
|
9612
9690
|
_a12 = _azureTranscript_1$Az2.newText;
|
9613
|
-
stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22,
|
9691
|
+
stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22, _o15, _a12), _o15 !== "" && (this._newTextPadding = " ");
|
9614
9692
|
}
|
9615
9693
|
break;
|
9616
9694
|
}
|
@@ -9952,84 +10030,77 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9952
10030
|
}, {
|
9953
10031
|
key: "submit",
|
9954
10032
|
value: function () {
|
9955
|
-
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9956
|
-
var
|
9957
|
-
return _regeneratorRuntime().wrap(function
|
9958
|
-
while (1) switch (
|
10033
|
+
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(e, t) {
|
10034
|
+
var l, c, n, s, o, a;
|
10035
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
10036
|
+
while (1) switch (_context74.prev = _context74.next) {
|
9959
10037
|
case 0:
|
9960
|
-
|
9961
|
-
if (
|
9962
|
-
|
10038
|
+
_context74.t0 = e;
|
10039
|
+
if (_context74.t0) {
|
10040
|
+
_context74.next = 6;
|
9963
10041
|
break;
|
9964
10042
|
}
|
9965
|
-
|
10043
|
+
_context74.next = 4;
|
9966
10044
|
return this._fileAttachments.completePlaceholders();
|
9967
10045
|
case 4:
|
9968
10046
|
n = this._fileAttachments.getAllFileData();
|
9969
|
-
s = n == null ? void 0 : n.map(function (
|
9970
|
-
return
|
10047
|
+
s = n == null ? void 0 : n.map(function (u) {
|
10048
|
+
return u.file;
|
9971
10049
|
});
|
9972
10050
|
case 6:
|
9973
10051
|
o = t === "" ? void 0 : t;
|
9974
|
-
if (!this._isRequestInProgress) {
|
9975
|
-
|
10052
|
+
if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
|
10053
|
+
_context74.next = 9;
|
9976
10054
|
break;
|
9977
10055
|
}
|
9978
|
-
return
|
10056
|
+
return _context74.abrupt("return");
|
9979
10057
|
case 9:
|
9980
|
-
|
9981
|
-
|
9982
|
-
_context73.next = 12;
|
9983
|
-
break;
|
9984
|
-
}
|
9985
|
-
return _context73.abrupt("return");
|
9986
|
-
case 12:
|
9987
|
-
if (!((c = this._serviceIO.deepChat) != null && c.validateMessageBeforeSending)) {
|
9988
|
-
_context73.next = 17;
|
10058
|
+
if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
|
10059
|
+
_context74.next = 14;
|
9989
10060
|
break;
|
9990
10061
|
}
|
9991
10062
|
if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
|
9992
|
-
|
10063
|
+
_context74.next = 12;
|
9993
10064
|
break;
|
9994
10065
|
}
|
9995
|
-
return
|
9996
|
-
case
|
9997
|
-
|
10066
|
+
return _context74.abrupt("return");
|
10067
|
+
case 12:
|
10068
|
+
_context74.next = 16;
|
9998
10069
|
break;
|
9999
|
-
case
|
10070
|
+
case 14:
|
10000
10071
|
if (this._serviceIO.canSendMessage(o, s)) {
|
10001
|
-
|
10072
|
+
_context74.next = 16;
|
10002
10073
|
break;
|
10003
10074
|
}
|
10004
|
-
return
|
10005
|
-
case
|
10075
|
+
return _context74.abrupt("return");
|
10076
|
+
case 16:
|
10006
10077
|
this.changeToLoadingIcon();
|
10007
10078
|
t !== "" && this._messages.addNewMessage({
|
10008
10079
|
text: t
|
10009
10080
|
}, !1, !0);
|
10010
|
-
|
10011
|
-
if (!
|
10012
|
-
|
10081
|
+
_context74.t1 = n;
|
10082
|
+
if (!_context74.t1) {
|
10083
|
+
_context74.next = 22;
|
10013
10084
|
break;
|
10014
10085
|
}
|
10015
|
-
|
10086
|
+
_context74.next = 22;
|
10016
10087
|
return this._messages.addMultipleFiles(n);
|
10017
|
-
case
|
10088
|
+
case 22:
|
10018
10089
|
this._messages.addLoadingMessage();
|
10019
10090
|
e || TextInputEl.clear(this._inputElementRef);
|
10020
|
-
|
10091
|
+
a = {
|
10021
10092
|
text: o,
|
10022
10093
|
files: s
|
10023
10094
|
};
|
10024
|
-
|
10025
|
-
return this._serviceIO.callAPI(
|
10026
|
-
case
|
10027
|
-
e || (
|
10028
|
-
case
|
10095
|
+
_context74.next = 27;
|
10096
|
+
return this._serviceIO.callAPI(a, this._messages);
|
10097
|
+
case 27:
|
10098
|
+
e || (c = this._fileAttachments) == null || c.removeAllFiles();
|
10099
|
+
case 28:
|
10029
10100
|
case "end":
|
10030
|
-
return
|
10101
|
+
return _context74.stop();
|
10031
10102
|
}
|
10032
|
-
},
|
10103
|
+
}, _callee74, this);
|
10033
10104
|
}));
|
10034
10105
|
function submit(_x126, _x127) {
|
10035
10106
|
return _submit.apply(this, arguments);
|
@@ -10039,7 +10110,8 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
10039
10110
|
}, {
|
10040
10111
|
key: "stopStream",
|
10041
10112
|
value: function stopStream() {
|
10042
|
-
|
10113
|
+
var e;
|
10114
|
+
this._abortStream.abort(), (e = this._stopClicked) == null || e.listener(), this.changeToSubmitIcon();
|
10043
10115
|
}
|
10044
10116
|
}, {
|
10045
10117
|
key: "changeToStopIcon",
|
@@ -10168,8 +10240,8 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
|
|
10168
10240
|
_s23 = new Blob([n], {
|
10169
10241
|
type: this._format
|
10170
10242
|
}),
|
10171
|
-
|
10172
|
-
_a13 = NewFileName.getFileName(this._newFilePrefix || "photo",
|
10243
|
+
_o16 = this._format === "image/jpeg" ? "jpeg" : "png",
|
10244
|
+
_a13 = NewFileName.getFileName(this._newFilePrefix || "photo", _o16);
|
10173
10245
|
return new File([_s23], _a13, {
|
10174
10246
|
type: _s23.type
|
10175
10247
|
});
|
@@ -10306,9 +10378,9 @@ var Input = /*#__PURE__*/function () {
|
|
10306
10378
|
u = _FILE_TYPE_BUTTON_ICO.id,
|
10307
10379
|
d = _FILE_TYPE_BUTTON_ICO.svgString,
|
10308
10380
|
h = _FILE_TYPE_BUTTON_ICO.dropupText,
|
10309
|
-
|
10381
|
+
f = new UploadFileButton(n, c, l, u, d, h);
|
10310
10382
|
s[a] = {
|
10311
|
-
button:
|
10383
|
+
button: f,
|
10312
10384
|
fileType: c
|
10313
10385
|
};
|
10314
10386
|
}
|