deep-chat-dev 9.0.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +205 -146
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +2 -0
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +796 -846
- package/dist/types/interceptors.d.ts.map +1 -1
- package/dist/utils/HTTP/HTTPRequest.d.ts.map +1 -1
- package/dist/utils/HTTP/websocket.d.ts +1 -1
- package/dist/utils/HTTP/websocket.d.ts.map +1 -1
- package/dist/utils/events/fireEvents.d.ts +1 -0
- package/dist/utils/events/fireEvents.d.ts.map +1 -1
- package/dist/views/chat/introPanel/introPanel.d.ts +1 -0
- package/dist/views/chat/introPanel/introPanel.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +4 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/utils/HTTP/customRequest.d.ts +0 -9
- package/dist/utils/HTTP/customRequest.d.ts.map +0 -1
package/dist/deepChat.js
CHANGED
@@ -420,29 +420,29 @@ function getBytes(_x6, _x7) {
|
|
420
420
|
return _getBytes.apply(this, arguments);
|
421
421
|
}
|
422
422
|
function _getBytes() {
|
423
|
-
_getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
423
|
+
_getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r, e) {
|
424
424
|
var t, n;
|
425
|
-
return _regeneratorRuntime().wrap(function
|
426
|
-
while (1) switch (
|
425
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
426
|
+
while (1) switch (_context71.prev = _context71.next) {
|
427
427
|
case 0:
|
428
428
|
t = r.getReader();
|
429
429
|
case 1:
|
430
|
-
|
430
|
+
_context71.next = 3;
|
431
431
|
return t.read();
|
432
432
|
case 3:
|
433
|
-
if ((n =
|
434
|
-
|
433
|
+
if ((n = _context71.sent).done) {
|
434
|
+
_context71.next = 7;
|
435
435
|
break;
|
436
436
|
}
|
437
437
|
e(n.value);
|
438
438
|
case 5:
|
439
|
-
|
439
|
+
_context71.next = 1;
|
440
440
|
break;
|
441
441
|
case 7:
|
442
442
|
case "end":
|
443
|
-
return
|
443
|
+
return _context71.stop();
|
444
444
|
}
|
445
|
-
},
|
445
|
+
}, _callee71);
|
446
446
|
}));
|
447
447
|
return _getBytes.apply(this, arguments);
|
448
448
|
}
|
@@ -547,21 +547,21 @@ function fetchEventSource(r, e) {
|
|
547
547
|
t == null || t.addEventListener("abort", function () {
|
548
548
|
y(), h();
|
549
549
|
});
|
550
|
-
var
|
550
|
+
var S = u !== null && u !== void 0 ? u : window.fetch,
|
551
551
|
_ = s !== null && s !== void 0 ? s : defaultOnOpen;
|
552
552
|
function I() {
|
553
553
|
return _I.apply(this, arguments);
|
554
554
|
}
|
555
555
|
function _I() {
|
556
556
|
_I = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
557
|
-
var R, w,
|
557
|
+
var R, w, x;
|
558
558
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
559
559
|
while (1) switch (_context3.prev = _context3.next) {
|
560
560
|
case 0:
|
561
561
|
b = new AbortController();
|
562
562
|
_context3.prev = 1;
|
563
563
|
_context3.next = 4;
|
564
|
-
return
|
564
|
+
return S(r, Object.assign(Object.assign({}, d), {
|
565
565
|
headers: f,
|
566
566
|
signal: b.signal
|
567
567
|
}));
|
@@ -571,10 +571,10 @@ function fetchEventSource(r, e) {
|
|
571
571
|
return _(w);
|
572
572
|
case 7:
|
573
573
|
_context3.next = 9;
|
574
|
-
return getBytes(w.body, getLines(getMessages(function (
|
575
|
-
|
576
|
-
}, function (
|
577
|
-
v =
|
574
|
+
return getBytes(w.body, getLines(getMessages(function (x) {
|
575
|
+
x ? f[LastEventId] = x : delete f[LastEventId];
|
576
|
+
}, function (x) {
|
577
|
+
v = x;
|
578
578
|
}, o)));
|
579
579
|
case 9:
|
580
580
|
a == null || a();
|
@@ -586,10 +586,10 @@ function fetchEventSource(r, e) {
|
|
586
586
|
_context3.prev = 14;
|
587
587
|
_context3.t0 = _context3["catch"](1);
|
588
588
|
if (!b.signal.aborted) try {
|
589
|
-
|
590
|
-
window.clearTimeout(g), g = window.setTimeout(I,
|
591
|
-
} catch (
|
592
|
-
y(), p(
|
589
|
+
x = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : v;
|
590
|
+
window.clearTimeout(g), g = window.setTimeout(I, x);
|
591
|
+
} catch (x) {
|
592
|
+
y(), p(x);
|
593
593
|
}
|
594
594
|
case 17:
|
595
595
|
case "end":
|
@@ -606,89 +606,6 @@ function defaultOnOpen(r) {
|
|
606
606
|
var e = r.headers.get("content-type");
|
607
607
|
if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
|
608
608
|
}
|
609
|
-
var _Demo = /*#__PURE__*/function () {
|
610
|
-
function C() {
|
611
|
-
_classCallCheck(this, C);
|
612
|
-
}
|
613
|
-
_createClass(C, null, [{
|
614
|
-
key: "generateResponseForOneMessage",
|
615
|
-
value: function generateResponseForOneMessage(e) {
|
616
|
-
if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
|
617
|
-
if (e.text) {
|
618
|
-
if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
|
619
|
-
if (e.text.includes("updog")) return "What's updog?";
|
620
|
-
}
|
621
|
-
return "Hi there! This is a demo response!";
|
622
|
-
}
|
623
|
-
}, {
|
624
|
-
key: "generateResponse",
|
625
|
-
value: function generateResponse(e) {
|
626
|
-
var t = [];
|
627
|
-
for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
|
628
|
-
if (t.length === 1) return C.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
|
629
|
-
var n = e.messages.findIndex(function (s) {
|
630
|
-
return s.text;
|
631
|
-
});
|
632
|
-
return n !== -1 && t.splice(n, 1), t.length === 1 ? C.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
|
633
|
-
}
|
634
|
-
}, {
|
635
|
-
key: "getCustomResponse",
|
636
|
-
value: function getCustomResponse(e, t) {
|
637
|
-
return typeof e == "function" ? e(t) : e;
|
638
|
-
}
|
639
|
-
}, {
|
640
|
-
key: "getResponse",
|
641
|
-
value: function getResponse(e) {
|
642
|
-
return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
643
|
-
result: {
|
644
|
-
text: C.generateResponse(e)
|
645
|
-
}
|
646
|
-
};
|
647
|
-
}
|
648
|
-
// timeout is used to simulate a timeout for a response to come back
|
649
|
-
}, {
|
650
|
-
key: "request",
|
651
|
-
value: function request(e, t, n) {
|
652
|
-
var s = C.getResponse(e);
|
653
|
-
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
654
|
-
var o;
|
655
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
656
|
-
while (1) switch (_context4.prev = _context4.next) {
|
657
|
-
case 0:
|
658
|
-
_context4.next = 2;
|
659
|
-
return n == null ? void 0 : n(s);
|
660
|
-
case 2:
|
661
|
-
_context4.t0 = _context4.sent;
|
662
|
-
if (_context4.t0) {
|
663
|
-
_context4.next = 5;
|
664
|
-
break;
|
665
|
-
}
|
666
|
-
_context4.t0 = s;
|
667
|
-
case 5:
|
668
|
-
o = _context4.t0;
|
669
|
-
o.error ? e.addNewErrorMessage("service", o.error) : o.result && e.addNewMessage(o.result, !0, !0), t();
|
670
|
-
case 7:
|
671
|
-
case "end":
|
672
|
-
return _context4.stop();
|
673
|
-
}
|
674
|
-
}, _callee4);
|
675
|
-
})), 400);
|
676
|
-
}
|
677
|
-
// timeout is used to simulate a timeout for a response to come back
|
678
|
-
}, {
|
679
|
-
key: "requestStream",
|
680
|
-
value: function requestStream(e, t) {
|
681
|
-
setTimeout(function () {
|
682
|
-
var s, o;
|
683
|
-
var n = (o = (s = C.getResponse(e)) == null ? void 0 : s.result) == null ? void 0 : o.text;
|
684
|
-
Stream.simulate(e, t, n);
|
685
|
-
}, 400);
|
686
|
-
}
|
687
|
-
}]);
|
688
|
-
return C;
|
689
|
-
}();
|
690
|
-
_Demo.URL = "deep-chat-demo";
|
691
|
-
var Demo = _Demo;
|
692
609
|
var Stream = /*#__PURE__*/function () {
|
693
610
|
function Stream() {
|
694
611
|
_classCallCheck(this, Stream);
|
@@ -697,7 +614,7 @@ var Stream = /*#__PURE__*/function () {
|
|
697
614
|
key: "request",
|
698
615
|
value: // prettier-ignore
|
699
616
|
function () {
|
700
|
-
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
617
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(e, t, n) {
|
701
618
|
var s,
|
702
619
|
f,
|
703
620
|
b,
|
@@ -713,19 +630,19 @@ var Stream = /*#__PURE__*/function () {
|
|
713
630
|
d,
|
714
631
|
h,
|
715
632
|
p,
|
716
|
-
|
717
|
-
return _regeneratorRuntime().wrap(function
|
718
|
-
while (1) switch (
|
633
|
+
_args5 = arguments;
|
634
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
635
|
+
while (1) switch (_context5.prev = _context5.next) {
|
719
636
|
case 0:
|
720
|
-
s =
|
637
|
+
s = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : !0;
|
721
638
|
o = {
|
722
639
|
body: t,
|
723
640
|
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
724
641
|
};
|
725
|
-
|
642
|
+
_context5.next = 4;
|
726
643
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
727
644
|
case 4:
|
728
|
-
_yield$RequestUtils$p =
|
645
|
+
_yield$RequestUtils$p = _context5.sent;
|
729
646
|
a = _yield$RequestUtils$p.body;
|
730
647
|
l = _yield$RequestUtils$p.headers;
|
731
648
|
c = _yield$RequestUtils$p.error;
|
@@ -734,16 +651,16 @@ var Stream = /*#__PURE__*/function () {
|
|
734
651
|
d = _e$streamHandlers.onClose;
|
735
652
|
h = _e$streamHandlers.abortStream;
|
736
653
|
if (!c) {
|
737
|
-
|
654
|
+
_context5.next = 14;
|
738
655
|
break;
|
739
656
|
}
|
740
|
-
return
|
657
|
+
return _context5.abrupt("return", Stream.onInterceptorError(n, c, d));
|
741
658
|
case 14:
|
742
659
|
if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
|
743
|
-
|
660
|
+
_context5.next = 16;
|
744
661
|
break;
|
745
662
|
}
|
746
|
-
return
|
663
|
+
return _context5.abrupt("return", Demo.requestStream(n, e.streamHandlers));
|
747
664
|
case 16:
|
748
665
|
p = null;
|
749
666
|
fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
|
@@ -753,32 +670,32 @@ var Stream = /*#__PURE__*/function () {
|
|
753
670
|
openWhenHidden: !0,
|
754
671
|
// keep stream open when browser tab not open
|
755
672
|
onopen: function onopen(g) {
|
756
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
757
|
-
return _regeneratorRuntime().wrap(function
|
758
|
-
while (1) switch (
|
673
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
674
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
675
|
+
while (1) switch (_context4.prev = _context4.next) {
|
759
676
|
case 0:
|
760
677
|
if (!g.ok) {
|
761
|
-
|
678
|
+
_context4.next = 2;
|
762
679
|
break;
|
763
680
|
}
|
764
|
-
return
|
681
|
+
return _context4.abrupt("return", (p = n.addNewStreamedMessage(), u()));
|
765
682
|
case 2:
|
766
|
-
|
683
|
+
_context4.next = 4;
|
767
684
|
return RequestUtils.processResponseByType(g);
|
768
685
|
case 4:
|
769
|
-
throw
|
686
|
+
throw _context4.sent;
|
770
687
|
case 5:
|
771
688
|
case "end":
|
772
|
-
return
|
689
|
+
return _context4.stop();
|
773
690
|
}
|
774
|
-
},
|
691
|
+
}, _callee4);
|
775
692
|
}))();
|
776
693
|
},
|
777
694
|
onmessage: function onmessage(g) {
|
778
695
|
var y;
|
779
696
|
if (JSON.stringify(g.data) !== JSON.stringify("[DONE]")) {
|
780
|
-
var
|
781
|
-
(y = e.extractResultData) == null || y.call(e,
|
697
|
+
var S = JSON.parse(g.data);
|
698
|
+
(y = e.extractResultData) == null || y.call(e, S).then(function (_) {
|
782
699
|
(_ == null ? void 0 : _.text) === void 0 ? console.error("Response data: ".concat(g.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : p && n.updateStreamedMessage(_.text, p);
|
783
700
|
})["catch"](function (_) {
|
784
701
|
return RequestUtils.displayError(n, _);
|
@@ -796,15 +713,15 @@ var Stream = /*#__PURE__*/function () {
|
|
796
713
|
var y;
|
797
714
|
(y = e.extractResultData) == null || y.call(e, g).then(function () {
|
798
715
|
RequestUtils.displayError(n, g);
|
799
|
-
})["catch"](function (
|
800
|
-
RequestUtils.displayError(n,
|
716
|
+
})["catch"](function (S) {
|
717
|
+
RequestUtils.displayError(n, S);
|
801
718
|
});
|
802
719
|
});
|
803
720
|
case 18:
|
804
721
|
case "end":
|
805
|
-
return
|
722
|
+
return _context5.stop();
|
806
723
|
}
|
807
|
-
},
|
724
|
+
}, _callee5);
|
808
725
|
}));
|
809
726
|
function request(_x8, _x9, _x10) {
|
810
727
|
return _request.apply(this, arguments);
|
@@ -848,69 +765,89 @@ var Stream = /*#__PURE__*/function () {
|
|
848
765
|
}]);
|
849
766
|
return Stream;
|
850
767
|
}();
|
851
|
-
var
|
852
|
-
function
|
853
|
-
_classCallCheck(this,
|
768
|
+
var _Demo = /*#__PURE__*/function () {
|
769
|
+
function C() {
|
770
|
+
_classCallCheck(this, C);
|
854
771
|
}
|
855
|
-
_createClass(
|
772
|
+
_createClass(C, null, [{
|
773
|
+
key: "generateResponseForOneMessage",
|
774
|
+
value: function generateResponseForOneMessage(e) {
|
775
|
+
if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
|
776
|
+
if (e.text) {
|
777
|
+
if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
|
778
|
+
if (e.text.includes("updog")) return "What's updog?";
|
779
|
+
}
|
780
|
+
return "Hi there! This is a demo response!";
|
781
|
+
}
|
782
|
+
}, {
|
783
|
+
key: "generateResponse",
|
784
|
+
value: function generateResponse(e) {
|
785
|
+
var t = [];
|
786
|
+
for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
|
787
|
+
if (t.length === 1) return C.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
|
788
|
+
var n = e.messages.findIndex(function (s) {
|
789
|
+
return s.text;
|
790
|
+
});
|
791
|
+
return n !== -1 && t.splice(n, 1), t.length === 1 ? C.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
|
792
|
+
}
|
793
|
+
}, {
|
794
|
+
key: "getCustomResponse",
|
795
|
+
value: function getCustomResponse(e, t) {
|
796
|
+
return typeof e == "function" ? e(t) : e;
|
797
|
+
}
|
798
|
+
}, {
|
799
|
+
key: "getResponse",
|
800
|
+
value: function getResponse(e) {
|
801
|
+
return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
802
|
+
result: {
|
803
|
+
text: C.generateResponse(e)
|
804
|
+
}
|
805
|
+
};
|
806
|
+
}
|
807
|
+
// timeout is used to simulate a timeout for a response to come back
|
808
|
+
}, {
|
856
809
|
key: "request",
|
857
|
-
value:
|
858
|
-
|
859
|
-
|
810
|
+
value: function request(e, t, n) {
|
811
|
+
var s = C.getResponse(e);
|
812
|
+
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
860
813
|
var o;
|
861
|
-
return _regeneratorRuntime().wrap(function
|
862
|
-
while (1) switch (
|
814
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
815
|
+
while (1) switch (_context6.prev = _context6.next) {
|
863
816
|
case 0:
|
864
|
-
|
865
|
-
|
866
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(a) {
|
867
|
-
var l;
|
868
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
869
|
-
while (1) switch (_context7.prev = _context7.next) {
|
870
|
-
case 0:
|
871
|
-
if (e.extractResultData) {
|
872
|
-
_context7.next = 2;
|
873
|
-
break;
|
874
|
-
}
|
875
|
-
return _context7.abrupt("return");
|
876
|
-
case 2:
|
877
|
-
_context7.next = 4;
|
878
|
-
return e.extractResultData(a);
|
879
|
-
case 4:
|
880
|
-
l = _context7.sent;
|
881
|
-
if (!(!l || _typeof(l) != "object")) {
|
882
|
-
_context7.next = 7;
|
883
|
-
break;
|
884
|
-
}
|
885
|
-
throw Error(ErrorMessages.INVALID_RESPONSE(a, "response", !!e.deepChat.responseInterceptor, l));
|
886
|
-
case 7:
|
887
|
-
e.deepChat.stream && l.text ? Stream.simulate(n, e.streamHandlers, l.text) : (n.addNewMessage(l, !0, !0), o());
|
888
|
-
case 8:
|
889
|
-
case "end":
|
890
|
-
return _context7.stop();
|
891
|
-
}
|
892
|
-
}, _callee7);
|
893
|
-
}));
|
894
|
-
return function (_x15) {
|
895
|
-
return _ref2.apply(this, arguments);
|
896
|
-
};
|
897
|
-
}())["catch"](function (a) {
|
898
|
-
RequestUtils.displayError(n, a), o();
|
899
|
-
});
|
817
|
+
_context6.next = 2;
|
818
|
+
return n == null ? void 0 : n(s);
|
900
819
|
case 2:
|
820
|
+
_context6.t0 = _context6.sent;
|
821
|
+
if (_context6.t0) {
|
822
|
+
_context6.next = 5;
|
823
|
+
break;
|
824
|
+
}
|
825
|
+
_context6.t0 = s;
|
826
|
+
case 5:
|
827
|
+
o = _context6.t0;
|
828
|
+
o.error ? e.addNewErrorMessage("service", o.error) : o.result && e.addNewMessage(o.result, !0, !0), t();
|
829
|
+
case 7:
|
901
830
|
case "end":
|
902
|
-
return
|
831
|
+
return _context6.stop();
|
903
832
|
}
|
904
|
-
},
|
905
|
-
}));
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
833
|
+
}, _callee6);
|
834
|
+
})), 400);
|
835
|
+
}
|
836
|
+
// timeout is used to simulate a timeout for a response to come back
|
837
|
+
}, {
|
838
|
+
key: "requestStream",
|
839
|
+
value: function requestStream(e, t) {
|
840
|
+
setTimeout(function () {
|
841
|
+
var s, o;
|
842
|
+
var n = (o = (s = C.getResponse(e)) == null ? void 0 : s.result) == null ? void 0 : o.text;
|
843
|
+
Stream.simulate(e, t, n);
|
844
|
+
}, 400);
|
845
|
+
}
|
911
846
|
}]);
|
912
|
-
return
|
847
|
+
return C;
|
913
848
|
}();
|
849
|
+
_Demo.URL = "deep-chat-demo";
|
850
|
+
var Demo = _Demo;
|
914
851
|
var HTTPRequest = /*#__PURE__*/function () {
|
915
852
|
function HTTPRequest() {
|
916
853
|
_classCallCheck(this, HTTPRequest);
|
@@ -919,7 +856,7 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
919
856
|
key: "request",
|
920
857
|
value: // prettier-ignore
|
921
858
|
function () {
|
922
|
-
var
|
859
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
|
923
860
|
var s,
|
924
861
|
h,
|
925
862
|
p,
|
@@ -932,41 +869,35 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
932
869
|
c,
|
933
870
|
u,
|
934
871
|
d,
|
935
|
-
|
936
|
-
return _regeneratorRuntime().wrap(function
|
937
|
-
while (1) switch (
|
872
|
+
_args8 = arguments;
|
873
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
874
|
+
while (1) switch (_context8.prev = _context8.next) {
|
938
875
|
case 0:
|
939
|
-
s =
|
940
|
-
if (!e.requestSettings.handler) {
|
941
|
-
_context10.next = 3;
|
942
|
-
break;
|
943
|
-
}
|
944
|
-
return _context10.abrupt("return", CustomRequest.request(e, t, n, e.requestSettings.handler));
|
945
|
-
case 3:
|
876
|
+
s = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : !0;
|
946
877
|
o = {
|
947
878
|
body: t,
|
948
879
|
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
949
880
|
};
|
950
|
-
|
881
|
+
_context8.next = 4;
|
951
882
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
952
|
-
case
|
953
|
-
_yield$RequestUtils$p2 =
|
883
|
+
case 4:
|
884
|
+
_yield$RequestUtils$p2 = _context8.sent;
|
954
885
|
a = _yield$RequestUtils$p2.body;
|
955
886
|
l = _yield$RequestUtils$p2.headers;
|
956
887
|
c = _yield$RequestUtils$p2.error;
|
957
888
|
u = e.completionsHandlers.onFinish;
|
958
889
|
if (!c) {
|
959
|
-
|
890
|
+
_context8.next = 11;
|
960
891
|
break;
|
961
892
|
}
|
962
|
-
return
|
963
|
-
case
|
893
|
+
return _context8.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
|
894
|
+
case 11:
|
964
895
|
if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
|
965
|
-
|
896
|
+
_context8.next = 13;
|
966
897
|
break;
|
967
898
|
}
|
968
|
-
return
|
969
|
-
case
|
899
|
+
return _context8.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
|
900
|
+
case 13:
|
970
901
|
d = !0;
|
971
902
|
fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
|
972
903
|
method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
|
@@ -977,40 +908,40 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
977
908
|
}).then(function (m) {
|
978
909
|
return RequestUtils.processResponseByType(m);
|
979
910
|
}).then( /*#__PURE__*/function () {
|
980
|
-
var
|
981
|
-
var y,
|
982
|
-
return _regeneratorRuntime().wrap(function
|
983
|
-
while (1) switch (
|
911
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(m) {
|
912
|
+
var y, S, v, g;
|
913
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
914
|
+
while (1) switch (_context7.prev = _context7.next) {
|
984
915
|
case 0:
|
985
916
|
if (e.extractResultData) {
|
986
|
-
|
917
|
+
_context7.next = 2;
|
987
918
|
break;
|
988
919
|
}
|
989
|
-
return
|
920
|
+
return _context7.abrupt("return");
|
990
921
|
case 2:
|
991
|
-
|
992
|
-
return (
|
922
|
+
_context7.next = 4;
|
923
|
+
return (S = (y = e.deepChat).responseInterceptor) == null ? void 0 : S.call(y, m);
|
993
924
|
case 4:
|
994
|
-
|
995
|
-
if (
|
996
|
-
|
925
|
+
_context7.t0 = _context7.sent;
|
926
|
+
if (_context7.t0) {
|
927
|
+
_context7.next = 7;
|
997
928
|
break;
|
998
929
|
}
|
999
|
-
|
930
|
+
_context7.t0 = m;
|
1000
931
|
case 7:
|
1001
|
-
v =
|
1002
|
-
|
932
|
+
v = _context7.t0;
|
933
|
+
_context7.next = 10;
|
1003
934
|
return e.extractResultData(v);
|
1004
935
|
case 10:
|
1005
|
-
g =
|
936
|
+
g = _context7.sent;
|
1006
937
|
if (d) {
|
1007
|
-
|
938
|
+
_context7.next = 13;
|
1008
939
|
break;
|
1009
940
|
}
|
1010
941
|
throw m;
|
1011
942
|
case 13:
|
1012
943
|
if (!(!g || _typeof(g) != "object")) {
|
1013
|
-
|
944
|
+
_context7.next = 15;
|
1014
945
|
break;
|
1015
946
|
}
|
1016
947
|
throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
|
@@ -1018,24 +949,24 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1018
949
|
g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
|
1019
950
|
case 16:
|
1020
951
|
case "end":
|
1021
|
-
return
|
952
|
+
return _context7.stop();
|
1022
953
|
}
|
1023
|
-
},
|
954
|
+
}, _callee7);
|
1024
955
|
}));
|
1025
|
-
return function (
|
1026
|
-
return
|
956
|
+
return function (_x14) {
|
957
|
+
return _ref2.apply(this, arguments);
|
1027
958
|
};
|
1028
959
|
}())["catch"](function (m) {
|
1029
960
|
RequestUtils.displayError(n, m), u();
|
1030
961
|
});
|
1031
|
-
case
|
962
|
+
case 15:
|
1032
963
|
case "end":
|
1033
|
-
return
|
964
|
+
return _context8.stop();
|
1034
965
|
}
|
1035
|
-
},
|
966
|
+
}, _callee8);
|
1036
967
|
}));
|
1037
|
-
function request(
|
1038
|
-
return
|
968
|
+
function request(_x11, _x12, _x13) {
|
969
|
+
return _request2.apply(this, arguments);
|
1039
970
|
}
|
1040
971
|
return request;
|
1041
972
|
}() // prettier-ignore
|
@@ -1047,44 +978,44 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1047
978
|
fetch(t, n).then(function (a) {
|
1048
979
|
return a.json();
|
1049
980
|
}).then( /*#__PURE__*/function () {
|
1050
|
-
var
|
981
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(a) {
|
1051
982
|
var c, u, l;
|
1052
|
-
return _regeneratorRuntime().wrap(function
|
1053
|
-
while (1) switch (
|
983
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
984
|
+
while (1) switch (_context9.prev = _context9.next) {
|
1054
985
|
case 0:
|
1055
986
|
if (e.extractPollResultData) {
|
1056
|
-
|
987
|
+
_context9.next = 2;
|
1057
988
|
break;
|
1058
989
|
}
|
1059
|
-
return
|
990
|
+
return _context9.abrupt("return");
|
1060
991
|
case 2:
|
1061
|
-
|
1062
|
-
|
992
|
+
_context9.t0 = e;
|
993
|
+
_context9.next = 5;
|
1063
994
|
return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
|
1064
995
|
case 5:
|
1065
|
-
|
1066
|
-
if (
|
1067
|
-
|
996
|
+
_context9.t1 = _context9.sent;
|
997
|
+
if (_context9.t1) {
|
998
|
+
_context9.next = 8;
|
1068
999
|
break;
|
1069
1000
|
}
|
1070
|
-
|
1001
|
+
_context9.t1 = a;
|
1071
1002
|
case 8:
|
1072
|
-
|
1073
|
-
|
1074
|
-
return
|
1003
|
+
_context9.t2 = _context9.t1;
|
1004
|
+
_context9.next = 11;
|
1005
|
+
return _context9.t0.extractPollResultData.call(_context9.t0, _context9.t2);
|
1075
1006
|
case 11:
|
1076
|
-
l =
|
1007
|
+
l = _context9.sent;
|
1077
1008
|
l.timeoutMS ? setTimeout(function () {
|
1078
1009
|
HTTPRequest.executePollRequest(e, t, n, s);
|
1079
1010
|
}, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
|
1080
1011
|
case 13:
|
1081
1012
|
case "end":
|
1082
|
-
return
|
1013
|
+
return _context9.stop();
|
1083
1014
|
}
|
1084
|
-
},
|
1015
|
+
}, _callee9);
|
1085
1016
|
}));
|
1086
|
-
return function (
|
1087
|
-
return
|
1017
|
+
return function (_x15) {
|
1018
|
+
return _ref3.apply(this, arguments);
|
1088
1019
|
};
|
1089
1020
|
}())["catch"](function (a) {
|
1090
1021
|
RequestUtils.displayError(s, a), o();
|
@@ -1094,7 +1025,7 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1094
1025
|
}, {
|
1095
1026
|
key: "poll",
|
1096
1027
|
value: function () {
|
1097
|
-
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1028
|
+
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
|
1098
1029
|
var s,
|
1099
1030
|
f,
|
1100
1031
|
b,
|
@@ -1108,27 +1039,27 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1108
1039
|
d,
|
1109
1040
|
h,
|
1110
1041
|
p,
|
1111
|
-
|
1112
|
-
return _regeneratorRuntime().wrap(function
|
1113
|
-
while (1) switch (
|
1042
|
+
_args10 = arguments;
|
1043
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
1044
|
+
while (1) switch (_context10.prev = _context10.next) {
|
1114
1045
|
case 0:
|
1115
|
-
s =
|
1046
|
+
s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
|
1116
1047
|
o = {
|
1117
1048
|
body: t,
|
1118
1049
|
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
1119
1050
|
};
|
1120
|
-
|
1051
|
+
_context10.next = 4;
|
1121
1052
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
1122
1053
|
case 4:
|
1123
|
-
_yield$RequestUtils$p3 =
|
1054
|
+
_yield$RequestUtils$p3 = _context10.sent;
|
1124
1055
|
a = _yield$RequestUtils$p3.body;
|
1125
1056
|
l = _yield$RequestUtils$p3.headers;
|
1126
1057
|
c = _yield$RequestUtils$p3.error;
|
1127
1058
|
if (!c) {
|
1128
|
-
|
1059
|
+
_context10.next = 10;
|
1129
1060
|
break;
|
1130
1061
|
}
|
1131
|
-
return
|
1062
|
+
return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c));
|
1132
1063
|
case 10:
|
1133
1064
|
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, p = {
|
1134
1065
|
method: d,
|
@@ -1138,11 +1069,11 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1138
1069
|
HTTPRequest.executePollRequest(e, u, p, n);
|
1139
1070
|
case 12:
|
1140
1071
|
case "end":
|
1141
|
-
return
|
1072
|
+
return _context10.stop();
|
1142
1073
|
}
|
1143
|
-
},
|
1074
|
+
}, _callee10);
|
1144
1075
|
}));
|
1145
|
-
function poll(
|
1076
|
+
function poll(_x16, _x17, _x18) {
|
1146
1077
|
return _poll.apply(this, arguments);
|
1147
1078
|
}
|
1148
1079
|
return poll;
|
@@ -1230,7 +1161,11 @@ var Websocket = /*#__PURE__*/function () {
|
|
1230
1161
|
value: function setup(e, t) {
|
1231
1162
|
if (e.requestSettings.url !== Demo.URL) {
|
1232
1163
|
var n = typeof t != "boolean" ? t : void 0;
|
1233
|
-
|
1164
|
+
try {
|
1165
|
+
e.websocket = Websocket.connect(e.requestSettings.url, n), console.log("got here"), e.permittedErrorPrefixes = ["Connection error", "Error in server message"];
|
1166
|
+
} catch (_unused2) {
|
1167
|
+
console.log("error caught");
|
1168
|
+
}
|
1234
1169
|
}
|
1235
1170
|
}
|
1236
1171
|
}, {
|
@@ -1242,53 +1177,53 @@ var Websocket = /*#__PURE__*/function () {
|
|
1242
1177
|
key: "assignListeners",
|
1243
1178
|
value: function assignListeners(e, t) {
|
1244
1179
|
e.websocket && (e.websocket.onmessage = /*#__PURE__*/function () {
|
1245
|
-
var
|
1180
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(n) {
|
1246
1181
|
var s, o, a, l, c;
|
1247
|
-
return _regeneratorRuntime().wrap(function
|
1248
|
-
while (1) switch (
|
1182
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
1183
|
+
while (1) switch (_context11.prev = _context11.next) {
|
1249
1184
|
case 0:
|
1250
1185
|
if (!e.extractResultData) {
|
1251
|
-
|
1186
|
+
_context11.next = 20;
|
1252
1187
|
break;
|
1253
1188
|
}
|
1254
|
-
|
1189
|
+
_context11.prev = 1;
|
1255
1190
|
a = JSON.parse(n.data);
|
1256
|
-
|
1191
|
+
_context11.next = 5;
|
1257
1192
|
return (o = (s = e.deepChat).responseInterceptor) == null ? void 0 : o.call(s, a);
|
1258
1193
|
case 5:
|
1259
|
-
|
1260
|
-
if (
|
1261
|
-
|
1194
|
+
_context11.t0 = _context11.sent;
|
1195
|
+
if (_context11.t0) {
|
1196
|
+
_context11.next = 8;
|
1262
1197
|
break;
|
1263
1198
|
}
|
1264
|
-
|
1199
|
+
_context11.t0 = a;
|
1265
1200
|
case 8:
|
1266
|
-
l =
|
1267
|
-
|
1201
|
+
l = _context11.t0;
|
1202
|
+
_context11.next = 11;
|
1268
1203
|
return e.extractResultData(l);
|
1269
1204
|
case 11:
|
1270
|
-
c =
|
1205
|
+
c = _context11.sent;
|
1271
1206
|
if (!(!c || _typeof(c) != "object")) {
|
1272
|
-
|
1207
|
+
_context11.next = 14;
|
1273
1208
|
break;
|
1274
1209
|
}
|
1275
1210
|
throw Error(ErrorMessages.INVALID_RESPONSE(a, "server", !!e.deepChat.responseInterceptor, l));
|
1276
1211
|
case 14:
|
1277
1212
|
e.deepChat.stream && c.text ? Stream.simulate(t, e.streamHandlers, c.text) : t.addNewMessage(c, !0, !0);
|
1278
|
-
|
1213
|
+
_context11.next = 20;
|
1279
1214
|
break;
|
1280
1215
|
case 17:
|
1281
|
-
|
1282
|
-
|
1283
|
-
RequestUtils.displayError(t,
|
1216
|
+
_context11.prev = 17;
|
1217
|
+
_context11.t1 = _context11["catch"](1);
|
1218
|
+
RequestUtils.displayError(t, _context11.t1, "Error in server message");
|
1284
1219
|
case 20:
|
1285
1220
|
case "end":
|
1286
|
-
return
|
1221
|
+
return _context11.stop();
|
1287
1222
|
}
|
1288
|
-
},
|
1223
|
+
}, _callee11, null, [[1, 17]]);
|
1289
1224
|
}));
|
1290
|
-
return function (
|
1291
|
-
return
|
1225
|
+
return function (_x19) {
|
1226
|
+
return _ref4.apply(this, arguments);
|
1292
1227
|
};
|
1293
1228
|
}(), e.websocket.onerror = function (n) {
|
1294
1229
|
console.error(n), t.addNewErrorMessage("service", "Connection error");
|
@@ -1299,7 +1234,7 @@ var Websocket = /*#__PURE__*/function () {
|
|
1299
1234
|
}, {
|
1300
1235
|
key: "sendWebsocket",
|
1301
1236
|
value: function () {
|
1302
|
-
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1237
|
+
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n, s) {
|
1303
1238
|
var o,
|
1304
1239
|
d,
|
1305
1240
|
h,
|
@@ -1308,42 +1243,42 @@ var Websocket = /*#__PURE__*/function () {
|
|
1308
1243
|
l,
|
1309
1244
|
c,
|
1310
1245
|
u,
|
1311
|
-
|
1312
|
-
return _regeneratorRuntime().wrap(function
|
1313
|
-
while (1) switch (
|
1246
|
+
_args12 = arguments;
|
1247
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
1248
|
+
while (1) switch (_context12.prev = _context12.next) {
|
1314
1249
|
case 0:
|
1315
|
-
o =
|
1250
|
+
o = _args12.length > 4 && _args12[4] !== undefined ? _args12[4] : !0;
|
1316
1251
|
a = {
|
1317
1252
|
body: n,
|
1318
1253
|
headers: (d = t.requestSettings) == null ? void 0 : d.headers
|
1319
1254
|
};
|
1320
|
-
|
1255
|
+
_context12.next = 4;
|
1321
1256
|
return RequestUtils.processResponseInterceptor(t.deepChat, a);
|
1322
1257
|
case 4:
|
1323
|
-
_yield$RequestUtils$p4 =
|
1258
|
+
_yield$RequestUtils$p4 = _context12.sent;
|
1324
1259
|
l = _yield$RequestUtils$p4.body;
|
1325
1260
|
c = _yield$RequestUtils$p4.error;
|
1326
1261
|
if (!c) {
|
1327
|
-
|
1262
|
+
_context12.next = 9;
|
1328
1263
|
break;
|
1329
1264
|
}
|
1330
|
-
return
|
1265
|
+
return _context12.abrupt("return", s.addNewErrorMessage("service", c));
|
1331
1266
|
case 9:
|
1332
1267
|
u = o ? JSON.stringify(l) : l;
|
1333
1268
|
if (!(((h = t.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
|
1334
|
-
|
1269
|
+
_context12.next = 12;
|
1335
1270
|
break;
|
1336
1271
|
}
|
1337
|
-
return
|
1272
|
+
return _context12.abrupt("return", Demo.request(s, t.completionsHandlers.onFinish, t.deepChat.responseInterceptor));
|
1338
1273
|
case 12:
|
1339
1274
|
e.readyState !== e.OPEN ? (console.error("Connection is not open"), s.addNewErrorMessage("service", "Connection error")) : e.send(JSON.stringify(u));
|
1340
1275
|
case 13:
|
1341
1276
|
case "end":
|
1342
|
-
return
|
1277
|
+
return _context12.stop();
|
1343
1278
|
}
|
1344
|
-
},
|
1279
|
+
}, _callee12);
|
1345
1280
|
}));
|
1346
|
-
function sendWebsocket(
|
1281
|
+
function sendWebsocket(_x20, _x21, _x22, _x23) {
|
1347
1282
|
return _sendWebsocket.apply(this, arguments);
|
1348
1283
|
}
|
1349
1284
|
return sendWebsocket;
|
@@ -1787,7 +1722,7 @@ function normalizeLink(r) {
|
|
1787
1722
|
var e = replaceEntities(r);
|
1788
1723
|
try {
|
1789
1724
|
e = decodeURI(e);
|
1790
|
-
} catch (
|
1725
|
+
} catch (_unused3) {}
|
1791
1726
|
return encodeURI(e);
|
1792
1727
|
}
|
1793
1728
|
function parseLinkDestination(r, e) {
|
@@ -2224,12 +2159,12 @@ function list(r, e, t, n) {
|
|
2224
2159
|
v,
|
2225
2160
|
g,
|
2226
2161
|
y,
|
2227
|
-
|
2162
|
+
S,
|
2228
2163
|
_,
|
2229
2164
|
I,
|
2230
2165
|
R = !0,
|
2231
2166
|
w,
|
2232
|
-
|
2167
|
+
x,
|
2233
2168
|
H,
|
2234
2169
|
F;
|
2235
2170
|
if ((h = skipOrderedListMarker(r, e)) >= 0) v = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) v = !1;else return !1;
|
@@ -2244,15 +2179,15 @@ function list(r, e, t, n) {
|
|
2244
2179
|
type: "bullet_list_open",
|
2245
2180
|
lines: _ = [e, 0],
|
2246
2181
|
level: r.level++
|
2247
|
-
}), s = e,
|
2182
|
+
}), s = e, S = !1, w = r.parser.ruler.getRules("list"); s < t && (g = r.skipSpaces(h), p = r.eMarks[s], g >= p ? f = 1 : f = g - h, f > 4 && (f = 1), f < 1 && (f = 1), o = h - r.bMarks[s] + f, r.tokens.push({
|
2248
2183
|
type: "list_item_open",
|
2249
2184
|
lines: I = [e, 0],
|
2250
2185
|
level: r.level++
|
2251
|
-
}), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = g - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight ||
|
2186
|
+
}), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = g - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || S) && (R = !1), S = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
|
2252
2187
|
type: "list_item_close",
|
2253
2188
|
level: --r.level
|
2254
2189
|
}), s = e = r.line, I[1] = s, g = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
|
2255
|
-
for (F = !1,
|
2190
|
+
for (F = !1, x = 0, H = w.length; x < H; x++) if (w[x](r, s, t, !0)) {
|
2256
2191
|
F = !0;
|
2257
2192
|
break;
|
2258
2193
|
}
|
@@ -3234,12 +3169,12 @@ var RemarkableConfig = /*#__PURE__*/function () {
|
|
3234
3169
|
highlight: function highlight(t, n) {
|
3235
3170
|
if (n && e.getLanguage(n)) try {
|
3236
3171
|
return e.highlight(n, t).value;
|
3237
|
-
} catch (
|
3172
|
+
} catch (_unused4) {
|
3238
3173
|
console.error("failed to setup the highlight dependency");
|
3239
3174
|
}
|
3240
3175
|
try {
|
3241
3176
|
return e.highlightAuto(t).value;
|
3242
|
-
} catch (
|
3177
|
+
} catch (_unused5) {
|
3243
3178
|
console.error("failed to automatically highlight messages");
|
3244
3179
|
}
|
3245
3180
|
return "";
|
@@ -3392,11 +3327,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3392
3327
|
}, {
|
3393
3328
|
key: "callServiceAPI",
|
3394
3329
|
value: function () {
|
3395
|
-
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3330
|
+
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
|
3396
3331
|
var _c$headers, _u$ContentType;
|
3397
3332
|
var l, c, u, d, s, o, a;
|
3398
|
-
return _regeneratorRuntime().wrap(function
|
3399
|
-
while (1) switch (
|
3333
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
3334
|
+
while (1) switch (_context13.prev = _context13.next) {
|
3400
3335
|
case 0:
|
3401
3336
|
s = _objectSpread({
|
3402
3337
|
messages: t
|
@@ -3405,26 +3340,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3405
3340
|
(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);
|
3406
3341
|
a = this.deepChat.stream;
|
3407
3342
|
if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
|
3408
|
-
|
3343
|
+
_context13.next = 9;
|
3409
3344
|
break;
|
3410
3345
|
}
|
3411
|
-
|
3346
|
+
_context13.next = 7;
|
3412
3347
|
return Stream.request(this, s, e);
|
3413
3348
|
case 7:
|
3414
|
-
|
3349
|
+
_context13.next = 11;
|
3415
3350
|
break;
|
3416
3351
|
case 9:
|
3417
|
-
|
3352
|
+
_context13.next = 11;
|
3418
3353
|
return HTTPRequest.request(this, s, e);
|
3419
3354
|
case 11:
|
3420
3355
|
o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
|
3421
3356
|
case 12:
|
3422
3357
|
case "end":
|
3423
|
-
return
|
3358
|
+
return _context13.stop();
|
3424
3359
|
}
|
3425
|
-
},
|
3360
|
+
}, _callee13, this);
|
3426
3361
|
}));
|
3427
|
-
function callServiceAPI(
|
3362
|
+
function callServiceAPI(_x24, _x25, _x26) {
|
3428
3363
|
return _callServiceAPI.apply(this, arguments);
|
3429
3364
|
}
|
3430
3365
|
return callServiceAPI;
|
@@ -3432,24 +3367,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3432
3367
|
}, {
|
3433
3368
|
key: "callApiWithFiles",
|
3434
3369
|
value: function () {
|
3435
|
-
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3370
|
+
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
|
3436
3371
|
var o, a, l;
|
3437
|
-
return _regeneratorRuntime().wrap(function
|
3438
|
-
while (1) switch (
|
3372
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
3373
|
+
while (1) switch (_context14.prev = _context14.next) {
|
3439
3374
|
case 0:
|
3440
3375
|
o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
|
3441
3376
|
this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
|
3442
|
-
|
3377
|
+
_context14.next = 4;
|
3443
3378
|
return HTTPRequest.request(this, o, t, !1);
|
3444
3379
|
case 4:
|
3445
3380
|
this.requestSettings = a;
|
3446
3381
|
case 5:
|
3447
3382
|
case "end":
|
3448
|
-
return
|
3383
|
+
return _context14.stop();
|
3449
3384
|
}
|
3450
|
-
},
|
3385
|
+
}, _callee14, this);
|
3451
3386
|
}));
|
3452
|
-
function callApiWithFiles(
|
3387
|
+
function callApiWithFiles(_x27, _x28, _x29, _x30) {
|
3453
3388
|
return _callApiWithFiles.apply(this, arguments);
|
3454
3389
|
}
|
3455
3390
|
return callApiWithFiles;
|
@@ -3457,13 +3392,13 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3457
3392
|
}, {
|
3458
3393
|
key: "callAPI",
|
3459
3394
|
value: function () {
|
3460
|
-
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3395
|
+
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t) {
|
3461
3396
|
var n, s;
|
3462
|
-
return _regeneratorRuntime().wrap(function
|
3463
|
-
while (1) switch (
|
3397
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
3398
|
+
while (1) switch (_context15.prev = _context15.next) {
|
3464
3399
|
case 0:
|
3465
3400
|
if (this.requestSettings) {
|
3466
|
-
|
3401
|
+
_context15.next = 2;
|
3467
3402
|
break;
|
3468
3403
|
}
|
3469
3404
|
throw new Error("Request settings have not been set up");
|
@@ -3477,11 +3412,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3477
3412
|
} else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
|
3478
3413
|
case 4:
|
3479
3414
|
case "end":
|
3480
|
-
return
|
3415
|
+
return _context15.stop();
|
3481
3416
|
}
|
3482
|
-
},
|
3417
|
+
}, _callee15, this);
|
3483
3418
|
}));
|
3484
|
-
function callAPI(
|
3419
|
+
function callAPI(_x31, _x32) {
|
3485
3420
|
return _callAPI.apply(this, arguments);
|
3486
3421
|
}
|
3487
3422
|
return callAPI;
|
@@ -3489,24 +3424,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3489
3424
|
}, {
|
3490
3425
|
key: "extractResultData",
|
3491
3426
|
value: function () {
|
3492
|
-
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3493
|
-
return _regeneratorRuntime().wrap(function
|
3494
|
-
while (1) switch (
|
3427
|
+
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e) {
|
3428
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
3429
|
+
while (1) switch (_context16.prev = _context16.next) {
|
3495
3430
|
case 0:
|
3496
3431
|
if (!e.error) {
|
3497
|
-
|
3432
|
+
_context16.next = 2;
|
3498
3433
|
break;
|
3499
3434
|
}
|
3500
3435
|
throw e.error;
|
3501
3436
|
case 2:
|
3502
|
-
return
|
3437
|
+
return _context16.abrupt("return", e.result);
|
3503
3438
|
case 3:
|
3504
3439
|
case "end":
|
3505
|
-
return
|
3440
|
+
return _context16.stop();
|
3506
3441
|
}
|
3507
|
-
},
|
3442
|
+
}, _callee16);
|
3508
3443
|
}));
|
3509
|
-
function extractResultData(
|
3444
|
+
function extractResultData(_x33) {
|
3510
3445
|
return _extractResultData.apply(this, arguments);
|
3511
3446
|
}
|
3512
3447
|
return extractResultData;
|
@@ -3870,13 +3805,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3870
3805
|
}, {
|
3871
3806
|
key: "callServiceAPI",
|
3872
3807
|
value: function () {
|
3873
|
-
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3808
|
+
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
|
3874
3809
|
var s;
|
3875
|
-
return _regeneratorRuntime().wrap(function
|
3876
|
-
while (1) switch (
|
3810
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
3811
|
+
while (1) switch (_context17.prev = _context17.next) {
|
3877
3812
|
case 0:
|
3878
3813
|
if (this.requestSettings) {
|
3879
|
-
|
3814
|
+
_context17.next = 2;
|
3880
3815
|
break;
|
3881
3816
|
}
|
3882
3817
|
throw new Error("Request settings have not been set up");
|
@@ -3885,11 +3820,11 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3885
3820
|
HTTPRequest.request(this, s, e);
|
3886
3821
|
case 4:
|
3887
3822
|
case "end":
|
3888
|
-
return
|
3823
|
+
return _context17.stop();
|
3889
3824
|
}
|
3890
|
-
},
|
3825
|
+
}, _callee17, this);
|
3891
3826
|
}));
|
3892
|
-
function callServiceAPI(
|
3827
|
+
function callServiceAPI(_x34, _x35, _x36) {
|
3893
3828
|
return _callServiceAPI2.apply(this, arguments);
|
3894
3829
|
}
|
3895
3830
|
return callServiceAPI;
|
@@ -3918,18 +3853,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
3918
3853
|
}, {
|
3919
3854
|
key: "callServiceAPI",
|
3920
3855
|
value: function () {
|
3921
|
-
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3922
|
-
return _regeneratorRuntime().wrap(function
|
3923
|
-
while (1) switch (
|
3856
|
+
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n) {
|
3857
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
3858
|
+
while (1) switch (_context18.prev = _context18.next) {
|
3924
3859
|
case 0:
|
3925
3860
|
if (this.requestSettings) {
|
3926
|
-
|
3861
|
+
_context18.next = 2;
|
3927
3862
|
break;
|
3928
3863
|
}
|
3929
3864
|
throw new Error("Request settings have not been set up");
|
3930
3865
|
case 2:
|
3931
3866
|
if (n != null && n[0]) {
|
3932
|
-
|
3867
|
+
_context18.next = 4;
|
3933
3868
|
break;
|
3934
3869
|
}
|
3935
3870
|
throw new Error("No file was added");
|
@@ -3937,11 +3872,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
3937
3872
|
HTTPRequest.poll(this, n[0], e, !1);
|
3938
3873
|
case 5:
|
3939
3874
|
case "end":
|
3940
|
-
return
|
3875
|
+
return _context18.stop();
|
3941
3876
|
}
|
3942
|
-
},
|
3877
|
+
}, _callee18, this);
|
3943
3878
|
}));
|
3944
|
-
function callServiceAPI(
|
3879
|
+
function callServiceAPI(_x37, _x38, _x39) {
|
3945
3880
|
return _callServiceAPI3.apply(this, arguments);
|
3946
3881
|
}
|
3947
3882
|
return callServiceAPI;
|
@@ -3970,35 +3905,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
3970
3905
|
_createClass(HuggingFaceAudioClassificationIO, [{
|
3971
3906
|
key: "extractPollResultData",
|
3972
3907
|
value: function () {
|
3973
|
-
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3908
|
+
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
|
3974
3909
|
var t;
|
3975
|
-
return _regeneratorRuntime().wrap(function
|
3976
|
-
while (1) switch (
|
3910
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
3911
|
+
while (1) switch (_context19.prev = _context19.next) {
|
3977
3912
|
case 0:
|
3978
3913
|
if (!e.estimated_time) {
|
3979
|
-
|
3914
|
+
_context19.next = 2;
|
3980
3915
|
break;
|
3981
3916
|
}
|
3982
|
-
return
|
3917
|
+
return _context19.abrupt("return", {
|
3983
3918
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
3984
3919
|
});
|
3985
3920
|
case 2:
|
3986
3921
|
if (!e.error) {
|
3987
|
-
|
3922
|
+
_context19.next = 4;
|
3988
3923
|
break;
|
3989
3924
|
}
|
3990
3925
|
throw e.error;
|
3991
3926
|
case 4:
|
3992
|
-
return
|
3927
|
+
return _context19.abrupt("return", {
|
3993
3928
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
3994
3929
|
});
|
3995
3930
|
case 5:
|
3996
3931
|
case "end":
|
3997
|
-
return
|
3932
|
+
return _context19.stop();
|
3998
3933
|
}
|
3999
|
-
},
|
3934
|
+
}, _callee19);
|
4000
3935
|
}));
|
4001
|
-
function extractPollResultData(
|
3936
|
+
function extractPollResultData(_x40) {
|
4002
3937
|
return _extractPollResultData.apply(this, arguments);
|
4003
3938
|
}
|
4004
3939
|
return extractPollResultData;
|
@@ -4021,35 +3956,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
4021
3956
|
_createClass(HuggingFaceImageClassificationIO, [{
|
4022
3957
|
key: "extractPollResultData",
|
4023
3958
|
value: function () {
|
4024
|
-
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3959
|
+
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
|
4025
3960
|
var t;
|
4026
|
-
return _regeneratorRuntime().wrap(function
|
4027
|
-
while (1) switch (
|
3961
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
3962
|
+
while (1) switch (_context20.prev = _context20.next) {
|
4028
3963
|
case 0:
|
4029
3964
|
if (!e.estimated_time) {
|
4030
|
-
|
3965
|
+
_context20.next = 2;
|
4031
3966
|
break;
|
4032
3967
|
}
|
4033
|
-
return
|
3968
|
+
return _context20.abrupt("return", {
|
4034
3969
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4035
3970
|
});
|
4036
3971
|
case 2:
|
4037
3972
|
if (!e.error) {
|
4038
|
-
|
3973
|
+
_context20.next = 4;
|
4039
3974
|
break;
|
4040
3975
|
}
|
4041
3976
|
throw e.error;
|
4042
3977
|
case 4:
|
4043
|
-
return
|
3978
|
+
return _context20.abrupt("return", {
|
4044
3979
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
4045
3980
|
});
|
4046
3981
|
case 5:
|
4047
3982
|
case "end":
|
4048
|
-
return
|
3983
|
+
return _context20.stop();
|
4049
3984
|
}
|
4050
|
-
},
|
3985
|
+
}, _callee20);
|
4051
3986
|
}));
|
4052
|
-
function extractPollResultData(
|
3987
|
+
function extractPollResultData(_x41) {
|
4053
3988
|
return _extractPollResultData2.apply(this, arguments);
|
4054
3989
|
}
|
4055
3990
|
return extractPollResultData;
|
@@ -4134,19 +4069,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4134
4069
|
}, {
|
4135
4070
|
key: "callServiceAPI",
|
4136
4071
|
value: function () {
|
4137
|
-
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4072
|
+
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
|
4138
4073
|
var s;
|
4139
|
-
return _regeneratorRuntime().wrap(function
|
4140
|
-
while (1) switch (
|
4074
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
4075
|
+
while (1) switch (_context21.prev = _context21.next) {
|
4141
4076
|
case 0:
|
4142
4077
|
if (this.requestSettings) {
|
4143
|
-
|
4078
|
+
_context21.next = 2;
|
4144
4079
|
break;
|
4145
4080
|
}
|
4146
4081
|
throw new Error("Request settings have not been set up");
|
4147
4082
|
case 2:
|
4148
4083
|
if (n) {
|
4149
|
-
|
4084
|
+
_context21.next = 4;
|
4150
4085
|
break;
|
4151
4086
|
}
|
4152
4087
|
throw new Error("Image was not found");
|
@@ -4155,11 +4090,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4155
4090
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
4156
4091
|
case 6:
|
4157
4092
|
case "end":
|
4158
|
-
return
|
4093
|
+
return _context21.stop();
|
4159
4094
|
}
|
4160
|
-
},
|
4095
|
+
}, _callee21, this);
|
4161
4096
|
}));
|
4162
|
-
function callServiceAPI(
|
4097
|
+
function callServiceAPI(_x42, _x43, _x44) {
|
4163
4098
|
return _callServiceAPI4.apply(this, arguments);
|
4164
4099
|
}
|
4165
4100
|
return callServiceAPI;
|
@@ -4167,17 +4102,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4167
4102
|
}, {
|
4168
4103
|
key: "extractResultData",
|
4169
4104
|
value: function () {
|
4170
|
-
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4171
|
-
return _regeneratorRuntime().wrap(function
|
4172
|
-
while (1) switch (
|
4105
|
+
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
|
4106
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
4107
|
+
while (1) switch (_context22.prev = _context22.next) {
|
4173
4108
|
case 0:
|
4174
4109
|
if (!e.message) {
|
4175
|
-
|
4110
|
+
_context22.next = 2;
|
4176
4111
|
break;
|
4177
4112
|
}
|
4178
4113
|
throw e.message;
|
4179
4114
|
case 2:
|
4180
|
-
return
|
4115
|
+
return _context22.abrupt("return", {
|
4181
4116
|
files: e.artifacts.map(function (n) {
|
4182
4117
|
return {
|
4183
4118
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4187,11 +4122,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4187
4122
|
});
|
4188
4123
|
case 3:
|
4189
4124
|
case "end":
|
4190
|
-
return
|
4125
|
+
return _context22.stop();
|
4191
4126
|
}
|
4192
|
-
},
|
4127
|
+
}, _callee22);
|
4193
4128
|
}));
|
4194
|
-
function extractResultData(
|
4129
|
+
function extractResultData(_x45) {
|
4195
4130
|
return _extractResultData2.apply(this, arguments);
|
4196
4131
|
}
|
4197
4132
|
return extractResultData;
|
@@ -4243,19 +4178,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4243
4178
|
}, {
|
4244
4179
|
key: "callServiceAPI",
|
4245
4180
|
value: function () {
|
4246
|
-
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4181
|
+
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
|
4247
4182
|
var a, l, s, o;
|
4248
|
-
return _regeneratorRuntime().wrap(function
|
4249
|
-
while (1) switch (
|
4183
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
4184
|
+
while (1) switch (_context23.prev = _context23.next) {
|
4250
4185
|
case 0:
|
4251
4186
|
if (this.requestSettings) {
|
4252
|
-
|
4187
|
+
_context23.next = 2;
|
4253
4188
|
break;
|
4254
4189
|
}
|
4255
4190
|
throw new Error("Request settings have not been set up");
|
4256
4191
|
case 2:
|
4257
4192
|
if (!(!n || !n[0] || !n[1])) {
|
4258
|
-
|
4193
|
+
_context23.next = 4;
|
4259
4194
|
break;
|
4260
4195
|
}
|
4261
4196
|
throw new Error("Image was not found");
|
@@ -4264,11 +4199,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4264
4199
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4265
4200
|
case 6:
|
4266
4201
|
case "end":
|
4267
|
-
return
|
4202
|
+
return _context23.stop();
|
4268
4203
|
}
|
4269
|
-
},
|
4204
|
+
}, _callee23, this);
|
4270
4205
|
}));
|
4271
|
-
function callServiceAPI(
|
4206
|
+
function callServiceAPI(_x46, _x47, _x48) {
|
4272
4207
|
return _callServiceAPI5.apply(this, arguments);
|
4273
4208
|
}
|
4274
4209
|
return callServiceAPI;
|
@@ -4276,17 +4211,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4276
4211
|
}, {
|
4277
4212
|
key: "extractResultData",
|
4278
4213
|
value: function () {
|
4279
|
-
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4280
|
-
return _regeneratorRuntime().wrap(function
|
4281
|
-
while (1) switch (
|
4214
|
+
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
|
4215
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
4216
|
+
while (1) switch (_context24.prev = _context24.next) {
|
4282
4217
|
case 0:
|
4283
4218
|
if (!e.message) {
|
4284
|
-
|
4219
|
+
_context24.next = 2;
|
4285
4220
|
break;
|
4286
4221
|
}
|
4287
4222
|
throw e.message;
|
4288
4223
|
case 2:
|
4289
|
-
return
|
4224
|
+
return _context24.abrupt("return", {
|
4290
4225
|
files: e.artifacts.map(function (n) {
|
4291
4226
|
return {
|
4292
4227
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4296,11 +4231,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4296
4231
|
});
|
4297
4232
|
case 3:
|
4298
4233
|
case "end":
|
4299
|
-
return
|
4234
|
+
return _context24.stop();
|
4300
4235
|
}
|
4301
|
-
},
|
4236
|
+
}, _callee24);
|
4302
4237
|
}));
|
4303
|
-
function extractResultData(
|
4238
|
+
function extractResultData(_x49) {
|
4304
4239
|
return _extractResultData3.apply(this, arguments);
|
4305
4240
|
}
|
4306
4241
|
return extractResultData;
|
@@ -4333,34 +4268,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
|
|
4333
4268
|
_createClass(HuggingFaceAudioRecognitionIO, [{
|
4334
4269
|
key: "extractPollResultData",
|
4335
4270
|
value: function () {
|
4336
|
-
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4337
|
-
return _regeneratorRuntime().wrap(function
|
4338
|
-
while (1) switch (
|
4271
|
+
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
|
4272
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
4273
|
+
while (1) switch (_context25.prev = _context25.next) {
|
4339
4274
|
case 0:
|
4340
4275
|
if (!e.estimated_time) {
|
4341
|
-
|
4276
|
+
_context25.next = 2;
|
4342
4277
|
break;
|
4343
4278
|
}
|
4344
|
-
return
|
4279
|
+
return _context25.abrupt("return", {
|
4345
4280
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4346
4281
|
});
|
4347
4282
|
case 2:
|
4348
4283
|
if (!e.error) {
|
4349
|
-
|
4284
|
+
_context25.next = 4;
|
4350
4285
|
break;
|
4351
4286
|
}
|
4352
4287
|
throw e.error;
|
4353
4288
|
case 4:
|
4354
|
-
return
|
4289
|
+
return _context25.abrupt("return", {
|
4355
4290
|
text: e.text || ""
|
4356
4291
|
});
|
4357
4292
|
case 5:
|
4358
4293
|
case "end":
|
4359
|
-
return
|
4294
|
+
return _context25.stop();
|
4360
4295
|
}
|
4361
|
-
},
|
4296
|
+
}, _callee25);
|
4362
4297
|
}));
|
4363
|
-
function extractPollResultData(
|
4298
|
+
function extractPollResultData(_x50) {
|
4364
4299
|
return _extractPollResultData3.apply(this, arguments);
|
4365
4300
|
}
|
4366
4301
|
return extractPollResultData;
|
@@ -4381,26 +4316,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
|
|
4381
4316
|
_createClass(HuggingFaceTextGenerationIO, [{
|
4382
4317
|
key: "extractResultData",
|
4383
4318
|
value: function () {
|
4384
|
-
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4385
|
-
return _regeneratorRuntime().wrap(function
|
4386
|
-
while (1) switch (
|
4319
|
+
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
|
4320
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
4321
|
+
while (1) switch (_context26.prev = _context26.next) {
|
4387
4322
|
case 0:
|
4388
4323
|
if (!e.error) {
|
4389
|
-
|
4324
|
+
_context26.next = 2;
|
4390
4325
|
break;
|
4391
4326
|
}
|
4392
4327
|
throw e.error;
|
4393
4328
|
case 2:
|
4394
|
-
return
|
4329
|
+
return _context26.abrupt("return", {
|
4395
4330
|
text: e[0].generated_text || ""
|
4396
4331
|
});
|
4397
4332
|
case 3:
|
4398
4333
|
case "end":
|
4399
|
-
return
|
4334
|
+
return _context26.stop();
|
4400
4335
|
}
|
4401
|
-
},
|
4336
|
+
}, _callee26);
|
4402
4337
|
}));
|
4403
|
-
function extractResultData(
|
4338
|
+
function extractResultData(_x51) {
|
4404
4339
|
return _extractResultData4.apply(this, arguments);
|
4405
4340
|
}
|
4406
4341
|
return extractResultData;
|
@@ -4437,26 +4372,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
|
|
4437
4372
|
}, {
|
4438
4373
|
key: "extractResultData",
|
4439
4374
|
value: function () {
|
4440
|
-
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4441
|
-
return _regeneratorRuntime().wrap(function
|
4442
|
-
while (1) switch (
|
4375
|
+
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
|
4376
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
4377
|
+
while (1) switch (_context27.prev = _context27.next) {
|
4443
4378
|
case 0:
|
4444
4379
|
if (!e.error) {
|
4445
|
-
|
4380
|
+
_context27.next = 2;
|
4446
4381
|
break;
|
4447
4382
|
}
|
4448
4383
|
throw e.error;
|
4449
4384
|
case 2:
|
4450
|
-
return
|
4385
|
+
return _context27.abrupt("return", {
|
4451
4386
|
text: e.answer || ""
|
4452
4387
|
});
|
4453
4388
|
case 3:
|
4454
4389
|
case "end":
|
4455
|
-
return
|
4390
|
+
return _context27.stop();
|
4456
4391
|
}
|
4457
|
-
},
|
4392
|
+
}, _callee27);
|
4458
4393
|
}));
|
4459
|
-
function extractResultData(
|
4394
|
+
function extractResultData(_x52) {
|
4460
4395
|
return _extractResultData5.apply(this, arguments);
|
4461
4396
|
}
|
4462
4397
|
return extractResultData;
|
@@ -4477,26 +4412,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
|
|
4477
4412
|
_createClass(HuggingFaceSummarizationIO, [{
|
4478
4413
|
key: "extractResultData",
|
4479
4414
|
value: function () {
|
4480
|
-
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4481
|
-
return _regeneratorRuntime().wrap(function
|
4482
|
-
while (1) switch (
|
4415
|
+
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
|
4416
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
4417
|
+
while (1) switch (_context28.prev = _context28.next) {
|
4483
4418
|
case 0:
|
4484
4419
|
if (!e.error) {
|
4485
|
-
|
4420
|
+
_context28.next = 2;
|
4486
4421
|
break;
|
4487
4422
|
}
|
4488
4423
|
throw e.error;
|
4489
4424
|
case 2:
|
4490
|
-
return
|
4425
|
+
return _context28.abrupt("return", {
|
4491
4426
|
text: e[0].summary_text || ""
|
4492
4427
|
});
|
4493
4428
|
case 3:
|
4494
4429
|
case "end":
|
4495
|
-
return
|
4430
|
+
return _context28.stop();
|
4496
4431
|
}
|
4497
|
-
},
|
4432
|
+
}, _callee28);
|
4498
4433
|
}));
|
4499
|
-
function extractResultData(
|
4434
|
+
function extractResultData(_x53) {
|
4500
4435
|
return _extractResultData6.apply(this, arguments);
|
4501
4436
|
}
|
4502
4437
|
return extractResultData;
|
@@ -4557,26 +4492,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
|
|
4557
4492
|
}, {
|
4558
4493
|
key: "extractResultData",
|
4559
4494
|
value: function () {
|
4560
|
-
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4561
|
-
return _regeneratorRuntime().wrap(function
|
4562
|
-
while (1) switch (
|
4495
|
+
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
|
4496
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
4497
|
+
while (1) switch (_context29.prev = _context29.next) {
|
4563
4498
|
case 0:
|
4564
4499
|
if (!e.error) {
|
4565
|
-
|
4500
|
+
_context29.next = 2;
|
4566
4501
|
break;
|
4567
4502
|
}
|
4568
4503
|
throw e.error;
|
4569
4504
|
case 2:
|
4570
|
-
return
|
4505
|
+
return _context29.abrupt("return", {
|
4571
4506
|
text: e.generated_text || ""
|
4572
4507
|
});
|
4573
4508
|
case 3:
|
4574
4509
|
case "end":
|
4575
|
-
return
|
4510
|
+
return _context29.stop();
|
4576
4511
|
}
|
4577
|
-
},
|
4512
|
+
}, _callee29);
|
4578
4513
|
}));
|
4579
|
-
function extractResultData(
|
4514
|
+
function extractResultData(_x54) {
|
4580
4515
|
return _extractResultData7.apply(this, arguments);
|
4581
4516
|
}
|
4582
4517
|
return extractResultData;
|
@@ -4618,19 +4553,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4618
4553
|
}, {
|
4619
4554
|
key: "callServiceAPI",
|
4620
4555
|
value: function () {
|
4621
|
-
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4556
|
+
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e, t, n) {
|
4622
4557
|
var a, l, s, o;
|
4623
|
-
return _regeneratorRuntime().wrap(function
|
4624
|
-
while (1) switch (
|
4558
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
4559
|
+
while (1) switch (_context30.prev = _context30.next) {
|
4625
4560
|
case 0:
|
4626
4561
|
if (this.requestSettings) {
|
4627
|
-
|
4562
|
+
_context30.next = 2;
|
4628
4563
|
break;
|
4629
4564
|
}
|
4630
4565
|
throw new Error("Request settings have not been set up");
|
4631
4566
|
case 2:
|
4632
4567
|
if (n) {
|
4633
|
-
|
4568
|
+
_context30.next = 4;
|
4634
4569
|
break;
|
4635
4570
|
}
|
4636
4571
|
throw new Error("Image was not found");
|
@@ -4639,11 +4574,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4639
4574
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4640
4575
|
case 6:
|
4641
4576
|
case "end":
|
4642
|
-
return
|
4577
|
+
return _context30.stop();
|
4643
4578
|
}
|
4644
|
-
},
|
4579
|
+
}, _callee30, this);
|
4645
4580
|
}));
|
4646
|
-
function callServiceAPI(
|
4581
|
+
function callServiceAPI(_x55, _x56, _x57) {
|
4647
4582
|
return _callServiceAPI6.apply(this, arguments);
|
4648
4583
|
}
|
4649
4584
|
return callServiceAPI;
|
@@ -4651,17 +4586,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4651
4586
|
}, {
|
4652
4587
|
key: "extractResultData",
|
4653
4588
|
value: function () {
|
4654
|
-
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4655
|
-
return _regeneratorRuntime().wrap(function
|
4656
|
-
while (1) switch (
|
4589
|
+
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
|
4590
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
4591
|
+
while (1) switch (_context31.prev = _context31.next) {
|
4657
4592
|
case 0:
|
4658
4593
|
if (!e.message) {
|
4659
|
-
|
4594
|
+
_context31.next = 2;
|
4660
4595
|
break;
|
4661
4596
|
}
|
4662
4597
|
throw e.message;
|
4663
4598
|
case 2:
|
4664
|
-
return
|
4599
|
+
return _context31.abrupt("return", {
|
4665
4600
|
files: e.artifacts.map(function (n) {
|
4666
4601
|
return {
|
4667
4602
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4671,11 +4606,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4671
4606
|
});
|
4672
4607
|
case 3:
|
4673
4608
|
case "end":
|
4674
|
-
return
|
4609
|
+
return _context31.stop();
|
4675
4610
|
}
|
4676
|
-
},
|
4611
|
+
}, _callee31);
|
4677
4612
|
}));
|
4678
|
-
function extractResultData(
|
4613
|
+
function extractResultData(_x58) {
|
4679
4614
|
return _extractResultData8.apply(this, arguments);
|
4680
4615
|
}
|
4681
4616
|
return extractResultData;
|
@@ -4706,26 +4641,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
|
|
4706
4641
|
_createClass(HuggingFaceTranslationIO, [{
|
4707
4642
|
key: "extractResultData",
|
4708
4643
|
value: function () {
|
4709
|
-
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4710
|
-
return _regeneratorRuntime().wrap(function
|
4711
|
-
while (1) switch (
|
4644
|
+
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
|
4645
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
4646
|
+
while (1) switch (_context32.prev = _context32.next) {
|
4712
4647
|
case 0:
|
4713
4648
|
if (!e.error) {
|
4714
|
-
|
4649
|
+
_context32.next = 2;
|
4715
4650
|
break;
|
4716
4651
|
}
|
4717
4652
|
throw e.error;
|
4718
4653
|
case 2:
|
4719
|
-
return
|
4654
|
+
return _context32.abrupt("return", {
|
4720
4655
|
text: e[0].translation_text || ""
|
4721
4656
|
});
|
4722
4657
|
case 3:
|
4723
4658
|
case "end":
|
4724
|
-
return
|
4659
|
+
return _context32.stop();
|
4725
4660
|
}
|
4726
|
-
},
|
4661
|
+
}, _callee32);
|
4727
4662
|
}));
|
4728
|
-
function extractResultData(
|
4663
|
+
function extractResultData(_x59) {
|
4729
4664
|
return _extractResultData9.apply(this, arguments);
|
4730
4665
|
}
|
4731
4666
|
return extractResultData;
|
@@ -4759,13 +4694,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4759
4694
|
}, {
|
4760
4695
|
key: "callServiceAPI",
|
4761
4696
|
value: function () {
|
4762
|
-
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4697
|
+
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t) {
|
4763
4698
|
var n;
|
4764
|
-
return _regeneratorRuntime().wrap(function
|
4765
|
-
while (1) switch (
|
4699
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
4700
|
+
while (1) switch (_context33.prev = _context33.next) {
|
4766
4701
|
case 0:
|
4767
4702
|
if (this.requestSettings) {
|
4768
|
-
|
4703
|
+
_context33.next = 2;
|
4769
4704
|
break;
|
4770
4705
|
}
|
4771
4706
|
throw new Error("Request settings have not been set up");
|
@@ -4774,11 +4709,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4774
4709
|
HTTPRequest.request(this, n, e);
|
4775
4710
|
case 4:
|
4776
4711
|
case "end":
|
4777
|
-
return
|
4712
|
+
return _context33.stop();
|
4778
4713
|
}
|
4779
|
-
},
|
4714
|
+
}, _callee33, this);
|
4780
4715
|
}));
|
4781
|
-
function callServiceAPI(
|
4716
|
+
function callServiceAPI(_x60, _x61) {
|
4782
4717
|
return _callServiceAPI7.apply(this, arguments);
|
4783
4718
|
}
|
4784
4719
|
return callServiceAPI;
|
@@ -4786,17 +4721,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4786
4721
|
}, {
|
4787
4722
|
key: "extractResultData",
|
4788
4723
|
value: function () {
|
4789
|
-
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4790
|
-
return _regeneratorRuntime().wrap(function
|
4791
|
-
while (1) switch (
|
4724
|
+
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
|
4725
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
4726
|
+
while (1) switch (_context34.prev = _context34.next) {
|
4792
4727
|
case 0:
|
4793
4728
|
if (!e.message) {
|
4794
|
-
|
4729
|
+
_context34.next = 2;
|
4795
4730
|
break;
|
4796
4731
|
}
|
4797
4732
|
throw e.message;
|
4798
4733
|
case 2:
|
4799
|
-
return
|
4734
|
+
return _context34.abrupt("return", {
|
4800
4735
|
files: e.artifacts.map(function (n) {
|
4801
4736
|
return {
|
4802
4737
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4806,11 +4741,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4806
4741
|
});
|
4807
4742
|
case 3:
|
4808
4743
|
case "end":
|
4809
|
-
return
|
4744
|
+
return _context34.stop();
|
4810
4745
|
}
|
4811
|
-
},
|
4746
|
+
}, _callee34);
|
4812
4747
|
}));
|
4813
|
-
function extractResultData(
|
4748
|
+
function extractResultData(_x62) {
|
4814
4749
|
return _extractResultData10.apply(this, arguments);
|
4815
4750
|
}
|
4816
4751
|
return extractResultData;
|
@@ -4843,26 +4778,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
|
|
4843
4778
|
_createClass(HuggingFaceFillMaskIO, [{
|
4844
4779
|
key: "extractResultData",
|
4845
4780
|
value: function () {
|
4846
|
-
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4847
|
-
return _regeneratorRuntime().wrap(function
|
4848
|
-
while (1) switch (
|
4781
|
+
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
|
4782
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
4783
|
+
while (1) switch (_context35.prev = _context35.next) {
|
4849
4784
|
case 0:
|
4850
4785
|
if (!e.error) {
|
4851
|
-
|
4786
|
+
_context35.next = 2;
|
4852
4787
|
break;
|
4853
4788
|
}
|
4854
4789
|
throw e.error;
|
4855
4790
|
case 2:
|
4856
|
-
return
|
4791
|
+
return _context35.abrupt("return", {
|
4857
4792
|
text: e[0].sequence || ""
|
4858
4793
|
});
|
4859
4794
|
case 3:
|
4860
4795
|
case "end":
|
4861
|
-
return
|
4796
|
+
return _context35.stop();
|
4862
4797
|
}
|
4863
|
-
},
|
4798
|
+
}, _callee35);
|
4864
4799
|
}));
|
4865
|
-
function extractResultData(
|
4800
|
+
function extractResultData(_x63) {
|
4866
4801
|
return _extractResultData11.apply(this, arguments);
|
4867
4802
|
}
|
4868
4803
|
return extractResultData;
|
@@ -4937,13 +4872,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4937
4872
|
}, {
|
4938
4873
|
key: "callServiceAPI",
|
4939
4874
|
value: function () {
|
4940
|
-
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4875
|
+
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
|
4941
4876
|
var n;
|
4942
|
-
return _regeneratorRuntime().wrap(function
|
4943
|
-
while (1) switch (
|
4877
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
4878
|
+
while (1) switch (_context36.prev = _context36.next) {
|
4944
4879
|
case 0:
|
4945
4880
|
if (this.requestSettings) {
|
4946
|
-
|
4881
|
+
_context36.next = 2;
|
4947
4882
|
break;
|
4948
4883
|
}
|
4949
4884
|
throw new Error("Request settings have not been set up");
|
@@ -4952,11 +4887,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4952
4887
|
HTTPRequest.request(this, n, e);
|
4953
4888
|
case 4:
|
4954
4889
|
case "end":
|
4955
|
-
return
|
4890
|
+
return _context36.stop();
|
4956
4891
|
}
|
4957
|
-
},
|
4892
|
+
}, _callee36, this);
|
4958
4893
|
}));
|
4959
|
-
function callServiceAPI(
|
4894
|
+
function callServiceAPI(_x64, _x65) {
|
4960
4895
|
return _callServiceAPI8.apply(this, arguments);
|
4961
4896
|
}
|
4962
4897
|
return callServiceAPI;
|
@@ -4964,27 +4899,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4964
4899
|
}, {
|
4965
4900
|
key: "extractResultData",
|
4966
4901
|
value: function () {
|
4967
|
-
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4902
|
+
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
|
4968
4903
|
var t;
|
4969
|
-
return _regeneratorRuntime().wrap(function
|
4970
|
-
while (1) switch (
|
4904
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
4905
|
+
while (1) switch (_context37.prev = _context37.next) {
|
4971
4906
|
case 0:
|
4972
4907
|
if (!e.message) {
|
4973
|
-
|
4908
|
+
_context37.next = 2;
|
4974
4909
|
break;
|
4975
4910
|
}
|
4976
4911
|
throw e.message;
|
4977
4912
|
case 2:
|
4978
|
-
return
|
4913
|
+
return _context37.abrupt("return", {
|
4979
4914
|
text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
|
4980
4915
|
});
|
4981
4916
|
case 3:
|
4982
4917
|
case "end":
|
4983
|
-
return
|
4918
|
+
return _context37.stop();
|
4984
4919
|
}
|
4985
|
-
},
|
4920
|
+
}, _callee37);
|
4986
4921
|
}));
|
4987
|
-
function extractResultData(
|
4922
|
+
function extractResultData(_x66) {
|
4988
4923
|
return _extractResultData12.apply(this, arguments);
|
4989
4924
|
}
|
4990
4925
|
return extractResultData;
|
@@ -5014,13 +4949,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5014
4949
|
}, {
|
5015
4950
|
key: "callServiceAPI",
|
5016
4951
|
value: function () {
|
5017
|
-
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4952
|
+
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
|
5018
4953
|
var n;
|
5019
|
-
return _regeneratorRuntime().wrap(function
|
5020
|
-
while (1) switch (
|
4954
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
4955
|
+
while (1) switch (_context38.prev = _context38.next) {
|
5021
4956
|
case 0:
|
5022
4957
|
if (this.requestSettings) {
|
5023
|
-
|
4958
|
+
_context38.next = 2;
|
5024
4959
|
break;
|
5025
4960
|
}
|
5026
4961
|
throw new Error("Request settings have not been set up");
|
@@ -5029,11 +4964,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5029
4964
|
HTTPRequest.request(this, n, e);
|
5030
4965
|
case 4:
|
5031
4966
|
case "end":
|
5032
|
-
return
|
4967
|
+
return _context38.stop();
|
5033
4968
|
}
|
5034
|
-
},
|
4969
|
+
}, _callee38, this);
|
5035
4970
|
}));
|
5036
|
-
function callServiceAPI(
|
4971
|
+
function callServiceAPI(_x67, _x68) {
|
5037
4972
|
return _callServiceAPI9.apply(this, arguments);
|
5038
4973
|
}
|
5039
4974
|
return callServiceAPI;
|
@@ -5041,26 +4976,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5041
4976
|
}, {
|
5042
4977
|
key: "extractResultData",
|
5043
4978
|
value: function () {
|
5044
|
-
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5045
|
-
return _regeneratorRuntime().wrap(function
|
5046
|
-
while (1) switch (
|
4979
|
+
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
|
4980
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
4981
|
+
while (1) switch (_context39.prev = _context39.next) {
|
5047
4982
|
case 0:
|
5048
4983
|
if (!e.message) {
|
5049
|
-
|
4984
|
+
_context39.next = 2;
|
5050
4985
|
break;
|
5051
4986
|
}
|
5052
4987
|
throw e.message;
|
5053
4988
|
case 2:
|
5054
|
-
return
|
4989
|
+
return _context39.abrupt("return", {
|
5055
4990
|
text: e.summary || ""
|
5056
4991
|
});
|
5057
4992
|
case 3:
|
5058
4993
|
case "end":
|
5059
|
-
return
|
4994
|
+
return _context39.stop();
|
5060
4995
|
}
|
5061
|
-
},
|
4996
|
+
}, _callee39);
|
5062
4997
|
}));
|
5063
|
-
function extractResultData(
|
4998
|
+
function extractResultData(_x69) {
|
5064
4999
|
return _extractResultData13.apply(this, arguments);
|
5065
5000
|
}
|
5066
5001
|
return extractResultData;
|
@@ -5217,13 +5152,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5217
5152
|
}, {
|
5218
5153
|
key: "callServiceAPI",
|
5219
5154
|
value: function () {
|
5220
|
-
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5155
|
+
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
|
5221
5156
|
var n;
|
5222
|
-
return _regeneratorRuntime().wrap(function
|
5223
|
-
while (1) switch (
|
5157
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
5158
|
+
while (1) switch (_context40.prev = _context40.next) {
|
5224
5159
|
case 0:
|
5225
5160
|
if (this.requestSettings) {
|
5226
|
-
|
5161
|
+
_context40.next = 2;
|
5227
5162
|
break;
|
5228
5163
|
}
|
5229
5164
|
throw new Error("Request settings have not been set up");
|
@@ -5232,11 +5167,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5232
5167
|
HTTPRequest.request(this, n, e), this.messages = e;
|
5233
5168
|
case 4:
|
5234
5169
|
case "end":
|
5235
|
-
return
|
5170
|
+
return _context40.stop();
|
5236
5171
|
}
|
5237
|
-
},
|
5172
|
+
}, _callee40, this);
|
5238
5173
|
}));
|
5239
|
-
function callServiceAPI(
|
5174
|
+
function callServiceAPI(_x70, _x71) {
|
5240
5175
|
return _callServiceAPI10.apply(this, arguments);
|
5241
5176
|
}
|
5242
5177
|
return callServiceAPI;
|
@@ -5244,13 +5179,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5244
5179
|
}, {
|
5245
5180
|
key: "extractResultData",
|
5246
5181
|
value: function () {
|
5247
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5182
|
+
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
|
5248
5183
|
var t, n, s;
|
5249
|
-
return _regeneratorRuntime().wrap(function
|
5250
|
-
while (1) switch (
|
5184
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
5185
|
+
while (1) switch (_context41.prev = _context41.next) {
|
5251
5186
|
case 0:
|
5252
5187
|
if (!e.error) {
|
5253
|
-
|
5188
|
+
_context41.next = 2;
|
5254
5189
|
break;
|
5255
5190
|
}
|
5256
5191
|
throw e.error.message;
|
@@ -5262,16 +5197,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5262
5197
|
};
|
5263
5198
|
HTTPRequest.executePollRequest(this, n, s, this.messages);
|
5264
5199
|
}
|
5265
|
-
return
|
5200
|
+
return _context41.abrupt("return", {
|
5266
5201
|
pollingInAnotherRequest: !0
|
5267
5202
|
});
|
5268
5203
|
case 4:
|
5269
5204
|
case "end":
|
5270
|
-
return
|
5205
|
+
return _context41.stop();
|
5271
5206
|
}
|
5272
|
-
},
|
5207
|
+
}, _callee41, this);
|
5273
5208
|
}));
|
5274
|
-
function extractResultData(
|
5209
|
+
function extractResultData(_x72) {
|
5275
5210
|
return _extractResultData14.apply(this, arguments);
|
5276
5211
|
}
|
5277
5212
|
return extractResultData;
|
@@ -5279,33 +5214,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5279
5214
|
}, {
|
5280
5215
|
key: "extractPollResultData",
|
5281
5216
|
value: function () {
|
5282
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5217
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
|
5283
5218
|
var t, _iterator, _step, n;
|
5284
|
-
return _regeneratorRuntime().wrap(function
|
5285
|
-
while (1) switch (
|
5219
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
5220
|
+
while (1) switch (_context42.prev = _context42.next) {
|
5286
5221
|
case 0:
|
5287
5222
|
if (!e.error) {
|
5288
|
-
|
5223
|
+
_context42.next = 2;
|
5289
5224
|
break;
|
5290
5225
|
}
|
5291
5226
|
throw e.error;
|
5292
5227
|
case 2:
|
5293
5228
|
if (!(e.status === "running")) {
|
5294
|
-
|
5229
|
+
_context42.next = 4;
|
5295
5230
|
break;
|
5296
5231
|
}
|
5297
|
-
return
|
5232
|
+
return _context42.abrupt("return", {
|
5298
5233
|
timeoutMS: 2e3
|
5299
5234
|
});
|
5300
5235
|
case 4:
|
5301
5236
|
if (!(e.errors.length > 0)) {
|
5302
|
-
|
5237
|
+
_context42.next = 6;
|
5303
5238
|
break;
|
5304
5239
|
}
|
5305
5240
|
throw e.errors[0];
|
5306
5241
|
case 6:
|
5307
5242
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
5308
|
-
|
5243
|
+
_context42.next = 8;
|
5309
5244
|
break;
|
5310
5245
|
}
|
5311
5246
|
throw e.tasks.items[0].results.errors[0];
|
@@ -5322,16 +5257,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5322
5257
|
} finally {
|
5323
5258
|
_iterator.f();
|
5324
5259
|
}
|
5325
|
-
return
|
5260
|
+
return _context42.abrupt("return", {
|
5326
5261
|
text: t || ""
|
5327
5262
|
});
|
5328
5263
|
case 12:
|
5329
5264
|
case "end":
|
5330
|
-
return
|
5265
|
+
return _context42.stop();
|
5331
5266
|
}
|
5332
|
-
},
|
5267
|
+
}, _callee42);
|
5333
5268
|
}));
|
5334
|
-
function extractPollResultData(
|
5269
|
+
function extractPollResultData(_x73) {
|
5335
5270
|
return _extractPollResultData4.apply(this, arguments);
|
5336
5271
|
}
|
5337
5272
|
return extractPollResultData;
|
@@ -5430,13 +5365,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5430
5365
|
}, {
|
5431
5366
|
key: "callServiceAPI",
|
5432
5367
|
value: function () {
|
5433
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5368
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
|
5434
5369
|
var n;
|
5435
|
-
return _regeneratorRuntime().wrap(function
|
5436
|
-
while (1) switch (
|
5370
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
5371
|
+
while (1) switch (_context43.prev = _context43.next) {
|
5437
5372
|
case 0:
|
5438
5373
|
if (this.requestSettings) {
|
5439
|
-
|
5374
|
+
_context43.next = 2;
|
5440
5375
|
break;
|
5441
5376
|
}
|
5442
5377
|
throw new Error("Request settings have not been set up");
|
@@ -5445,11 +5380,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5445
5380
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
5446
5381
|
case 4:
|
5447
5382
|
case "end":
|
5448
|
-
return
|
5383
|
+
return _context43.stop();
|
5449
5384
|
}
|
5450
|
-
},
|
5385
|
+
}, _callee43, this);
|
5451
5386
|
}));
|
5452
|
-
function callServiceAPI(
|
5387
|
+
function callServiceAPI(_x74, _x75) {
|
5453
5388
|
return _callServiceAPI11.apply(this, arguments);
|
5454
5389
|
}
|
5455
5390
|
return callServiceAPI;
|
@@ -5457,27 +5392,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5457
5392
|
}, {
|
5458
5393
|
key: "extractResultData",
|
5459
5394
|
value: function () {
|
5460
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5395
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
|
5461
5396
|
var t;
|
5462
|
-
return _regeneratorRuntime().wrap(function
|
5463
|
-
while (1) switch (
|
5397
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
5398
|
+
while (1) switch (_context44.prev = _context44.next) {
|
5464
5399
|
case 0:
|
5465
5400
|
if (!e.error) {
|
5466
|
-
|
5401
|
+
_context44.next = 2;
|
5467
5402
|
break;
|
5468
5403
|
}
|
5469
5404
|
throw e.error.message;
|
5470
5405
|
case 2:
|
5471
|
-
return
|
5406
|
+
return _context44.abrupt("return", {
|
5472
5407
|
text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
|
5473
5408
|
});
|
5474
5409
|
case 3:
|
5475
5410
|
case "end":
|
5476
|
-
return
|
5411
|
+
return _context44.stop();
|
5477
5412
|
}
|
5478
|
-
},
|
5413
|
+
}, _callee44);
|
5479
5414
|
}));
|
5480
|
-
function extractResultData(
|
5415
|
+
function extractResultData(_x76) {
|
5481
5416
|
return _extractResultData15.apply(this, arguments);
|
5482
5417
|
}
|
5483
5418
|
return extractResultData;
|
@@ -5492,17 +5427,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5492
5427
|
_createClass(AssemblyAIUtils, null, [{
|
5493
5428
|
key: "poll",
|
5494
5429
|
value: function () {
|
5495
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5430
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
|
5496
5431
|
var n, l, c, d;
|
5497
|
-
return _regeneratorRuntime().wrap(function
|
5498
|
-
while (1) switch (
|
5432
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
5433
|
+
while (1) switch (_context45.prev = _context45.next) {
|
5499
5434
|
case 0:
|
5500
5435
|
n = {
|
5501
5436
|
authorization: e,
|
5502
5437
|
"content-type": "application/json"
|
5503
5438
|
};
|
5504
|
-
|
5505
|
-
|
5439
|
+
_context45.t0 = "https://api.assemblyai.com/v2/transcript/";
|
5440
|
+
_context45.next = 4;
|
5506
5441
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
5507
5442
|
method: "POST",
|
5508
5443
|
body: JSON.stringify({
|
@@ -5511,55 +5446,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5511
5446
|
headers: n
|
5512
5447
|
});
|
5513
5448
|
case 4:
|
5514
|
-
|
5515
|
-
return
|
5449
|
+
_context45.next = 6;
|
5450
|
+
return _context45.sent.json();
|
5516
5451
|
case 6:
|
5517
|
-
|
5518
|
-
l =
|
5452
|
+
_context45.t1 = _context45.sent.id;
|
5453
|
+
l = _context45.t0.concat.call(_context45.t0, _context45.t1);
|
5519
5454
|
case 8:
|
5520
5455
|
if (c) {
|
5521
|
-
|
5456
|
+
_context45.next = 24;
|
5522
5457
|
break;
|
5523
5458
|
}
|
5524
|
-
|
5459
|
+
_context45.next = 11;
|
5525
5460
|
return fetch(l, {
|
5526
5461
|
headers: n
|
5527
5462
|
});
|
5528
5463
|
case 11:
|
5529
|
-
|
5530
|
-
return
|
5464
|
+
_context45.next = 13;
|
5465
|
+
return _context45.sent.json();
|
5531
5466
|
case 13:
|
5532
|
-
d =
|
5467
|
+
d = _context45.sent;
|
5533
5468
|
if (!(d.status === "completed")) {
|
5534
|
-
|
5469
|
+
_context45.next = 18;
|
5535
5470
|
break;
|
5536
5471
|
}
|
5537
5472
|
c = d;
|
5538
|
-
|
5473
|
+
_context45.next = 22;
|
5539
5474
|
break;
|
5540
5475
|
case 18:
|
5541
5476
|
if (!(d.status === "error")) {
|
5542
|
-
|
5477
|
+
_context45.next = 20;
|
5543
5478
|
break;
|
5544
5479
|
}
|
5545
5480
|
throw new Error("Transcription failed: ".concat(d.error));
|
5546
5481
|
case 20:
|
5547
|
-
|
5482
|
+
_context45.next = 22;
|
5548
5483
|
return new Promise(function (h) {
|
5549
5484
|
return setTimeout(h, 3e3);
|
5550
5485
|
});
|
5551
5486
|
case 22:
|
5552
|
-
|
5487
|
+
_context45.next = 8;
|
5553
5488
|
break;
|
5554
5489
|
case 24:
|
5555
|
-
return
|
5490
|
+
return _context45.abrupt("return", c);
|
5556
5491
|
case 25:
|
5557
5492
|
case "end":
|
5558
|
-
return
|
5493
|
+
return _context45.stop();
|
5559
5494
|
}
|
5560
|
-
},
|
5495
|
+
}, _callee45);
|
5561
5496
|
}));
|
5562
|
-
function poll(
|
5497
|
+
function poll(_x77, _x78) {
|
5563
5498
|
return _poll2.apply(this, arguments);
|
5564
5499
|
}
|
5565
5500
|
return poll;
|
@@ -5607,19 +5542,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5607
5542
|
_createClass(AssemblyAIAudioIO, [{
|
5608
5543
|
key: "callServiceAPI",
|
5609
5544
|
value: function () {
|
5610
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5545
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t, n) {
|
5611
5546
|
var s;
|
5612
|
-
return _regeneratorRuntime().wrap(function
|
5613
|
-
while (1) switch (
|
5547
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
5548
|
+
while (1) switch (_context46.prev = _context46.next) {
|
5614
5549
|
case 0:
|
5615
5550
|
if ((s = this.requestSettings) != null && s.headers) {
|
5616
|
-
|
5551
|
+
_context46.next = 2;
|
5617
5552
|
break;
|
5618
5553
|
}
|
5619
5554
|
throw new Error("Request settings have not been set up");
|
5620
5555
|
case 2:
|
5621
5556
|
if (n != null && n[0]) {
|
5622
|
-
|
5557
|
+
_context46.next = 4;
|
5623
5558
|
break;
|
5624
5559
|
}
|
5625
5560
|
throw new Error("No file was added");
|
@@ -5627,11 +5562,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5627
5562
|
HTTPRequest.request(this, n[0], e, !1);
|
5628
5563
|
case 5:
|
5629
5564
|
case "end":
|
5630
|
-
return
|
5565
|
+
return _context46.stop();
|
5631
5566
|
}
|
5632
|
-
},
|
5567
|
+
}, _callee46, this);
|
5633
5568
|
}));
|
5634
|
-
function callServiceAPI(
|
5569
|
+
function callServiceAPI(_x79, _x80, _x81) {
|
5635
5570
|
return _callServiceAPI12.apply(this, arguments);
|
5636
5571
|
}
|
5637
5572
|
return callServiceAPI;
|
@@ -5639,32 +5574,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5639
5574
|
}, {
|
5640
5575
|
key: "extractResultData",
|
5641
5576
|
value: function () {
|
5642
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5577
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
|
5643
5578
|
var s, o, t;
|
5644
|
-
return _regeneratorRuntime().wrap(function
|
5645
|
-
while (1) switch (
|
5579
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
5580
|
+
while (1) switch (_context47.prev = _context47.next) {
|
5646
5581
|
case 0:
|
5647
5582
|
if (!e.error) {
|
5648
|
-
|
5583
|
+
_context47.next = 2;
|
5649
5584
|
break;
|
5650
5585
|
}
|
5651
5586
|
throw e.error;
|
5652
5587
|
case 2:
|
5653
5588
|
t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
|
5654
|
-
|
5589
|
+
_context47.next = 5;
|
5655
5590
|
return AssemblyAIUtils.poll(t, e.upload_url);
|
5656
5591
|
case 5:
|
5657
|
-
|
5658
|
-
return
|
5659
|
-
text:
|
5592
|
+
_context47.t0 = _context47.sent.text;
|
5593
|
+
return _context47.abrupt("return", {
|
5594
|
+
text: _context47.t0
|
5660
5595
|
});
|
5661
5596
|
case 7:
|
5662
5597
|
case "end":
|
5663
|
-
return
|
5598
|
+
return _context47.stop();
|
5664
5599
|
}
|
5665
|
-
},
|
5600
|
+
}, _callee47, this);
|
5666
5601
|
}));
|
5667
|
-
function extractResultData(
|
5602
|
+
function extractResultData(_x82) {
|
5668
5603
|
return _extractResultData16.apply(this, arguments);
|
5669
5604
|
}
|
5670
5605
|
return extractResultData;
|
@@ -5714,13 +5649,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5714
5649
|
}, {
|
5715
5650
|
key: "callServiceAPI",
|
5716
5651
|
value: function () {
|
5717
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5652
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
|
5718
5653
|
var n;
|
5719
|
-
return _regeneratorRuntime().wrap(function
|
5720
|
-
while (1) switch (
|
5654
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
5655
|
+
while (1) switch (_context48.prev = _context48.next) {
|
5721
5656
|
case 0:
|
5722
5657
|
if (this.requestSettings) {
|
5723
|
-
|
5658
|
+
_context48.next = 2;
|
5724
5659
|
break;
|
5725
5660
|
}
|
5726
5661
|
throw new Error("Request settings have not been set up");
|
@@ -5729,11 +5664,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5729
5664
|
HTTPRequest.request(this, n, e, !1);
|
5730
5665
|
case 4:
|
5731
5666
|
case "end":
|
5732
|
-
return
|
5667
|
+
return _context48.stop();
|
5733
5668
|
}
|
5734
|
-
},
|
5669
|
+
}, _callee48, this);
|
5735
5670
|
}));
|
5736
|
-
function callServiceAPI(
|
5671
|
+
function callServiceAPI(_x83, _x84) {
|
5737
5672
|
return _callServiceAPI13.apply(this, arguments);
|
5738
5673
|
}
|
5739
5674
|
return callServiceAPI;
|
@@ -5741,11 +5676,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5741
5676
|
}, {
|
5742
5677
|
key: "extractResultData",
|
5743
5678
|
value: function () {
|
5744
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5745
|
-
return _regeneratorRuntime().wrap(function
|
5746
|
-
while (1) switch (
|
5679
|
+
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
|
5680
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
5681
|
+
while (1) switch (_context49.prev = _context49.next) {
|
5747
5682
|
case 0:
|
5748
|
-
return
|
5683
|
+
return _context49.abrupt("return", new Promise(function (t) {
|
5749
5684
|
var n = new FileReader();
|
5750
5685
|
n.readAsDataURL(e), n.onload = function (s) {
|
5751
5686
|
t({
|
@@ -5758,11 +5693,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5758
5693
|
}));
|
5759
5694
|
case 1:
|
5760
5695
|
case "end":
|
5761
|
-
return
|
5696
|
+
return _context49.stop();
|
5762
5697
|
}
|
5763
|
-
},
|
5698
|
+
}, _callee49);
|
5764
5699
|
}));
|
5765
|
-
function extractResultData(
|
5700
|
+
function extractResultData(_x85) {
|
5766
5701
|
return _extractResultData17.apply(this, arguments);
|
5767
5702
|
}
|
5768
5703
|
return extractResultData;
|
@@ -5798,19 +5733,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5798
5733
|
_createClass(j, [{
|
5799
5734
|
key: "callServiceAPI",
|
5800
5735
|
value: function () {
|
5801
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5736
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
|
5802
5737
|
var s, o;
|
5803
|
-
return _regeneratorRuntime().wrap(function
|
5804
|
-
while (1) switch (
|
5738
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
5739
|
+
while (1) switch (_context50.prev = _context50.next) {
|
5805
5740
|
case 0:
|
5806
5741
|
if ((s = this.requestSettings) != null && s.headers) {
|
5807
|
-
|
5742
|
+
_context50.next = 2;
|
5808
5743
|
break;
|
5809
5744
|
}
|
5810
5745
|
throw new Error("Request settings have not been set up");
|
5811
5746
|
case 2:
|
5812
5747
|
if (n != null && n[0]) {
|
5813
|
-
|
5748
|
+
_context50.next = 4;
|
5814
5749
|
break;
|
5815
5750
|
}
|
5816
5751
|
throw new Error("No file was added");
|
@@ -5818,11 +5753,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5818
5753
|
(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);
|
5819
5754
|
case 5:
|
5820
5755
|
case "end":
|
5821
|
-
return
|
5756
|
+
return _context50.stop();
|
5822
5757
|
}
|
5823
|
-
},
|
5758
|
+
}, _callee50, this);
|
5824
5759
|
}));
|
5825
|
-
function callServiceAPI(
|
5760
|
+
function callServiceAPI(_x86, _x87, _x88) {
|
5826
5761
|
return _callServiceAPI14.apply(this, arguments);
|
5827
5762
|
}
|
5828
5763
|
return callServiceAPI;
|
@@ -5830,26 +5765,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5830
5765
|
}, {
|
5831
5766
|
key: "extractResultData",
|
5832
5767
|
value: function () {
|
5833
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5834
|
-
return _regeneratorRuntime().wrap(function
|
5835
|
-
while (1) switch (
|
5768
|
+
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
|
5769
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
5770
|
+
while (1) switch (_context51.prev = _context51.next) {
|
5836
5771
|
case 0:
|
5837
5772
|
if (!e.error) {
|
5838
|
-
|
5773
|
+
_context51.next = 2;
|
5839
5774
|
break;
|
5840
5775
|
}
|
5841
5776
|
throw e.error;
|
5842
5777
|
case 2:
|
5843
|
-
return
|
5778
|
+
return _context51.abrupt("return", {
|
5844
5779
|
text: e.DisplayText || ""
|
5845
5780
|
});
|
5846
5781
|
case 3:
|
5847
5782
|
case "end":
|
5848
|
-
return
|
5783
|
+
return _context51.stop();
|
5849
5784
|
}
|
5850
|
-
},
|
5785
|
+
}, _callee51);
|
5851
5786
|
}));
|
5852
|
-
function extractResultData(
|
5787
|
+
function extractResultData(_x89) {
|
5853
5788
|
return _extractResultData18.apply(this, arguments);
|
5854
5789
|
}
|
5855
5790
|
return extractResultData;
|
@@ -5892,13 +5827,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5892
5827
|
}, {
|
5893
5828
|
key: "callServiceAPI",
|
5894
5829
|
value: function () {
|
5895
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5830
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
|
5896
5831
|
var n;
|
5897
|
-
return _regeneratorRuntime().wrap(function
|
5898
|
-
while (1) switch (
|
5832
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
5833
|
+
while (1) switch (_context52.prev = _context52.next) {
|
5899
5834
|
case 0:
|
5900
5835
|
if (this.requestSettings) {
|
5901
|
-
|
5836
|
+
_context52.next = 2;
|
5902
5837
|
break;
|
5903
5838
|
}
|
5904
5839
|
throw new Error("Request settings have not been set up");
|
@@ -5907,11 +5842,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5907
5842
|
HTTPRequest.request(this, n, e);
|
5908
5843
|
case 4:
|
5909
5844
|
case "end":
|
5910
|
-
return
|
5845
|
+
return _context52.stop();
|
5911
5846
|
}
|
5912
|
-
},
|
5847
|
+
}, _callee52, this);
|
5913
5848
|
}));
|
5914
|
-
function callServiceAPI(
|
5849
|
+
function callServiceAPI(_x90, _x91) {
|
5915
5850
|
return _callServiceAPI15.apply(this, arguments);
|
5916
5851
|
}
|
5917
5852
|
return callServiceAPI;
|
@@ -5919,27 +5854,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5919
5854
|
}, {
|
5920
5855
|
key: "extractResultData",
|
5921
5856
|
value: function () {
|
5922
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5857
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
|
5923
5858
|
var t;
|
5924
|
-
return _regeneratorRuntime().wrap(function
|
5925
|
-
while (1) switch (
|
5859
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
5860
|
+
while (1) switch (_context53.prev = _context53.next) {
|
5926
5861
|
case 0:
|
5927
5862
|
if (!Array.isArray(e)) {
|
5928
|
-
|
5863
|
+
_context53.next = 2;
|
5929
5864
|
break;
|
5930
5865
|
}
|
5931
|
-
return
|
5866
|
+
return _context53.abrupt("return", {
|
5932
5867
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
5933
5868
|
});
|
5934
5869
|
case 2:
|
5935
5870
|
throw e.error;
|
5936
5871
|
case 3:
|
5937
5872
|
case "end":
|
5938
|
-
return
|
5873
|
+
return _context53.stop();
|
5939
5874
|
}
|
5940
|
-
},
|
5875
|
+
}, _callee53);
|
5941
5876
|
}));
|
5942
|
-
function extractResultData(
|
5877
|
+
function extractResultData(_x92) {
|
5943
5878
|
return _extractResultData19.apply(this, arguments);
|
5944
5879
|
}
|
5945
5880
|
return extractResultData;
|
@@ -6006,27 +5941,27 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6006
5941
|
}, {
|
6007
5942
|
key: "callServiceAPI",
|
6008
5943
|
value: function () {
|
6009
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5944
|
+
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
|
6010
5945
|
var s, o;
|
6011
|
-
return _regeneratorRuntime().wrap(function
|
6012
|
-
while (1) switch (
|
5946
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
5947
|
+
while (1) switch (_context54.prev = _context54.next) {
|
6013
5948
|
case 0:
|
6014
5949
|
if ((s = this.requestSettings) != null && s.headers) {
|
6015
|
-
|
5950
|
+
_context54.next = 2;
|
6016
5951
|
break;
|
6017
5952
|
}
|
6018
5953
|
throw new Error("Request settings have not been set up");
|
6019
5954
|
case 2:
|
6020
5955
|
if (!(n != null && n[0])) {
|
6021
|
-
|
5956
|
+
_context54.next = 6;
|
6022
5957
|
break;
|
6023
5958
|
}
|
6024
5959
|
this.callApiWithImage(e, t, n);
|
6025
|
-
|
5960
|
+
_context54.next = 11;
|
6026
5961
|
break;
|
6027
5962
|
case 6:
|
6028
5963
|
if (this.requestSettings) {
|
6029
|
-
|
5964
|
+
_context54.next = 8;
|
6030
5965
|
break;
|
6031
5966
|
}
|
6032
5967
|
throw new Error("Request settings have not been set up");
|
@@ -6036,11 +5971,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6036
5971
|
HTTPRequest.request(this, o, e);
|
6037
5972
|
case 11:
|
6038
5973
|
case "end":
|
6039
|
-
return
|
5974
|
+
return _context54.stop();
|
6040
5975
|
}
|
6041
|
-
},
|
5976
|
+
}, _callee54, this);
|
6042
5977
|
}));
|
6043
|
-
function callServiceAPI(
|
5978
|
+
function callServiceAPI(_x93, _x94, _x95) {
|
6044
5979
|
return _callServiceAPI16.apply(this, arguments);
|
6045
5980
|
}
|
6046
5981
|
return callServiceAPI;
|
@@ -6048,17 +5983,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6048
5983
|
}, {
|
6049
5984
|
key: "extractResultData",
|
6050
5985
|
value: function () {
|
6051
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6052
|
-
return _regeneratorRuntime().wrap(function
|
6053
|
-
while (1) switch (
|
5986
|
+
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
|
5987
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
5988
|
+
while (1) switch (_context55.prev = _context55.next) {
|
6054
5989
|
case 0:
|
6055
5990
|
if (!e.error) {
|
6056
|
-
|
5991
|
+
_context55.next = 2;
|
6057
5992
|
break;
|
6058
5993
|
}
|
6059
5994
|
throw e.error.message;
|
6060
5995
|
case 2:
|
6061
|
-
return
|
5996
|
+
return _context55.abrupt("return", {
|
6062
5997
|
files: e.data.map(function (n) {
|
6063
5998
|
return n.url ? {
|
6064
5999
|
src: n.url,
|
@@ -6071,11 +6006,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6071
6006
|
});
|
6072
6007
|
case 3:
|
6073
6008
|
case "end":
|
6074
|
-
return
|
6009
|
+
return _context55.stop();
|
6075
6010
|
}
|
6076
|
-
},
|
6011
|
+
}, _callee55);
|
6077
6012
|
}));
|
6078
|
-
function extractResultData(
|
6013
|
+
function extractResultData(_x96) {
|
6079
6014
|
return _extractResultData20.apply(this, arguments);
|
6080
6015
|
}
|
6081
6016
|
return extractResultData;
|
@@ -6109,27 +6044,27 @@ _OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variati
|
|
6109
6044
|
_OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
6110
6045
|
var OpenAIImagesIO = _OpenAIImagesIO;
|
6111
6046
|
var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
6112
|
-
_inherits(
|
6113
|
-
var _super31 = _createSuper(
|
6114
|
-
function
|
6047
|
+
_inherits(M, _DirectServiceIO10);
|
6048
|
+
var _super31 = _createSuper(M);
|
6049
|
+
function M(e) {
|
6115
6050
|
var _l$model2;
|
6116
6051
|
var _this24;
|
6117
|
-
_classCallCheck(this,
|
6052
|
+
_classCallCheck(this, M);
|
6118
6053
|
var a, l;
|
6119
6054
|
var t = e.directConnection,
|
6120
6055
|
n = e.textInput,
|
6121
6056
|
s = t == null ? void 0 : t.openAI;
|
6122
6057
|
_this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
|
6123
6058
|
audio: {}
|
6124
|
-
}), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url =
|
6059
|
+
}), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = M.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
|
6125
6060
|
var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
|
6126
|
-
_typeof(o) == "object" && (_this24.processConfig(o),
|
6061
|
+
_typeof(o) == "object" && (_this24.processConfig(o), M.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = M.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = M.canSendFileMessage;
|
6127
6062
|
return _this24;
|
6128
6063
|
}
|
6129
|
-
_createClass(
|
6064
|
+
_createClass(M, [{
|
6130
6065
|
key: "processConfig",
|
6131
6066
|
value: function processConfig(e) {
|
6132
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
6067
|
+
e != null && e.type && e.type === "translation" && (this._service_url = M.AUDIO_TRANSLATIONS_URL, delete e.language);
|
6133
6068
|
}
|
6134
6069
|
}, {
|
6135
6070
|
key: "preprocessBody",
|
@@ -6147,33 +6082,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6147
6082
|
}, {
|
6148
6083
|
key: "callServiceAPI",
|
6149
6084
|
value: function () {
|
6150
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6085
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
|
6151
6086
|
var a, s, o;
|
6152
|
-
return _regeneratorRuntime().wrap(function
|
6153
|
-
while (1) switch (
|
6087
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
6088
|
+
while (1) switch (_context56.prev = _context56.next) {
|
6154
6089
|
case 0:
|
6155
6090
|
if ((a = this.requestSettings) != null && a.headers) {
|
6156
|
-
|
6091
|
+
_context56.next = 2;
|
6157
6092
|
break;
|
6158
6093
|
}
|
6159
6094
|
throw new Error("Request settings have not been set up");
|
6160
6095
|
case 2:
|
6161
6096
|
if (n != null && n[0]) {
|
6162
|
-
|
6097
|
+
_context56.next = 4;
|
6163
6098
|
break;
|
6164
6099
|
}
|
6165
6100
|
throw new Error("No file was added");
|
6166
6101
|
case 4:
|
6167
6102
|
this.url = this.requestSettings.url || this._service_url;
|
6168
|
-
s = this.preprocessBody(this.rawBody, t, n), o =
|
6103
|
+
s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
|
6169
6104
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
6170
6105
|
case 7:
|
6171
6106
|
case "end":
|
6172
|
-
return
|
6107
|
+
return _context56.stop();
|
6173
6108
|
}
|
6174
|
-
},
|
6109
|
+
}, _callee56, this);
|
6175
6110
|
}));
|
6176
|
-
function callServiceAPI(
|
6111
|
+
function callServiceAPI(_x97, _x98, _x99) {
|
6177
6112
|
return _callServiceAPI17.apply(this, arguments);
|
6178
6113
|
}
|
6179
6114
|
return callServiceAPI;
|
@@ -6181,26 +6116,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6181
6116
|
}, {
|
6182
6117
|
key: "extractResultData",
|
6183
6118
|
value: function () {
|
6184
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6185
|
-
return _regeneratorRuntime().wrap(function
|
6186
|
-
while (1) switch (
|
6119
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
|
6120
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
6121
|
+
while (1) switch (_context57.prev = _context57.next) {
|
6187
6122
|
case 0:
|
6188
6123
|
if (!e.error) {
|
6189
|
-
|
6124
|
+
_context57.next = 2;
|
6190
6125
|
break;
|
6191
6126
|
}
|
6192
6127
|
throw e.error.message;
|
6193
6128
|
case 2:
|
6194
|
-
return
|
6129
|
+
return _context57.abrupt("return", {
|
6195
6130
|
text: e.text
|
6196
6131
|
});
|
6197
6132
|
case 3:
|
6198
6133
|
case "end":
|
6199
|
-
return
|
6134
|
+
return _context57.stop();
|
6200
6135
|
}
|
6201
|
-
},
|
6136
|
+
}, _callee57);
|
6202
6137
|
}));
|
6203
|
-
function extractResultData(
|
6138
|
+
function extractResultData(_x100) {
|
6204
6139
|
return _extractResultData21.apply(this, arguments);
|
6205
6140
|
}
|
6206
6141
|
return extractResultData;
|
@@ -6224,7 +6159,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6224
6159
|
}), n;
|
6225
6160
|
}
|
6226
6161
|
}]);
|
6227
|
-
return
|
6162
|
+
return M;
|
6228
6163
|
}(DirectServiceIO);
|
6229
6164
|
_OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
6230
6165
|
_OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
@@ -6266,13 +6201,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6266
6201
|
}, {
|
6267
6202
|
key: "callServiceAPI",
|
6268
6203
|
value: function () {
|
6269
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6204
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
|
6270
6205
|
var n;
|
6271
|
-
return _regeneratorRuntime().wrap(function
|
6272
|
-
while (1) switch (
|
6206
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6207
|
+
while (1) switch (_context58.prev = _context58.next) {
|
6273
6208
|
case 0:
|
6274
6209
|
if (this.requestSettings) {
|
6275
|
-
|
6210
|
+
_context58.next = 2;
|
6276
6211
|
break;
|
6277
6212
|
}
|
6278
6213
|
throw new Error("Request settings have not been set up");
|
@@ -6281,11 +6216,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6281
6216
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
6282
6217
|
case 4:
|
6283
6218
|
case "end":
|
6284
|
-
return
|
6219
|
+
return _context58.stop();
|
6285
6220
|
}
|
6286
|
-
},
|
6221
|
+
}, _callee58, this);
|
6287
6222
|
}));
|
6288
|
-
function callServiceAPI(
|
6223
|
+
function callServiceAPI(_x101, _x102) {
|
6289
6224
|
return _callServiceAPI18.apply(this, arguments);
|
6290
6225
|
}
|
6291
6226
|
return callServiceAPI;
|
@@ -6293,17 +6228,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6293
6228
|
}, {
|
6294
6229
|
key: "extractResultData",
|
6295
6230
|
value: function () {
|
6296
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6297
|
-
return _regeneratorRuntime().wrap(function
|
6298
|
-
while (1) switch (
|
6231
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
6232
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
6233
|
+
while (1) switch (_context59.prev = _context59.next) {
|
6299
6234
|
case 0:
|
6300
6235
|
if (!e.error) {
|
6301
|
-
|
6236
|
+
_context59.next = 2;
|
6302
6237
|
break;
|
6303
6238
|
}
|
6304
6239
|
throw e.error.message;
|
6305
6240
|
case 2:
|
6306
|
-
return
|
6241
|
+
return _context59.abrupt("return", e.choices[0].delta ? {
|
6307
6242
|
text: e.choices[0].delta.content || ""
|
6308
6243
|
} : e.choices[0].message ? {
|
6309
6244
|
text: e.choices[0].message.content
|
@@ -6312,11 +6247,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6312
6247
|
});
|
6313
6248
|
case 3:
|
6314
6249
|
case "end":
|
6315
|
-
return
|
6250
|
+
return _context59.stop();
|
6316
6251
|
}
|
6317
|
-
},
|
6252
|
+
}, _callee59);
|
6318
6253
|
}));
|
6319
|
-
function extractResultData(
|
6254
|
+
function extractResultData(_x103) {
|
6320
6255
|
return _extractResultData22.apply(this, arguments);
|
6321
6256
|
}
|
6322
6257
|
return extractResultData;
|
@@ -6364,13 +6299,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6364
6299
|
}, {
|
6365
6300
|
key: "callServiceAPI",
|
6366
6301
|
value: function () {
|
6367
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6302
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
|
6368
6303
|
var n;
|
6369
|
-
return _regeneratorRuntime().wrap(function
|
6370
|
-
while (1) switch (
|
6304
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
6305
|
+
while (1) switch (_context60.prev = _context60.next) {
|
6371
6306
|
case 0:
|
6372
6307
|
if (this.requestSettings) {
|
6373
|
-
|
6308
|
+
_context60.next = 2;
|
6374
6309
|
break;
|
6375
6310
|
}
|
6376
6311
|
throw new Error("Request settings have not been set up");
|
@@ -6379,11 +6314,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6379
6314
|
HTTPRequest.request(this, n, e);
|
6380
6315
|
case 4:
|
6381
6316
|
case "end":
|
6382
|
-
return
|
6317
|
+
return _context60.stop();
|
6383
6318
|
}
|
6384
|
-
},
|
6319
|
+
}, _callee60, this);
|
6385
6320
|
}));
|
6386
|
-
function callServiceAPI(
|
6321
|
+
function callServiceAPI(_x104, _x105) {
|
6387
6322
|
return _callServiceAPI19.apply(this, arguments);
|
6388
6323
|
}
|
6389
6324
|
return callServiceAPI;
|
@@ -6391,26 +6326,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6391
6326
|
}, {
|
6392
6327
|
key: "extractResultData",
|
6393
6328
|
value: function () {
|
6394
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6395
|
-
return _regeneratorRuntime().wrap(function
|
6396
|
-
while (1) switch (
|
6329
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
|
6330
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
6331
|
+
while (1) switch (_context61.prev = _context61.next) {
|
6397
6332
|
case 0:
|
6398
6333
|
if (!e.message) {
|
6399
|
-
|
6334
|
+
_context61.next = 2;
|
6400
6335
|
break;
|
6401
6336
|
}
|
6402
6337
|
throw e.message;
|
6403
6338
|
case 2:
|
6404
|
-
return
|
6339
|
+
return _context61.abrupt("return", {
|
6405
6340
|
text: e.text
|
6406
6341
|
});
|
6407
6342
|
case 3:
|
6408
6343
|
case "end":
|
6409
|
-
return
|
6344
|
+
return _context61.stop();
|
6410
6345
|
}
|
6411
|
-
},
|
6346
|
+
}, _callee61);
|
6412
6347
|
}));
|
6413
|
-
function extractResultData(
|
6348
|
+
function extractResultData(_x106) {
|
6414
6349
|
return _extractResultData23.apply(this, arguments);
|
6415
6350
|
}
|
6416
6351
|
return extractResultData;
|
@@ -6512,6 +6447,11 @@ var FireEvents = /*#__PURE__*/function () {
|
|
6512
6447
|
detail: s
|
6513
6448
|
}));
|
6514
6449
|
}
|
6450
|
+
}, {
|
6451
|
+
key: "onClearMessages",
|
6452
|
+
value: function onClearMessages(e) {
|
6453
|
+
e.onClearMessages(), e.dispatchEvent(new CustomEvent("clear-messages"));
|
6454
|
+
}
|
6515
6455
|
}, {
|
6516
6456
|
key: "onRender",
|
6517
6457
|
value: function onRender(e) {
|
@@ -6682,6 +6622,11 @@ var IntroPanel = /*#__PURE__*/function () {
|
|
6682
6622
|
value: function hide() {
|
6683
6623
|
this._isDisplayed && this._elementRef && (this._elementRef.style.display = "none", this._isDisplayed = !1);
|
6684
6624
|
}
|
6625
|
+
}, {
|
6626
|
+
key: "display",
|
6627
|
+
value: function display() {
|
6628
|
+
!this._isDisplayed && this._elementRef && (this._elementRef.style.display = "", this._isDisplayed = !0);
|
6629
|
+
}
|
6685
6630
|
}], [{
|
6686
6631
|
key: "createIntroPanel",
|
6687
6632
|
value: function createIntroPanel(e) {
|
@@ -6733,7 +6678,7 @@ var _FileMessageUtils = /*#__PURE__*/function () {
|
|
6733
6678
|
})["catch"](function () {})["finally"](function () {
|
6734
6679
|
B.waitToLoadThenScroll(t);
|
6735
6680
|
});
|
6736
|
-
} catch (
|
6681
|
+
} catch (_unused6) {
|
6737
6682
|
t.scrollTop = t.scrollHeight;
|
6738
6683
|
}
|
6739
6684
|
}
|
@@ -6756,24 +6701,24 @@ var FileMessages = /*#__PURE__*/function () {
|
|
6756
6701
|
}, {
|
6757
6702
|
key: "addNewImageMessage",
|
6758
6703
|
value: function () {
|
6759
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6704
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, n) {
|
6760
6705
|
var s,
|
6761
6706
|
o,
|
6762
6707
|
a,
|
6763
|
-
|
6764
|
-
return _regeneratorRuntime().wrap(function
|
6765
|
-
while (1) switch (
|
6708
|
+
_args62 = arguments;
|
6709
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
6710
|
+
while (1) switch (_context62.prev = _context62.next) {
|
6766
6711
|
case 0:
|
6767
|
-
s =
|
6712
|
+
s = _args62.length > 3 && _args62[3] !== undefined ? _args62[3] : !1;
|
6768
6713
|
o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
|
6769
6714
|
a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
|
6770
6715
|
case 3:
|
6771
6716
|
case "end":
|
6772
|
-
return
|
6717
|
+
return _context62.stop();
|
6773
6718
|
}
|
6774
|
-
},
|
6719
|
+
}, _callee62);
|
6775
6720
|
}));
|
6776
|
-
function addNewImageMessage(
|
6721
|
+
function addNewImageMessage(_x107, _x108, _x109) {
|
6777
6722
|
return _addNewImageMessage.apply(this, arguments);
|
6778
6723
|
}
|
6779
6724
|
return addNewImageMessage;
|
@@ -6911,9 +6856,9 @@ var Messages = /*#__PURE__*/function () {
|
|
6911
6856
|
var s = t.permittedErrorPrefixes,
|
6912
6857
|
o = t.introPanelMarkUp,
|
6913
6858
|
a = t.demo;
|
6914
|
-
this._remarkable = RemarkableConfig.createNew(), this.elementRef = Messages.createContainerElement(), this.messageStyles = e.messageStyles, this._avatars = e.avatars, this._names = e.names, this._errorMessageOverrides = (l = e.errorMessages) == null ? void 0 : l.overrides, this._onNewMessage = FireEvents.onNewMessage.bind(this, e), this._displayLoadingMessage = Messages.getDisplayLoadingMessage(e, t), this._permittedErrorPrefixes = s, this.populateIntroPanel(n, o, e.introPanelStyle), e.introMessage && this.addIntroductoryMessage(e.introMessage), e.initialMessages && this.populateInitialMessages(e.initialMessages), this.displayServiceErrorMessages = (c = e.errorMessages) == null ? void 0 : c.displayServiceErrorMessages, e.getMessages = function () {
|
6859
|
+
this._remarkable = RemarkableConfig.createNew(), this.elementRef = Messages.createContainerElement(), this.messageStyles = e.messageStyles, this._avatars = e.avatars, this._names = e.names, this._errorMessageOverrides = (l = e.errorMessages) == null ? void 0 : l.overrides, this._onNewMessage = FireEvents.onNewMessage.bind(this, e), this._onClearMessages = FireEvents.onClearMessages.bind(this, e), this._displayLoadingMessage = Messages.getDisplayLoadingMessage(e, t), this._permittedErrorPrefixes = s, this.populateIntroPanel(n, o, e.introPanelStyle), e.introMessage && this.addIntroductoryMessage(e.introMessage), e.initialMessages && this.populateInitialMessages(e.initialMessages), this.displayServiceErrorMessages = (c = e.errorMessages) == null ? void 0 : c.displayServiceErrorMessages, e.getMessages = function () {
|
6915
6860
|
return JSON.parse(JSON.stringify(_this28.messages));
|
6916
|
-
}, e.refreshMessages = this.refreshTextMessages.bind(this), a && this.prepareDemo(a), e.textToSpeech && TextToSpeech.processConfig(e.textToSpeech, function (u) {
|
6861
|
+
}, e.clearMessages = this.clearMessages.bind(this), e.refreshMessages = this.refreshTextMessages.bind(this), a && this.prepareDemo(a), e.textToSpeech && TextToSpeech.processConfig(e.textToSpeech, function (u) {
|
6917
6862
|
_this28._textToSpeech = u;
|
6918
6863
|
});
|
6919
6864
|
}
|
@@ -6925,9 +6870,11 @@ var Messages = /*#__PURE__*/function () {
|
|
6925
6870
|
}, {
|
6926
6871
|
key: "addIntroductoryMessage",
|
6927
6872
|
value: function addIntroductoryMessage(e) {
|
6928
|
-
var
|
6929
|
-
|
6930
|
-
|
6873
|
+
var t;
|
6874
|
+
if (e && (this._introMessage = e), this._introMessage) {
|
6875
|
+
var n = this.createAndAppendNewMessageElement(this._introMessage, !0);
|
6876
|
+
this.applyCustomStyles(n, !0, !1, (t = this.messageStyles) == null ? void 0 : t.intro);
|
6877
|
+
}
|
6931
6878
|
}
|
6932
6879
|
}, {
|
6933
6880
|
key: "populateInitialMessages",
|
@@ -7091,12 +7038,12 @@ var Messages = /*#__PURE__*/function () {
|
|
7091
7038
|
}, {
|
7092
7039
|
key: "addMultipleFiles",
|
7093
7040
|
value: function () {
|
7094
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7041
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
7095
7042
|
var _this31 = this;
|
7096
|
-
return _regeneratorRuntime().wrap(function
|
7097
|
-
while (1) switch (
|
7043
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
7044
|
+
while (1) switch (_context63.prev = _context63.next) {
|
7098
7045
|
case 0:
|
7099
|
-
return
|
7046
|
+
return _context63.abrupt("return", Promise.all((e || []).map(function (t) {
|
7100
7047
|
return new Promise(function (n) {
|
7101
7048
|
if (!t.type || t.type === "any") {
|
7102
7049
|
var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
|
@@ -7121,26 +7068,25 @@ var Messages = /*#__PURE__*/function () {
|
|
7121
7068
|
})));
|
7122
7069
|
case 1:
|
7123
7070
|
case "end":
|
7124
|
-
return
|
7071
|
+
return _context63.stop();
|
7125
7072
|
}
|
7126
|
-
},
|
7073
|
+
}, _callee63);
|
7127
7074
|
}));
|
7128
|
-
function addMultipleFiles(
|
7075
|
+
function addMultipleFiles(_x110) {
|
7129
7076
|
return _addMultipleFiles.apply(this, arguments);
|
7130
7077
|
}
|
7131
7078
|
return addMultipleFiles;
|
7132
|
-
}()
|
7133
|
-
|
7134
|
-
|
7135
|
-
|
7136
|
-
|
7137
|
-
|
7138
|
-
|
7139
|
-
|
7140
|
-
|
7141
|
-
|
7142
|
-
|
7143
|
-
// }
|
7079
|
+
}()
|
7080
|
+
}, {
|
7081
|
+
key: "clearMessages",
|
7082
|
+
value: function clearMessages(e) {
|
7083
|
+
var n, s;
|
7084
|
+
var t = [];
|
7085
|
+
this._messageElementRefs.forEach(function (o) {
|
7086
|
+
var a = o.bubbleElement.classList;
|
7087
|
+
a.contains("loading-message-text") || a.contains("streamed-message") ? t.push(o) : o.outerContainer.remove();
|
7088
|
+
}), this._messageElementRefs = t, e !== !1 && ((n = this._introPanel) != null && n._elementRef && this._introPanel.display(), this.addIntroductoryMessage()), (s = this._onClearMessages) == null || s.call(this);
|
7089
|
+
}
|
7144
7090
|
// this is mostly used for enabling highlight.js to highlight code if it is downloads later
|
7145
7091
|
}, {
|
7146
7092
|
key: "refreshTextMessages",
|
@@ -7872,18 +7818,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
7872
7818
|
var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
7873
7819
|
STOP_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
7874
7820
|
_AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
|
7875
|
-
_inherits(
|
7876
|
-
var _super35 = _createSuper(
|
7877
|
-
function
|
7878
|
-
_classCallCheck(this,
|
7821
|
+
_inherits(k, _FileAttachmentsType);
|
7822
|
+
var _super35 = _createSuper(k);
|
7823
|
+
function k(e, t, n) {
|
7824
|
+
_classCallCheck(this, k);
|
7879
7825
|
return _super35.call(this, e, t, n);
|
7880
7826
|
}
|
7881
|
-
_createClass(
|
7827
|
+
_createClass(k, [{
|
7882
7828
|
key: "createTimer",
|
7883
7829
|
value: function createTimer(e, t) {
|
7884
7830
|
var _this37 = this;
|
7885
7831
|
var n = 0;
|
7886
|
-
var s = t !== void 0 && t <
|
7832
|
+
var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
|
7887
7833
|
return setInterval(function () {
|
7888
7834
|
var l;
|
7889
7835
|
n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -7895,7 +7841,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
7895
7841
|
}, {
|
7896
7842
|
key: "createPlaceholderAudioAttachment",
|
7897
7843
|
value: function createPlaceholderAudioAttachment(e) {
|
7898
|
-
var t =
|
7844
|
+
var t = k.createAudioContainer(),
|
7899
7845
|
n = document.createElement("div");
|
7900
7846
|
n.classList.add("audio-placeholder-text-3-digits");
|
7901
7847
|
var s = document.createElement("div");
|
@@ -7932,7 +7878,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
7932
7878
|
key: "completePlaceholderAttachment",
|
7933
7879
|
value: function completePlaceholderAttachment(e, t) {
|
7934
7880
|
var n = this._activePlaceholderAttachment;
|
7935
|
-
n && (n.file = e,
|
7881
|
+
n && (n.file = e, k.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
7936
7882
|
}
|
7937
7883
|
}, {
|
7938
7884
|
key: "removePlaceholderAttachment",
|
@@ -7972,8 +7918,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
7972
7918
|
}, {
|
7973
7919
|
key: "createAudioAttachment",
|
7974
7920
|
value: function createAudioAttachment(e) {
|
7975
|
-
var t =
|
7976
|
-
return
|
7921
|
+
var t = k.createAudioContainer();
|
7922
|
+
return k.addAudioElements(t, e), t;
|
7977
7923
|
}
|
7978
7924
|
}, {
|
7979
7925
|
key: "stopAttachmentPlayback",
|
@@ -7982,7 +7928,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
7982
7928
|
(s = (n = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : n[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
|
7983
7929
|
}
|
7984
7930
|
}]);
|
7985
|
-
return
|
7931
|
+
return k;
|
7986
7932
|
}(FileAttachmentsType);
|
7987
7933
|
_AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
|
7988
7934
|
var AudioFileAttachmentType = _AudioFileAttachmentType;
|
@@ -8036,33 +7982,33 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8036
7982
|
}, {
|
8037
7983
|
key: "completePlaceholders",
|
8038
7984
|
value: function () {
|
8039
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8040
|
-
return _regeneratorRuntime().wrap(function
|
8041
|
-
while (1) switch (
|
7985
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
|
7986
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
7987
|
+
while (1) switch (_context65.prev = _context65.next) {
|
8042
7988
|
case 0:
|
8043
|
-
|
7989
|
+
_context65.next = 2;
|
8044
7990
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
8045
|
-
var
|
7991
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
|
8046
7992
|
var t;
|
8047
|
-
return _regeneratorRuntime().wrap(function
|
8048
|
-
while (1) switch (
|
7993
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
7994
|
+
while (1) switch (_context64.prev = _context64.next) {
|
8049
7995
|
case 0:
|
8050
|
-
return
|
7996
|
+
return _context64.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
8051
7997
|
case 1:
|
8052
7998
|
case "end":
|
8053
|
-
return
|
7999
|
+
return _context64.stop();
|
8054
8000
|
}
|
8055
|
-
},
|
8001
|
+
}, _callee64);
|
8056
8002
|
}));
|
8057
|
-
return function (
|
8058
|
-
return
|
8003
|
+
return function (_x111) {
|
8004
|
+
return _ref5.apply(this, arguments);
|
8059
8005
|
};
|
8060
8006
|
}()));
|
8061
8007
|
case 2:
|
8062
8008
|
case "end":
|
8063
|
-
return
|
8009
|
+
return _context65.stop();
|
8064
8010
|
}
|
8065
|
-
},
|
8011
|
+
}, _callee65, this);
|
8066
8012
|
}));
|
8067
8013
|
function completePlaceholders() {
|
8068
8014
|
return _completePlaceholders.apply(this, arguments);
|
@@ -9282,26 +9228,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9282
9228
|
}, {
|
9283
9229
|
key: "getNewSpeechConfig",
|
9284
9230
|
value: function () {
|
9285
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9286
|
-
return _regeneratorRuntime().wrap(function
|
9287
|
-
while (1) switch (
|
9231
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t) {
|
9232
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
9233
|
+
while (1) switch (_context66.prev = _context66.next) {
|
9288
9234
|
case 0:
|
9289
9235
|
if (!t.region) {
|
9290
|
-
|
9236
|
+
_context66.next = 2;
|
9291
9237
|
break;
|
9292
9238
|
}
|
9293
|
-
return
|
9239
|
+
return _context66.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) {
|
9294
9240
|
return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
|
9295
9241
|
})["catch"](function (n) {
|
9296
9242
|
return console.error(n), null;
|
9297
9243
|
}) : null);
|
9298
9244
|
case 2:
|
9299
9245
|
case "end":
|
9300
|
-
return
|
9246
|
+
return _context66.stop();
|
9301
9247
|
}
|
9302
|
-
},
|
9248
|
+
}, _callee66);
|
9303
9249
|
}));
|
9304
|
-
function getNewSpeechConfig(
|
9250
|
+
function getNewSpeechConfig(_x112, _x113) {
|
9305
9251
|
return _getNewSpeechConfig.apply(this, arguments);
|
9306
9252
|
}
|
9307
9253
|
return getNewSpeechConfig;
|
@@ -9314,23 +9260,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9314
9260
|
}, {
|
9315
9261
|
key: "get",
|
9316
9262
|
value: function () {
|
9317
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9263
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e, t) {
|
9318
9264
|
var n;
|
9319
|
-
return _regeneratorRuntime().wrap(function
|
9320
|
-
while (1) switch (
|
9265
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
9266
|
+
while (1) switch (_context67.prev = _context67.next) {
|
9321
9267
|
case 0:
|
9322
|
-
|
9268
|
+
_context67.next = 2;
|
9323
9269
|
return AzureSpeechConfig.getNewSpeechConfig(e, t);
|
9324
9270
|
case 2:
|
9325
|
-
n =
|
9326
|
-
return
|
9271
|
+
n = _context67.sent;
|
9272
|
+
return _context67.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
|
9327
9273
|
case 4:
|
9328
9274
|
case "end":
|
9329
|
-
return
|
9275
|
+
return _context67.stop();
|
9330
9276
|
}
|
9331
|
-
},
|
9277
|
+
}, _callee67);
|
9332
9278
|
}));
|
9333
|
-
function get(
|
9279
|
+
function get(_x114, _x115) {
|
9334
9280
|
return _get.apply(this, arguments);
|
9335
9281
|
}
|
9336
9282
|
return get;
|
@@ -9420,28 +9366,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9420
9366
|
}, {
|
9421
9367
|
key: "startAsync",
|
9422
9368
|
value: function () {
|
9423
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9369
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
|
9424
9370
|
var t;
|
9425
|
-
return _regeneratorRuntime().wrap(function
|
9426
|
-
while (1) switch (
|
9371
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
9372
|
+
while (1) switch (_context68.prev = _context68.next) {
|
9427
9373
|
case 0:
|
9428
|
-
|
9429
|
-
if (!
|
9430
|
-
|
9374
|
+
_context68.t0 = this.validate(e);
|
9375
|
+
if (!_context68.t0) {
|
9376
|
+
_context68.next = 6;
|
9431
9377
|
break;
|
9432
9378
|
}
|
9433
|
-
|
9379
|
+
_context68.next = 4;
|
9434
9380
|
return this.instantiateService(e);
|
9435
9381
|
case 4:
|
9436
9382
|
this._translations = e == null ? void 0 : e.translations;
|
9437
9383
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
9438
9384
|
case 6:
|
9439
9385
|
case "end":
|
9440
|
-
return
|
9386
|
+
return _context68.stop();
|
9441
9387
|
}
|
9442
|
-
},
|
9388
|
+
}, _callee68, this);
|
9443
9389
|
}));
|
9444
|
-
function startAsync(
|
9390
|
+
function startAsync(_x116) {
|
9445
9391
|
return _startAsync.apply(this, arguments);
|
9446
9392
|
}
|
9447
9393
|
return startAsync;
|
@@ -9454,28 +9400,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9454
9400
|
}, {
|
9455
9401
|
key: "instantiateService",
|
9456
9402
|
value: function () {
|
9457
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9403
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
|
9458
9404
|
var t, n, s, o;
|
9459
|
-
return _regeneratorRuntime().wrap(function
|
9460
|
-
while (1) switch (
|
9405
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
9406
|
+
while (1) switch (_context69.prev = _context69.next) {
|
9461
9407
|
case 0:
|
9462
9408
|
t = Azure.getAPI();
|
9463
9409
|
n = t.AudioConfig.fromDefaultMicrophoneInput();
|
9464
|
-
|
9410
|
+
_context69.next = 4;
|
9465
9411
|
return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
|
9466
9412
|
case 4:
|
9467
|
-
s =
|
9413
|
+
s = _context69.sent;
|
9468
9414
|
if (s) {
|
9469
9415
|
o = new t.SpeechRecognizer(s, n);
|
9470
9416
|
this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
9471
9417
|
} else this.error("Unable to contact Azure server");
|
9472
9418
|
case 6:
|
9473
9419
|
case "end":
|
9474
|
-
return
|
9420
|
+
return _context69.stop();
|
9475
9421
|
}
|
9476
|
-
},
|
9422
|
+
}, _callee69, this);
|
9477
9423
|
}));
|
9478
|
-
function instantiateService(
|
9424
|
+
function instantiateService(_x117) {
|
9479
9425
|
return _instantiateService.apply(this, arguments);
|
9480
9426
|
}
|
9481
9427
|
return instantiateService;
|
@@ -9852,17 +9798,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9852
9798
|
}, {
|
9853
9799
|
key: "submit",
|
9854
9800
|
value: function () {
|
9855
|
-
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9801
|
+
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
|
9856
9802
|
var l, c, n, s, o, a;
|
9857
|
-
return _regeneratorRuntime().wrap(function
|
9858
|
-
while (1) switch (
|
9803
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
9804
|
+
while (1) switch (_context70.prev = _context70.next) {
|
9859
9805
|
case 0:
|
9860
|
-
|
9861
|
-
if (
|
9862
|
-
|
9806
|
+
_context70.t0 = e;
|
9807
|
+
if (_context70.t0) {
|
9808
|
+
_context70.next = 6;
|
9863
9809
|
break;
|
9864
9810
|
}
|
9865
|
-
|
9811
|
+
_context70.next = 4;
|
9866
9812
|
return this._fileAttachments.completePlaceholders();
|
9867
9813
|
case 4:
|
9868
9814
|
n = this._fileAttachments.getAllFileData();
|
@@ -9872,40 +9818,40 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9872
9818
|
case 6:
|
9873
9819
|
o = t === "" ? void 0 : t;
|
9874
9820
|
if (!this._isRequestInProgress) {
|
9875
|
-
|
9821
|
+
_context70.next = 9;
|
9876
9822
|
break;
|
9877
9823
|
}
|
9878
|
-
return
|
9824
|
+
return _context70.abrupt("return");
|
9879
9825
|
case 9:
|
9880
9826
|
if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
|
9881
|
-
|
9827
|
+
_context70.next = 14;
|
9882
9828
|
break;
|
9883
9829
|
}
|
9884
9830
|
if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
|
9885
|
-
|
9831
|
+
_context70.next = 12;
|
9886
9832
|
break;
|
9887
9833
|
}
|
9888
|
-
return
|
9834
|
+
return _context70.abrupt("return");
|
9889
9835
|
case 12:
|
9890
|
-
|
9836
|
+
_context70.next = 16;
|
9891
9837
|
break;
|
9892
9838
|
case 14:
|
9893
9839
|
if (this._serviceIO.canSendMessage(o, s)) {
|
9894
|
-
|
9840
|
+
_context70.next = 16;
|
9895
9841
|
break;
|
9896
9842
|
}
|
9897
|
-
return
|
9843
|
+
return _context70.abrupt("return");
|
9898
9844
|
case 16:
|
9899
9845
|
this.changeToLoadingIcon();
|
9900
9846
|
t !== "" && this._messages.addNewMessage({
|
9901
9847
|
text: t
|
9902
9848
|
}, !1, !0);
|
9903
|
-
|
9904
|
-
if (!
|
9905
|
-
|
9849
|
+
_context70.t1 = n;
|
9850
|
+
if (!_context70.t1) {
|
9851
|
+
_context70.next = 22;
|
9906
9852
|
break;
|
9907
9853
|
}
|
9908
|
-
|
9854
|
+
_context70.next = 22;
|
9909
9855
|
return this._messages.addMultipleFiles(n);
|
9910
9856
|
case 22:
|
9911
9857
|
this._messages.addLoadingMessage();
|
@@ -9914,17 +9860,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9914
9860
|
text: o,
|
9915
9861
|
files: s
|
9916
9862
|
};
|
9917
|
-
|
9863
|
+
_context70.next = 27;
|
9918
9864
|
return this._serviceIO.callAPI(a, this._messages);
|
9919
9865
|
case 27:
|
9920
9866
|
e || (c = this._fileAttachments) == null || c.removeAllFiles();
|
9921
9867
|
case 28:
|
9922
9868
|
case "end":
|
9923
|
-
return
|
9869
|
+
return _context70.stop();
|
9924
9870
|
}
|
9925
|
-
},
|
9871
|
+
}, _callee70, this);
|
9926
9872
|
}));
|
9927
|
-
function submit(
|
9873
|
+
function submit(_x118, _x119) {
|
9928
9874
|
return _submit.apply(this, arguments);
|
9929
9875
|
}
|
9930
9876
|
return submit;
|
@@ -10256,13 +10202,16 @@ var DeepChat = /*#__PURE__*/function (_InternalHTML2) {
|
|
10256
10202
|
function DeepChat() {
|
10257
10203
|
var _this60;
|
10258
10204
|
_classCallCheck(this, DeepChat);
|
10259
|
-
_this60 = _super45.call(this), _this60.
|
10205
|
+
_this60 = _super45.call(this), _this60.request = {
|
10206
|
+
url: "ws://loasdasdsacalhost:8080",
|
10207
|
+
websocket: !0
|
10208
|
+
}, _this60.getMessages = function () {
|
10260
10209
|
return [];
|
10261
10210
|
}, _this60.submitUserMessage = function () {
|
10262
10211
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
10263
10212
|
}, _this60.focusInput = function () {
|
10264
10213
|
FocusUtils.focusFromParentElement(_this60._elementRef);
|
10265
|
-
}, _this60.refreshMessages = function () {}, _this60.onNewMessage = function () {}, _this60.onComponentRender = function () {}, _this60._hasBeenRendered = !1, _this60._auxiliaryStyleApplied = !1, GoogleFont.appendStyleSheetToHead(), _this60._elementRef = document.createElement("div"), _this60._elementRef.id = "container", _this60.attachShadow({
|
10214
|
+
}, _this60.refreshMessages = function () {}, _this60.clearMessages = function () {}, _this60.onNewMessage = function () {}, _this60.onClearMessages = function () {}, _this60.onComponentRender = function () {}, _this60._hasBeenRendered = !1, _this60._auxiliaryStyleApplied = !1, GoogleFont.appendStyleSheetToHead(), _this60._elementRef = document.createElement("div"), _this60._elementRef.id = "container", _this60.attachShadow({
|
10266
10215
|
mode: "open"
|
10267
10216
|
}).appendChild(_this60._elementRef), WebComponentStyleUtils.apply(style, _this60.shadowRoot), setTimeout(function () {
|
10268
10217
|
_this60._hasBeenRendered || _this60.onRender();
|
@@ -10279,8 +10228,8 @@ var DeepChat = /*#__PURE__*/function (_InternalHTML2) {
|
|
10279
10228
|
key: "onRender",
|
10280
10229
|
value: function onRender() {
|
10281
10230
|
var _this$_activeService, _this$_childElement;
|
10282
|
-
var e, t;
|
10283
|
-
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = ServiceIOFactory.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (WebComponentStyleUtils.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Object.assign(this._elementRef.style, this.containerStyle), this._activeService.key && this._activeService.validateConfigKey ? ValidateKeyPropertyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : this._activeService instanceof DirectServiceIO && this._activeService.key || (e = this.request) != null && e.url || (t = this.
|
10231
|
+
var e, t, n;
|
10232
|
+
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = ServiceIOFactory.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (WebComponentStyleUtils.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Object.assign(this._elementRef.style, this.containerStyle), this._activeService.key && this._activeService.validateConfigKey ? ValidateKeyPropertyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : this._activeService instanceof DirectServiceIO && this._activeService.key || (e = this.request) != null && e.url || (t = this.request) != null && t.handler || (n = this.directConnection) != null && n.demo ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], ChatView.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof DirectServiceIO ? InsertKeyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : (console.log("here"), ErrorView.render(this._elementRef, 'Please define "request" with a "url"')), this._hasBeenRendered = !0, FireEvents.onRender(this));
|
10284
10233
|
}
|
10285
10234
|
}]);
|
10286
10235
|
return DeepChat;
|
@@ -10317,6 +10266,7 @@ __decorateClass([Property("object")], DeepChat.prototype, "mixedFiles", 2);
|
|
10317
10266
|
__decorateClass([Property("object")], DeepChat.prototype, "dragAndDrop", 2);
|
10318
10267
|
__decorateClass([Property("object")], DeepChat.prototype, "introPanelStyle", 2);
|
10319
10268
|
__decorateClass([Property("function")], DeepChat.prototype, "onNewMessage", 2);
|
10269
|
+
__decorateClass([Property("function")], DeepChat.prototype, "onClearMessages", 2);
|
10320
10270
|
__decorateClass([Property("function")], DeepChat.prototype, "onComponentRender", 2);
|
10321
10271
|
customElements.define("deep-chat", DeepChat);
|
10322
10272
|
export { DeepChat };
|