deep-chat-dev 1.1.38 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +1687 -1632
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +789 -720
- package/dist/types/interceptors.d.ts +2 -1
- package/dist/types/interceptors.d.ts.map +1 -1
- package/dist/types/request.d.ts +2 -0
- package/dist/types/request.d.ts.map +1 -1
- package/dist/utils/HTTP/HTTPRequest.d.ts.map +1 -1
- package/dist/utils/HTTP/customRequest.d.ts +9 -0
- package/dist/utils/HTTP/customRequest.d.ts.map +1 -0
- package/package.json +1 -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 _callee73(r, e) {
|
424
424
|
var t, n;
|
425
|
-
return _regeneratorRuntime().wrap(function
|
426
|
-
while (1) switch (
|
425
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
426
|
+
while (1) switch (_context73.prev = _context73.next) {
|
427
427
|
case 0:
|
428
428
|
t = r.getReader();
|
429
429
|
case 1:
|
430
|
-
|
430
|
+
_context73.next = 3;
|
431
431
|
return t.read();
|
432
432
|
case 3:
|
433
|
-
if ((n =
|
434
|
-
|
433
|
+
if ((n = _context73.sent).done) {
|
434
|
+
_context73.next = 7;
|
435
435
|
break;
|
436
436
|
}
|
437
437
|
e(n.value);
|
438
438
|
case 5:
|
439
|
-
|
439
|
+
_context73.next = 1;
|
440
440
|
break;
|
441
441
|
case 7:
|
442
442
|
case "end":
|
443
|
-
return
|
443
|
+
return _context73.stop();
|
444
444
|
}
|
445
|
-
},
|
445
|
+
}, _callee73);
|
446
446
|
}));
|
447
447
|
return _getBytes.apply(this, arguments);
|
448
448
|
}
|
@@ -606,6 +606,89 @@ 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;
|
609
692
|
var Stream = /*#__PURE__*/function () {
|
610
693
|
function Stream() {
|
611
694
|
_classCallCheck(this, Stream);
|
@@ -614,7 +697,7 @@ var Stream = /*#__PURE__*/function () {
|
|
614
697
|
key: "request",
|
615
698
|
value: // prettier-ignore
|
616
699
|
function () {
|
617
|
-
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
700
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, n) {
|
618
701
|
var s,
|
619
702
|
f,
|
620
703
|
b,
|
@@ -630,19 +713,19 @@ var Stream = /*#__PURE__*/function () {
|
|
630
713
|
d,
|
631
714
|
h,
|
632
715
|
p,
|
633
|
-
|
634
|
-
return _regeneratorRuntime().wrap(function
|
635
|
-
while (1) switch (
|
716
|
+
_args6 = arguments;
|
717
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
718
|
+
while (1) switch (_context6.prev = _context6.next) {
|
636
719
|
case 0:
|
637
|
-
s =
|
720
|
+
s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
|
638
721
|
o = {
|
639
722
|
body: t,
|
640
723
|
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
641
724
|
};
|
642
|
-
|
725
|
+
_context6.next = 4;
|
643
726
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
644
727
|
case 4:
|
645
|
-
_yield$RequestUtils$p =
|
728
|
+
_yield$RequestUtils$p = _context6.sent;
|
646
729
|
a = _yield$RequestUtils$p.body;
|
647
730
|
l = _yield$RequestUtils$p.headers;
|
648
731
|
c = _yield$RequestUtils$p.error;
|
@@ -651,16 +734,16 @@ var Stream = /*#__PURE__*/function () {
|
|
651
734
|
d = _e$streamHandlers.onClose;
|
652
735
|
h = _e$streamHandlers.abortStream;
|
653
736
|
if (!c) {
|
654
|
-
|
737
|
+
_context6.next = 14;
|
655
738
|
break;
|
656
739
|
}
|
657
|
-
return
|
740
|
+
return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
|
658
741
|
case 14:
|
659
742
|
if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
|
660
|
-
|
743
|
+
_context6.next = 16;
|
661
744
|
break;
|
662
745
|
}
|
663
|
-
return
|
746
|
+
return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
|
664
747
|
case 16:
|
665
748
|
p = null;
|
666
749
|
fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
|
@@ -670,25 +753,25 @@ var Stream = /*#__PURE__*/function () {
|
|
670
753
|
openWhenHidden: !0,
|
671
754
|
// keep stream open when browser tab not open
|
672
755
|
onopen: function onopen(g) {
|
673
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
674
|
-
return _regeneratorRuntime().wrap(function
|
675
|
-
while (1) switch (
|
756
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
757
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
758
|
+
while (1) switch (_context5.prev = _context5.next) {
|
676
759
|
case 0:
|
677
760
|
if (!g.ok) {
|
678
|
-
|
761
|
+
_context5.next = 2;
|
679
762
|
break;
|
680
763
|
}
|
681
|
-
return
|
764
|
+
return _context5.abrupt("return", (p = n.addNewStreamedMessage(), u()));
|
682
765
|
case 2:
|
683
|
-
|
766
|
+
_context5.next = 4;
|
684
767
|
return RequestUtils.processResponseByType(g);
|
685
768
|
case 4:
|
686
|
-
throw
|
769
|
+
throw _context5.sent;
|
687
770
|
case 5:
|
688
771
|
case "end":
|
689
|
-
return
|
772
|
+
return _context5.stop();
|
690
773
|
}
|
691
|
-
},
|
774
|
+
}, _callee5);
|
692
775
|
}))();
|
693
776
|
},
|
694
777
|
onmessage: function onmessage(g) {
|
@@ -719,9 +802,9 @@ var Stream = /*#__PURE__*/function () {
|
|
719
802
|
});
|
720
803
|
case 18:
|
721
804
|
case "end":
|
722
|
-
return
|
805
|
+
return _context6.stop();
|
723
806
|
}
|
724
|
-
},
|
807
|
+
}, _callee6);
|
725
808
|
}));
|
726
809
|
function request(_x8, _x9, _x10) {
|
727
810
|
return _request.apply(this, arguments);
|
@@ -765,89 +848,69 @@ var Stream = /*#__PURE__*/function () {
|
|
765
848
|
}]);
|
766
849
|
return Stream;
|
767
850
|
}();
|
768
|
-
var
|
769
|
-
function
|
770
|
-
_classCallCheck(this,
|
851
|
+
var CustomRequest = /*#__PURE__*/function () {
|
852
|
+
function CustomRequest() {
|
853
|
+
_classCallCheck(this, CustomRequest);
|
771
854
|
}
|
772
|
-
_createClass(
|
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 A.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 ? A.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 ? A.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
802
|
-
result: {
|
803
|
-
text: A.generateResponse(e)
|
804
|
-
}
|
805
|
-
};
|
806
|
-
}
|
807
|
-
// timeout is used to simulate a timeout for a response to come back
|
808
|
-
}, {
|
855
|
+
_createClass(CustomRequest, null, [{
|
809
856
|
key: "request",
|
810
|
-
value:
|
811
|
-
|
812
|
-
|
857
|
+
value: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
858
|
+
function () {
|
859
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n, s) {
|
813
860
|
var o;
|
814
|
-
return _regeneratorRuntime().wrap(function
|
815
|
-
while (1) switch (
|
861
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
862
|
+
while (1) switch (_context8.prev = _context8.next) {
|
816
863
|
case 0:
|
817
|
-
|
818
|
-
|
864
|
+
o = e.completionsHandlers.onFinish;
|
865
|
+
s(t).then( /*#__PURE__*/function () {
|
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
|
+
});
|
819
900
|
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) : e.addNewMessage(o.result, !0, !0), t();
|
829
|
-
case 7:
|
830
901
|
case "end":
|
831
|
-
return
|
902
|
+
return _context8.stop();
|
832
903
|
}
|
833
|
-
},
|
834
|
-
}))
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
setTimeout(function () {
|
841
|
-
var s, o;
|
842
|
-
var n = (o = (s = A.getResponse(e)) == null ? void 0 : s.result) == null ? void 0 : o.text;
|
843
|
-
Stream.simulate(e, t, n);
|
844
|
-
}, 400);
|
845
|
-
}
|
904
|
+
}, _callee8);
|
905
|
+
}));
|
906
|
+
function request(_x11, _x12, _x13, _x14) {
|
907
|
+
return _request2.apply(this, arguments);
|
908
|
+
}
|
909
|
+
return request;
|
910
|
+
}()
|
846
911
|
}]);
|
847
|
-
return
|
912
|
+
return CustomRequest;
|
848
913
|
}();
|
849
|
-
_Demo.URL = "deep-chat-demo";
|
850
|
-
var Demo = _Demo;
|
851
914
|
var HTTPRequest = /*#__PURE__*/function () {
|
852
915
|
function HTTPRequest() {
|
853
916
|
_classCallCheck(this, HTTPRequest);
|
@@ -856,7 +919,7 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
856
919
|
key: "request",
|
857
920
|
value: // prettier-ignore
|
858
921
|
function () {
|
859
|
-
var
|
922
|
+
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
|
860
923
|
var s,
|
861
924
|
h,
|
862
925
|
p,
|
@@ -869,35 +932,41 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
869
932
|
c,
|
870
933
|
u,
|
871
934
|
d,
|
872
|
-
|
873
|
-
return _regeneratorRuntime().wrap(function
|
874
|
-
while (1) switch (
|
935
|
+
_args10 = arguments;
|
936
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
937
|
+
while (1) switch (_context10.prev = _context10.next) {
|
875
938
|
case 0:
|
876
|
-
s =
|
939
|
+
s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
|
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:
|
877
946
|
o = {
|
878
947
|
body: t,
|
879
948
|
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
880
949
|
};
|
881
|
-
|
950
|
+
_context10.next = 6;
|
882
951
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
883
|
-
case
|
884
|
-
_yield$RequestUtils$p2 =
|
952
|
+
case 6:
|
953
|
+
_yield$RequestUtils$p2 = _context10.sent;
|
885
954
|
a = _yield$RequestUtils$p2.body;
|
886
955
|
l = _yield$RequestUtils$p2.headers;
|
887
956
|
c = _yield$RequestUtils$p2.error;
|
888
957
|
u = e.completionsHandlers.onFinish;
|
889
958
|
if (!c) {
|
890
|
-
|
959
|
+
_context10.next = 13;
|
891
960
|
break;
|
892
961
|
}
|
893
|
-
return
|
894
|
-
case
|
962
|
+
return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
|
963
|
+
case 13:
|
895
964
|
if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
|
896
|
-
|
965
|
+
_context10.next = 15;
|
897
966
|
break;
|
898
967
|
}
|
899
|
-
return
|
900
|
-
case
|
968
|
+
return _context10.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
|
969
|
+
case 15:
|
901
970
|
d = !0;
|
902
971
|
fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
|
903
972
|
method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
|
@@ -908,40 +977,40 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
908
977
|
}).then(function (m) {
|
909
978
|
return RequestUtils.processResponseByType(m);
|
910
979
|
}).then( /*#__PURE__*/function () {
|
911
|
-
var
|
980
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(m) {
|
912
981
|
var y, x, v, g;
|
913
|
-
return _regeneratorRuntime().wrap(function
|
914
|
-
while (1) switch (
|
982
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
983
|
+
while (1) switch (_context9.prev = _context9.next) {
|
915
984
|
case 0:
|
916
985
|
if (e.extractResultData) {
|
917
|
-
|
986
|
+
_context9.next = 2;
|
918
987
|
break;
|
919
988
|
}
|
920
|
-
return
|
989
|
+
return _context9.abrupt("return");
|
921
990
|
case 2:
|
922
|
-
|
991
|
+
_context9.next = 4;
|
923
992
|
return (x = (y = e.deepChat).responseInterceptor) == null ? void 0 : x.call(y, m);
|
924
993
|
case 4:
|
925
|
-
|
926
|
-
if (
|
927
|
-
|
994
|
+
_context9.t0 = _context9.sent;
|
995
|
+
if (_context9.t0) {
|
996
|
+
_context9.next = 7;
|
928
997
|
break;
|
929
998
|
}
|
930
|
-
|
999
|
+
_context9.t0 = m;
|
931
1000
|
case 7:
|
932
|
-
v =
|
933
|
-
|
1001
|
+
v = _context9.t0;
|
1002
|
+
_context9.next = 10;
|
934
1003
|
return e.extractResultData(v);
|
935
1004
|
case 10:
|
936
|
-
g =
|
1005
|
+
g = _context9.sent;
|
937
1006
|
if (d) {
|
938
|
-
|
1007
|
+
_context9.next = 13;
|
939
1008
|
break;
|
940
1009
|
}
|
941
1010
|
throw m;
|
942
1011
|
case 13:
|
943
1012
|
if (!(!g || _typeof(g) != "object")) {
|
944
|
-
|
1013
|
+
_context9.next = 15;
|
945
1014
|
break;
|
946
1015
|
}
|
947
1016
|
throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
|
@@ -949,24 +1018,24 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
949
1018
|
g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
|
950
1019
|
case 16:
|
951
1020
|
case "end":
|
952
|
-
return
|
1021
|
+
return _context9.stop();
|
953
1022
|
}
|
954
|
-
},
|
1023
|
+
}, _callee9);
|
955
1024
|
}));
|
956
|
-
return function (
|
957
|
-
return
|
1025
|
+
return function (_x19) {
|
1026
|
+
return _ref3.apply(this, arguments);
|
958
1027
|
};
|
959
1028
|
}())["catch"](function (m) {
|
960
1029
|
RequestUtils.displayError(n, m), u();
|
961
1030
|
});
|
962
|
-
case
|
1031
|
+
case 17:
|
963
1032
|
case "end":
|
964
|
-
return
|
1033
|
+
return _context10.stop();
|
965
1034
|
}
|
966
|
-
},
|
1035
|
+
}, _callee10);
|
967
1036
|
}));
|
968
|
-
function request(
|
969
|
-
return
|
1037
|
+
function request(_x16, _x17, _x18) {
|
1038
|
+
return _request3.apply(this, arguments);
|
970
1039
|
}
|
971
1040
|
return request;
|
972
1041
|
}() // prettier-ignore
|
@@ -978,44 +1047,44 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
978
1047
|
fetch(t, n).then(function (a) {
|
979
1048
|
return a.json();
|
980
1049
|
}).then( /*#__PURE__*/function () {
|
981
|
-
var
|
1050
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(a) {
|
982
1051
|
var c, u, l;
|
983
|
-
return _regeneratorRuntime().wrap(function
|
984
|
-
while (1) switch (
|
1052
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
1053
|
+
while (1) switch (_context11.prev = _context11.next) {
|
985
1054
|
case 0:
|
986
1055
|
if (e.extractPollResultData) {
|
987
|
-
|
1056
|
+
_context11.next = 2;
|
988
1057
|
break;
|
989
1058
|
}
|
990
|
-
return
|
1059
|
+
return _context11.abrupt("return");
|
991
1060
|
case 2:
|
992
|
-
|
993
|
-
|
1061
|
+
_context11.t0 = e;
|
1062
|
+
_context11.next = 5;
|
994
1063
|
return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
|
995
1064
|
case 5:
|
996
|
-
|
997
|
-
if (
|
998
|
-
|
1065
|
+
_context11.t1 = _context11.sent;
|
1066
|
+
if (_context11.t1) {
|
1067
|
+
_context11.next = 8;
|
999
1068
|
break;
|
1000
1069
|
}
|
1001
|
-
|
1070
|
+
_context11.t1 = a;
|
1002
1071
|
case 8:
|
1003
|
-
|
1004
|
-
|
1005
|
-
return
|
1072
|
+
_context11.t2 = _context11.t1;
|
1073
|
+
_context11.next = 11;
|
1074
|
+
return _context11.t0.extractPollResultData.call(_context11.t0, _context11.t2);
|
1006
1075
|
case 11:
|
1007
|
-
l =
|
1076
|
+
l = _context11.sent;
|
1008
1077
|
l.timeoutMS ? setTimeout(function () {
|
1009
1078
|
HTTPRequest.executePollRequest(e, t, n, s);
|
1010
1079
|
}, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
|
1011
1080
|
case 13:
|
1012
1081
|
case "end":
|
1013
|
-
return
|
1082
|
+
return _context11.stop();
|
1014
1083
|
}
|
1015
|
-
},
|
1084
|
+
}, _callee11);
|
1016
1085
|
}));
|
1017
|
-
return function (
|
1018
|
-
return
|
1086
|
+
return function (_x20) {
|
1087
|
+
return _ref4.apply(this, arguments);
|
1019
1088
|
};
|
1020
1089
|
}())["catch"](function (a) {
|
1021
1090
|
RequestUtils.displayError(s, a), o();
|
@@ -1025,7 +1094,7 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1025
1094
|
}, {
|
1026
1095
|
key: "poll",
|
1027
1096
|
value: function () {
|
1028
|
-
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1097
|
+
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
|
1029
1098
|
var s,
|
1030
1099
|
f,
|
1031
1100
|
b,
|
@@ -1039,27 +1108,27 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1039
1108
|
d,
|
1040
1109
|
h,
|
1041
1110
|
p,
|
1042
|
-
|
1043
|
-
return _regeneratorRuntime().wrap(function
|
1044
|
-
while (1) switch (
|
1111
|
+
_args12 = arguments;
|
1112
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
1113
|
+
while (1) switch (_context12.prev = _context12.next) {
|
1045
1114
|
case 0:
|
1046
|
-
s =
|
1115
|
+
s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
|
1047
1116
|
o = {
|
1048
1117
|
body: t,
|
1049
1118
|
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
1050
1119
|
};
|
1051
|
-
|
1120
|
+
_context12.next = 4;
|
1052
1121
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
1053
1122
|
case 4:
|
1054
|
-
_yield$RequestUtils$p3 =
|
1123
|
+
_yield$RequestUtils$p3 = _context12.sent;
|
1055
1124
|
a = _yield$RequestUtils$p3.body;
|
1056
1125
|
l = _yield$RequestUtils$p3.headers;
|
1057
1126
|
c = _yield$RequestUtils$p3.error;
|
1058
1127
|
if (!c) {
|
1059
|
-
|
1128
|
+
_context12.next = 10;
|
1060
1129
|
break;
|
1061
1130
|
}
|
1062
|
-
return
|
1131
|
+
return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c));
|
1063
1132
|
case 10:
|
1064
1133
|
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 = {
|
1065
1134
|
method: d,
|
@@ -1069,11 +1138,11 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1069
1138
|
HTTPRequest.executePollRequest(e, u, p, n);
|
1070
1139
|
case 12:
|
1071
1140
|
case "end":
|
1072
|
-
return
|
1141
|
+
return _context12.stop();
|
1073
1142
|
}
|
1074
|
-
},
|
1143
|
+
}, _callee12);
|
1075
1144
|
}));
|
1076
|
-
function poll(
|
1145
|
+
function poll(_x21, _x22, _x23) {
|
1077
1146
|
return _poll.apply(this, arguments);
|
1078
1147
|
}
|
1079
1148
|
return poll;
|
@@ -1173,53 +1242,53 @@ var Websocket = /*#__PURE__*/function () {
|
|
1173
1242
|
key: "assignListeners",
|
1174
1243
|
value: function assignListeners(e, t) {
|
1175
1244
|
e.websocket && (e.websocket.onmessage = /*#__PURE__*/function () {
|
1176
|
-
var
|
1245
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(n) {
|
1177
1246
|
var s, o, a, l, c;
|
1178
|
-
return _regeneratorRuntime().wrap(function
|
1179
|
-
while (1) switch (
|
1247
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
1248
|
+
while (1) switch (_context13.prev = _context13.next) {
|
1180
1249
|
case 0:
|
1181
1250
|
if (!e.extractResultData) {
|
1182
|
-
|
1251
|
+
_context13.next = 20;
|
1183
1252
|
break;
|
1184
1253
|
}
|
1185
|
-
|
1254
|
+
_context13.prev = 1;
|
1186
1255
|
a = JSON.parse(n.data);
|
1187
|
-
|
1256
|
+
_context13.next = 5;
|
1188
1257
|
return (o = (s = e.deepChat).responseInterceptor) == null ? void 0 : o.call(s, a);
|
1189
1258
|
case 5:
|
1190
|
-
|
1191
|
-
if (
|
1192
|
-
|
1259
|
+
_context13.t0 = _context13.sent;
|
1260
|
+
if (_context13.t0) {
|
1261
|
+
_context13.next = 8;
|
1193
1262
|
break;
|
1194
1263
|
}
|
1195
|
-
|
1264
|
+
_context13.t0 = a;
|
1196
1265
|
case 8:
|
1197
|
-
l =
|
1198
|
-
|
1266
|
+
l = _context13.t0;
|
1267
|
+
_context13.next = 11;
|
1199
1268
|
return e.extractResultData(l);
|
1200
1269
|
case 11:
|
1201
|
-
c =
|
1270
|
+
c = _context13.sent;
|
1202
1271
|
if (!(!c || _typeof(c) != "object")) {
|
1203
|
-
|
1272
|
+
_context13.next = 14;
|
1204
1273
|
break;
|
1205
1274
|
}
|
1206
1275
|
throw Error(ErrorMessages.INVALID_RESPONSE(a, "server", !!e.deepChat.responseInterceptor, l));
|
1207
1276
|
case 14:
|
1208
1277
|
e.deepChat.stream && c.text ? Stream.simulate(t, e.streamHandlers, c.text) : t.addNewMessage(c, !0, !0);
|
1209
|
-
|
1278
|
+
_context13.next = 20;
|
1210
1279
|
break;
|
1211
1280
|
case 17:
|
1212
|
-
|
1213
|
-
|
1214
|
-
RequestUtils.displayError(t,
|
1281
|
+
_context13.prev = 17;
|
1282
|
+
_context13.t1 = _context13["catch"](1);
|
1283
|
+
RequestUtils.displayError(t, _context13.t1, "Error in server message");
|
1215
1284
|
case 20:
|
1216
1285
|
case "end":
|
1217
|
-
return
|
1286
|
+
return _context13.stop();
|
1218
1287
|
}
|
1219
|
-
},
|
1288
|
+
}, _callee13, null, [[1, 17]]);
|
1220
1289
|
}));
|
1221
|
-
return function (
|
1222
|
-
return
|
1290
|
+
return function (_x24) {
|
1291
|
+
return _ref5.apply(this, arguments);
|
1223
1292
|
};
|
1224
1293
|
}(), e.websocket.onerror = function (n) {
|
1225
1294
|
console.error(n), t.addNewErrorMessage("service", "Connection error");
|
@@ -1230,7 +1299,7 @@ var Websocket = /*#__PURE__*/function () {
|
|
1230
1299
|
}, {
|
1231
1300
|
key: "sendWebsocket",
|
1232
1301
|
value: function () {
|
1233
|
-
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1302
|
+
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
|
1234
1303
|
var o,
|
1235
1304
|
d,
|
1236
1305
|
h,
|
@@ -1239,42 +1308,42 @@ var Websocket = /*#__PURE__*/function () {
|
|
1239
1308
|
l,
|
1240
1309
|
c,
|
1241
1310
|
u,
|
1242
|
-
|
1243
|
-
return _regeneratorRuntime().wrap(function
|
1244
|
-
while (1) switch (
|
1311
|
+
_args14 = arguments;
|
1312
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
1313
|
+
while (1) switch (_context14.prev = _context14.next) {
|
1245
1314
|
case 0:
|
1246
|
-
o =
|
1315
|
+
o = _args14.length > 4 && _args14[4] !== undefined ? _args14[4] : !0;
|
1247
1316
|
a = {
|
1248
1317
|
body: n,
|
1249
1318
|
headers: (d = t.requestSettings) == null ? void 0 : d.headers
|
1250
1319
|
};
|
1251
|
-
|
1320
|
+
_context14.next = 4;
|
1252
1321
|
return RequestUtils.processResponseInterceptor(t.deepChat, a);
|
1253
1322
|
case 4:
|
1254
|
-
_yield$RequestUtils$p4 =
|
1323
|
+
_yield$RequestUtils$p4 = _context14.sent;
|
1255
1324
|
l = _yield$RequestUtils$p4.body;
|
1256
1325
|
c = _yield$RequestUtils$p4.error;
|
1257
1326
|
if (!c) {
|
1258
|
-
|
1327
|
+
_context14.next = 9;
|
1259
1328
|
break;
|
1260
1329
|
}
|
1261
|
-
return
|
1330
|
+
return _context14.abrupt("return", s.addNewErrorMessage("service", c));
|
1262
1331
|
case 9:
|
1263
1332
|
u = o ? JSON.stringify(l) : l;
|
1264
1333
|
if (!(((h = t.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
|
1265
|
-
|
1334
|
+
_context14.next = 12;
|
1266
1335
|
break;
|
1267
1336
|
}
|
1268
|
-
return
|
1337
|
+
return _context14.abrupt("return", Demo.request(s, t.completionsHandlers.onFinish, t.deepChat.responseInterceptor));
|
1269
1338
|
case 12:
|
1270
1339
|
e.readyState !== e.OPEN ? (console.error("Connection is not open"), s.addNewErrorMessage("service", "Connection error")) : e.send(JSON.stringify(u));
|
1271
1340
|
case 13:
|
1272
1341
|
case "end":
|
1273
|
-
return
|
1342
|
+
return _context14.stop();
|
1274
1343
|
}
|
1275
|
-
},
|
1344
|
+
}, _callee14);
|
1276
1345
|
}));
|
1277
|
-
function sendWebsocket(
|
1346
|
+
function sendWebsocket(_x25, _x26, _x27, _x28) {
|
1278
1347
|
return _sendWebsocket.apply(this, arguments);
|
1279
1348
|
}
|
1280
1349
|
return sendWebsocket;
|
@@ -3323,11 +3392,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3323
3392
|
}, {
|
3324
3393
|
key: "callServiceAPI",
|
3325
3394
|
value: function () {
|
3326
|
-
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3395
|
+
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t, n) {
|
3327
3396
|
var _c$headers, _u$ContentType;
|
3328
3397
|
var l, c, u, d, s, o, a;
|
3329
|
-
return _regeneratorRuntime().wrap(function
|
3330
|
-
while (1) switch (
|
3398
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
3399
|
+
while (1) switch (_context15.prev = _context15.next) {
|
3331
3400
|
case 0:
|
3332
3401
|
s = _objectSpread({
|
3333
3402
|
messages: t
|
@@ -3336,26 +3405,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3336
3405
|
(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);
|
3337
3406
|
a = this.deepChat.stream;
|
3338
3407
|
if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
|
3339
|
-
|
3408
|
+
_context15.next = 9;
|
3340
3409
|
break;
|
3341
3410
|
}
|
3342
|
-
|
3411
|
+
_context15.next = 7;
|
3343
3412
|
return Stream.request(this, s, e);
|
3344
3413
|
case 7:
|
3345
|
-
|
3414
|
+
_context15.next = 11;
|
3346
3415
|
break;
|
3347
3416
|
case 9:
|
3348
|
-
|
3417
|
+
_context15.next = 11;
|
3349
3418
|
return HTTPRequest.request(this, s, e);
|
3350
3419
|
case 11:
|
3351
3420
|
o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
|
3352
3421
|
case 12:
|
3353
3422
|
case "end":
|
3354
|
-
return
|
3423
|
+
return _context15.stop();
|
3355
3424
|
}
|
3356
|
-
},
|
3425
|
+
}, _callee15, this);
|
3357
3426
|
}));
|
3358
|
-
function callServiceAPI(
|
3427
|
+
function callServiceAPI(_x29, _x30, _x31) {
|
3359
3428
|
return _callServiceAPI.apply(this, arguments);
|
3360
3429
|
}
|
3361
3430
|
return callServiceAPI;
|
@@ -3363,24 +3432,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3363
3432
|
}, {
|
3364
3433
|
key: "callApiWithFiles",
|
3365
3434
|
value: function () {
|
3366
|
-
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3435
|
+
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n, s) {
|
3367
3436
|
var o, a, l;
|
3368
|
-
return _regeneratorRuntime().wrap(function
|
3369
|
-
while (1) switch (
|
3437
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
3438
|
+
while (1) switch (_context16.prev = _context16.next) {
|
3370
3439
|
case 0:
|
3371
3440
|
o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
|
3372
3441
|
this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
|
3373
|
-
|
3442
|
+
_context16.next = 4;
|
3374
3443
|
return HTTPRequest.request(this, o, t, !1);
|
3375
3444
|
case 4:
|
3376
3445
|
this.requestSettings = a;
|
3377
3446
|
case 5:
|
3378
3447
|
case "end":
|
3379
|
-
return
|
3448
|
+
return _context16.stop();
|
3380
3449
|
}
|
3381
|
-
},
|
3450
|
+
}, _callee16, this);
|
3382
3451
|
}));
|
3383
|
-
function callApiWithFiles(
|
3452
|
+
function callApiWithFiles(_x32, _x33, _x34, _x35) {
|
3384
3453
|
return _callApiWithFiles.apply(this, arguments);
|
3385
3454
|
}
|
3386
3455
|
return callApiWithFiles;
|
@@ -3388,13 +3457,13 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3388
3457
|
}, {
|
3389
3458
|
key: "callAPI",
|
3390
3459
|
value: function () {
|
3391
|
-
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3460
|
+
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t) {
|
3392
3461
|
var n, s;
|
3393
|
-
return _regeneratorRuntime().wrap(function
|
3394
|
-
while (1) switch (
|
3462
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
3463
|
+
while (1) switch (_context17.prev = _context17.next) {
|
3395
3464
|
case 0:
|
3396
3465
|
if (this.requestSettings) {
|
3397
|
-
|
3466
|
+
_context17.next = 2;
|
3398
3467
|
break;
|
3399
3468
|
}
|
3400
3469
|
throw new Error("Request settings have not been set up");
|
@@ -3408,11 +3477,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3408
3477
|
} else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
|
3409
3478
|
case 4:
|
3410
3479
|
case "end":
|
3411
|
-
return
|
3480
|
+
return _context17.stop();
|
3412
3481
|
}
|
3413
|
-
},
|
3482
|
+
}, _callee17, this);
|
3414
3483
|
}));
|
3415
|
-
function callAPI(
|
3484
|
+
function callAPI(_x36, _x37) {
|
3416
3485
|
return _callAPI.apply(this, arguments);
|
3417
3486
|
}
|
3418
3487
|
return callAPI;
|
@@ -3420,24 +3489,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3420
3489
|
}, {
|
3421
3490
|
key: "extractResultData",
|
3422
3491
|
value: function () {
|
3423
|
-
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3424
|
-
return _regeneratorRuntime().wrap(function
|
3425
|
-
while (1) switch (
|
3492
|
+
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e) {
|
3493
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
3494
|
+
while (1) switch (_context18.prev = _context18.next) {
|
3426
3495
|
case 0:
|
3427
3496
|
if (!e.error) {
|
3428
|
-
|
3497
|
+
_context18.next = 2;
|
3429
3498
|
break;
|
3430
3499
|
}
|
3431
3500
|
throw e.error;
|
3432
3501
|
case 2:
|
3433
|
-
return
|
3502
|
+
return _context18.abrupt("return", e.result);
|
3434
3503
|
case 3:
|
3435
3504
|
case "end":
|
3436
|
-
return
|
3505
|
+
return _context18.stop();
|
3437
3506
|
}
|
3438
|
-
},
|
3507
|
+
}, _callee18);
|
3439
3508
|
}));
|
3440
|
-
function extractResultData(
|
3509
|
+
function extractResultData(_x38) {
|
3441
3510
|
return _extractResultData.apply(this, arguments);
|
3442
3511
|
}
|
3443
3512
|
return extractResultData;
|
@@ -3801,13 +3870,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3801
3870
|
}, {
|
3802
3871
|
key: "callServiceAPI",
|
3803
3872
|
value: function () {
|
3804
|
-
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3873
|
+
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t, n) {
|
3805
3874
|
var s;
|
3806
|
-
return _regeneratorRuntime().wrap(function
|
3807
|
-
while (1) switch (
|
3875
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
3876
|
+
while (1) switch (_context19.prev = _context19.next) {
|
3808
3877
|
case 0:
|
3809
3878
|
if (this.requestSettings) {
|
3810
|
-
|
3879
|
+
_context19.next = 2;
|
3811
3880
|
break;
|
3812
3881
|
}
|
3813
3882
|
throw new Error("Request settings have not been set up");
|
@@ -3816,11 +3885,11 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3816
3885
|
HTTPRequest.request(this, s, e);
|
3817
3886
|
case 4:
|
3818
3887
|
case "end":
|
3819
|
-
return
|
3888
|
+
return _context19.stop();
|
3820
3889
|
}
|
3821
|
-
},
|
3890
|
+
}, _callee19, this);
|
3822
3891
|
}));
|
3823
|
-
function callServiceAPI(
|
3892
|
+
function callServiceAPI(_x39, _x40, _x41) {
|
3824
3893
|
return _callServiceAPI2.apply(this, arguments);
|
3825
3894
|
}
|
3826
3895
|
return callServiceAPI;
|
@@ -3849,18 +3918,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
3849
3918
|
}, {
|
3850
3919
|
key: "callServiceAPI",
|
3851
3920
|
value: function () {
|
3852
|
-
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3853
|
-
return _regeneratorRuntime().wrap(function
|
3854
|
-
while (1) switch (
|
3921
|
+
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e, t, n) {
|
3922
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
3923
|
+
while (1) switch (_context20.prev = _context20.next) {
|
3855
3924
|
case 0:
|
3856
3925
|
if (this.requestSettings) {
|
3857
|
-
|
3926
|
+
_context20.next = 2;
|
3858
3927
|
break;
|
3859
3928
|
}
|
3860
3929
|
throw new Error("Request settings have not been set up");
|
3861
3930
|
case 2:
|
3862
3931
|
if (n != null && n[0]) {
|
3863
|
-
|
3932
|
+
_context20.next = 4;
|
3864
3933
|
break;
|
3865
3934
|
}
|
3866
3935
|
throw new Error("No file was added");
|
@@ -3868,11 +3937,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
3868
3937
|
HTTPRequest.poll(this, n[0], e, !1);
|
3869
3938
|
case 5:
|
3870
3939
|
case "end":
|
3871
|
-
return
|
3940
|
+
return _context20.stop();
|
3872
3941
|
}
|
3873
|
-
},
|
3942
|
+
}, _callee20, this);
|
3874
3943
|
}));
|
3875
|
-
function callServiceAPI(
|
3944
|
+
function callServiceAPI(_x42, _x43, _x44) {
|
3876
3945
|
return _callServiceAPI3.apply(this, arguments);
|
3877
3946
|
}
|
3878
3947
|
return callServiceAPI;
|
@@ -3901,35 +3970,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
3901
3970
|
_createClass(HuggingFaceAudioClassificationIO, [{
|
3902
3971
|
key: "extractPollResultData",
|
3903
3972
|
value: function () {
|
3904
|
-
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3973
|
+
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e) {
|
3905
3974
|
var t;
|
3906
|
-
return _regeneratorRuntime().wrap(function
|
3907
|
-
while (1) switch (
|
3975
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
3976
|
+
while (1) switch (_context21.prev = _context21.next) {
|
3908
3977
|
case 0:
|
3909
3978
|
if (!e.estimated_time) {
|
3910
|
-
|
3979
|
+
_context21.next = 2;
|
3911
3980
|
break;
|
3912
3981
|
}
|
3913
|
-
return
|
3982
|
+
return _context21.abrupt("return", {
|
3914
3983
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
3915
3984
|
});
|
3916
3985
|
case 2:
|
3917
3986
|
if (!e.error) {
|
3918
|
-
|
3987
|
+
_context21.next = 4;
|
3919
3988
|
break;
|
3920
3989
|
}
|
3921
3990
|
throw e.error;
|
3922
3991
|
case 4:
|
3923
|
-
return
|
3992
|
+
return _context21.abrupt("return", {
|
3924
3993
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
3925
3994
|
});
|
3926
3995
|
case 5:
|
3927
3996
|
case "end":
|
3928
|
-
return
|
3997
|
+
return _context21.stop();
|
3929
3998
|
}
|
3930
|
-
},
|
3999
|
+
}, _callee21);
|
3931
4000
|
}));
|
3932
|
-
function extractPollResultData(
|
4001
|
+
function extractPollResultData(_x45) {
|
3933
4002
|
return _extractPollResultData.apply(this, arguments);
|
3934
4003
|
}
|
3935
4004
|
return extractPollResultData;
|
@@ -3952,35 +4021,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
3952
4021
|
_createClass(HuggingFaceImageClassificationIO, [{
|
3953
4022
|
key: "extractPollResultData",
|
3954
4023
|
value: function () {
|
3955
|
-
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4024
|
+
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
|
3956
4025
|
var t;
|
3957
|
-
return _regeneratorRuntime().wrap(function
|
3958
|
-
while (1) switch (
|
4026
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
4027
|
+
while (1) switch (_context22.prev = _context22.next) {
|
3959
4028
|
case 0:
|
3960
4029
|
if (!e.estimated_time) {
|
3961
|
-
|
4030
|
+
_context22.next = 2;
|
3962
4031
|
break;
|
3963
4032
|
}
|
3964
|
-
return
|
4033
|
+
return _context22.abrupt("return", {
|
3965
4034
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
3966
4035
|
});
|
3967
4036
|
case 2:
|
3968
4037
|
if (!e.error) {
|
3969
|
-
|
4038
|
+
_context22.next = 4;
|
3970
4039
|
break;
|
3971
4040
|
}
|
3972
4041
|
throw e.error;
|
3973
4042
|
case 4:
|
3974
|
-
return
|
4043
|
+
return _context22.abrupt("return", {
|
3975
4044
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
3976
4045
|
});
|
3977
4046
|
case 5:
|
3978
4047
|
case "end":
|
3979
|
-
return
|
4048
|
+
return _context22.stop();
|
3980
4049
|
}
|
3981
|
-
},
|
4050
|
+
}, _callee22);
|
3982
4051
|
}));
|
3983
|
-
function extractPollResultData(
|
4052
|
+
function extractPollResultData(_x46) {
|
3984
4053
|
return _extractPollResultData2.apply(this, arguments);
|
3985
4054
|
}
|
3986
4055
|
return extractPollResultData;
|
@@ -4065,19 +4134,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4065
4134
|
}, {
|
4066
4135
|
key: "callServiceAPI",
|
4067
4136
|
value: function () {
|
4068
|
-
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4137
|
+
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
|
4069
4138
|
var s;
|
4070
|
-
return _regeneratorRuntime().wrap(function
|
4071
|
-
while (1) switch (
|
4139
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
4140
|
+
while (1) switch (_context23.prev = _context23.next) {
|
4072
4141
|
case 0:
|
4073
4142
|
if (this.requestSettings) {
|
4074
|
-
|
4143
|
+
_context23.next = 2;
|
4075
4144
|
break;
|
4076
4145
|
}
|
4077
4146
|
throw new Error("Request settings have not been set up");
|
4078
4147
|
case 2:
|
4079
4148
|
if (n) {
|
4080
|
-
|
4149
|
+
_context23.next = 4;
|
4081
4150
|
break;
|
4082
4151
|
}
|
4083
4152
|
throw new Error("Image was not found");
|
@@ -4086,11 +4155,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4086
4155
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
4087
4156
|
case 6:
|
4088
4157
|
case "end":
|
4089
|
-
return
|
4158
|
+
return _context23.stop();
|
4090
4159
|
}
|
4091
|
-
},
|
4160
|
+
}, _callee23, this);
|
4092
4161
|
}));
|
4093
|
-
function callServiceAPI(
|
4162
|
+
function callServiceAPI(_x47, _x48, _x49) {
|
4094
4163
|
return _callServiceAPI4.apply(this, arguments);
|
4095
4164
|
}
|
4096
4165
|
return callServiceAPI;
|
@@ -4098,17 +4167,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4098
4167
|
}, {
|
4099
4168
|
key: "extractResultData",
|
4100
4169
|
value: function () {
|
4101
|
-
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4102
|
-
return _regeneratorRuntime().wrap(function
|
4103
|
-
while (1) switch (
|
4170
|
+
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
|
4171
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
4172
|
+
while (1) switch (_context24.prev = _context24.next) {
|
4104
4173
|
case 0:
|
4105
4174
|
if (!e.message) {
|
4106
|
-
|
4175
|
+
_context24.next = 2;
|
4107
4176
|
break;
|
4108
4177
|
}
|
4109
4178
|
throw e.message;
|
4110
4179
|
case 2:
|
4111
|
-
return
|
4180
|
+
return _context24.abrupt("return", {
|
4112
4181
|
files: e.artifacts.map(function (n) {
|
4113
4182
|
return {
|
4114
4183
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4118,11 +4187,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4118
4187
|
});
|
4119
4188
|
case 3:
|
4120
4189
|
case "end":
|
4121
|
-
return
|
4190
|
+
return _context24.stop();
|
4122
4191
|
}
|
4123
|
-
},
|
4192
|
+
}, _callee24);
|
4124
4193
|
}));
|
4125
|
-
function extractResultData(
|
4194
|
+
function extractResultData(_x50) {
|
4126
4195
|
return _extractResultData2.apply(this, arguments);
|
4127
4196
|
}
|
4128
4197
|
return extractResultData;
|
@@ -4174,19 +4243,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4174
4243
|
}, {
|
4175
4244
|
key: "callServiceAPI",
|
4176
4245
|
value: function () {
|
4177
|
-
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4246
|
+
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
|
4178
4247
|
var a, l, s, o;
|
4179
|
-
return _regeneratorRuntime().wrap(function
|
4180
|
-
while (1) switch (
|
4248
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
4249
|
+
while (1) switch (_context25.prev = _context25.next) {
|
4181
4250
|
case 0:
|
4182
4251
|
if (this.requestSettings) {
|
4183
|
-
|
4252
|
+
_context25.next = 2;
|
4184
4253
|
break;
|
4185
4254
|
}
|
4186
4255
|
throw new Error("Request settings have not been set up");
|
4187
4256
|
case 2:
|
4188
4257
|
if (!(!n || !n[0] || !n[1])) {
|
4189
|
-
|
4258
|
+
_context25.next = 4;
|
4190
4259
|
break;
|
4191
4260
|
}
|
4192
4261
|
throw new Error("Image was not found");
|
@@ -4195,11 +4264,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4195
4264
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4196
4265
|
case 6:
|
4197
4266
|
case "end":
|
4198
|
-
return
|
4267
|
+
return _context25.stop();
|
4199
4268
|
}
|
4200
|
-
},
|
4269
|
+
}, _callee25, this);
|
4201
4270
|
}));
|
4202
|
-
function callServiceAPI(
|
4271
|
+
function callServiceAPI(_x51, _x52, _x53) {
|
4203
4272
|
return _callServiceAPI5.apply(this, arguments);
|
4204
4273
|
}
|
4205
4274
|
return callServiceAPI;
|
@@ -4207,17 +4276,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4207
4276
|
}, {
|
4208
4277
|
key: "extractResultData",
|
4209
4278
|
value: function () {
|
4210
|
-
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4211
|
-
return _regeneratorRuntime().wrap(function
|
4212
|
-
while (1) switch (
|
4279
|
+
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
|
4280
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
4281
|
+
while (1) switch (_context26.prev = _context26.next) {
|
4213
4282
|
case 0:
|
4214
4283
|
if (!e.message) {
|
4215
|
-
|
4284
|
+
_context26.next = 2;
|
4216
4285
|
break;
|
4217
4286
|
}
|
4218
4287
|
throw e.message;
|
4219
4288
|
case 2:
|
4220
|
-
return
|
4289
|
+
return _context26.abrupt("return", {
|
4221
4290
|
files: e.artifacts.map(function (n) {
|
4222
4291
|
return {
|
4223
4292
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4227,11 +4296,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4227
4296
|
});
|
4228
4297
|
case 3:
|
4229
4298
|
case "end":
|
4230
|
-
return
|
4299
|
+
return _context26.stop();
|
4231
4300
|
}
|
4232
|
-
},
|
4301
|
+
}, _callee26);
|
4233
4302
|
}));
|
4234
|
-
function extractResultData(
|
4303
|
+
function extractResultData(_x54) {
|
4235
4304
|
return _extractResultData3.apply(this, arguments);
|
4236
4305
|
}
|
4237
4306
|
return extractResultData;
|
@@ -4264,34 +4333,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
|
|
4264
4333
|
_createClass(HuggingFaceAudioRecognitionIO, [{
|
4265
4334
|
key: "extractPollResultData",
|
4266
4335
|
value: function () {
|
4267
|
-
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4268
|
-
return _regeneratorRuntime().wrap(function
|
4269
|
-
while (1) switch (
|
4336
|
+
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
|
4337
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
4338
|
+
while (1) switch (_context27.prev = _context27.next) {
|
4270
4339
|
case 0:
|
4271
4340
|
if (!e.estimated_time) {
|
4272
|
-
|
4341
|
+
_context27.next = 2;
|
4273
4342
|
break;
|
4274
4343
|
}
|
4275
|
-
return
|
4344
|
+
return _context27.abrupt("return", {
|
4276
4345
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4277
4346
|
});
|
4278
4347
|
case 2:
|
4279
4348
|
if (!e.error) {
|
4280
|
-
|
4349
|
+
_context27.next = 4;
|
4281
4350
|
break;
|
4282
4351
|
}
|
4283
4352
|
throw e.error;
|
4284
4353
|
case 4:
|
4285
|
-
return
|
4354
|
+
return _context27.abrupt("return", {
|
4286
4355
|
text: e.text || ""
|
4287
4356
|
});
|
4288
4357
|
case 5:
|
4289
4358
|
case "end":
|
4290
|
-
return
|
4359
|
+
return _context27.stop();
|
4291
4360
|
}
|
4292
|
-
},
|
4361
|
+
}, _callee27);
|
4293
4362
|
}));
|
4294
|
-
function extractPollResultData(
|
4363
|
+
function extractPollResultData(_x55) {
|
4295
4364
|
return _extractPollResultData3.apply(this, arguments);
|
4296
4365
|
}
|
4297
4366
|
return extractPollResultData;
|
@@ -4312,26 +4381,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
|
|
4312
4381
|
_createClass(HuggingFaceTextGenerationIO, [{
|
4313
4382
|
key: "extractResultData",
|
4314
4383
|
value: function () {
|
4315
|
-
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4316
|
-
return _regeneratorRuntime().wrap(function
|
4317
|
-
while (1) switch (
|
4384
|
+
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
|
4385
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
4386
|
+
while (1) switch (_context28.prev = _context28.next) {
|
4318
4387
|
case 0:
|
4319
4388
|
if (!e.error) {
|
4320
|
-
|
4389
|
+
_context28.next = 2;
|
4321
4390
|
break;
|
4322
4391
|
}
|
4323
4392
|
throw e.error;
|
4324
4393
|
case 2:
|
4325
|
-
return
|
4394
|
+
return _context28.abrupt("return", {
|
4326
4395
|
text: e[0].generated_text || ""
|
4327
4396
|
});
|
4328
4397
|
case 3:
|
4329
4398
|
case "end":
|
4330
|
-
return
|
4399
|
+
return _context28.stop();
|
4331
4400
|
}
|
4332
|
-
},
|
4401
|
+
}, _callee28);
|
4333
4402
|
}));
|
4334
|
-
function extractResultData(
|
4403
|
+
function extractResultData(_x56) {
|
4335
4404
|
return _extractResultData4.apply(this, arguments);
|
4336
4405
|
}
|
4337
4406
|
return extractResultData;
|
@@ -4368,26 +4437,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
|
|
4368
4437
|
}, {
|
4369
4438
|
key: "extractResultData",
|
4370
4439
|
value: function () {
|
4371
|
-
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4372
|
-
return _regeneratorRuntime().wrap(function
|
4373
|
-
while (1) switch (
|
4440
|
+
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
|
4441
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
4442
|
+
while (1) switch (_context29.prev = _context29.next) {
|
4374
4443
|
case 0:
|
4375
4444
|
if (!e.error) {
|
4376
|
-
|
4445
|
+
_context29.next = 2;
|
4377
4446
|
break;
|
4378
4447
|
}
|
4379
4448
|
throw e.error;
|
4380
4449
|
case 2:
|
4381
|
-
return
|
4450
|
+
return _context29.abrupt("return", {
|
4382
4451
|
text: e.answer || ""
|
4383
4452
|
});
|
4384
4453
|
case 3:
|
4385
4454
|
case "end":
|
4386
|
-
return
|
4455
|
+
return _context29.stop();
|
4387
4456
|
}
|
4388
|
-
},
|
4457
|
+
}, _callee29);
|
4389
4458
|
}));
|
4390
|
-
function extractResultData(
|
4459
|
+
function extractResultData(_x57) {
|
4391
4460
|
return _extractResultData5.apply(this, arguments);
|
4392
4461
|
}
|
4393
4462
|
return extractResultData;
|
@@ -4408,26 +4477,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
|
|
4408
4477
|
_createClass(HuggingFaceSummarizationIO, [{
|
4409
4478
|
key: "extractResultData",
|
4410
4479
|
value: function () {
|
4411
|
-
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4412
|
-
return _regeneratorRuntime().wrap(function
|
4413
|
-
while (1) switch (
|
4480
|
+
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
|
4481
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
4482
|
+
while (1) switch (_context30.prev = _context30.next) {
|
4414
4483
|
case 0:
|
4415
4484
|
if (!e.error) {
|
4416
|
-
|
4485
|
+
_context30.next = 2;
|
4417
4486
|
break;
|
4418
4487
|
}
|
4419
4488
|
throw e.error;
|
4420
4489
|
case 2:
|
4421
|
-
return
|
4490
|
+
return _context30.abrupt("return", {
|
4422
4491
|
text: e[0].summary_text || ""
|
4423
4492
|
});
|
4424
4493
|
case 3:
|
4425
4494
|
case "end":
|
4426
|
-
return
|
4495
|
+
return _context30.stop();
|
4427
4496
|
}
|
4428
|
-
},
|
4497
|
+
}, _callee30);
|
4429
4498
|
}));
|
4430
|
-
function extractResultData(
|
4499
|
+
function extractResultData(_x58) {
|
4431
4500
|
return _extractResultData6.apply(this, arguments);
|
4432
4501
|
}
|
4433
4502
|
return extractResultData;
|
@@ -4488,26 +4557,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
|
|
4488
4557
|
}, {
|
4489
4558
|
key: "extractResultData",
|
4490
4559
|
value: function () {
|
4491
|
-
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4492
|
-
return _regeneratorRuntime().wrap(function
|
4493
|
-
while (1) switch (
|
4560
|
+
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
|
4561
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
4562
|
+
while (1) switch (_context31.prev = _context31.next) {
|
4494
4563
|
case 0:
|
4495
4564
|
if (!e.error) {
|
4496
|
-
|
4565
|
+
_context31.next = 2;
|
4497
4566
|
break;
|
4498
4567
|
}
|
4499
4568
|
throw e.error;
|
4500
4569
|
case 2:
|
4501
|
-
return
|
4570
|
+
return _context31.abrupt("return", {
|
4502
4571
|
text: e.generated_text || ""
|
4503
4572
|
});
|
4504
4573
|
case 3:
|
4505
4574
|
case "end":
|
4506
|
-
return
|
4575
|
+
return _context31.stop();
|
4507
4576
|
}
|
4508
|
-
},
|
4577
|
+
}, _callee31);
|
4509
4578
|
}));
|
4510
|
-
function extractResultData(
|
4579
|
+
function extractResultData(_x59) {
|
4511
4580
|
return _extractResultData7.apply(this, arguments);
|
4512
4581
|
}
|
4513
4582
|
return extractResultData;
|
@@ -4549,19 +4618,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4549
4618
|
}, {
|
4550
4619
|
key: "callServiceAPI",
|
4551
4620
|
value: function () {
|
4552
|
-
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4621
|
+
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e, t, n) {
|
4553
4622
|
var a, l, s, o;
|
4554
|
-
return _regeneratorRuntime().wrap(function
|
4555
|
-
while (1) switch (
|
4623
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
4624
|
+
while (1) switch (_context32.prev = _context32.next) {
|
4556
4625
|
case 0:
|
4557
4626
|
if (this.requestSettings) {
|
4558
|
-
|
4627
|
+
_context32.next = 2;
|
4559
4628
|
break;
|
4560
4629
|
}
|
4561
4630
|
throw new Error("Request settings have not been set up");
|
4562
4631
|
case 2:
|
4563
4632
|
if (n) {
|
4564
|
-
|
4633
|
+
_context32.next = 4;
|
4565
4634
|
break;
|
4566
4635
|
}
|
4567
4636
|
throw new Error("Image was not found");
|
@@ -4570,11 +4639,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4570
4639
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4571
4640
|
case 6:
|
4572
4641
|
case "end":
|
4573
|
-
return
|
4642
|
+
return _context32.stop();
|
4574
4643
|
}
|
4575
|
-
},
|
4644
|
+
}, _callee32, this);
|
4576
4645
|
}));
|
4577
|
-
function callServiceAPI(
|
4646
|
+
function callServiceAPI(_x60, _x61, _x62) {
|
4578
4647
|
return _callServiceAPI6.apply(this, arguments);
|
4579
4648
|
}
|
4580
4649
|
return callServiceAPI;
|
@@ -4582,17 +4651,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4582
4651
|
}, {
|
4583
4652
|
key: "extractResultData",
|
4584
4653
|
value: function () {
|
4585
|
-
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4586
|
-
return _regeneratorRuntime().wrap(function
|
4587
|
-
while (1) switch (
|
4654
|
+
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e) {
|
4655
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
4656
|
+
while (1) switch (_context33.prev = _context33.next) {
|
4588
4657
|
case 0:
|
4589
4658
|
if (!e.message) {
|
4590
|
-
|
4659
|
+
_context33.next = 2;
|
4591
4660
|
break;
|
4592
4661
|
}
|
4593
4662
|
throw e.message;
|
4594
4663
|
case 2:
|
4595
|
-
return
|
4664
|
+
return _context33.abrupt("return", {
|
4596
4665
|
files: e.artifacts.map(function (n) {
|
4597
4666
|
return {
|
4598
4667
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4602,11 +4671,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4602
4671
|
});
|
4603
4672
|
case 3:
|
4604
4673
|
case "end":
|
4605
|
-
return
|
4674
|
+
return _context33.stop();
|
4606
4675
|
}
|
4607
|
-
},
|
4676
|
+
}, _callee33);
|
4608
4677
|
}));
|
4609
|
-
function extractResultData(
|
4678
|
+
function extractResultData(_x63) {
|
4610
4679
|
return _extractResultData8.apply(this, arguments);
|
4611
4680
|
}
|
4612
4681
|
return extractResultData;
|
@@ -4637,26 +4706,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
|
|
4637
4706
|
_createClass(HuggingFaceTranslationIO, [{
|
4638
4707
|
key: "extractResultData",
|
4639
4708
|
value: function () {
|
4640
|
-
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4641
|
-
return _regeneratorRuntime().wrap(function
|
4642
|
-
while (1) switch (
|
4709
|
+
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
|
4710
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
4711
|
+
while (1) switch (_context34.prev = _context34.next) {
|
4643
4712
|
case 0:
|
4644
4713
|
if (!e.error) {
|
4645
|
-
|
4714
|
+
_context34.next = 2;
|
4646
4715
|
break;
|
4647
4716
|
}
|
4648
4717
|
throw e.error;
|
4649
4718
|
case 2:
|
4650
|
-
return
|
4719
|
+
return _context34.abrupt("return", {
|
4651
4720
|
text: e[0].translation_text || ""
|
4652
4721
|
});
|
4653
4722
|
case 3:
|
4654
4723
|
case "end":
|
4655
|
-
return
|
4724
|
+
return _context34.stop();
|
4656
4725
|
}
|
4657
|
-
},
|
4726
|
+
}, _callee34);
|
4658
4727
|
}));
|
4659
|
-
function extractResultData(
|
4728
|
+
function extractResultData(_x64) {
|
4660
4729
|
return _extractResultData9.apply(this, arguments);
|
4661
4730
|
}
|
4662
4731
|
return extractResultData;
|
@@ -4690,13 +4759,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4690
4759
|
}, {
|
4691
4760
|
key: "callServiceAPI",
|
4692
4761
|
value: function () {
|
4693
|
-
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4762
|
+
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e, t) {
|
4694
4763
|
var n;
|
4695
|
-
return _regeneratorRuntime().wrap(function
|
4696
|
-
while (1) switch (
|
4764
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
4765
|
+
while (1) switch (_context35.prev = _context35.next) {
|
4697
4766
|
case 0:
|
4698
4767
|
if (this.requestSettings) {
|
4699
|
-
|
4768
|
+
_context35.next = 2;
|
4700
4769
|
break;
|
4701
4770
|
}
|
4702
4771
|
throw new Error("Request settings have not been set up");
|
@@ -4705,11 +4774,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4705
4774
|
HTTPRequest.request(this, n, e);
|
4706
4775
|
case 4:
|
4707
4776
|
case "end":
|
4708
|
-
return
|
4777
|
+
return _context35.stop();
|
4709
4778
|
}
|
4710
|
-
},
|
4779
|
+
}, _callee35, this);
|
4711
4780
|
}));
|
4712
|
-
function callServiceAPI(
|
4781
|
+
function callServiceAPI(_x65, _x66) {
|
4713
4782
|
return _callServiceAPI7.apply(this, arguments);
|
4714
4783
|
}
|
4715
4784
|
return callServiceAPI;
|
@@ -4717,17 +4786,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4717
4786
|
}, {
|
4718
4787
|
key: "extractResultData",
|
4719
4788
|
value: function () {
|
4720
|
-
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4721
|
-
return _regeneratorRuntime().wrap(function
|
4722
|
-
while (1) switch (
|
4789
|
+
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e) {
|
4790
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
4791
|
+
while (1) switch (_context36.prev = _context36.next) {
|
4723
4792
|
case 0:
|
4724
4793
|
if (!e.message) {
|
4725
|
-
|
4794
|
+
_context36.next = 2;
|
4726
4795
|
break;
|
4727
4796
|
}
|
4728
4797
|
throw e.message;
|
4729
4798
|
case 2:
|
4730
|
-
return
|
4799
|
+
return _context36.abrupt("return", {
|
4731
4800
|
files: e.artifacts.map(function (n) {
|
4732
4801
|
return {
|
4733
4802
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4737,11 +4806,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4737
4806
|
});
|
4738
4807
|
case 3:
|
4739
4808
|
case "end":
|
4740
|
-
return
|
4809
|
+
return _context36.stop();
|
4741
4810
|
}
|
4742
|
-
},
|
4811
|
+
}, _callee36);
|
4743
4812
|
}));
|
4744
|
-
function extractResultData(
|
4813
|
+
function extractResultData(_x67) {
|
4745
4814
|
return _extractResultData10.apply(this, arguments);
|
4746
4815
|
}
|
4747
4816
|
return extractResultData;
|
@@ -4774,26 +4843,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
|
|
4774
4843
|
_createClass(HuggingFaceFillMaskIO, [{
|
4775
4844
|
key: "extractResultData",
|
4776
4845
|
value: function () {
|
4777
|
-
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4778
|
-
return _regeneratorRuntime().wrap(function
|
4779
|
-
while (1) switch (
|
4846
|
+
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
|
4847
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
4848
|
+
while (1) switch (_context37.prev = _context37.next) {
|
4780
4849
|
case 0:
|
4781
4850
|
if (!e.error) {
|
4782
|
-
|
4851
|
+
_context37.next = 2;
|
4783
4852
|
break;
|
4784
4853
|
}
|
4785
4854
|
throw e.error;
|
4786
4855
|
case 2:
|
4787
|
-
return
|
4856
|
+
return _context37.abrupt("return", {
|
4788
4857
|
text: e[0].sequence || ""
|
4789
4858
|
});
|
4790
4859
|
case 3:
|
4791
4860
|
case "end":
|
4792
|
-
return
|
4861
|
+
return _context37.stop();
|
4793
4862
|
}
|
4794
|
-
},
|
4863
|
+
}, _callee37);
|
4795
4864
|
}));
|
4796
|
-
function extractResultData(
|
4865
|
+
function extractResultData(_x68) {
|
4797
4866
|
return _extractResultData11.apply(this, arguments);
|
4798
4867
|
}
|
4799
4868
|
return extractResultData;
|
@@ -4868,13 +4937,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4868
4937
|
}, {
|
4869
4938
|
key: "callServiceAPI",
|
4870
4939
|
value: function () {
|
4871
|
-
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4940
|
+
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
|
4872
4941
|
var n;
|
4873
|
-
return _regeneratorRuntime().wrap(function
|
4874
|
-
while (1) switch (
|
4942
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
4943
|
+
while (1) switch (_context38.prev = _context38.next) {
|
4875
4944
|
case 0:
|
4876
4945
|
if (this.requestSettings) {
|
4877
|
-
|
4946
|
+
_context38.next = 2;
|
4878
4947
|
break;
|
4879
4948
|
}
|
4880
4949
|
throw new Error("Request settings have not been set up");
|
@@ -4883,11 +4952,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4883
4952
|
HTTPRequest.request(this, n, e);
|
4884
4953
|
case 4:
|
4885
4954
|
case "end":
|
4886
|
-
return
|
4955
|
+
return _context38.stop();
|
4887
4956
|
}
|
4888
|
-
},
|
4957
|
+
}, _callee38, this);
|
4889
4958
|
}));
|
4890
|
-
function callServiceAPI(
|
4959
|
+
function callServiceAPI(_x69, _x70) {
|
4891
4960
|
return _callServiceAPI8.apply(this, arguments);
|
4892
4961
|
}
|
4893
4962
|
return callServiceAPI;
|
@@ -4895,27 +4964,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4895
4964
|
}, {
|
4896
4965
|
key: "extractResultData",
|
4897
4966
|
value: function () {
|
4898
|
-
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4967
|
+
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
|
4899
4968
|
var t;
|
4900
|
-
return _regeneratorRuntime().wrap(function
|
4901
|
-
while (1) switch (
|
4969
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
4970
|
+
while (1) switch (_context39.prev = _context39.next) {
|
4902
4971
|
case 0:
|
4903
4972
|
if (!e.message) {
|
4904
|
-
|
4973
|
+
_context39.next = 2;
|
4905
4974
|
break;
|
4906
4975
|
}
|
4907
4976
|
throw e.message;
|
4908
4977
|
case 2:
|
4909
|
-
return
|
4978
|
+
return _context39.abrupt("return", {
|
4910
4979
|
text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
|
4911
4980
|
});
|
4912
4981
|
case 3:
|
4913
4982
|
case "end":
|
4914
|
-
return
|
4983
|
+
return _context39.stop();
|
4915
4984
|
}
|
4916
|
-
},
|
4985
|
+
}, _callee39);
|
4917
4986
|
}));
|
4918
|
-
function extractResultData(
|
4987
|
+
function extractResultData(_x71) {
|
4919
4988
|
return _extractResultData12.apply(this, arguments);
|
4920
4989
|
}
|
4921
4990
|
return extractResultData;
|
@@ -4945,13 +5014,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
4945
5014
|
}, {
|
4946
5015
|
key: "callServiceAPI",
|
4947
5016
|
value: function () {
|
4948
|
-
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5017
|
+
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
|
4949
5018
|
var n;
|
4950
|
-
return _regeneratorRuntime().wrap(function
|
4951
|
-
while (1) switch (
|
5019
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
5020
|
+
while (1) switch (_context40.prev = _context40.next) {
|
4952
5021
|
case 0:
|
4953
5022
|
if (this.requestSettings) {
|
4954
|
-
|
5023
|
+
_context40.next = 2;
|
4955
5024
|
break;
|
4956
5025
|
}
|
4957
5026
|
throw new Error("Request settings have not been set up");
|
@@ -4960,11 +5029,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
4960
5029
|
HTTPRequest.request(this, n, e);
|
4961
5030
|
case 4:
|
4962
5031
|
case "end":
|
4963
|
-
return
|
5032
|
+
return _context40.stop();
|
4964
5033
|
}
|
4965
|
-
},
|
5034
|
+
}, _callee40, this);
|
4966
5035
|
}));
|
4967
|
-
function callServiceAPI(
|
5036
|
+
function callServiceAPI(_x72, _x73) {
|
4968
5037
|
return _callServiceAPI9.apply(this, arguments);
|
4969
5038
|
}
|
4970
5039
|
return callServiceAPI;
|
@@ -4972,26 +5041,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
4972
5041
|
}, {
|
4973
5042
|
key: "extractResultData",
|
4974
5043
|
value: function () {
|
4975
|
-
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4976
|
-
return _regeneratorRuntime().wrap(function
|
4977
|
-
while (1) switch (
|
5044
|
+
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
|
5045
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
5046
|
+
while (1) switch (_context41.prev = _context41.next) {
|
4978
5047
|
case 0:
|
4979
5048
|
if (!e.message) {
|
4980
|
-
|
5049
|
+
_context41.next = 2;
|
4981
5050
|
break;
|
4982
5051
|
}
|
4983
5052
|
throw e.message;
|
4984
5053
|
case 2:
|
4985
|
-
return
|
5054
|
+
return _context41.abrupt("return", {
|
4986
5055
|
text: e.summary || ""
|
4987
5056
|
});
|
4988
5057
|
case 3:
|
4989
5058
|
case "end":
|
4990
|
-
return
|
5059
|
+
return _context41.stop();
|
4991
5060
|
}
|
4992
|
-
},
|
5061
|
+
}, _callee41);
|
4993
5062
|
}));
|
4994
|
-
function extractResultData(
|
5063
|
+
function extractResultData(_x74) {
|
4995
5064
|
return _extractResultData13.apply(this, arguments);
|
4996
5065
|
}
|
4997
5066
|
return extractResultData;
|
@@ -5148,13 +5217,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5148
5217
|
}, {
|
5149
5218
|
key: "callServiceAPI",
|
5150
5219
|
value: function () {
|
5151
|
-
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5152
|
-
var n;
|
5153
|
-
return _regeneratorRuntime().wrap(function
|
5154
|
-
while (1) switch (
|
5220
|
+
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
|
5221
|
+
var n;
|
5222
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
5223
|
+
while (1) switch (_context42.prev = _context42.next) {
|
5155
5224
|
case 0:
|
5156
5225
|
if (this.requestSettings) {
|
5157
|
-
|
5226
|
+
_context42.next = 2;
|
5158
5227
|
break;
|
5159
5228
|
}
|
5160
5229
|
throw new Error("Request settings have not been set up");
|
@@ -5163,11 +5232,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5163
5232
|
HTTPRequest.request(this, n, e), this.messages = e;
|
5164
5233
|
case 4:
|
5165
5234
|
case "end":
|
5166
|
-
return
|
5235
|
+
return _context42.stop();
|
5167
5236
|
}
|
5168
|
-
},
|
5237
|
+
}, _callee42, this);
|
5169
5238
|
}));
|
5170
|
-
function callServiceAPI(
|
5239
|
+
function callServiceAPI(_x75, _x76) {
|
5171
5240
|
return _callServiceAPI10.apply(this, arguments);
|
5172
5241
|
}
|
5173
5242
|
return callServiceAPI;
|
@@ -5175,13 +5244,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5175
5244
|
}, {
|
5176
5245
|
key: "extractResultData",
|
5177
5246
|
value: function () {
|
5178
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5247
|
+
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e) {
|
5179
5248
|
var t, n, s;
|
5180
|
-
return _regeneratorRuntime().wrap(function
|
5181
|
-
while (1) switch (
|
5249
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
5250
|
+
while (1) switch (_context43.prev = _context43.next) {
|
5182
5251
|
case 0:
|
5183
5252
|
if (!e.error) {
|
5184
|
-
|
5253
|
+
_context43.next = 2;
|
5185
5254
|
break;
|
5186
5255
|
}
|
5187
5256
|
throw e.error.message;
|
@@ -5193,16 +5262,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5193
5262
|
};
|
5194
5263
|
HTTPRequest.executePollRequest(this, n, s, this.messages);
|
5195
5264
|
}
|
5196
|
-
return
|
5265
|
+
return _context43.abrupt("return", {
|
5197
5266
|
pollingInAnotherRequest: !0
|
5198
5267
|
});
|
5199
5268
|
case 4:
|
5200
5269
|
case "end":
|
5201
|
-
return
|
5270
|
+
return _context43.stop();
|
5202
5271
|
}
|
5203
|
-
},
|
5272
|
+
}, _callee43, this);
|
5204
5273
|
}));
|
5205
|
-
function extractResultData(
|
5274
|
+
function extractResultData(_x77) {
|
5206
5275
|
return _extractResultData14.apply(this, arguments);
|
5207
5276
|
}
|
5208
5277
|
return extractResultData;
|
@@ -5210,33 +5279,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5210
5279
|
}, {
|
5211
5280
|
key: "extractPollResultData",
|
5212
5281
|
value: function () {
|
5213
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5282
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
|
5214
5283
|
var t, _iterator, _step, n;
|
5215
|
-
return _regeneratorRuntime().wrap(function
|
5216
|
-
while (1) switch (
|
5284
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
5285
|
+
while (1) switch (_context44.prev = _context44.next) {
|
5217
5286
|
case 0:
|
5218
5287
|
if (!e.error) {
|
5219
|
-
|
5288
|
+
_context44.next = 2;
|
5220
5289
|
break;
|
5221
5290
|
}
|
5222
5291
|
throw e.error;
|
5223
5292
|
case 2:
|
5224
5293
|
if (!(e.status === "running")) {
|
5225
|
-
|
5294
|
+
_context44.next = 4;
|
5226
5295
|
break;
|
5227
5296
|
}
|
5228
|
-
return
|
5297
|
+
return _context44.abrupt("return", {
|
5229
5298
|
timeoutMS: 2e3
|
5230
5299
|
});
|
5231
5300
|
case 4:
|
5232
5301
|
if (!(e.errors.length > 0)) {
|
5233
|
-
|
5302
|
+
_context44.next = 6;
|
5234
5303
|
break;
|
5235
5304
|
}
|
5236
5305
|
throw e.errors[0];
|
5237
5306
|
case 6:
|
5238
5307
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
5239
|
-
|
5308
|
+
_context44.next = 8;
|
5240
5309
|
break;
|
5241
5310
|
}
|
5242
5311
|
throw e.tasks.items[0].results.errors[0];
|
@@ -5253,16 +5322,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5253
5322
|
} finally {
|
5254
5323
|
_iterator.f();
|
5255
5324
|
}
|
5256
|
-
return
|
5325
|
+
return _context44.abrupt("return", {
|
5257
5326
|
text: t || ""
|
5258
5327
|
});
|
5259
5328
|
case 12:
|
5260
5329
|
case "end":
|
5261
|
-
return
|
5330
|
+
return _context44.stop();
|
5262
5331
|
}
|
5263
|
-
},
|
5332
|
+
}, _callee44);
|
5264
5333
|
}));
|
5265
|
-
function extractPollResultData(
|
5334
|
+
function extractPollResultData(_x78) {
|
5266
5335
|
return _extractPollResultData4.apply(this, arguments);
|
5267
5336
|
}
|
5268
5337
|
return extractPollResultData;
|
@@ -5361,13 +5430,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5361
5430
|
}, {
|
5362
5431
|
key: "callServiceAPI",
|
5363
5432
|
value: function () {
|
5364
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5433
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
|
5365
5434
|
var n;
|
5366
|
-
return _regeneratorRuntime().wrap(function
|
5367
|
-
while (1) switch (
|
5435
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
5436
|
+
while (1) switch (_context45.prev = _context45.next) {
|
5368
5437
|
case 0:
|
5369
5438
|
if (this.requestSettings) {
|
5370
|
-
|
5439
|
+
_context45.next = 2;
|
5371
5440
|
break;
|
5372
5441
|
}
|
5373
5442
|
throw new Error("Request settings have not been set up");
|
@@ -5376,11 +5445,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5376
5445
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
5377
5446
|
case 4:
|
5378
5447
|
case "end":
|
5379
|
-
return
|
5448
|
+
return _context45.stop();
|
5380
5449
|
}
|
5381
|
-
},
|
5450
|
+
}, _callee45, this);
|
5382
5451
|
}));
|
5383
|
-
function callServiceAPI(
|
5452
|
+
function callServiceAPI(_x79, _x80) {
|
5384
5453
|
return _callServiceAPI11.apply(this, arguments);
|
5385
5454
|
}
|
5386
5455
|
return callServiceAPI;
|
@@ -5388,27 +5457,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5388
5457
|
}, {
|
5389
5458
|
key: "extractResultData",
|
5390
5459
|
value: function () {
|
5391
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5460
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
|
5392
5461
|
var t;
|
5393
|
-
return _regeneratorRuntime().wrap(function
|
5394
|
-
while (1) switch (
|
5462
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
5463
|
+
while (1) switch (_context46.prev = _context46.next) {
|
5395
5464
|
case 0:
|
5396
5465
|
if (!e.error) {
|
5397
|
-
|
5466
|
+
_context46.next = 2;
|
5398
5467
|
break;
|
5399
5468
|
}
|
5400
5469
|
throw e.error.message;
|
5401
5470
|
case 2:
|
5402
|
-
return
|
5471
|
+
return _context46.abrupt("return", {
|
5403
5472
|
text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
|
5404
5473
|
});
|
5405
5474
|
case 3:
|
5406
5475
|
case "end":
|
5407
|
-
return
|
5476
|
+
return _context46.stop();
|
5408
5477
|
}
|
5409
|
-
},
|
5478
|
+
}, _callee46);
|
5410
5479
|
}));
|
5411
|
-
function extractResultData(
|
5480
|
+
function extractResultData(_x81) {
|
5412
5481
|
return _extractResultData15.apply(this, arguments);
|
5413
5482
|
}
|
5414
5483
|
return extractResultData;
|
@@ -5423,17 +5492,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5423
5492
|
_createClass(AssemblyAIUtils, null, [{
|
5424
5493
|
key: "poll",
|
5425
5494
|
value: function () {
|
5426
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5495
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
|
5427
5496
|
var n, l, c, d;
|
5428
|
-
return _regeneratorRuntime().wrap(function
|
5429
|
-
while (1) switch (
|
5497
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
5498
|
+
while (1) switch (_context47.prev = _context47.next) {
|
5430
5499
|
case 0:
|
5431
5500
|
n = {
|
5432
5501
|
authorization: e,
|
5433
5502
|
"content-type": "application/json"
|
5434
5503
|
};
|
5435
|
-
|
5436
|
-
|
5504
|
+
_context47.t0 = "https://api.assemblyai.com/v2/transcript/";
|
5505
|
+
_context47.next = 4;
|
5437
5506
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
5438
5507
|
method: "POST",
|
5439
5508
|
body: JSON.stringify({
|
@@ -5442,55 +5511,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5442
5511
|
headers: n
|
5443
5512
|
});
|
5444
5513
|
case 4:
|
5445
|
-
|
5446
|
-
return
|
5514
|
+
_context47.next = 6;
|
5515
|
+
return _context47.sent.json();
|
5447
5516
|
case 6:
|
5448
|
-
|
5449
|
-
l =
|
5517
|
+
_context47.t1 = _context47.sent.id;
|
5518
|
+
l = _context47.t0.concat.call(_context47.t0, _context47.t1);
|
5450
5519
|
case 8:
|
5451
5520
|
if (c) {
|
5452
|
-
|
5521
|
+
_context47.next = 24;
|
5453
5522
|
break;
|
5454
5523
|
}
|
5455
|
-
|
5524
|
+
_context47.next = 11;
|
5456
5525
|
return fetch(l, {
|
5457
5526
|
headers: n
|
5458
5527
|
});
|
5459
5528
|
case 11:
|
5460
|
-
|
5461
|
-
return
|
5529
|
+
_context47.next = 13;
|
5530
|
+
return _context47.sent.json();
|
5462
5531
|
case 13:
|
5463
|
-
d =
|
5532
|
+
d = _context47.sent;
|
5464
5533
|
if (!(d.status === "completed")) {
|
5465
|
-
|
5534
|
+
_context47.next = 18;
|
5466
5535
|
break;
|
5467
5536
|
}
|
5468
5537
|
c = d;
|
5469
|
-
|
5538
|
+
_context47.next = 22;
|
5470
5539
|
break;
|
5471
5540
|
case 18:
|
5472
5541
|
if (!(d.status === "error")) {
|
5473
|
-
|
5542
|
+
_context47.next = 20;
|
5474
5543
|
break;
|
5475
5544
|
}
|
5476
5545
|
throw new Error("Transcription failed: ".concat(d.error));
|
5477
5546
|
case 20:
|
5478
|
-
|
5547
|
+
_context47.next = 22;
|
5479
5548
|
return new Promise(function (h) {
|
5480
5549
|
return setTimeout(h, 3e3);
|
5481
5550
|
});
|
5482
5551
|
case 22:
|
5483
|
-
|
5552
|
+
_context47.next = 8;
|
5484
5553
|
break;
|
5485
5554
|
case 24:
|
5486
|
-
return
|
5555
|
+
return _context47.abrupt("return", c);
|
5487
5556
|
case 25:
|
5488
5557
|
case "end":
|
5489
|
-
return
|
5558
|
+
return _context47.stop();
|
5490
5559
|
}
|
5491
|
-
},
|
5560
|
+
}, _callee47);
|
5492
5561
|
}));
|
5493
|
-
function poll(
|
5562
|
+
function poll(_x82, _x83) {
|
5494
5563
|
return _poll2.apply(this, arguments);
|
5495
5564
|
}
|
5496
5565
|
return poll;
|
@@ -5538,19 +5607,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5538
5607
|
_createClass(AssemblyAIAudioIO, [{
|
5539
5608
|
key: "callServiceAPI",
|
5540
5609
|
value: function () {
|
5541
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5610
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t, n) {
|
5542
5611
|
var s;
|
5543
|
-
return _regeneratorRuntime().wrap(function
|
5544
|
-
while (1) switch (
|
5612
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
5613
|
+
while (1) switch (_context48.prev = _context48.next) {
|
5545
5614
|
case 0:
|
5546
5615
|
if ((s = this.requestSettings) != null && s.headers) {
|
5547
|
-
|
5616
|
+
_context48.next = 2;
|
5548
5617
|
break;
|
5549
5618
|
}
|
5550
5619
|
throw new Error("Request settings have not been set up");
|
5551
5620
|
case 2:
|
5552
5621
|
if (n != null && n[0]) {
|
5553
|
-
|
5622
|
+
_context48.next = 4;
|
5554
5623
|
break;
|
5555
5624
|
}
|
5556
5625
|
throw new Error("No file was added");
|
@@ -5558,11 +5627,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5558
5627
|
HTTPRequest.request(this, n[0], e, !1);
|
5559
5628
|
case 5:
|
5560
5629
|
case "end":
|
5561
|
-
return
|
5630
|
+
return _context48.stop();
|
5562
5631
|
}
|
5563
|
-
},
|
5632
|
+
}, _callee48, this);
|
5564
5633
|
}));
|
5565
|
-
function callServiceAPI(
|
5634
|
+
function callServiceAPI(_x84, _x85, _x86) {
|
5566
5635
|
return _callServiceAPI12.apply(this, arguments);
|
5567
5636
|
}
|
5568
5637
|
return callServiceAPI;
|
@@ -5570,32 +5639,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5570
5639
|
}, {
|
5571
5640
|
key: "extractResultData",
|
5572
5641
|
value: function () {
|
5573
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5642
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
|
5574
5643
|
var s, o, t;
|
5575
|
-
return _regeneratorRuntime().wrap(function
|
5576
|
-
while (1) switch (
|
5644
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
5645
|
+
while (1) switch (_context49.prev = _context49.next) {
|
5577
5646
|
case 0:
|
5578
5647
|
if (!e.error) {
|
5579
|
-
|
5648
|
+
_context49.next = 2;
|
5580
5649
|
break;
|
5581
5650
|
}
|
5582
5651
|
throw e.error;
|
5583
5652
|
case 2:
|
5584
5653
|
t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
|
5585
|
-
|
5654
|
+
_context49.next = 5;
|
5586
5655
|
return AssemblyAIUtils.poll(t, e.upload_url);
|
5587
5656
|
case 5:
|
5588
|
-
|
5589
|
-
return
|
5590
|
-
text:
|
5657
|
+
_context49.t0 = _context49.sent.text;
|
5658
|
+
return _context49.abrupt("return", {
|
5659
|
+
text: _context49.t0
|
5591
5660
|
});
|
5592
5661
|
case 7:
|
5593
5662
|
case "end":
|
5594
|
-
return
|
5663
|
+
return _context49.stop();
|
5595
5664
|
}
|
5596
|
-
},
|
5665
|
+
}, _callee49, this);
|
5597
5666
|
}));
|
5598
|
-
function extractResultData(
|
5667
|
+
function extractResultData(_x87) {
|
5599
5668
|
return _extractResultData16.apply(this, arguments);
|
5600
5669
|
}
|
5601
5670
|
return extractResultData;
|
@@ -5645,13 +5714,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5645
5714
|
}, {
|
5646
5715
|
key: "callServiceAPI",
|
5647
5716
|
value: function () {
|
5648
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5717
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t) {
|
5649
5718
|
var n;
|
5650
|
-
return _regeneratorRuntime().wrap(function
|
5651
|
-
while (1) switch (
|
5719
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
5720
|
+
while (1) switch (_context50.prev = _context50.next) {
|
5652
5721
|
case 0:
|
5653
5722
|
if (this.requestSettings) {
|
5654
|
-
|
5723
|
+
_context50.next = 2;
|
5655
5724
|
break;
|
5656
5725
|
}
|
5657
5726
|
throw new Error("Request settings have not been set up");
|
@@ -5660,11 +5729,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5660
5729
|
HTTPRequest.request(this, n, e, !1);
|
5661
5730
|
case 4:
|
5662
5731
|
case "end":
|
5663
|
-
return
|
5732
|
+
return _context50.stop();
|
5664
5733
|
}
|
5665
|
-
},
|
5734
|
+
}, _callee50, this);
|
5666
5735
|
}));
|
5667
|
-
function callServiceAPI(
|
5736
|
+
function callServiceAPI(_x88, _x89) {
|
5668
5737
|
return _callServiceAPI13.apply(this, arguments);
|
5669
5738
|
}
|
5670
5739
|
return callServiceAPI;
|
@@ -5672,11 +5741,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5672
5741
|
}, {
|
5673
5742
|
key: "extractResultData",
|
5674
5743
|
value: function () {
|
5675
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5676
|
-
return _regeneratorRuntime().wrap(function
|
5677
|
-
while (1) switch (
|
5744
|
+
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
|
5745
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
5746
|
+
while (1) switch (_context51.prev = _context51.next) {
|
5678
5747
|
case 0:
|
5679
|
-
return
|
5748
|
+
return _context51.abrupt("return", new Promise(function (t) {
|
5680
5749
|
var n = new FileReader();
|
5681
5750
|
n.readAsDataURL(e), n.onload = function (s) {
|
5682
5751
|
t({
|
@@ -5689,11 +5758,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5689
5758
|
}));
|
5690
5759
|
case 1:
|
5691
5760
|
case "end":
|
5692
|
-
return
|
5761
|
+
return _context51.stop();
|
5693
5762
|
}
|
5694
|
-
},
|
5763
|
+
}, _callee51);
|
5695
5764
|
}));
|
5696
|
-
function extractResultData(
|
5765
|
+
function extractResultData(_x90) {
|
5697
5766
|
return _extractResultData17.apply(this, arguments);
|
5698
5767
|
}
|
5699
5768
|
return extractResultData;
|
@@ -5729,19 +5798,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5729
5798
|
_createClass(j, [{
|
5730
5799
|
key: "callServiceAPI",
|
5731
5800
|
value: function () {
|
5732
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5801
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t, n) {
|
5733
5802
|
var s, o;
|
5734
|
-
return _regeneratorRuntime().wrap(function
|
5735
|
-
while (1) switch (
|
5803
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
5804
|
+
while (1) switch (_context52.prev = _context52.next) {
|
5736
5805
|
case 0:
|
5737
5806
|
if ((s = this.requestSettings) != null && s.headers) {
|
5738
|
-
|
5807
|
+
_context52.next = 2;
|
5739
5808
|
break;
|
5740
5809
|
}
|
5741
5810
|
throw new Error("Request settings have not been set up");
|
5742
5811
|
case 2:
|
5743
5812
|
if (n != null && n[0]) {
|
5744
|
-
|
5813
|
+
_context52.next = 4;
|
5745
5814
|
break;
|
5746
5815
|
}
|
5747
5816
|
throw new Error("No file was added");
|
@@ -5749,11 +5818,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5749
5818
|
(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);
|
5750
5819
|
case 5:
|
5751
5820
|
case "end":
|
5752
|
-
return
|
5821
|
+
return _context52.stop();
|
5753
5822
|
}
|
5754
|
-
},
|
5823
|
+
}, _callee52, this);
|
5755
5824
|
}));
|
5756
|
-
function callServiceAPI(
|
5825
|
+
function callServiceAPI(_x91, _x92, _x93) {
|
5757
5826
|
return _callServiceAPI14.apply(this, arguments);
|
5758
5827
|
}
|
5759
5828
|
return callServiceAPI;
|
@@ -5761,26 +5830,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5761
5830
|
}, {
|
5762
5831
|
key: "extractResultData",
|
5763
5832
|
value: function () {
|
5764
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5765
|
-
return _regeneratorRuntime().wrap(function
|
5766
|
-
while (1) switch (
|
5833
|
+
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
|
5834
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
5835
|
+
while (1) switch (_context53.prev = _context53.next) {
|
5767
5836
|
case 0:
|
5768
5837
|
if (!e.error) {
|
5769
|
-
|
5838
|
+
_context53.next = 2;
|
5770
5839
|
break;
|
5771
5840
|
}
|
5772
5841
|
throw e.error;
|
5773
5842
|
case 2:
|
5774
|
-
return
|
5843
|
+
return _context53.abrupt("return", {
|
5775
5844
|
text: e.DisplayText || ""
|
5776
5845
|
});
|
5777
5846
|
case 3:
|
5778
5847
|
case "end":
|
5779
|
-
return
|
5848
|
+
return _context53.stop();
|
5780
5849
|
}
|
5781
|
-
},
|
5850
|
+
}, _callee53);
|
5782
5851
|
}));
|
5783
|
-
function extractResultData(
|
5852
|
+
function extractResultData(_x94) {
|
5784
5853
|
return _extractResultData18.apply(this, arguments);
|
5785
5854
|
}
|
5786
5855
|
return extractResultData;
|
@@ -5823,13 +5892,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5823
5892
|
}, {
|
5824
5893
|
key: "callServiceAPI",
|
5825
5894
|
value: function () {
|
5826
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5895
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t) {
|
5827
5896
|
var n;
|
5828
|
-
return _regeneratorRuntime().wrap(function
|
5829
|
-
while (1) switch (
|
5897
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
5898
|
+
while (1) switch (_context54.prev = _context54.next) {
|
5830
5899
|
case 0:
|
5831
5900
|
if (this.requestSettings) {
|
5832
|
-
|
5901
|
+
_context54.next = 2;
|
5833
5902
|
break;
|
5834
5903
|
}
|
5835
5904
|
throw new Error("Request settings have not been set up");
|
@@ -5838,11 +5907,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5838
5907
|
HTTPRequest.request(this, n, e);
|
5839
5908
|
case 4:
|
5840
5909
|
case "end":
|
5841
|
-
return
|
5910
|
+
return _context54.stop();
|
5842
5911
|
}
|
5843
|
-
},
|
5912
|
+
}, _callee54, this);
|
5844
5913
|
}));
|
5845
|
-
function callServiceAPI(
|
5914
|
+
function callServiceAPI(_x95, _x96) {
|
5846
5915
|
return _callServiceAPI15.apply(this, arguments);
|
5847
5916
|
}
|
5848
5917
|
return callServiceAPI;
|
@@ -5850,27 +5919,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5850
5919
|
}, {
|
5851
5920
|
key: "extractResultData",
|
5852
5921
|
value: function () {
|
5853
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5922
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
|
5854
5923
|
var t;
|
5855
|
-
return _regeneratorRuntime().wrap(function
|
5856
|
-
while (1) switch (
|
5924
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
5925
|
+
while (1) switch (_context55.prev = _context55.next) {
|
5857
5926
|
case 0:
|
5858
5927
|
if (!Array.isArray(e)) {
|
5859
|
-
|
5928
|
+
_context55.next = 2;
|
5860
5929
|
break;
|
5861
5930
|
}
|
5862
|
-
return
|
5931
|
+
return _context55.abrupt("return", {
|
5863
5932
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
5864
5933
|
});
|
5865
5934
|
case 2:
|
5866
5935
|
throw e.error;
|
5867
5936
|
case 3:
|
5868
5937
|
case "end":
|
5869
|
-
return
|
5938
|
+
return _context55.stop();
|
5870
5939
|
}
|
5871
|
-
},
|
5940
|
+
}, _callee55);
|
5872
5941
|
}));
|
5873
|
-
function extractResultData(
|
5942
|
+
function extractResultData(_x97) {
|
5874
5943
|
return _extractResultData19.apply(this, arguments);
|
5875
5944
|
}
|
5876
5945
|
return extractResultData;
|
@@ -5879,11 +5948,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5879
5948
|
return AzureTranslationIO;
|
5880
5949
|
}(DirectServiceIO);
|
5881
5950
|
var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
5882
|
-
_inherits(
|
5883
|
-
var _super30 = _createSuper(
|
5884
|
-
function
|
5951
|
+
_inherits(A, _DirectServiceIO9);
|
5952
|
+
var _super30 = _createSuper(A);
|
5953
|
+
function A(e) {
|
5885
5954
|
var _this23;
|
5886
|
-
_classCallCheck(this,
|
5955
|
+
_classCallCheck(this, A);
|
5887
5956
|
var l;
|
5888
5957
|
var t = e.directConnection,
|
5889
5958
|
n = e.textInput,
|
@@ -5907,10 +5976,10 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
5907
5976
|
}
|
5908
5977
|
};
|
5909
5978
|
}
|
5910
|
-
_typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage =
|
5979
|
+
_typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
|
5911
5980
|
return _this23;
|
5912
5981
|
}
|
5913
|
-
_createClass(
|
5982
|
+
_createClass(A, [{
|
5914
5983
|
key: "preprocessBody",
|
5915
5984
|
value: function preprocessBody(e, t) {
|
5916
5985
|
var n = JSON.parse(JSON.stringify(e));
|
@@ -5928,50 +5997,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
5928
5997
|
var s;
|
5929
5998
|
var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
|
5930
5999
|
if (n[1] || o && o !== "") {
|
5931
|
-
this.url =
|
6000
|
+
this.url = A.IMAGE_EDIT_URL;
|
5932
6001
|
var c = this.preprocessBody(this.rawBody, o);
|
5933
|
-
s =
|
5934
|
-
} else this.url =
|
6002
|
+
s = A.createFormDataBody(c, n[0], n[1]);
|
6003
|
+
} else this.url = A.IMAGE_VARIATIONS_URL, s = A.createFormDataBody(this.rawBody, n[0]);
|
5935
6004
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
5936
6005
|
}
|
5937
6006
|
}, {
|
5938
6007
|
key: "callServiceAPI",
|
5939
6008
|
value: function () {
|
5940
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6009
|
+
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
|
5941
6010
|
var s, o;
|
5942
|
-
return _regeneratorRuntime().wrap(function
|
5943
|
-
while (1) switch (
|
6011
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
6012
|
+
while (1) switch (_context56.prev = _context56.next) {
|
5944
6013
|
case 0:
|
5945
6014
|
if ((s = this.requestSettings) != null && s.headers) {
|
5946
|
-
|
6015
|
+
_context56.next = 2;
|
5947
6016
|
break;
|
5948
6017
|
}
|
5949
6018
|
throw new Error("Request settings have not been set up");
|
5950
6019
|
case 2:
|
5951
6020
|
if (!(n != null && n[0])) {
|
5952
|
-
|
6021
|
+
_context56.next = 6;
|
5953
6022
|
break;
|
5954
6023
|
}
|
5955
6024
|
this.callApiWithImage(e, t, n);
|
5956
|
-
|
6025
|
+
_context56.next = 11;
|
5957
6026
|
break;
|
5958
6027
|
case 6:
|
5959
6028
|
if (this.requestSettings) {
|
5960
|
-
|
6029
|
+
_context56.next = 8;
|
5961
6030
|
break;
|
5962
6031
|
}
|
5963
6032
|
throw new Error("Request settings have not been set up");
|
5964
6033
|
case 8:
|
5965
|
-
this.url =
|
6034
|
+
this.url = A.IMAGE_GENERATION_URL;
|
5966
6035
|
o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
5967
6036
|
HTTPRequest.request(this, o, e);
|
5968
6037
|
case 11:
|
5969
6038
|
case "end":
|
5970
|
-
return
|
6039
|
+
return _context56.stop();
|
5971
6040
|
}
|
5972
|
-
},
|
6041
|
+
}, _callee56, this);
|
5973
6042
|
}));
|
5974
|
-
function callServiceAPI(
|
6043
|
+
function callServiceAPI(_x98, _x99, _x100) {
|
5975
6044
|
return _callServiceAPI16.apply(this, arguments);
|
5976
6045
|
}
|
5977
6046
|
return callServiceAPI;
|
@@ -5979,17 +6048,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
5979
6048
|
}, {
|
5980
6049
|
key: "extractResultData",
|
5981
6050
|
value: function () {
|
5982
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5983
|
-
return _regeneratorRuntime().wrap(function
|
5984
|
-
while (1) switch (
|
6051
|
+
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
|
6052
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
6053
|
+
while (1) switch (_context57.prev = _context57.next) {
|
5985
6054
|
case 0:
|
5986
6055
|
if (!e.error) {
|
5987
|
-
|
6056
|
+
_context57.next = 2;
|
5988
6057
|
break;
|
5989
6058
|
}
|
5990
6059
|
throw e.error.message;
|
5991
6060
|
case 2:
|
5992
|
-
return
|
6061
|
+
return _context57.abrupt("return", {
|
5993
6062
|
files: e.data.map(function (n) {
|
5994
6063
|
return n.url ? {
|
5995
6064
|
src: n.url,
|
@@ -6002,11 +6071,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6002
6071
|
});
|
6003
6072
|
case 3:
|
6004
6073
|
case "end":
|
6005
|
-
return
|
6074
|
+
return _context57.stop();
|
6006
6075
|
}
|
6007
|
-
},
|
6076
|
+
}, _callee57);
|
6008
6077
|
}));
|
6009
|
-
function extractResultData(
|
6078
|
+
function extractResultData(_x101) {
|
6010
6079
|
return _extractResultData20.apply(this, arguments);
|
6011
6080
|
}
|
6012
6081
|
return extractResultData;
|
@@ -6033,7 +6102,7 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6033
6102
|
}), s;
|
6034
6103
|
}
|
6035
6104
|
}]);
|
6036
|
-
return
|
6105
|
+
return A;
|
6037
6106
|
}(DirectServiceIO);
|
6038
6107
|
_OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
6039
6108
|
_OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
@@ -6078,19 +6147,19 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6078
6147
|
}, {
|
6079
6148
|
key: "callServiceAPI",
|
6080
6149
|
value: function () {
|
6081
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6150
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, n) {
|
6082
6151
|
var a, s, o;
|
6083
|
-
return _regeneratorRuntime().wrap(function
|
6084
|
-
while (1) switch (
|
6152
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6153
|
+
while (1) switch (_context58.prev = _context58.next) {
|
6085
6154
|
case 0:
|
6086
6155
|
if ((a = this.requestSettings) != null && a.headers) {
|
6087
|
-
|
6156
|
+
_context58.next = 2;
|
6088
6157
|
break;
|
6089
6158
|
}
|
6090
6159
|
throw new Error("Request settings have not been set up");
|
6091
6160
|
case 2:
|
6092
6161
|
if (n != null && n[0]) {
|
6093
|
-
|
6162
|
+
_context58.next = 4;
|
6094
6163
|
break;
|
6095
6164
|
}
|
6096
6165
|
throw new Error("No file was added");
|
@@ -6100,11 +6169,11 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6100
6169
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
6101
6170
|
case 7:
|
6102
6171
|
case "end":
|
6103
|
-
return
|
6172
|
+
return _context58.stop();
|
6104
6173
|
}
|
6105
|
-
},
|
6174
|
+
}, _callee58, this);
|
6106
6175
|
}));
|
6107
|
-
function callServiceAPI(
|
6176
|
+
function callServiceAPI(_x102, _x103, _x104) {
|
6108
6177
|
return _callServiceAPI17.apply(this, arguments);
|
6109
6178
|
}
|
6110
6179
|
return callServiceAPI;
|
@@ -6112,26 +6181,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6112
6181
|
}, {
|
6113
6182
|
key: "extractResultData",
|
6114
6183
|
value: function () {
|
6115
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6116
|
-
return _regeneratorRuntime().wrap(function
|
6117
|
-
while (1) switch (
|
6184
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
6185
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
6186
|
+
while (1) switch (_context59.prev = _context59.next) {
|
6118
6187
|
case 0:
|
6119
6188
|
if (!e.error) {
|
6120
|
-
|
6189
|
+
_context59.next = 2;
|
6121
6190
|
break;
|
6122
6191
|
}
|
6123
6192
|
throw e.error.message;
|
6124
6193
|
case 2:
|
6125
|
-
return
|
6194
|
+
return _context59.abrupt("return", {
|
6126
6195
|
text: e.text
|
6127
6196
|
});
|
6128
6197
|
case 3:
|
6129
6198
|
case "end":
|
6130
|
-
return
|
6199
|
+
return _context59.stop();
|
6131
6200
|
}
|
6132
|
-
},
|
6201
|
+
}, _callee59);
|
6133
6202
|
}));
|
6134
|
-
function extractResultData(
|
6203
|
+
function extractResultData(_x105) {
|
6135
6204
|
return _extractResultData21.apply(this, arguments);
|
6136
6205
|
}
|
6137
6206
|
return extractResultData;
|
@@ -6197,13 +6266,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6197
6266
|
}, {
|
6198
6267
|
key: "callServiceAPI",
|
6199
6268
|
value: function () {
|
6200
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6269
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
|
6201
6270
|
var n;
|
6202
|
-
return _regeneratorRuntime().wrap(function
|
6203
|
-
while (1) switch (
|
6271
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
6272
|
+
while (1) switch (_context60.prev = _context60.next) {
|
6204
6273
|
case 0:
|
6205
6274
|
if (this.requestSettings) {
|
6206
|
-
|
6275
|
+
_context60.next = 2;
|
6207
6276
|
break;
|
6208
6277
|
}
|
6209
6278
|
throw new Error("Request settings have not been set up");
|
@@ -6212,11 +6281,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6212
6281
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
6213
6282
|
case 4:
|
6214
6283
|
case "end":
|
6215
|
-
return
|
6284
|
+
return _context60.stop();
|
6216
6285
|
}
|
6217
|
-
},
|
6286
|
+
}, _callee60, this);
|
6218
6287
|
}));
|
6219
|
-
function callServiceAPI(
|
6288
|
+
function callServiceAPI(_x106, _x107) {
|
6220
6289
|
return _callServiceAPI18.apply(this, arguments);
|
6221
6290
|
}
|
6222
6291
|
return callServiceAPI;
|
@@ -6224,17 +6293,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6224
6293
|
}, {
|
6225
6294
|
key: "extractResultData",
|
6226
6295
|
value: function () {
|
6227
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6228
|
-
return _regeneratorRuntime().wrap(function
|
6229
|
-
while (1) switch (
|
6296
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
|
6297
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
6298
|
+
while (1) switch (_context61.prev = _context61.next) {
|
6230
6299
|
case 0:
|
6231
6300
|
if (!e.error) {
|
6232
|
-
|
6301
|
+
_context61.next = 2;
|
6233
6302
|
break;
|
6234
6303
|
}
|
6235
6304
|
throw e.error.message;
|
6236
6305
|
case 2:
|
6237
|
-
return
|
6306
|
+
return _context61.abrupt("return", e.choices[0].delta ? {
|
6238
6307
|
text: e.choices[0].delta.content || ""
|
6239
6308
|
} : e.choices[0].message ? {
|
6240
6309
|
text: e.choices[0].message.content
|
@@ -6243,11 +6312,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6243
6312
|
});
|
6244
6313
|
case 3:
|
6245
6314
|
case "end":
|
6246
|
-
return
|
6315
|
+
return _context61.stop();
|
6247
6316
|
}
|
6248
|
-
},
|
6317
|
+
}, _callee61);
|
6249
6318
|
}));
|
6250
|
-
function extractResultData(
|
6319
|
+
function extractResultData(_x108) {
|
6251
6320
|
return _extractResultData22.apply(this, arguments);
|
6252
6321
|
}
|
6253
6322
|
return extractResultData;
|
@@ -6295,13 +6364,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6295
6364
|
}, {
|
6296
6365
|
key: "callServiceAPI",
|
6297
6366
|
value: function () {
|
6298
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6367
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
|
6299
6368
|
var n;
|
6300
|
-
return _regeneratorRuntime().wrap(function
|
6301
|
-
while (1) switch (
|
6369
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
6370
|
+
while (1) switch (_context62.prev = _context62.next) {
|
6302
6371
|
case 0:
|
6303
6372
|
if (this.requestSettings) {
|
6304
|
-
|
6373
|
+
_context62.next = 2;
|
6305
6374
|
break;
|
6306
6375
|
}
|
6307
6376
|
throw new Error("Request settings have not been set up");
|
@@ -6310,11 +6379,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6310
6379
|
HTTPRequest.request(this, n, e);
|
6311
6380
|
case 4:
|
6312
6381
|
case "end":
|
6313
|
-
return
|
6382
|
+
return _context62.stop();
|
6314
6383
|
}
|
6315
|
-
},
|
6384
|
+
}, _callee62, this);
|
6316
6385
|
}));
|
6317
|
-
function callServiceAPI(
|
6386
|
+
function callServiceAPI(_x109, _x110) {
|
6318
6387
|
return _callServiceAPI19.apply(this, arguments);
|
6319
6388
|
}
|
6320
6389
|
return callServiceAPI;
|
@@ -6322,26 +6391,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6322
6391
|
}, {
|
6323
6392
|
key: "extractResultData",
|
6324
6393
|
value: function () {
|
6325
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6326
|
-
return _regeneratorRuntime().wrap(function
|
6327
|
-
while (1) switch (
|
6394
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
6395
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
6396
|
+
while (1) switch (_context63.prev = _context63.next) {
|
6328
6397
|
case 0:
|
6329
6398
|
if (!e.message) {
|
6330
|
-
|
6399
|
+
_context63.next = 2;
|
6331
6400
|
break;
|
6332
6401
|
}
|
6333
6402
|
throw e.message;
|
6334
6403
|
case 2:
|
6335
|
-
return
|
6404
|
+
return _context63.abrupt("return", {
|
6336
6405
|
text: e.text
|
6337
6406
|
});
|
6338
6407
|
case 3:
|
6339
6408
|
case "end":
|
6340
|
-
return
|
6409
|
+
return _context63.stop();
|
6341
6410
|
}
|
6342
|
-
},
|
6411
|
+
}, _callee63);
|
6343
6412
|
}));
|
6344
|
-
function extractResultData(
|
6413
|
+
function extractResultData(_x111) {
|
6345
6414
|
return _extractResultData23.apply(this, arguments);
|
6346
6415
|
}
|
6347
6416
|
return extractResultData;
|
@@ -6687,24 +6756,24 @@ var FileMessages = /*#__PURE__*/function () {
|
|
6687
6756
|
}, {
|
6688
6757
|
key: "addNewImageMessage",
|
6689
6758
|
value: function () {
|
6690
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6759
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t, n) {
|
6691
6760
|
var s,
|
6692
6761
|
o,
|
6693
6762
|
a,
|
6694
|
-
|
6695
|
-
return _regeneratorRuntime().wrap(function
|
6696
|
-
while (1) switch (
|
6763
|
+
_args64 = arguments;
|
6764
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
6765
|
+
while (1) switch (_context64.prev = _context64.next) {
|
6697
6766
|
case 0:
|
6698
|
-
s =
|
6767
|
+
s = _args64.length > 3 && _args64[3] !== undefined ? _args64[3] : !1;
|
6699
6768
|
o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
|
6700
6769
|
a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
|
6701
6770
|
case 3:
|
6702
6771
|
case "end":
|
6703
|
-
return
|
6772
|
+
return _context64.stop();
|
6704
6773
|
}
|
6705
|
-
},
|
6774
|
+
}, _callee64);
|
6706
6775
|
}));
|
6707
|
-
function addNewImageMessage(
|
6776
|
+
function addNewImageMessage(_x112, _x113, _x114) {
|
6708
6777
|
return _addNewImageMessage.apply(this, arguments);
|
6709
6778
|
}
|
6710
6779
|
return addNewImageMessage;
|
@@ -7022,12 +7091,12 @@ var Messages = /*#__PURE__*/function () {
|
|
7022
7091
|
}, {
|
7023
7092
|
key: "addMultipleFiles",
|
7024
7093
|
value: function () {
|
7025
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7094
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e) {
|
7026
7095
|
var _this31 = this;
|
7027
|
-
return _regeneratorRuntime().wrap(function
|
7028
|
-
while (1) switch (
|
7096
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
7097
|
+
while (1) switch (_context65.prev = _context65.next) {
|
7029
7098
|
case 0:
|
7030
|
-
return
|
7099
|
+
return _context65.abrupt("return", Promise.all((e || []).map(function (t) {
|
7031
7100
|
return new Promise(function (n) {
|
7032
7101
|
if (!t.type || t.type === "any") {
|
7033
7102
|
var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
|
@@ -7052,11 +7121,11 @@ var Messages = /*#__PURE__*/function () {
|
|
7052
7121
|
})));
|
7053
7122
|
case 1:
|
7054
7123
|
case "end":
|
7055
|
-
return
|
7124
|
+
return _context65.stop();
|
7056
7125
|
}
|
7057
|
-
},
|
7126
|
+
}, _callee65);
|
7058
7127
|
}));
|
7059
|
-
function addMultipleFiles(
|
7128
|
+
function addMultipleFiles(_x115) {
|
7060
7129
|
return _addMultipleFiles.apply(this, arguments);
|
7061
7130
|
}
|
7062
7131
|
return addMultipleFiles;
|
@@ -7967,33 +8036,33 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
7967
8036
|
}, {
|
7968
8037
|
key: "completePlaceholders",
|
7969
8038
|
value: function () {
|
7970
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7971
|
-
return _regeneratorRuntime().wrap(function
|
7972
|
-
while (1) switch (
|
8039
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
|
8040
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
8041
|
+
while (1) switch (_context67.prev = _context67.next) {
|
7973
8042
|
case 0:
|
7974
|
-
|
8043
|
+
_context67.next = 2;
|
7975
8044
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
7976
|
-
var
|
8045
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e) {
|
7977
8046
|
var t;
|
7978
|
-
return _regeneratorRuntime().wrap(function
|
7979
|
-
while (1) switch (
|
8047
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
8048
|
+
while (1) switch (_context66.prev = _context66.next) {
|
7980
8049
|
case 0:
|
7981
|
-
return
|
8050
|
+
return _context66.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
7982
8051
|
case 1:
|
7983
8052
|
case "end":
|
7984
|
-
return
|
8053
|
+
return _context66.stop();
|
7985
8054
|
}
|
7986
|
-
},
|
8055
|
+
}, _callee66);
|
7987
8056
|
}));
|
7988
|
-
return function (
|
7989
|
-
return
|
8057
|
+
return function (_x116) {
|
8058
|
+
return _ref6.apply(this, arguments);
|
7990
8059
|
};
|
7991
8060
|
}()));
|
7992
8061
|
case 2:
|
7993
8062
|
case "end":
|
7994
|
-
return
|
8063
|
+
return _context67.stop();
|
7995
8064
|
}
|
7996
|
-
},
|
8065
|
+
}, _callee67, this);
|
7997
8066
|
}));
|
7998
8067
|
function completePlaceholders() {
|
7999
8068
|
return _completePlaceholders.apply(this, arguments);
|
@@ -9213,26 +9282,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9213
9282
|
}, {
|
9214
9283
|
key: "getNewSpeechConfig",
|
9215
9284
|
value: function () {
|
9216
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9217
|
-
return _regeneratorRuntime().wrap(function
|
9218
|
-
while (1) switch (
|
9285
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e, t) {
|
9286
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
9287
|
+
while (1) switch (_context68.prev = _context68.next) {
|
9219
9288
|
case 0:
|
9220
9289
|
if (!t.region) {
|
9221
|
-
|
9290
|
+
_context68.next = 2;
|
9222
9291
|
break;
|
9223
9292
|
}
|
9224
|
-
return
|
9293
|
+
return _context68.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) {
|
9225
9294
|
return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
|
9226
9295
|
})["catch"](function (n) {
|
9227
9296
|
return console.error(n), null;
|
9228
9297
|
}) : null);
|
9229
9298
|
case 2:
|
9230
9299
|
case "end":
|
9231
|
-
return
|
9300
|
+
return _context68.stop();
|
9232
9301
|
}
|
9233
|
-
},
|
9302
|
+
}, _callee68);
|
9234
9303
|
}));
|
9235
|
-
function getNewSpeechConfig(
|
9304
|
+
function getNewSpeechConfig(_x117, _x118) {
|
9236
9305
|
return _getNewSpeechConfig.apply(this, arguments);
|
9237
9306
|
}
|
9238
9307
|
return getNewSpeechConfig;
|
@@ -9245,23 +9314,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9245
9314
|
}, {
|
9246
9315
|
key: "get",
|
9247
9316
|
value: function () {
|
9248
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9317
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e, t) {
|
9249
9318
|
var n;
|
9250
|
-
return _regeneratorRuntime().wrap(function
|
9251
|
-
while (1) switch (
|
9319
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
9320
|
+
while (1) switch (_context69.prev = _context69.next) {
|
9252
9321
|
case 0:
|
9253
|
-
|
9322
|
+
_context69.next = 2;
|
9254
9323
|
return AzureSpeechConfig.getNewSpeechConfig(e, t);
|
9255
9324
|
case 2:
|
9256
|
-
n =
|
9257
|
-
return
|
9325
|
+
n = _context69.sent;
|
9326
|
+
return _context69.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
|
9258
9327
|
case 4:
|
9259
9328
|
case "end":
|
9260
|
-
return
|
9329
|
+
return _context69.stop();
|
9261
9330
|
}
|
9262
|
-
},
|
9331
|
+
}, _callee69);
|
9263
9332
|
}));
|
9264
|
-
function get(
|
9333
|
+
function get(_x119, _x120) {
|
9265
9334
|
return _get.apply(this, arguments);
|
9266
9335
|
}
|
9267
9336
|
return get;
|
@@ -9351,28 +9420,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9351
9420
|
}, {
|
9352
9421
|
key: "startAsync",
|
9353
9422
|
value: function () {
|
9354
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9423
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e) {
|
9355
9424
|
var t;
|
9356
|
-
return _regeneratorRuntime().wrap(function
|
9357
|
-
while (1) switch (
|
9425
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
9426
|
+
while (1) switch (_context70.prev = _context70.next) {
|
9358
9427
|
case 0:
|
9359
|
-
|
9360
|
-
if (!
|
9361
|
-
|
9428
|
+
_context70.t0 = this.validate(e);
|
9429
|
+
if (!_context70.t0) {
|
9430
|
+
_context70.next = 6;
|
9362
9431
|
break;
|
9363
9432
|
}
|
9364
|
-
|
9433
|
+
_context70.next = 4;
|
9365
9434
|
return this.instantiateService(e);
|
9366
9435
|
case 4:
|
9367
9436
|
this._translations = e == null ? void 0 : e.translations;
|
9368
9437
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
9369
9438
|
case 6:
|
9370
9439
|
case "end":
|
9371
|
-
return
|
9440
|
+
return _context70.stop();
|
9372
9441
|
}
|
9373
|
-
},
|
9442
|
+
}, _callee70, this);
|
9374
9443
|
}));
|
9375
|
-
function startAsync(
|
9444
|
+
function startAsync(_x121) {
|
9376
9445
|
return _startAsync.apply(this, arguments);
|
9377
9446
|
}
|
9378
9447
|
return startAsync;
|
@@ -9385,28 +9454,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9385
9454
|
}, {
|
9386
9455
|
key: "instantiateService",
|
9387
9456
|
value: function () {
|
9388
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9457
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
|
9389
9458
|
var t, n, s, o;
|
9390
|
-
return _regeneratorRuntime().wrap(function
|
9391
|
-
while (1) switch (
|
9459
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
9460
|
+
while (1) switch (_context71.prev = _context71.next) {
|
9392
9461
|
case 0:
|
9393
9462
|
t = Azure.getAPI();
|
9394
9463
|
n = t.AudioConfig.fromDefaultMicrophoneInput();
|
9395
|
-
|
9464
|
+
_context71.next = 4;
|
9396
9465
|
return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
|
9397
9466
|
case 4:
|
9398
|
-
s =
|
9467
|
+
s = _context71.sent;
|
9399
9468
|
if (s) {
|
9400
9469
|
o = new t.SpeechRecognizer(s, n);
|
9401
9470
|
this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
9402
9471
|
} else this.error("Unable to contact Azure server");
|
9403
9472
|
case 6:
|
9404
9473
|
case "end":
|
9405
|
-
return
|
9474
|
+
return _context71.stop();
|
9406
9475
|
}
|
9407
|
-
},
|
9476
|
+
}, _callee71, this);
|
9408
9477
|
}));
|
9409
|
-
function instantiateService(
|
9478
|
+
function instantiateService(_x122) {
|
9410
9479
|
return _instantiateService.apply(this, arguments);
|
9411
9480
|
}
|
9412
9481
|
return instantiateService;
|
@@ -9783,17 +9852,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9783
9852
|
}, {
|
9784
9853
|
key: "submit",
|
9785
9854
|
value: function () {
|
9786
|
-
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9855
|
+
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e, t) {
|
9787
9856
|
var l, c, n, s, o, a;
|
9788
|
-
return _regeneratorRuntime().wrap(function
|
9789
|
-
while (1) switch (
|
9857
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
9858
|
+
while (1) switch (_context72.prev = _context72.next) {
|
9790
9859
|
case 0:
|
9791
|
-
|
9792
|
-
if (
|
9793
|
-
|
9860
|
+
_context72.t0 = e;
|
9861
|
+
if (_context72.t0) {
|
9862
|
+
_context72.next = 6;
|
9794
9863
|
break;
|
9795
9864
|
}
|
9796
|
-
|
9865
|
+
_context72.next = 4;
|
9797
9866
|
return this._fileAttachments.completePlaceholders();
|
9798
9867
|
case 4:
|
9799
9868
|
n = this._fileAttachments.getAllFileData();
|
@@ -9803,40 +9872,40 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9803
9872
|
case 6:
|
9804
9873
|
o = t === "" ? void 0 : t;
|
9805
9874
|
if (!this._isRequestInProgress) {
|
9806
|
-
|
9875
|
+
_context72.next = 9;
|
9807
9876
|
break;
|
9808
9877
|
}
|
9809
|
-
return
|
9878
|
+
return _context72.abrupt("return");
|
9810
9879
|
case 9:
|
9811
9880
|
if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
|
9812
|
-
|
9881
|
+
_context72.next = 14;
|
9813
9882
|
break;
|
9814
9883
|
}
|
9815
9884
|
if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
|
9816
|
-
|
9885
|
+
_context72.next = 12;
|
9817
9886
|
break;
|
9818
9887
|
}
|
9819
|
-
return
|
9888
|
+
return _context72.abrupt("return");
|
9820
9889
|
case 12:
|
9821
|
-
|
9890
|
+
_context72.next = 16;
|
9822
9891
|
break;
|
9823
9892
|
case 14:
|
9824
9893
|
if (this._serviceIO.canSendMessage(o, s)) {
|
9825
|
-
|
9894
|
+
_context72.next = 16;
|
9826
9895
|
break;
|
9827
9896
|
}
|
9828
|
-
return
|
9897
|
+
return _context72.abrupt("return");
|
9829
9898
|
case 16:
|
9830
9899
|
this.changeToLoadingIcon();
|
9831
9900
|
t !== "" && this._messages.addNewMessage({
|
9832
9901
|
text: t
|
9833
9902
|
}, !1, !0);
|
9834
|
-
|
9835
|
-
if (!
|
9836
|
-
|
9903
|
+
_context72.t1 = n;
|
9904
|
+
if (!_context72.t1) {
|
9905
|
+
_context72.next = 22;
|
9837
9906
|
break;
|
9838
9907
|
}
|
9839
|
-
|
9908
|
+
_context72.next = 22;
|
9840
9909
|
return this._messages.addMultipleFiles(n);
|
9841
9910
|
case 22:
|
9842
9911
|
this._messages.addLoadingMessage();
|
@@ -9845,17 +9914,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9845
9914
|
text: o,
|
9846
9915
|
files: s
|
9847
9916
|
};
|
9848
|
-
|
9917
|
+
_context72.next = 27;
|
9849
9918
|
return this._serviceIO.callAPI(a, this._messages);
|
9850
9919
|
case 27:
|
9851
9920
|
e || (c = this._fileAttachments) == null || c.removeAllFiles();
|
9852
9921
|
case 28:
|
9853
9922
|
case "end":
|
9854
|
-
return
|
9923
|
+
return _context72.stop();
|
9855
9924
|
}
|
9856
|
-
},
|
9925
|
+
}, _callee72, this);
|
9857
9926
|
}));
|
9858
|
-
function submit(
|
9927
|
+
function submit(_x123, _x124) {
|
9859
9928
|
return _submit.apply(this, arguments);
|
9860
9929
|
}
|
9861
9930
|
return submit;
|