deep-chat-dev 9.0.1 → 9.0.2
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 +261 -245
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +948 -846
- package/dist/services/assemblyAI/assemblyAIAudioIO.d.ts +2 -2
- package/dist/services/assemblyAI/assemblyAIAudioIO.d.ts.map +1 -1
- package/dist/services/azure/azureSpeechToTextIO.d.ts +2 -2
- package/dist/services/azure/azureSpeechToTextIO.d.ts.map +1 -1
- package/dist/services/azure/azureTextToSpeechIO.d.ts +2 -2
- package/dist/services/azure/azureTextToSpeechIO.d.ts.map +1 -1
- package/dist/services/azure/azureTranslationIO.d.ts +2 -2
- package/dist/services/azure/azureTranslationIO.d.ts.map +1 -1
- package/dist/services/cohere/cohereChatIO.d.ts +2 -2
- package/dist/services/cohere/cohereChatIO.d.ts.map +1 -1
- package/dist/services/cohere/cohereSummarizationIO.d.ts +2 -2
- package/dist/services/cohere/cohereSummarizationIO.d.ts.map +1 -1
- package/dist/services/cohere/cohereTextGenerationIO.d.ts +2 -2
- package/dist/services/cohere/cohereTextGenerationIO.d.ts.map +1 -1
- package/dist/services/huggingFace/huggingFaceConversationIO.d.ts +2 -2
- package/dist/services/huggingFace/huggingFaceConversationIO.d.ts.map +1 -1
- package/dist/services/huggingFace/huggingFaceFillMaskIO.d.ts +2 -2
- package/dist/services/huggingFace/huggingFaceFillMaskIO.d.ts.map +1 -1
- package/dist/services/huggingFace/huggingFaceQuestionAnswerIO.d.ts +2 -2
- package/dist/services/huggingFace/huggingFaceQuestionAnswerIO.d.ts.map +1 -1
- package/dist/services/huggingFace/huggingFaceSummarizationIO.d.ts +2 -2
- package/dist/services/huggingFace/huggingFaceSummarizationIO.d.ts.map +1 -1
- package/dist/services/huggingFace/huggingFaceTextGenerationIO.d.ts +2 -2
- package/dist/services/huggingFace/huggingFaceTextGenerationIO.d.ts.map +1 -1
- package/dist/services/huggingFace/huggingFaceTranslationIO.d.ts +2 -2
- package/dist/services/huggingFace/huggingFaceTranslationIO.d.ts.map +1 -1
- package/dist/services/openAI/openAIAudioIO.d.ts +2 -2
- package/dist/services/openAI/openAIAudioIO.d.ts.map +1 -1
- package/dist/services/openAI/openAIChatIO.d.ts +2 -2
- package/dist/services/openAI/openAIChatIO.d.ts.map +1 -1
- package/dist/services/openAI/openAICompletionsIO.d.ts +2 -2
- package/dist/services/openAI/openAICompletionsIO.d.ts.map +1 -1
- package/dist/services/openAI/openAIImagesIO.d.ts +2 -2
- package/dist/services/openAI/openAIImagesIO.d.ts.map +1 -1
- package/dist/services/serviceIO.d.ts +4 -4
- package/dist/services/serviceIO.d.ts.map +1 -1
- package/dist/services/stabilityAI/stabilityAIImageToImageIO.d.ts +2 -2
- package/dist/services/stabilityAI/stabilityAIImageToImageIO.d.ts.map +1 -1
- package/dist/services/stabilityAI/stabilityAIImageToImageMaskingIO.d.ts +2 -2
- package/dist/services/stabilityAI/stabilityAIImageToImageMaskingIO.d.ts.map +1 -1
- package/dist/services/stabilityAI/stabilityAIImageToImageUpscaleIO.d.ts +2 -2
- package/dist/services/stabilityAI/stabilityAIImageToImageUpscaleIO.d.ts.map +1 -1
- package/dist/services/stabilityAI/stabilityAITextToImageIO.d.ts +2 -2
- package/dist/services/stabilityAI/stabilityAITextToImageIO.d.ts.map +1 -1
- package/dist/services/utils/baseServiceIO.d.ts +2 -3
- package/dist/services/utils/baseServiceIO.d.ts.map +1 -1
- package/dist/types/demo.d.ts +2 -2
- package/dist/types/demo.d.ts.map +1 -1
- package/dist/types/interceptors.d.ts +2 -2
- package/dist/types/interceptors.d.ts.map +1 -1
- package/dist/types/request.d.ts +2 -2
- package/dist/types/request.d.ts.map +1 -1
- package/dist/types/{result.d.ts → response.d.ts} +3 -2
- package/dist/types/response.d.ts.map +1 -0
- package/dist/utils/HTTP/HTTPRequest.d.ts.map +1 -1
- package/dist/utils/HTTP/customRequest.d.ts +7 -0
- package/dist/utils/HTTP/customRequest.d.ts.map +1 -0
- package/dist/utils/HTTP/websocket.d.ts +4 -3
- package/dist/utils/HTTP/websocket.d.ts.map +1 -1
- package/dist/utils/demo/demo.d.ts.map +1 -1
- package/dist/views/chat/input/buttons/submit/submitButton.d.ts.map +1 -1
- package/dist/views/chat/messages/fileMessages.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +2 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/customService.d.ts +0 -6
- package/dist/types/customService.d.ts.map +0 -1
- package/dist/types/result.d.ts.map +0 -1
package/dist/deepChat.js
CHANGED
@@ -316,13 +316,13 @@ function getInterceptorMessage(r) {
|
|
316
316
|
function getInvalidResponseMessage(r, e, t, n) {
|
317
317
|
var s = "\n".concat(capitalizeFirstLetter(e), " message: ").concat(JSON.stringify(r), " \n"),
|
318
318
|
o = t ? "".concat(capitalizeFirstLetter(e), " message after interceptor: ").concat(getInterceptorMessage(n), " \n") : "";
|
319
|
-
return "".concat(s + o, "Make sure the ").concat(e, " message is using the
|
319
|
+
return "".concat(s + o, "Make sure the ").concat(e, " message is using the Response format: https://deepchat.dev/docs/connect/#Response \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
|
320
320
|
}
|
321
321
|
var ErrorMessages = {
|
322
322
|
INVALID_KEY: "Invalid API Key",
|
323
323
|
CONNECTION_FAILED: "Failed to connect",
|
324
324
|
INVALID_RESPONSE: getInvalidResponseMessage,
|
325
|
-
INVALID_STREAM_RESPONSE: "Make sure the events are using the
|
325
|
+
INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
|
326
326
|
},
|
327
327
|
_RequestUtils = /*#__PURE__*/function () {
|
328
328
|
function D() {
|
@@ -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
|
}
|
@@ -539,16 +539,16 @@ function fetchEventSource(r, e) {
|
|
539
539
|
b.abort(), document.hidden || I();
|
540
540
|
}
|
541
541
|
c || document.addEventListener("visibilitychange", m);
|
542
|
-
var
|
543
|
-
|
542
|
+
var g = DefaultRetryInterval,
|
543
|
+
v = 0;
|
544
544
|
function y() {
|
545
|
-
document.removeEventListener("visibilitychange", m), window.clearTimeout(
|
545
|
+
document.removeEventListener("visibilitychange", m), window.clearTimeout(v), b.abort();
|
546
546
|
}
|
547
547
|
t == null || t.addEventListener("abort", function () {
|
548
548
|
y(), h();
|
549
549
|
});
|
550
|
-
var
|
551
|
-
|
550
|
+
var _ = u !== null && u !== void 0 ? u : window.fetch,
|
551
|
+
S = s !== null && s !== void 0 ? s : defaultOnOpen;
|
552
552
|
function I() {
|
553
553
|
return _I.apply(this, arguments);
|
554
554
|
}
|
@@ -561,20 +561,20 @@ function fetchEventSource(r, e) {
|
|
561
561
|
b = new AbortController();
|
562
562
|
_context3.prev = 1;
|
563
563
|
_context3.next = 4;
|
564
|
-
return
|
564
|
+
return _(r, Object.assign(Object.assign({}, d), {
|
565
565
|
headers: f,
|
566
566
|
signal: b.signal
|
567
567
|
}));
|
568
568
|
case 4:
|
569
569
|
w = _context3.sent;
|
570
570
|
_context3.next = 7;
|
571
|
-
return
|
571
|
+
return S(w);
|
572
572
|
case 7:
|
573
573
|
_context3.next = 9;
|
574
574
|
return getBytes(w.body, getLines(getMessages(function (x) {
|
575
575
|
x ? f[LastEventId] = x : delete f[LastEventId];
|
576
576
|
}, function (x) {
|
577
|
-
|
577
|
+
g = x;
|
578
578
|
}, o)));
|
579
579
|
case 9:
|
580
580
|
a == null || a();
|
@@ -586,8 +586,8 @@ function fetchEventSource(r, e) {
|
|
586
586
|
_context3.prev = 14;
|
587
587
|
_context3.t0 = _context3["catch"](1);
|
588
588
|
if (!b.signal.aborted) try {
|
589
|
-
x = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R :
|
590
|
-
window.clearTimeout(
|
589
|
+
x = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : g;
|
590
|
+
window.clearTimeout(v), v = window.setTimeout(I, x);
|
591
591
|
} catch (x) {
|
592
592
|
y(), p(x);
|
593
593
|
}
|
@@ -606,6 +606,87 @@ 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
|
+
text: C.generateResponse(e)
|
644
|
+
};
|
645
|
+
}
|
646
|
+
// timeout is used to simulate a timeout for a response to come back
|
647
|
+
}, {
|
648
|
+
key: "request",
|
649
|
+
value: function request(e, t, n) {
|
650
|
+
var s = C.getResponse(e);
|
651
|
+
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
652
|
+
var o;
|
653
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
654
|
+
while (1) switch (_context4.prev = _context4.next) {
|
655
|
+
case 0:
|
656
|
+
_context4.next = 2;
|
657
|
+
return n == null ? void 0 : n(s);
|
658
|
+
case 2:
|
659
|
+
_context4.t0 = _context4.sent;
|
660
|
+
if (_context4.t0) {
|
661
|
+
_context4.next = 5;
|
662
|
+
break;
|
663
|
+
}
|
664
|
+
_context4.t0 = s;
|
665
|
+
case 5:
|
666
|
+
o = _context4.t0;
|
667
|
+
o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
|
668
|
+
case 7:
|
669
|
+
case "end":
|
670
|
+
return _context4.stop();
|
671
|
+
}
|
672
|
+
}, _callee4);
|
673
|
+
})), 400);
|
674
|
+
}
|
675
|
+
// timeout is used to simulate a timeout for a response to come back
|
676
|
+
}, {
|
677
|
+
key: "requestStream",
|
678
|
+
value: function requestStream(e, t) {
|
679
|
+
setTimeout(function () {
|
680
|
+
var s;
|
681
|
+
var n = (s = C.getResponse(e)) == null ? void 0 : s.text;
|
682
|
+
Stream.simulate(e, t, n);
|
683
|
+
}, 400);
|
684
|
+
}
|
685
|
+
}]);
|
686
|
+
return C;
|
687
|
+
}();
|
688
|
+
_Demo.URL = "deep-chat-demo";
|
689
|
+
var Demo = _Demo;
|
609
690
|
var Stream = /*#__PURE__*/function () {
|
610
691
|
function Stream() {
|
611
692
|
_classCallCheck(this, Stream);
|
@@ -614,12 +695,12 @@ var Stream = /*#__PURE__*/function () {
|
|
614
695
|
key: "request",
|
615
696
|
value: // prettier-ignore
|
616
697
|
function () {
|
617
|
-
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
698
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, n) {
|
618
699
|
var s,
|
619
700
|
f,
|
620
701
|
b,
|
621
702
|
m,
|
622
|
-
|
703
|
+
g,
|
623
704
|
o,
|
624
705
|
_yield$RequestUtils$p,
|
625
706
|
a,
|
@@ -630,19 +711,19 @@ var Stream = /*#__PURE__*/function () {
|
|
630
711
|
d,
|
631
712
|
h,
|
632
713
|
p,
|
633
|
-
|
634
|
-
return _regeneratorRuntime().wrap(function
|
635
|
-
while (1) switch (
|
714
|
+
_args6 = arguments;
|
715
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
716
|
+
while (1) switch (_context6.prev = _context6.next) {
|
636
717
|
case 0:
|
637
|
-
s =
|
718
|
+
s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
|
638
719
|
o = {
|
639
720
|
body: t,
|
640
721
|
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
641
722
|
};
|
642
|
-
|
723
|
+
_context6.next = 4;
|
643
724
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
644
725
|
case 4:
|
645
|
-
_yield$RequestUtils$p =
|
726
|
+
_yield$RequestUtils$p = _context6.sent;
|
646
727
|
a = _yield$RequestUtils$p.body;
|
647
728
|
l = _yield$RequestUtils$p.headers;
|
648
729
|
c = _yield$RequestUtils$p.error;
|
@@ -651,77 +732,77 @@ var Stream = /*#__PURE__*/function () {
|
|
651
732
|
d = _e$streamHandlers.onClose;
|
652
733
|
h = _e$streamHandlers.abortStream;
|
653
734
|
if (!c) {
|
654
|
-
|
735
|
+
_context6.next = 14;
|
655
736
|
break;
|
656
737
|
}
|
657
|
-
return
|
738
|
+
return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
|
658
739
|
case 14:
|
659
740
|
if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
|
660
|
-
|
741
|
+
_context6.next = 16;
|
661
742
|
break;
|
662
743
|
}
|
663
|
-
return
|
744
|
+
return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
|
664
745
|
case 16:
|
665
746
|
p = null;
|
666
747
|
fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
|
667
|
-
method: ((
|
748
|
+
method: ((g = e.requestSettings) == null ? void 0 : g.method) || "POST",
|
668
749
|
headers: l,
|
669
750
|
body: s ? JSON.stringify(a) : a,
|
670
751
|
openWhenHidden: !0,
|
671
752
|
// keep stream open when browser tab not open
|
672
|
-
onopen: function onopen(
|
673
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
674
|
-
return _regeneratorRuntime().wrap(function
|
675
|
-
while (1) switch (
|
753
|
+
onopen: function onopen(v) {
|
754
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
755
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
756
|
+
while (1) switch (_context5.prev = _context5.next) {
|
676
757
|
case 0:
|
677
|
-
if (!
|
678
|
-
|
758
|
+
if (!v.ok) {
|
759
|
+
_context5.next = 2;
|
679
760
|
break;
|
680
761
|
}
|
681
|
-
return
|
762
|
+
return _context5.abrupt("return", (p = n.addNewStreamedMessage(), u()));
|
682
763
|
case 2:
|
683
|
-
|
684
|
-
return RequestUtils.processResponseByType(
|
764
|
+
_context5.next = 4;
|
765
|
+
return RequestUtils.processResponseByType(v);
|
685
766
|
case 4:
|
686
|
-
throw
|
767
|
+
throw _context5.sent;
|
687
768
|
case 5:
|
688
769
|
case "end":
|
689
|
-
return
|
770
|
+
return _context5.stop();
|
690
771
|
}
|
691
|
-
},
|
772
|
+
}, _callee5);
|
692
773
|
}))();
|
693
774
|
},
|
694
|
-
onmessage: function onmessage(
|
775
|
+
onmessage: function onmessage(v) {
|
695
776
|
var y;
|
696
|
-
if (JSON.stringify(
|
697
|
-
var
|
698
|
-
(y = e.extractResultData) == null || y.call(e,
|
699
|
-
(
|
700
|
-
})["catch"](function (
|
701
|
-
return RequestUtils.displayError(n,
|
777
|
+
if (JSON.stringify(v.data) !== JSON.stringify("[DONE]")) {
|
778
|
+
var _ = JSON.parse(v.data);
|
779
|
+
(y = e.extractResultData) == null || y.call(e, _).then(function (S) {
|
780
|
+
(S == null ? void 0 : S.text) === void 0 ? console.error("Response data: ".concat(v.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : p && n.updateStreamedMessage(S.text, p);
|
781
|
+
})["catch"](function (S) {
|
782
|
+
return RequestUtils.displayError(n, S);
|
702
783
|
});
|
703
784
|
}
|
704
785
|
},
|
705
|
-
onerror: function onerror(
|
706
|
-
throw d(),
|
786
|
+
onerror: function onerror(v) {
|
787
|
+
throw d(), v;
|
707
788
|
},
|
708
789
|
onclose: function onclose() {
|
709
790
|
n.finaliseStreamedMessage(), d();
|
710
791
|
},
|
711
792
|
signal: h.signal
|
712
|
-
})["catch"](function (
|
793
|
+
})["catch"](function (v) {
|
713
794
|
var y;
|
714
|
-
(y = e.extractResultData) == null || y.call(e,
|
715
|
-
RequestUtils.displayError(n,
|
716
|
-
})["catch"](function (
|
717
|
-
RequestUtils.displayError(n,
|
795
|
+
(y = e.extractResultData) == null || y.call(e, v).then(function () {
|
796
|
+
RequestUtils.displayError(n, v);
|
797
|
+
})["catch"](function (_) {
|
798
|
+
RequestUtils.displayError(n, _);
|
718
799
|
});
|
719
800
|
});
|
720
801
|
case 18:
|
721
802
|
case "end":
|
722
|
-
return
|
803
|
+
return _context6.stop();
|
723
804
|
}
|
724
|
-
},
|
805
|
+
}, _callee6);
|
725
806
|
}));
|
726
807
|
function request(_x8, _x9, _x10) {
|
727
808
|
return _request.apply(this, arguments);
|
@@ -765,89 +846,78 @@ var Stream = /*#__PURE__*/function () {
|
|
765
846
|
}]);
|
766
847
|
return Stream;
|
767
848
|
}();
|
768
|
-
var
|
769
|
-
function
|
770
|
-
_classCallCheck(this,
|
849
|
+
var CustomRequest = /*#__PURE__*/function () {
|
850
|
+
function CustomRequest() {
|
851
|
+
_classCallCheck(this, CustomRequest);
|
771
852
|
}
|
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 C.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
|
788
|
-
var n = e.messages.findIndex(function (s) {
|
789
|
-
return s.text;
|
790
|
-
});
|
791
|
-
return n !== -1 && t.splice(n, 1), t.length === 1 ? C.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
|
792
|
-
}
|
793
|
-
}, {
|
794
|
-
key: "getCustomResponse",
|
795
|
-
value: function getCustomResponse(e, t) {
|
796
|
-
return typeof e == "function" ? e(t) : e;
|
797
|
-
}
|
798
|
-
}, {
|
799
|
-
key: "getResponse",
|
800
|
-
value: function getResponse(e) {
|
801
|
-
return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
802
|
-
result: {
|
803
|
-
text: C.generateResponse(e)
|
804
|
-
}
|
805
|
-
};
|
806
|
-
}
|
807
|
-
// timeout is used to simulate a timeout for a response to come back
|
808
|
-
}, {
|
853
|
+
_createClass(CustomRequest, null, [{
|
809
854
|
key: "request",
|
810
|
-
value: function
|
811
|
-
var
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
while (1) switch (_context6.prev = _context6.next) {
|
855
|
+
value: function () {
|
856
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
|
857
|
+
var s, o;
|
858
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
859
|
+
while (1) switch (_context8.prev = _context8.next) {
|
816
860
|
case 0:
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
861
|
+
(o = (s = e.requestSettings).handler) == null || o.call(s, t).then( /*#__PURE__*/function () {
|
862
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(a) {
|
863
|
+
var u, d, l, c;
|
864
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
865
|
+
while (1) switch (_context7.prev = _context7.next) {
|
866
|
+
case 0:
|
867
|
+
if (e.extractResultData) {
|
868
|
+
_context7.next = 2;
|
869
|
+
break;
|
870
|
+
}
|
871
|
+
return _context7.abrupt("return");
|
872
|
+
case 2:
|
873
|
+
_context7.next = 4;
|
874
|
+
return (d = (u = e.deepChat).responseInterceptor) == null ? void 0 : d.call(u, a);
|
875
|
+
case 4:
|
876
|
+
_context7.t0 = _context7.sent;
|
877
|
+
if (_context7.t0) {
|
878
|
+
_context7.next = 7;
|
879
|
+
break;
|
880
|
+
}
|
881
|
+
_context7.t0 = a;
|
882
|
+
case 7:
|
883
|
+
l = _context7.t0;
|
884
|
+
_context7.next = 10;
|
885
|
+
return e.extractResultData(l);
|
886
|
+
case 10:
|
887
|
+
c = _context7.sent;
|
888
|
+
if (!(!c || _typeof(c) != "object")) {
|
889
|
+
_context7.next = 13;
|
890
|
+
break;
|
891
|
+
}
|
892
|
+
throw Error(ErrorMessages.INVALID_RESPONSE(a, "response", !!e.deepChat.responseInterceptor, c));
|
893
|
+
case 13:
|
894
|
+
e.deepChat.stream && c.text ? Stream.simulate(n, e.streamHandlers, c.text) : (n.addNewMessage(c, !0, !0), e.completionsHandlers.onFinish());
|
895
|
+
case 14:
|
896
|
+
case "end":
|
897
|
+
return _context7.stop();
|
898
|
+
}
|
899
|
+
}, _callee7);
|
900
|
+
}));
|
901
|
+
return function (_x14) {
|
902
|
+
return _ref2.apply(this, arguments);
|
903
|
+
};
|
904
|
+
}())["catch"](function (a) {
|
905
|
+
RequestUtils.displayError(n, a), e.completionsHandlers.onFinish();
|
906
|
+
});
|
907
|
+
case 1:
|
830
908
|
case "end":
|
831
|
-
return
|
909
|
+
return _context8.stop();
|
832
910
|
}
|
833
|
-
},
|
834
|
-
}))
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
setTimeout(function () {
|
841
|
-
var s, o;
|
842
|
-
var n = (o = (s = C.getResponse(e)) == null ? void 0 : s.result) == null ? void 0 : o.text;
|
843
|
-
Stream.simulate(e, t, n);
|
844
|
-
}, 400);
|
845
|
-
}
|
911
|
+
}, _callee8);
|
912
|
+
}));
|
913
|
+
function request(_x11, _x12, _x13) {
|
914
|
+
return _request2.apply(this, arguments);
|
915
|
+
}
|
916
|
+
return request;
|
917
|
+
}()
|
846
918
|
}]);
|
847
|
-
return
|
919
|
+
return CustomRequest;
|
848
920
|
}();
|
849
|
-
_Demo.URL = "deep-chat-demo";
|
850
|
-
var Demo = _Demo;
|
851
921
|
var HTTPRequest = /*#__PURE__*/function () {
|
852
922
|
function HTTPRequest() {
|
853
923
|
_classCallCheck(this, HTTPRequest);
|
@@ -856,12 +926,13 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
856
926
|
key: "request",
|
857
927
|
value: // prettier-ignore
|
858
928
|
function () {
|
859
|
-
var
|
929
|
+
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
|
860
930
|
var s,
|
861
931
|
h,
|
862
932
|
p,
|
863
933
|
f,
|
864
934
|
b,
|
935
|
+
m,
|
865
936
|
o,
|
866
937
|
_yield$RequestUtils$p2,
|
867
938
|
a,
|
@@ -869,104 +940,110 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
869
940
|
c,
|
870
941
|
u,
|
871
942
|
d,
|
872
|
-
|
873
|
-
return _regeneratorRuntime().wrap(function
|
874
|
-
while (1) switch (
|
943
|
+
_args10 = arguments;
|
944
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
945
|
+
while (1) switch (_context10.prev = _context10.next) {
|
875
946
|
case 0:
|
876
|
-
s =
|
947
|
+
s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
|
877
948
|
o = {
|
878
949
|
body: t,
|
879
950
|
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
880
951
|
};
|
881
|
-
|
952
|
+
_context10.next = 4;
|
882
953
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
883
954
|
case 4:
|
884
|
-
_yield$RequestUtils$p2 =
|
955
|
+
_yield$RequestUtils$p2 = _context10.sent;
|
885
956
|
a = _yield$RequestUtils$p2.body;
|
886
957
|
l = _yield$RequestUtils$p2.headers;
|
887
958
|
c = _yield$RequestUtils$p2.error;
|
888
959
|
u = e.completionsHandlers.onFinish;
|
889
960
|
if (!c) {
|
890
|
-
|
961
|
+
_context10.next = 11;
|
891
962
|
break;
|
892
963
|
}
|
893
|
-
return
|
964
|
+
return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
|
894
965
|
case 11:
|
895
|
-
if (!((
|
896
|
-
|
966
|
+
if (!((p = e.requestSettings) != null && p.handler)) {
|
967
|
+
_context10.next = 13;
|
897
968
|
break;
|
898
969
|
}
|
899
|
-
return
|
970
|
+
return _context10.abrupt("return", CustomRequest.request(e, a, n));
|
900
971
|
case 13:
|
972
|
+
if (!(((f = e.requestSettings) == null ? void 0 : f.url) === Demo.URL)) {
|
973
|
+
_context10.next = 15;
|
974
|
+
break;
|
975
|
+
}
|
976
|
+
return _context10.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
|
977
|
+
case 15:
|
901
978
|
d = !0;
|
902
|
-
fetch(((
|
903
|
-
method: ((
|
979
|
+
fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
|
980
|
+
method: ((m = e.requestSettings) == null ? void 0 : m.method) || "POST",
|
904
981
|
headers: l,
|
905
982
|
body: s ? JSON.stringify(a) : a
|
906
|
-
}).then(function (
|
907
|
-
return d = !!
|
908
|
-
}).then(function (
|
909
|
-
return RequestUtils.processResponseByType(
|
983
|
+
}).then(function (g) {
|
984
|
+
return d = !!g.ok, g;
|
985
|
+
}).then(function (g) {
|
986
|
+
return RequestUtils.processResponseByType(g);
|
910
987
|
}).then( /*#__PURE__*/function () {
|
911
|
-
var
|
912
|
-
var
|
913
|
-
return _regeneratorRuntime().wrap(function
|
914
|
-
while (1) switch (
|
988
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(g) {
|
989
|
+
var _, S, v, y;
|
990
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
991
|
+
while (1) switch (_context9.prev = _context9.next) {
|
915
992
|
case 0:
|
916
993
|
if (e.extractResultData) {
|
917
|
-
|
994
|
+
_context9.next = 2;
|
918
995
|
break;
|
919
996
|
}
|
920
|
-
return
|
997
|
+
return _context9.abrupt("return");
|
921
998
|
case 2:
|
922
|
-
|
923
|
-
return (S = (
|
999
|
+
_context9.next = 4;
|
1000
|
+
return (S = (_ = e.deepChat).responseInterceptor) == null ? void 0 : S.call(_, g);
|
924
1001
|
case 4:
|
925
|
-
|
926
|
-
if (
|
927
|
-
|
1002
|
+
_context9.t0 = _context9.sent;
|
1003
|
+
if (_context9.t0) {
|
1004
|
+
_context9.next = 7;
|
928
1005
|
break;
|
929
1006
|
}
|
930
|
-
|
1007
|
+
_context9.t0 = g;
|
931
1008
|
case 7:
|
932
|
-
v =
|
933
|
-
|
1009
|
+
v = _context9.t0;
|
1010
|
+
_context9.next = 10;
|
934
1011
|
return e.extractResultData(v);
|
935
1012
|
case 10:
|
936
|
-
|
1013
|
+
y = _context9.sent;
|
937
1014
|
if (d) {
|
938
|
-
|
1015
|
+
_context9.next = 13;
|
939
1016
|
break;
|
940
1017
|
}
|
941
|
-
throw
|
1018
|
+
throw g;
|
942
1019
|
case 13:
|
943
|
-
if (!(!
|
944
|
-
|
1020
|
+
if (!(!y || _typeof(y) != "object")) {
|
1021
|
+
_context9.next = 15;
|
945
1022
|
break;
|
946
1023
|
}
|
947
|
-
throw Error(ErrorMessages.INVALID_RESPONSE(
|
1024
|
+
throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
|
948
1025
|
case 15:
|
949
|
-
|
1026
|
+
y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
|
950
1027
|
case 16:
|
951
1028
|
case "end":
|
952
|
-
return
|
1029
|
+
return _context9.stop();
|
953
1030
|
}
|
954
|
-
},
|
1031
|
+
}, _callee9);
|
955
1032
|
}));
|
956
|
-
return function (
|
957
|
-
return
|
1033
|
+
return function (_x18) {
|
1034
|
+
return _ref3.apply(this, arguments);
|
958
1035
|
};
|
959
|
-
}())["catch"](function (
|
960
|
-
RequestUtils.displayError(n,
|
1036
|
+
}())["catch"](function (g) {
|
1037
|
+
RequestUtils.displayError(n, g), u();
|
961
1038
|
});
|
962
|
-
case
|
1039
|
+
case 17:
|
963
1040
|
case "end":
|
964
|
-
return
|
1041
|
+
return _context10.stop();
|
965
1042
|
}
|
966
|
-
},
|
1043
|
+
}, _callee10);
|
967
1044
|
}));
|
968
|
-
function request(
|
969
|
-
return
|
1045
|
+
function request(_x15, _x16, _x17) {
|
1046
|
+
return _request3.apply(this, arguments);
|
970
1047
|
}
|
971
1048
|
return request;
|
972
1049
|
}() // prettier-ignore
|
@@ -978,44 +1055,44 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
978
1055
|
fetch(t, n).then(function (a) {
|
979
1056
|
return a.json();
|
980
1057
|
}).then( /*#__PURE__*/function () {
|
981
|
-
var
|
1058
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(a) {
|
982
1059
|
var c, u, l;
|
983
|
-
return _regeneratorRuntime().wrap(function
|
984
|
-
while (1) switch (
|
1060
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
1061
|
+
while (1) switch (_context11.prev = _context11.next) {
|
985
1062
|
case 0:
|
986
1063
|
if (e.extractPollResultData) {
|
987
|
-
|
1064
|
+
_context11.next = 2;
|
988
1065
|
break;
|
989
1066
|
}
|
990
|
-
return
|
1067
|
+
return _context11.abrupt("return");
|
991
1068
|
case 2:
|
992
|
-
|
993
|
-
|
1069
|
+
_context11.t0 = e;
|
1070
|
+
_context11.next = 5;
|
994
1071
|
return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
|
995
1072
|
case 5:
|
996
|
-
|
997
|
-
if (
|
998
|
-
|
1073
|
+
_context11.t1 = _context11.sent;
|
1074
|
+
if (_context11.t1) {
|
1075
|
+
_context11.next = 8;
|
999
1076
|
break;
|
1000
1077
|
}
|
1001
|
-
|
1078
|
+
_context11.t1 = a;
|
1002
1079
|
case 8:
|
1003
|
-
|
1004
|
-
|
1005
|
-
return
|
1080
|
+
_context11.t2 = _context11.t1;
|
1081
|
+
_context11.next = 11;
|
1082
|
+
return _context11.t0.extractPollResultData.call(_context11.t0, _context11.t2);
|
1006
1083
|
case 11:
|
1007
|
-
l =
|
1084
|
+
l = _context11.sent;
|
1008
1085
|
l.timeoutMS ? setTimeout(function () {
|
1009
1086
|
HTTPRequest.executePollRequest(e, t, n, s);
|
1010
1087
|
}, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
|
1011
1088
|
case 13:
|
1012
1089
|
case "end":
|
1013
|
-
return
|
1090
|
+
return _context11.stop();
|
1014
1091
|
}
|
1015
|
-
},
|
1092
|
+
}, _callee11);
|
1016
1093
|
}));
|
1017
|
-
return function (
|
1018
|
-
return
|
1094
|
+
return function (_x19) {
|
1095
|
+
return _ref4.apply(this, arguments);
|
1019
1096
|
};
|
1020
1097
|
}())["catch"](function (a) {
|
1021
1098
|
RequestUtils.displayError(s, a), o();
|
@@ -1025,7 +1102,7 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1025
1102
|
}, {
|
1026
1103
|
key: "poll",
|
1027
1104
|
value: function () {
|
1028
|
-
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1105
|
+
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
|
1029
1106
|
var s,
|
1030
1107
|
f,
|
1031
1108
|
b,
|
@@ -1039,27 +1116,27 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1039
1116
|
d,
|
1040
1117
|
h,
|
1041
1118
|
p,
|
1042
|
-
|
1043
|
-
return _regeneratorRuntime().wrap(function
|
1044
|
-
while (1) switch (
|
1119
|
+
_args12 = arguments;
|
1120
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
1121
|
+
while (1) switch (_context12.prev = _context12.next) {
|
1045
1122
|
case 0:
|
1046
|
-
s =
|
1123
|
+
s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
|
1047
1124
|
o = {
|
1048
1125
|
body: t,
|
1049
1126
|
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
1050
1127
|
};
|
1051
|
-
|
1128
|
+
_context12.next = 4;
|
1052
1129
|
return RequestUtils.processResponseInterceptor(e.deepChat, o);
|
1053
1130
|
case 4:
|
1054
|
-
_yield$RequestUtils$p3 =
|
1131
|
+
_yield$RequestUtils$p3 = _context12.sent;
|
1055
1132
|
a = _yield$RequestUtils$p3.body;
|
1056
1133
|
l = _yield$RequestUtils$p3.headers;
|
1057
1134
|
c = _yield$RequestUtils$p3.error;
|
1058
1135
|
if (!c) {
|
1059
|
-
|
1136
|
+
_context12.next = 10;
|
1060
1137
|
break;
|
1061
1138
|
}
|
1062
|
-
return
|
1139
|
+
return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c));
|
1063
1140
|
case 10:
|
1064
1141
|
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
1142
|
method: d,
|
@@ -1069,11 +1146,11 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1069
1146
|
HTTPRequest.executePollRequest(e, u, p, n);
|
1070
1147
|
case 12:
|
1071
1148
|
case "end":
|
1072
|
-
return
|
1149
|
+
return _context12.stop();
|
1073
1150
|
}
|
1074
|
-
},
|
1151
|
+
}, _callee12);
|
1075
1152
|
}));
|
1076
|
-
function poll(
|
1153
|
+
function poll(_x20, _x21, _x22) {
|
1077
1154
|
return _poll.apply(this, arguments);
|
1078
1155
|
}
|
1079
1156
|
return poll;
|
@@ -1158,83 +1235,94 @@ var Websocket = /*#__PURE__*/function () {
|
|
1158
1235
|
}
|
1159
1236
|
_createClass(Websocket, null, [{
|
1160
1237
|
key: "setup",
|
1161
|
-
value: function setup(e
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1238
|
+
value: function setup(e) {
|
1239
|
+
e.requestSettings.url !== Demo.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
1240
|
+
}
|
1241
|
+
}, {
|
1242
|
+
key: "createConnection",
|
1243
|
+
value: function createConnection(e, t) {
|
1244
|
+
if (!document.body.contains(e.deepChat)) return;
|
1245
|
+
var n = e.requestSettings.websocket;
|
1246
|
+
if (n) try {
|
1247
|
+
var s = typeof n != "boolean" ? n : void 0;
|
1248
|
+
e.websocket = new WebSocket(e.requestSettings.url || "", s), e.websocket.onopen = function () {
|
1249
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, e.websocket, t);
|
1250
|
+
}, e.websocket.onerror = function (o) {
|
1251
|
+
console.error(o), Websocket.retryConnection(e, t);
|
1252
|
+
};
|
1253
|
+
} catch (s) {
|
1254
|
+
console.error(s), Websocket.retryConnection(e, t);
|
1169
1255
|
}
|
1170
1256
|
}
|
1171
1257
|
}, {
|
1172
|
-
key: "
|
1173
|
-
value: function
|
1174
|
-
|
1258
|
+
key: "retryConnection",
|
1259
|
+
value: function retryConnection(e, t) {
|
1260
|
+
document.body.contains(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
|
1261
|
+
Websocket.createConnection(e, t);
|
1262
|
+
}, 5e3));
|
1175
1263
|
}
|
1176
1264
|
}, {
|
1177
1265
|
key: "assignListeners",
|
1178
|
-
value: function assignListeners(e, t) {
|
1179
|
-
|
1180
|
-
var
|
1181
|
-
var
|
1182
|
-
return _regeneratorRuntime().wrap(function
|
1183
|
-
while (1) switch (
|
1266
|
+
value: function assignListeners(e, t, n) {
|
1267
|
+
t.onmessage = /*#__PURE__*/function () {
|
1268
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
|
1269
|
+
var o, a, l, c, u;
|
1270
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
1271
|
+
while (1) switch (_context13.prev = _context13.next) {
|
1184
1272
|
case 0:
|
1185
1273
|
if (!e.extractResultData) {
|
1186
|
-
|
1274
|
+
_context13.next = 20;
|
1187
1275
|
break;
|
1188
1276
|
}
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
return (
|
1277
|
+
_context13.prev = 1;
|
1278
|
+
l = JSON.parse(s.data);
|
1279
|
+
_context13.next = 5;
|
1280
|
+
return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
|
1193
1281
|
case 5:
|
1194
|
-
|
1195
|
-
if (
|
1196
|
-
|
1282
|
+
_context13.t0 = _context13.sent;
|
1283
|
+
if (_context13.t0) {
|
1284
|
+
_context13.next = 8;
|
1197
1285
|
break;
|
1198
1286
|
}
|
1199
|
-
|
1287
|
+
_context13.t0 = l;
|
1200
1288
|
case 8:
|
1201
|
-
|
1202
|
-
|
1203
|
-
return e.extractResultData(
|
1289
|
+
c = _context13.t0;
|
1290
|
+
_context13.next = 11;
|
1291
|
+
return e.extractResultData(c);
|
1204
1292
|
case 11:
|
1205
|
-
|
1206
|
-
if (!(!
|
1207
|
-
|
1293
|
+
u = _context13.sent;
|
1294
|
+
if (!(!u || _typeof(u) != "object")) {
|
1295
|
+
_context13.next = 14;
|
1208
1296
|
break;
|
1209
1297
|
}
|
1210
|
-
throw Error(ErrorMessages.INVALID_RESPONSE(
|
1298
|
+
throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
1211
1299
|
case 14:
|
1212
|
-
e.deepChat.stream &&
|
1213
|
-
|
1300
|
+
e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
|
1301
|
+
_context13.next = 20;
|
1214
1302
|
break;
|
1215
1303
|
case 17:
|
1216
|
-
|
1217
|
-
|
1218
|
-
RequestUtils.displayError(
|
1304
|
+
_context13.prev = 17;
|
1305
|
+
_context13.t1 = _context13["catch"](1);
|
1306
|
+
RequestUtils.displayError(n, _context13.t1, "Error in server message");
|
1219
1307
|
case 20:
|
1220
1308
|
case "end":
|
1221
|
-
return
|
1309
|
+
return _context13.stop();
|
1222
1310
|
}
|
1223
|
-
},
|
1311
|
+
}, _callee13, null, [[1, 17]]);
|
1224
1312
|
}));
|
1225
|
-
return function (
|
1226
|
-
return
|
1313
|
+
return function (_x23) {
|
1314
|
+
return _ref5.apply(this, arguments);
|
1227
1315
|
};
|
1228
|
-
}(),
|
1229
|
-
console.error(
|
1230
|
-
},
|
1231
|
-
console.error("Connection closed"),
|
1232
|
-
}
|
1316
|
+
}(), t.onerror = function (s) {
|
1317
|
+
console.error(s), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error");
|
1318
|
+
}, t.onclose = function () {
|
1319
|
+
console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
|
1320
|
+
};
|
1233
1321
|
}
|
1234
1322
|
}, {
|
1235
1323
|
key: "sendWebsocket",
|
1236
1324
|
value: function () {
|
1237
|
-
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1325
|
+
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
|
1238
1326
|
var o,
|
1239
1327
|
d,
|
1240
1328
|
h,
|
@@ -1243,42 +1331,42 @@ var Websocket = /*#__PURE__*/function () {
|
|
1243
1331
|
l,
|
1244
1332
|
c,
|
1245
1333
|
u,
|
1246
|
-
|
1247
|
-
return _regeneratorRuntime().wrap(function
|
1248
|
-
while (1) switch (
|
1334
|
+
_args14 = arguments;
|
1335
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
1336
|
+
while (1) switch (_context14.prev = _context14.next) {
|
1249
1337
|
case 0:
|
1250
|
-
o =
|
1338
|
+
o = _args14.length > 4 && _args14[4] !== undefined ? _args14[4] : !0;
|
1251
1339
|
a = {
|
1252
1340
|
body: n,
|
1253
1341
|
headers: (d = t.requestSettings) == null ? void 0 : d.headers
|
1254
1342
|
};
|
1255
|
-
|
1343
|
+
_context14.next = 4;
|
1256
1344
|
return RequestUtils.processResponseInterceptor(t.deepChat, a);
|
1257
1345
|
case 4:
|
1258
|
-
_yield$RequestUtils$p4 =
|
1346
|
+
_yield$RequestUtils$p4 = _context14.sent;
|
1259
1347
|
l = _yield$RequestUtils$p4.body;
|
1260
1348
|
c = _yield$RequestUtils$p4.error;
|
1261
1349
|
if (!c) {
|
1262
|
-
|
1350
|
+
_context14.next = 9;
|
1263
1351
|
break;
|
1264
1352
|
}
|
1265
|
-
return
|
1353
|
+
return _context14.abrupt("return", s.addNewErrorMessage("service", c));
|
1266
1354
|
case 9:
|
1267
1355
|
u = o ? JSON.stringify(l) : l;
|
1268
1356
|
if (!(((h = t.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
|
1269
|
-
|
1357
|
+
_context14.next = 12;
|
1270
1358
|
break;
|
1271
1359
|
}
|
1272
|
-
return
|
1360
|
+
return _context14.abrupt("return", Demo.request(s, t.completionsHandlers.onFinish, t.deepChat.responseInterceptor));
|
1273
1361
|
case 12:
|
1274
|
-
e.readyState !== e.OPEN ? (console.error("Connection is not open"), s.addNewErrorMessage("service", "Connection error")) : e.send(JSON.stringify(u));
|
1362
|
+
e.readyState === void 0 || e.readyState !== e.OPEN ? (console.error("Connection is not open"), s.isLastMessageError() || s.addNewErrorMessage("service", "Connection error")) : e.send(JSON.stringify(u));
|
1275
1363
|
case 13:
|
1276
1364
|
case "end":
|
1277
|
-
return
|
1365
|
+
return _context14.stop();
|
1278
1366
|
}
|
1279
|
-
},
|
1367
|
+
}, _callee14);
|
1280
1368
|
}));
|
1281
|
-
function sendWebsocket(
|
1369
|
+
function sendWebsocket(_x24, _x25, _x26, _x27) {
|
1282
1370
|
return _sendWebsocket.apply(this, arguments);
|
1283
1371
|
}
|
1284
1372
|
return sendWebsocket;
|
@@ -1722,7 +1810,7 @@ function normalizeLink(r) {
|
|
1722
1810
|
var e = replaceEntities(r);
|
1723
1811
|
try {
|
1724
1812
|
e = decodeURI(e);
|
1725
|
-
} catch (
|
1813
|
+
} catch (_unused2) {}
|
1726
1814
|
return encodeURI(e);
|
1727
1815
|
}
|
1728
1816
|
function parseLinkDestination(r, e) {
|
@@ -1938,24 +2026,24 @@ function replaceAt(r, e, t) {
|
|
1938
2026
|
return r.substr(0, e) + t + r.substr(e + 1);
|
1939
2027
|
}
|
1940
2028
|
function smartquotes(r) {
|
1941
|
-
var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m,
|
2029
|
+
var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, g, v;
|
1942
2030
|
if (r.options.typographer) {
|
1943
|
-
for (
|
1944
|
-
for (
|
1945
|
-
for (l =
|
1946
|
-
|
2031
|
+
for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
|
2032
|
+
for (g = r.tokens[m].children, v.length = 0, e = 0; e < g.length; e++) if (t = g[e], !(t.type !== "text" || QUOTE_TEST_RE.test(t.text))) {
|
2033
|
+
for (l = g[e].level, f = v.length - 1; f >= 0 && !(v[f].level <= l); f--);
|
2034
|
+
v.length = f + 1, n = t.content, o = 0, a = n.length;
|
1947
2035
|
e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
|
1948
2036
|
if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
|
1949
2037
|
b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
|
1950
2038
|
continue;
|
1951
2039
|
}
|
1952
2040
|
if (h = !u, p = !c, p) {
|
1953
|
-
for (f =
|
1954
|
-
d =
|
2041
|
+
for (f = v.length - 1; f >= 0 && (d = v[f], !(v[f].level < l)); f--) if (d.single === b && v[f].level === l) {
|
2042
|
+
d = v[f], b ? (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), v.length = f;
|
1955
2043
|
continue e;
|
1956
2044
|
}
|
1957
2045
|
}
|
1958
|
-
h ?
|
2046
|
+
h ? v.push({
|
1959
2047
|
token: e,
|
1960
2048
|
pos: s.index,
|
1961
2049
|
single: b,
|
@@ -2076,12 +2164,12 @@ function blockquote(r, e, t, n) {
|
|
2076
2164
|
f,
|
2077
2165
|
b,
|
2078
2166
|
m = r.bMarks[e] + r.tShift[e],
|
2079
|
-
|
2080
|
-
if (m >
|
2167
|
+
g = r.eMarks[e];
|
2168
|
+
if (m > g || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
|
2081
2169
|
if (n) return !0;
|
2082
|
-
for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m <
|
2170
|
+
for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m < g ? r.skipSpaces(m) : m, o = m >= g, a = [r.tShift[e]], r.tShift[e] = m - r.bMarks[e], h = r.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (m = r.bMarks[s] + r.tShift[s], g = r.eMarks[s], !(m >= g)); s++) {
|
2083
2171
|
if (r.src.charCodeAt(m++) === 62) {
|
2084
|
-
r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m <
|
2172
|
+
r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m < g ? r.skipSpaces(m) : m, o = m >= g, a.push(r.tShift[s]), r.tShift[s] = m - r.bMarks[s];
|
2085
2173
|
continue;
|
2086
2174
|
}
|
2087
2175
|
if (o) break;
|
@@ -2156,51 +2244,51 @@ function list(r, e, t, n) {
|
|
2156
2244
|
f,
|
2157
2245
|
b,
|
2158
2246
|
m,
|
2159
|
-
v,
|
2160
2247
|
g,
|
2248
|
+
v,
|
2161
2249
|
y,
|
2162
|
-
S,
|
2163
2250
|
_,
|
2251
|
+
S,
|
2164
2252
|
I,
|
2165
2253
|
R = !0,
|
2166
2254
|
w,
|
2167
2255
|
x,
|
2168
2256
|
H,
|
2169
2257
|
F;
|
2170
|
-
if ((h = skipOrderedListMarker(r, e)) >= 0)
|
2258
|
+
if ((h = skipOrderedListMarker(r, e)) >= 0) g = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) g = !1;else return !1;
|
2171
2259
|
if (r.level >= r.options.maxNesting) return !1;
|
2172
2260
|
if (m = r.src.charCodeAt(h - 1), n) return !0;
|
2173
|
-
for (y = r.tokens.length,
|
2261
|
+
for (y = r.tokens.length, g ? (d = r.bMarks[e] + r.tShift[e], b = Number(r.src.substr(d, h - d - 1)), r.tokens.push({
|
2174
2262
|
type: "ordered_list_open",
|
2175
2263
|
order: b,
|
2176
|
-
lines:
|
2264
|
+
lines: S = [e, 0],
|
2177
2265
|
level: r.level++
|
2178
2266
|
})) : r.tokens.push({
|
2179
2267
|
type: "bullet_list_open",
|
2180
|
-
lines:
|
2268
|
+
lines: S = [e, 0],
|
2181
2269
|
level: r.level++
|
2182
|
-
}), s = e,
|
2270
|
+
}), s = e, _ = !1, w = r.parser.ruler.getRules("list"); s < t && (v = r.skipSpaces(h), p = r.eMarks[s], v >= p ? f = 1 : f = v - h, f > 4 && (f = 1), f < 1 && (f = 1), o = h - r.bMarks[s] + f, r.tokens.push({
|
2183
2271
|
type: "list_item_open",
|
2184
2272
|
lines: I = [e, 0],
|
2185
2273
|
level: r.level++
|
2186
|
-
}), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] =
|
2274
|
+
}), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = v - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || _) && (R = !1), _ = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
|
2187
2275
|
type: "list_item_close",
|
2188
2276
|
level: --r.level
|
2189
|
-
}), s = e = r.line, I[1] = s,
|
2277
|
+
}), s = e = r.line, I[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
|
2190
2278
|
for (F = !1, x = 0, H = w.length; x < H; x++) if (w[x](r, s, t, !0)) {
|
2191
2279
|
F = !0;
|
2192
2280
|
break;
|
2193
2281
|
}
|
2194
2282
|
if (F) break;
|
2195
|
-
if (
|
2283
|
+
if (g) {
|
2196
2284
|
if (h = skipOrderedListMarker(r, s), h < 0) break;
|
2197
2285
|
} else if (h = skipBulletListMarker(r, s), h < 0) break;
|
2198
2286
|
if (m !== r.src.charCodeAt(h - 1)) break;
|
2199
2287
|
}
|
2200
2288
|
return r.tokens.push({
|
2201
|
-
type:
|
2289
|
+
type: g ? "ordered_list_close" : "bullet_list_close",
|
2202
2290
|
level: --r.level
|
2203
|
-
}),
|
2291
|
+
}), S[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
|
2204
2292
|
}
|
2205
2293
|
function footnote(r, e, t, n) {
|
2206
2294
|
var s,
|
@@ -2405,7 +2493,7 @@ function markTightParagraphs$1(r, e) {
|
|
2405
2493
|
for (t = e + 2, n = r.tokens.length - 2; t < n; t++) r.tokens[t].level === s && r.tokens[t].type === "paragraph_open" && (r.tokens[t + 2].tight = !0, r.tokens[t].tight = !0, t += 2);
|
2406
2494
|
}
|
2407
2495
|
function deflist(r, e, t, n) {
|
2408
|
-
var s, o, a, l, c, u, d, h, p, f, b, m,
|
2496
|
+
var s, o, a, l, c, u, d, h, p, f, b, m, g, v;
|
2409
2497
|
if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
|
2410
2498
|
if (d = e + 1, r.isEmpty(d) && ++d > t || r.tShift[d] < r.blkIndent || (s = skipMarker(r, d), s < 0) || r.level >= r.options.maxNesting) return !1;
|
2411
2499
|
u = r.tokens.length, r.tokens.push({
|
@@ -2414,7 +2502,7 @@ function deflist(r, e, t, n) {
|
|
2414
2502
|
level: r.level++
|
2415
2503
|
}), a = e, o = d;
|
2416
2504
|
e: for (;;) {
|
2417
|
-
for (
|
2505
|
+
for (v = !0, g = !1, r.tokens.push({
|
2418
2506
|
type: "dt_open",
|
2419
2507
|
lines: [a, a],
|
2420
2508
|
level: r.level++
|
@@ -2432,7 +2520,7 @@ function deflist(r, e, t, n) {
|
|
2432
2520
|
type: "dd_open",
|
2433
2521
|
lines: l = [d, 0],
|
2434
2522
|
level: r.level++
|
2435
|
-
}), m = r.tight, p = r.ddIndent, h = r.blkIndent, b = r.tShift[o], f = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight ||
|
2523
|
+
}), m = r.tight, p = r.ddIndent, h = r.blkIndent, b = r.tShift[o], f = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || g) && (v = !1), g = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = f, r.blkIndent = h, r.ddIndent = p, r.tokens.push({
|
2436
2524
|
type: "dd_close",
|
2437
2525
|
level: --r.level
|
2438
2526
|
}), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
|
@@ -2444,7 +2532,7 @@ function deflist(r, e, t, n) {
|
|
2444
2532
|
return r.tokens.push({
|
2445
2533
|
type: "dl_close",
|
2446
2534
|
level: --r.level
|
2447
|
-
}), c[1] = d, r.line = d,
|
2535
|
+
}), c[1] = d, r.line = d, v && markTightParagraphs$1(r, u), !0;
|
2448
2536
|
}
|
2449
2537
|
function paragraph(r, e) {
|
2450
2538
|
var t,
|
@@ -3169,12 +3257,12 @@ var RemarkableConfig = /*#__PURE__*/function () {
|
|
3169
3257
|
highlight: function highlight(t, n) {
|
3170
3258
|
if (n && e.getLanguage(n)) try {
|
3171
3259
|
return e.highlight(n, t).value;
|
3172
|
-
} catch (
|
3260
|
+
} catch (_unused3) {
|
3173
3261
|
console.error("failed to setup the highlight dependency");
|
3174
3262
|
}
|
3175
3263
|
try {
|
3176
3264
|
return e.highlightAuto(t).value;
|
3177
|
-
} catch (
|
3265
|
+
} catch (_unused4) {
|
3178
3266
|
console.error("failed to automatically highlight messages");
|
3179
3267
|
}
|
3180
3268
|
return "";
|
@@ -3308,7 +3396,7 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3308
3396
|
var _l$url;
|
3309
3397
|
_classCallCheck(this, BaseServiceIO);
|
3310
3398
|
var s, o, a, l;
|
3311
|
-
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = BaseServiceIO.canSendMessage, this.requestSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = n, Object.assign(this.rawBody, (s = e.request) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.totalMessagesMaxCharLength, this.maxMessages = (a = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : a.maxMessages, SetFileTypes.set(e, this, t), e.request && (this.requestSettings = e.request), this.demo && ((_l$url = (l = this.requestSettings).url) !== null && _l$url !== void 0 ? _l$url : l.url = Demo.URL), this._directServiceRequiresFiles = !!t && Object.keys(t).length > 0, this.requestSettings.websocket && Websocket.setup(this
|
3399
|
+
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = BaseServiceIO.canSendMessage, this.requestSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = n, Object.assign(this.rawBody, (s = e.request) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.totalMessagesMaxCharLength, this.maxMessages = (a = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : a.maxMessages, SetFileTypes.set(e, this, t), e.request && (this.requestSettings = e.request), this.demo && ((_l$url = (l = this.requestSettings).url) !== null && _l$url !== void 0 ? _l$url : l.url = Demo.URL), this._directServiceRequiresFiles = !!t && Object.keys(t).length > 0, this.requestSettings.websocket && Websocket.setup(this);
|
3312
3400
|
}
|
3313
3401
|
_createClass(BaseServiceIO, [{
|
3314
3402
|
key: "verifyKey",
|
@@ -3327,11 +3415,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3327
3415
|
}, {
|
3328
3416
|
key: "callServiceAPI",
|
3329
3417
|
value: function () {
|
3330
|
-
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3418
|
+
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t, n) {
|
3331
3419
|
var _c$headers, _u$ContentType;
|
3332
3420
|
var l, c, u, d, s, o, a;
|
3333
|
-
return _regeneratorRuntime().wrap(function
|
3334
|
-
while (1) switch (
|
3421
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
3422
|
+
while (1) switch (_context15.prev = _context15.next) {
|
3335
3423
|
case 0:
|
3336
3424
|
s = _objectSpread({
|
3337
3425
|
messages: t
|
@@ -3340,26 +3428,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3340
3428
|
(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);
|
3341
3429
|
a = this.deepChat.stream;
|
3342
3430
|
if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
|
3343
|
-
|
3431
|
+
_context15.next = 9;
|
3344
3432
|
break;
|
3345
3433
|
}
|
3346
|
-
|
3434
|
+
_context15.next = 7;
|
3347
3435
|
return Stream.request(this, s, e);
|
3348
3436
|
case 7:
|
3349
|
-
|
3437
|
+
_context15.next = 11;
|
3350
3438
|
break;
|
3351
3439
|
case 9:
|
3352
|
-
|
3440
|
+
_context15.next = 11;
|
3353
3441
|
return HTTPRequest.request(this, s, e);
|
3354
3442
|
case 11:
|
3355
3443
|
o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
|
3356
3444
|
case 12:
|
3357
3445
|
case "end":
|
3358
|
-
return
|
3446
|
+
return _context15.stop();
|
3359
3447
|
}
|
3360
|
-
},
|
3448
|
+
}, _callee15, this);
|
3361
3449
|
}));
|
3362
|
-
function callServiceAPI(
|
3450
|
+
function callServiceAPI(_x28, _x29, _x30) {
|
3363
3451
|
return _callServiceAPI.apply(this, arguments);
|
3364
3452
|
}
|
3365
3453
|
return callServiceAPI;
|
@@ -3367,24 +3455,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3367
3455
|
}, {
|
3368
3456
|
key: "callApiWithFiles",
|
3369
3457
|
value: function () {
|
3370
|
-
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3458
|
+
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n, s) {
|
3371
3459
|
var o, a, l;
|
3372
|
-
return _regeneratorRuntime().wrap(function
|
3373
|
-
while (1) switch (
|
3460
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
3461
|
+
while (1) switch (_context16.prev = _context16.next) {
|
3374
3462
|
case 0:
|
3375
3463
|
o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
|
3376
3464
|
this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
|
3377
|
-
|
3465
|
+
_context16.next = 4;
|
3378
3466
|
return HTTPRequest.request(this, o, t, !1);
|
3379
3467
|
case 4:
|
3380
3468
|
this.requestSettings = a;
|
3381
3469
|
case 5:
|
3382
3470
|
case "end":
|
3383
|
-
return
|
3471
|
+
return _context16.stop();
|
3384
3472
|
}
|
3385
|
-
},
|
3473
|
+
}, _callee16, this);
|
3386
3474
|
}));
|
3387
|
-
function callApiWithFiles(
|
3475
|
+
function callApiWithFiles(_x31, _x32, _x33, _x34) {
|
3388
3476
|
return _callApiWithFiles.apply(this, arguments);
|
3389
3477
|
}
|
3390
3478
|
return callApiWithFiles;
|
@@ -3392,13 +3480,13 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3392
3480
|
}, {
|
3393
3481
|
key: "callAPI",
|
3394
3482
|
value: function () {
|
3395
|
-
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3483
|
+
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t) {
|
3396
3484
|
var n, s;
|
3397
|
-
return _regeneratorRuntime().wrap(function
|
3398
|
-
while (1) switch (
|
3485
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
3486
|
+
while (1) switch (_context17.prev = _context17.next) {
|
3399
3487
|
case 0:
|
3400
3488
|
if (this.requestSettings) {
|
3401
|
-
|
3489
|
+
_context17.next = 2;
|
3402
3490
|
break;
|
3403
3491
|
}
|
3404
3492
|
throw new Error("Request settings have not been set up");
|
@@ -3412,36 +3500,37 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3412
3500
|
} else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
|
3413
3501
|
case 4:
|
3414
3502
|
case "end":
|
3415
|
-
return
|
3503
|
+
return _context17.stop();
|
3416
3504
|
}
|
3417
|
-
},
|
3505
|
+
}, _callee17, this);
|
3418
3506
|
}));
|
3419
|
-
function callAPI(
|
3507
|
+
function callAPI(_x35, _x36) {
|
3420
3508
|
return _callAPI.apply(this, arguments);
|
3421
3509
|
}
|
3422
3510
|
return callAPI;
|
3423
|
-
}()
|
3511
|
+
}() // WORK - validation to say that the response should have text, files or error property, link to example
|
3512
|
+
// and responseInterceptor
|
3424
3513
|
}, {
|
3425
3514
|
key: "extractResultData",
|
3426
3515
|
value: function () {
|
3427
|
-
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3428
|
-
return _regeneratorRuntime().wrap(function
|
3429
|
-
while (1) switch (
|
3516
|
+
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e) {
|
3517
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
3518
|
+
while (1) switch (_context18.prev = _context18.next) {
|
3430
3519
|
case 0:
|
3431
3520
|
if (!e.error) {
|
3432
|
-
|
3521
|
+
_context18.next = 2;
|
3433
3522
|
break;
|
3434
3523
|
}
|
3435
3524
|
throw e.error;
|
3436
3525
|
case 2:
|
3437
|
-
return
|
3526
|
+
return _context18.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
|
3438
3527
|
case 3:
|
3439
3528
|
case "end":
|
3440
|
-
return
|
3529
|
+
return _context18.stop();
|
3441
3530
|
}
|
3442
|
-
},
|
3531
|
+
}, _callee18);
|
3443
3532
|
}));
|
3444
|
-
function extractResultData(
|
3533
|
+
function extractResultData(_x37) {
|
3445
3534
|
return _extractResultData.apply(this, arguments);
|
3446
3535
|
}
|
3447
3536
|
return extractResultData;
|
@@ -3782,17 +3871,17 @@ var HuggingFaceUtils = /*#__PURE__*/function () {
|
|
3782
3871
|
return HuggingFaceUtils;
|
3783
3872
|
}();
|
3784
3873
|
var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
3785
|
-
_inherits(
|
3786
|
-
var _super3 = _createSuper(
|
3874
|
+
_inherits(j, _DirectServiceIO);
|
3875
|
+
var _super3 = _createSuper(j);
|
3787
3876
|
// prettier-ignore
|
3788
|
-
function
|
3877
|
+
function j(e, t, n, s, o, a) {
|
3789
3878
|
var _this4;
|
3790
|
-
_classCallCheck(this,
|
3791
|
-
_this4 = _super3.call(this, e, HuggingFaceUtils.buildKeyVerificationDetails(), HuggingFaceUtils.buildHeaders, o, a), _this4.insertKeyPlaceholderText = "Hugging Face Token", _this4.getKeyLink = "https://huggingface.co/settings/tokens", _this4.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this4.permittedErrorPrefixes = ["Authorization header"], _this4.url = "".concat(
|
3879
|
+
_classCallCheck(this, j);
|
3880
|
+
_this4 = _super3.call(this, e, HuggingFaceUtils.buildKeyVerificationDetails(), HuggingFaceUtils.buildHeaders, o, a), _this4.insertKeyPlaceholderText = "Hugging Face Token", _this4.getKeyLink = "https://huggingface.co/settings/tokens", _this4.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this4.permittedErrorPrefixes = ["Authorization header"], _this4.url = "".concat(j.URL_PREFIX).concat(n), _this4.textInputPlaceholderText = t, _typeof(s) == "object" && (s.model && (_this4.url = "".concat(j.URL_PREFIX).concat(s.model)), s.options && (_this4.rawBody.options = s.options), s.parameters && (_this4.rawBody.parameters = s.parameters));
|
3792
3881
|
return _this4;
|
3793
3882
|
}
|
3794
3883
|
// prettier-ignore
|
3795
|
-
_createClass(
|
3884
|
+
_createClass(j, [{
|
3796
3885
|
key: "preprocessBody",
|
3797
3886
|
value: function preprocessBody(e, t, n) {
|
3798
3887
|
var _s$options;
|
@@ -3805,13 +3894,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3805
3894
|
}, {
|
3806
3895
|
key: "callServiceAPI",
|
3807
3896
|
value: function () {
|
3808
|
-
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3897
|
+
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t, n) {
|
3809
3898
|
var s;
|
3810
|
-
return _regeneratorRuntime().wrap(function
|
3811
|
-
while (1) switch (
|
3899
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
3900
|
+
while (1) switch (_context19.prev = _context19.next) {
|
3812
3901
|
case 0:
|
3813
3902
|
if (this.requestSettings) {
|
3814
|
-
|
3903
|
+
_context19.next = 2;
|
3815
3904
|
break;
|
3816
3905
|
}
|
3817
3906
|
throw new Error("Request settings have not been set up");
|
@@ -3820,17 +3909,17 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
3820
3909
|
HTTPRequest.request(this, s, e);
|
3821
3910
|
case 4:
|
3822
3911
|
case "end":
|
3823
|
-
return
|
3912
|
+
return _context19.stop();
|
3824
3913
|
}
|
3825
|
-
},
|
3914
|
+
}, _callee19, this);
|
3826
3915
|
}));
|
3827
|
-
function callServiceAPI(
|
3916
|
+
function callServiceAPI(_x38, _x39, _x40) {
|
3828
3917
|
return _callServiceAPI2.apply(this, arguments);
|
3829
3918
|
}
|
3830
3919
|
return callServiceAPI;
|
3831
3920
|
}()
|
3832
3921
|
}]);
|
3833
|
-
return
|
3922
|
+
return j;
|
3834
3923
|
}(DirectServiceIO);
|
3835
3924
|
_HuggingFaceIO.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
3836
3925
|
var HuggingFaceIO = _HuggingFaceIO;
|
@@ -3853,18 +3942,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
3853
3942
|
}, {
|
3854
3943
|
key: "callServiceAPI",
|
3855
3944
|
value: function () {
|
3856
|
-
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3857
|
-
return _regeneratorRuntime().wrap(function
|
3858
|
-
while (1) switch (
|
3945
|
+
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e, t, n) {
|
3946
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
3947
|
+
while (1) switch (_context20.prev = _context20.next) {
|
3859
3948
|
case 0:
|
3860
3949
|
if (this.requestSettings) {
|
3861
|
-
|
3950
|
+
_context20.next = 2;
|
3862
3951
|
break;
|
3863
3952
|
}
|
3864
3953
|
throw new Error("Request settings have not been set up");
|
3865
3954
|
case 2:
|
3866
3955
|
if (n != null && n[0]) {
|
3867
|
-
|
3956
|
+
_context20.next = 4;
|
3868
3957
|
break;
|
3869
3958
|
}
|
3870
3959
|
throw new Error("No file was added");
|
@@ -3872,11 +3961,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
3872
3961
|
HTTPRequest.poll(this, n[0], e, !1);
|
3873
3962
|
case 5:
|
3874
3963
|
case "end":
|
3875
|
-
return
|
3964
|
+
return _context20.stop();
|
3876
3965
|
}
|
3877
|
-
},
|
3966
|
+
}, _callee20, this);
|
3878
3967
|
}));
|
3879
|
-
function callServiceAPI(
|
3968
|
+
function callServiceAPI(_x41, _x42, _x43) {
|
3880
3969
|
return _callServiceAPI3.apply(this, arguments);
|
3881
3970
|
}
|
3882
3971
|
return callServiceAPI;
|
@@ -3905,35 +3994,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
3905
3994
|
_createClass(HuggingFaceAudioClassificationIO, [{
|
3906
3995
|
key: "extractPollResultData",
|
3907
3996
|
value: function () {
|
3908
|
-
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3997
|
+
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e) {
|
3909
3998
|
var t;
|
3910
|
-
return _regeneratorRuntime().wrap(function
|
3911
|
-
while (1) switch (
|
3999
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
4000
|
+
while (1) switch (_context21.prev = _context21.next) {
|
3912
4001
|
case 0:
|
3913
4002
|
if (!e.estimated_time) {
|
3914
|
-
|
4003
|
+
_context21.next = 2;
|
3915
4004
|
break;
|
3916
4005
|
}
|
3917
|
-
return
|
4006
|
+
return _context21.abrupt("return", {
|
3918
4007
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
3919
4008
|
});
|
3920
4009
|
case 2:
|
3921
4010
|
if (!e.error) {
|
3922
|
-
|
4011
|
+
_context21.next = 4;
|
3923
4012
|
break;
|
3924
4013
|
}
|
3925
4014
|
throw e.error;
|
3926
4015
|
case 4:
|
3927
|
-
return
|
4016
|
+
return _context21.abrupt("return", {
|
3928
4017
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
3929
4018
|
});
|
3930
4019
|
case 5:
|
3931
4020
|
case "end":
|
3932
|
-
return
|
4021
|
+
return _context21.stop();
|
3933
4022
|
}
|
3934
|
-
},
|
4023
|
+
}, _callee21);
|
3935
4024
|
}));
|
3936
|
-
function extractPollResultData(
|
4025
|
+
function extractPollResultData(_x44) {
|
3937
4026
|
return _extractPollResultData.apply(this, arguments);
|
3938
4027
|
}
|
3939
4028
|
return extractPollResultData;
|
@@ -3956,35 +4045,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
3956
4045
|
_createClass(HuggingFaceImageClassificationIO, [{
|
3957
4046
|
key: "extractPollResultData",
|
3958
4047
|
value: function () {
|
3959
|
-
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4048
|
+
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
|
3960
4049
|
var t;
|
3961
|
-
return _regeneratorRuntime().wrap(function
|
3962
|
-
while (1) switch (
|
4050
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
4051
|
+
while (1) switch (_context22.prev = _context22.next) {
|
3963
4052
|
case 0:
|
3964
4053
|
if (!e.estimated_time) {
|
3965
|
-
|
4054
|
+
_context22.next = 2;
|
3966
4055
|
break;
|
3967
4056
|
}
|
3968
|
-
return
|
4057
|
+
return _context22.abrupt("return", {
|
3969
4058
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
3970
4059
|
});
|
3971
4060
|
case 2:
|
3972
4061
|
if (!e.error) {
|
3973
|
-
|
4062
|
+
_context22.next = 4;
|
3974
4063
|
break;
|
3975
4064
|
}
|
3976
4065
|
throw e.error;
|
3977
4066
|
case 4:
|
3978
|
-
return
|
4067
|
+
return _context22.abrupt("return", {
|
3979
4068
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
3980
4069
|
});
|
3981
4070
|
case 5:
|
3982
4071
|
case "end":
|
3983
|
-
return
|
4072
|
+
return _context22.stop();
|
3984
4073
|
}
|
3985
|
-
},
|
4074
|
+
}, _callee22);
|
3986
4075
|
}));
|
3987
|
-
function extractPollResultData(
|
4076
|
+
function extractPollResultData(_x45) {
|
3988
4077
|
return _extractPollResultData2.apply(this, arguments);
|
3989
4078
|
}
|
3990
4079
|
return extractPollResultData;
|
@@ -4069,19 +4158,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4069
4158
|
}, {
|
4070
4159
|
key: "callServiceAPI",
|
4071
4160
|
value: function () {
|
4072
|
-
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4161
|
+
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
|
4073
4162
|
var s;
|
4074
|
-
return _regeneratorRuntime().wrap(function
|
4075
|
-
while (1) switch (
|
4163
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
4164
|
+
while (1) switch (_context23.prev = _context23.next) {
|
4076
4165
|
case 0:
|
4077
4166
|
if (this.requestSettings) {
|
4078
|
-
|
4167
|
+
_context23.next = 2;
|
4079
4168
|
break;
|
4080
4169
|
}
|
4081
4170
|
throw new Error("Request settings have not been set up");
|
4082
4171
|
case 2:
|
4083
4172
|
if (n) {
|
4084
|
-
|
4173
|
+
_context23.next = 4;
|
4085
4174
|
break;
|
4086
4175
|
}
|
4087
4176
|
throw new Error("Image was not found");
|
@@ -4090,11 +4179,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4090
4179
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
4091
4180
|
case 6:
|
4092
4181
|
case "end":
|
4093
|
-
return
|
4182
|
+
return _context23.stop();
|
4094
4183
|
}
|
4095
|
-
},
|
4184
|
+
}, _callee23, this);
|
4096
4185
|
}));
|
4097
|
-
function callServiceAPI(
|
4186
|
+
function callServiceAPI(_x46, _x47, _x48) {
|
4098
4187
|
return _callServiceAPI4.apply(this, arguments);
|
4099
4188
|
}
|
4100
4189
|
return callServiceAPI;
|
@@ -4102,17 +4191,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4102
4191
|
}, {
|
4103
4192
|
key: "extractResultData",
|
4104
4193
|
value: function () {
|
4105
|
-
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4106
|
-
return _regeneratorRuntime().wrap(function
|
4107
|
-
while (1) switch (
|
4194
|
+
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
|
4195
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
4196
|
+
while (1) switch (_context24.prev = _context24.next) {
|
4108
4197
|
case 0:
|
4109
4198
|
if (!e.message) {
|
4110
|
-
|
4199
|
+
_context24.next = 2;
|
4111
4200
|
break;
|
4112
4201
|
}
|
4113
4202
|
throw e.message;
|
4114
4203
|
case 2:
|
4115
|
-
return
|
4204
|
+
return _context24.abrupt("return", {
|
4116
4205
|
files: e.artifacts.map(function (n) {
|
4117
4206
|
return {
|
4118
4207
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4122,11 +4211,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4122
4211
|
});
|
4123
4212
|
case 3:
|
4124
4213
|
case "end":
|
4125
|
-
return
|
4214
|
+
return _context24.stop();
|
4126
4215
|
}
|
4127
|
-
},
|
4216
|
+
}, _callee24);
|
4128
4217
|
}));
|
4129
|
-
function extractResultData(
|
4218
|
+
function extractResultData(_x49) {
|
4130
4219
|
return _extractResultData2.apply(this, arguments);
|
4131
4220
|
}
|
4132
4221
|
return extractResultData;
|
@@ -4178,19 +4267,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4178
4267
|
}, {
|
4179
4268
|
key: "callServiceAPI",
|
4180
4269
|
value: function () {
|
4181
|
-
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4270
|
+
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
|
4182
4271
|
var a, l, s, o;
|
4183
|
-
return _regeneratorRuntime().wrap(function
|
4184
|
-
while (1) switch (
|
4272
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
4273
|
+
while (1) switch (_context25.prev = _context25.next) {
|
4185
4274
|
case 0:
|
4186
4275
|
if (this.requestSettings) {
|
4187
|
-
|
4276
|
+
_context25.next = 2;
|
4188
4277
|
break;
|
4189
4278
|
}
|
4190
4279
|
throw new Error("Request settings have not been set up");
|
4191
4280
|
case 2:
|
4192
4281
|
if (!(!n || !n[0] || !n[1])) {
|
4193
|
-
|
4282
|
+
_context25.next = 4;
|
4194
4283
|
break;
|
4195
4284
|
}
|
4196
4285
|
throw new Error("Image was not found");
|
@@ -4199,11 +4288,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4199
4288
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4200
4289
|
case 6:
|
4201
4290
|
case "end":
|
4202
|
-
return
|
4291
|
+
return _context25.stop();
|
4203
4292
|
}
|
4204
|
-
},
|
4293
|
+
}, _callee25, this);
|
4205
4294
|
}));
|
4206
|
-
function callServiceAPI(
|
4295
|
+
function callServiceAPI(_x50, _x51, _x52) {
|
4207
4296
|
return _callServiceAPI5.apply(this, arguments);
|
4208
4297
|
}
|
4209
4298
|
return callServiceAPI;
|
@@ -4211,17 +4300,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4211
4300
|
}, {
|
4212
4301
|
key: "extractResultData",
|
4213
4302
|
value: function () {
|
4214
|
-
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4215
|
-
return _regeneratorRuntime().wrap(function
|
4216
|
-
while (1) switch (
|
4303
|
+
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
|
4304
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
4305
|
+
while (1) switch (_context26.prev = _context26.next) {
|
4217
4306
|
case 0:
|
4218
4307
|
if (!e.message) {
|
4219
|
-
|
4308
|
+
_context26.next = 2;
|
4220
4309
|
break;
|
4221
4310
|
}
|
4222
4311
|
throw e.message;
|
4223
4312
|
case 2:
|
4224
|
-
return
|
4313
|
+
return _context26.abrupt("return", {
|
4225
4314
|
files: e.artifacts.map(function (n) {
|
4226
4315
|
return {
|
4227
4316
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4231,11 +4320,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4231
4320
|
});
|
4232
4321
|
case 3:
|
4233
4322
|
case "end":
|
4234
|
-
return
|
4323
|
+
return _context26.stop();
|
4235
4324
|
}
|
4236
|
-
},
|
4325
|
+
}, _callee26);
|
4237
4326
|
}));
|
4238
|
-
function extractResultData(
|
4327
|
+
function extractResultData(_x53) {
|
4239
4328
|
return _extractResultData3.apply(this, arguments);
|
4240
4329
|
}
|
4241
4330
|
return extractResultData;
|
@@ -4268,34 +4357,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
|
|
4268
4357
|
_createClass(HuggingFaceAudioRecognitionIO, [{
|
4269
4358
|
key: "extractPollResultData",
|
4270
4359
|
value: function () {
|
4271
|
-
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4272
|
-
return _regeneratorRuntime().wrap(function
|
4273
|
-
while (1) switch (
|
4360
|
+
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
|
4361
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
4362
|
+
while (1) switch (_context27.prev = _context27.next) {
|
4274
4363
|
case 0:
|
4275
4364
|
if (!e.estimated_time) {
|
4276
|
-
|
4365
|
+
_context27.next = 2;
|
4277
4366
|
break;
|
4278
4367
|
}
|
4279
|
-
return
|
4368
|
+
return _context27.abrupt("return", {
|
4280
4369
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4281
4370
|
});
|
4282
4371
|
case 2:
|
4283
4372
|
if (!e.error) {
|
4284
|
-
|
4373
|
+
_context27.next = 4;
|
4285
4374
|
break;
|
4286
4375
|
}
|
4287
4376
|
throw e.error;
|
4288
4377
|
case 4:
|
4289
|
-
return
|
4378
|
+
return _context27.abrupt("return", {
|
4290
4379
|
text: e.text || ""
|
4291
4380
|
});
|
4292
4381
|
case 5:
|
4293
4382
|
case "end":
|
4294
|
-
return
|
4383
|
+
return _context27.stop();
|
4295
4384
|
}
|
4296
|
-
},
|
4385
|
+
}, _callee27);
|
4297
4386
|
}));
|
4298
|
-
function extractPollResultData(
|
4387
|
+
function extractPollResultData(_x54) {
|
4299
4388
|
return _extractPollResultData3.apply(this, arguments);
|
4300
4389
|
}
|
4301
4390
|
return extractPollResultData;
|
@@ -4316,26 +4405,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
|
|
4316
4405
|
_createClass(HuggingFaceTextGenerationIO, [{
|
4317
4406
|
key: "extractResultData",
|
4318
4407
|
value: function () {
|
4319
|
-
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4320
|
-
return _regeneratorRuntime().wrap(function
|
4321
|
-
while (1) switch (
|
4408
|
+
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
|
4409
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
4410
|
+
while (1) switch (_context28.prev = _context28.next) {
|
4322
4411
|
case 0:
|
4323
4412
|
if (!e.error) {
|
4324
|
-
|
4413
|
+
_context28.next = 2;
|
4325
4414
|
break;
|
4326
4415
|
}
|
4327
4416
|
throw e.error;
|
4328
4417
|
case 2:
|
4329
|
-
return
|
4418
|
+
return _context28.abrupt("return", {
|
4330
4419
|
text: e[0].generated_text || ""
|
4331
4420
|
});
|
4332
4421
|
case 3:
|
4333
4422
|
case "end":
|
4334
|
-
return
|
4423
|
+
return _context28.stop();
|
4335
4424
|
}
|
4336
|
-
},
|
4425
|
+
}, _callee28);
|
4337
4426
|
}));
|
4338
|
-
function extractResultData(
|
4427
|
+
function extractResultData(_x55) {
|
4339
4428
|
return _extractResultData4.apply(this, arguments);
|
4340
4429
|
}
|
4341
4430
|
return extractResultData;
|
@@ -4372,26 +4461,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
|
|
4372
4461
|
}, {
|
4373
4462
|
key: "extractResultData",
|
4374
4463
|
value: function () {
|
4375
|
-
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4376
|
-
return _regeneratorRuntime().wrap(function
|
4377
|
-
while (1) switch (
|
4464
|
+
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
|
4465
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
4466
|
+
while (1) switch (_context29.prev = _context29.next) {
|
4378
4467
|
case 0:
|
4379
4468
|
if (!e.error) {
|
4380
|
-
|
4469
|
+
_context29.next = 2;
|
4381
4470
|
break;
|
4382
4471
|
}
|
4383
4472
|
throw e.error;
|
4384
4473
|
case 2:
|
4385
|
-
return
|
4474
|
+
return _context29.abrupt("return", {
|
4386
4475
|
text: e.answer || ""
|
4387
4476
|
});
|
4388
4477
|
case 3:
|
4389
4478
|
case "end":
|
4390
|
-
return
|
4479
|
+
return _context29.stop();
|
4391
4480
|
}
|
4392
|
-
},
|
4481
|
+
}, _callee29);
|
4393
4482
|
}));
|
4394
|
-
function extractResultData(
|
4483
|
+
function extractResultData(_x56) {
|
4395
4484
|
return _extractResultData5.apply(this, arguments);
|
4396
4485
|
}
|
4397
4486
|
return extractResultData;
|
@@ -4412,26 +4501,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
|
|
4412
4501
|
_createClass(HuggingFaceSummarizationIO, [{
|
4413
4502
|
key: "extractResultData",
|
4414
4503
|
value: function () {
|
4415
|
-
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4416
|
-
return _regeneratorRuntime().wrap(function
|
4417
|
-
while (1) switch (
|
4504
|
+
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
|
4505
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
4506
|
+
while (1) switch (_context30.prev = _context30.next) {
|
4418
4507
|
case 0:
|
4419
4508
|
if (!e.error) {
|
4420
|
-
|
4509
|
+
_context30.next = 2;
|
4421
4510
|
break;
|
4422
4511
|
}
|
4423
4512
|
throw e.error;
|
4424
4513
|
case 2:
|
4425
|
-
return
|
4514
|
+
return _context30.abrupt("return", {
|
4426
4515
|
text: e[0].summary_text || ""
|
4427
4516
|
});
|
4428
4517
|
case 3:
|
4429
4518
|
case "end":
|
4430
|
-
return
|
4519
|
+
return _context30.stop();
|
4431
4520
|
}
|
4432
|
-
},
|
4521
|
+
}, _callee30);
|
4433
4522
|
}));
|
4434
|
-
function extractResultData(
|
4523
|
+
function extractResultData(_x57) {
|
4435
4524
|
return _extractResultData6.apply(this, arguments);
|
4436
4525
|
}
|
4437
4526
|
return extractResultData;
|
@@ -4492,26 +4581,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
|
|
4492
4581
|
}, {
|
4493
4582
|
key: "extractResultData",
|
4494
4583
|
value: function () {
|
4495
|
-
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4496
|
-
return _regeneratorRuntime().wrap(function
|
4497
|
-
while (1) switch (
|
4584
|
+
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
|
4585
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
4586
|
+
while (1) switch (_context31.prev = _context31.next) {
|
4498
4587
|
case 0:
|
4499
4588
|
if (!e.error) {
|
4500
|
-
|
4589
|
+
_context31.next = 2;
|
4501
4590
|
break;
|
4502
4591
|
}
|
4503
4592
|
throw e.error;
|
4504
4593
|
case 2:
|
4505
|
-
return
|
4594
|
+
return _context31.abrupt("return", {
|
4506
4595
|
text: e.generated_text || ""
|
4507
4596
|
});
|
4508
4597
|
case 3:
|
4509
4598
|
case "end":
|
4510
|
-
return
|
4599
|
+
return _context31.stop();
|
4511
4600
|
}
|
4512
|
-
},
|
4601
|
+
}, _callee31);
|
4513
4602
|
}));
|
4514
|
-
function extractResultData(
|
4603
|
+
function extractResultData(_x58) {
|
4515
4604
|
return _extractResultData7.apply(this, arguments);
|
4516
4605
|
}
|
4517
4606
|
return extractResultData;
|
@@ -4553,19 +4642,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4553
4642
|
}, {
|
4554
4643
|
key: "callServiceAPI",
|
4555
4644
|
value: function () {
|
4556
|
-
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4645
|
+
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e, t, n) {
|
4557
4646
|
var a, l, s, o;
|
4558
|
-
return _regeneratorRuntime().wrap(function
|
4559
|
-
while (1) switch (
|
4647
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
4648
|
+
while (1) switch (_context32.prev = _context32.next) {
|
4560
4649
|
case 0:
|
4561
4650
|
if (this.requestSettings) {
|
4562
|
-
|
4651
|
+
_context32.next = 2;
|
4563
4652
|
break;
|
4564
4653
|
}
|
4565
4654
|
throw new Error("Request settings have not been set up");
|
4566
4655
|
case 2:
|
4567
4656
|
if (n) {
|
4568
|
-
|
4657
|
+
_context32.next = 4;
|
4569
4658
|
break;
|
4570
4659
|
}
|
4571
4660
|
throw new Error("Image was not found");
|
@@ -4574,11 +4663,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4574
4663
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4575
4664
|
case 6:
|
4576
4665
|
case "end":
|
4577
|
-
return
|
4666
|
+
return _context32.stop();
|
4578
4667
|
}
|
4579
|
-
},
|
4668
|
+
}, _callee32, this);
|
4580
4669
|
}));
|
4581
|
-
function callServiceAPI(
|
4670
|
+
function callServiceAPI(_x59, _x60, _x61) {
|
4582
4671
|
return _callServiceAPI6.apply(this, arguments);
|
4583
4672
|
}
|
4584
4673
|
return callServiceAPI;
|
@@ -4586,17 +4675,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4586
4675
|
}, {
|
4587
4676
|
key: "extractResultData",
|
4588
4677
|
value: function () {
|
4589
|
-
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4590
|
-
return _regeneratorRuntime().wrap(function
|
4591
|
-
while (1) switch (
|
4678
|
+
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e) {
|
4679
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
4680
|
+
while (1) switch (_context33.prev = _context33.next) {
|
4592
4681
|
case 0:
|
4593
4682
|
if (!e.message) {
|
4594
|
-
|
4683
|
+
_context33.next = 2;
|
4595
4684
|
break;
|
4596
4685
|
}
|
4597
4686
|
throw e.message;
|
4598
4687
|
case 2:
|
4599
|
-
return
|
4688
|
+
return _context33.abrupt("return", {
|
4600
4689
|
files: e.artifacts.map(function (n) {
|
4601
4690
|
return {
|
4602
4691
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4606,11 +4695,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4606
4695
|
});
|
4607
4696
|
case 3:
|
4608
4697
|
case "end":
|
4609
|
-
return
|
4698
|
+
return _context33.stop();
|
4610
4699
|
}
|
4611
|
-
},
|
4700
|
+
}, _callee33);
|
4612
4701
|
}));
|
4613
|
-
function extractResultData(
|
4702
|
+
function extractResultData(_x62) {
|
4614
4703
|
return _extractResultData8.apply(this, arguments);
|
4615
4704
|
}
|
4616
4705
|
return extractResultData;
|
@@ -4641,26 +4730,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
|
|
4641
4730
|
_createClass(HuggingFaceTranslationIO, [{
|
4642
4731
|
key: "extractResultData",
|
4643
4732
|
value: function () {
|
4644
|
-
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4645
|
-
return _regeneratorRuntime().wrap(function
|
4646
|
-
while (1) switch (
|
4733
|
+
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
|
4734
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
4735
|
+
while (1) switch (_context34.prev = _context34.next) {
|
4647
4736
|
case 0:
|
4648
4737
|
if (!e.error) {
|
4649
|
-
|
4738
|
+
_context34.next = 2;
|
4650
4739
|
break;
|
4651
4740
|
}
|
4652
4741
|
throw e.error;
|
4653
4742
|
case 2:
|
4654
|
-
return
|
4743
|
+
return _context34.abrupt("return", {
|
4655
4744
|
text: e[0].translation_text || ""
|
4656
4745
|
});
|
4657
4746
|
case 3:
|
4658
4747
|
case "end":
|
4659
|
-
return
|
4748
|
+
return _context34.stop();
|
4660
4749
|
}
|
4661
|
-
},
|
4750
|
+
}, _callee34);
|
4662
4751
|
}));
|
4663
|
-
function extractResultData(
|
4752
|
+
function extractResultData(_x63) {
|
4664
4753
|
return _extractResultData9.apply(this, arguments);
|
4665
4754
|
}
|
4666
4755
|
return extractResultData;
|
@@ -4694,13 +4783,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4694
4783
|
}, {
|
4695
4784
|
key: "callServiceAPI",
|
4696
4785
|
value: function () {
|
4697
|
-
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4786
|
+
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e, t) {
|
4698
4787
|
var n;
|
4699
|
-
return _regeneratorRuntime().wrap(function
|
4700
|
-
while (1) switch (
|
4788
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
4789
|
+
while (1) switch (_context35.prev = _context35.next) {
|
4701
4790
|
case 0:
|
4702
4791
|
if (this.requestSettings) {
|
4703
|
-
|
4792
|
+
_context35.next = 2;
|
4704
4793
|
break;
|
4705
4794
|
}
|
4706
4795
|
throw new Error("Request settings have not been set up");
|
@@ -4709,11 +4798,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4709
4798
|
HTTPRequest.request(this, n, e);
|
4710
4799
|
case 4:
|
4711
4800
|
case "end":
|
4712
|
-
return
|
4801
|
+
return _context35.stop();
|
4713
4802
|
}
|
4714
|
-
},
|
4803
|
+
}, _callee35, this);
|
4715
4804
|
}));
|
4716
|
-
function callServiceAPI(
|
4805
|
+
function callServiceAPI(_x64, _x65) {
|
4717
4806
|
return _callServiceAPI7.apply(this, arguments);
|
4718
4807
|
}
|
4719
4808
|
return callServiceAPI;
|
@@ -4721,17 +4810,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4721
4810
|
}, {
|
4722
4811
|
key: "extractResultData",
|
4723
4812
|
value: function () {
|
4724
|
-
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4725
|
-
return _regeneratorRuntime().wrap(function
|
4726
|
-
while (1) switch (
|
4813
|
+
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e) {
|
4814
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
4815
|
+
while (1) switch (_context36.prev = _context36.next) {
|
4727
4816
|
case 0:
|
4728
4817
|
if (!e.message) {
|
4729
|
-
|
4818
|
+
_context36.next = 2;
|
4730
4819
|
break;
|
4731
4820
|
}
|
4732
4821
|
throw e.message;
|
4733
4822
|
case 2:
|
4734
|
-
return
|
4823
|
+
return _context36.abrupt("return", {
|
4735
4824
|
files: e.artifacts.map(function (n) {
|
4736
4825
|
return {
|
4737
4826
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4741,11 +4830,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4741
4830
|
});
|
4742
4831
|
case 3:
|
4743
4832
|
case "end":
|
4744
|
-
return
|
4833
|
+
return _context36.stop();
|
4745
4834
|
}
|
4746
|
-
},
|
4835
|
+
}, _callee36);
|
4747
4836
|
}));
|
4748
|
-
function extractResultData(
|
4837
|
+
function extractResultData(_x66) {
|
4749
4838
|
return _extractResultData10.apply(this, arguments);
|
4750
4839
|
}
|
4751
4840
|
return extractResultData;
|
@@ -4778,26 +4867,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
|
|
4778
4867
|
_createClass(HuggingFaceFillMaskIO, [{
|
4779
4868
|
key: "extractResultData",
|
4780
4869
|
value: function () {
|
4781
|
-
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4782
|
-
return _regeneratorRuntime().wrap(function
|
4783
|
-
while (1) switch (
|
4870
|
+
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
|
4871
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
4872
|
+
while (1) switch (_context37.prev = _context37.next) {
|
4784
4873
|
case 0:
|
4785
4874
|
if (!e.error) {
|
4786
|
-
|
4875
|
+
_context37.next = 2;
|
4787
4876
|
break;
|
4788
4877
|
}
|
4789
4878
|
throw e.error;
|
4790
4879
|
case 2:
|
4791
|
-
return
|
4880
|
+
return _context37.abrupt("return", {
|
4792
4881
|
text: e[0].sequence || ""
|
4793
4882
|
});
|
4794
4883
|
case 3:
|
4795
4884
|
case "end":
|
4796
|
-
return
|
4885
|
+
return _context37.stop();
|
4797
4886
|
}
|
4798
|
-
},
|
4887
|
+
}, _callee37);
|
4799
4888
|
}));
|
4800
|
-
function extractResultData(
|
4889
|
+
function extractResultData(_x67) {
|
4801
4890
|
return _extractResultData11.apply(this, arguments);
|
4802
4891
|
}
|
4803
4892
|
return extractResultData;
|
@@ -4872,13 +4961,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4872
4961
|
}, {
|
4873
4962
|
key: "callServiceAPI",
|
4874
4963
|
value: function () {
|
4875
|
-
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4964
|
+
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
|
4876
4965
|
var n;
|
4877
|
-
return _regeneratorRuntime().wrap(function
|
4878
|
-
while (1) switch (
|
4966
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
4967
|
+
while (1) switch (_context38.prev = _context38.next) {
|
4879
4968
|
case 0:
|
4880
4969
|
if (this.requestSettings) {
|
4881
|
-
|
4970
|
+
_context38.next = 2;
|
4882
4971
|
break;
|
4883
4972
|
}
|
4884
4973
|
throw new Error("Request settings have not been set up");
|
@@ -4887,11 +4976,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4887
4976
|
HTTPRequest.request(this, n, e);
|
4888
4977
|
case 4:
|
4889
4978
|
case "end":
|
4890
|
-
return
|
4979
|
+
return _context38.stop();
|
4891
4980
|
}
|
4892
|
-
},
|
4981
|
+
}, _callee38, this);
|
4893
4982
|
}));
|
4894
|
-
function callServiceAPI(
|
4983
|
+
function callServiceAPI(_x68, _x69) {
|
4895
4984
|
return _callServiceAPI8.apply(this, arguments);
|
4896
4985
|
}
|
4897
4986
|
return callServiceAPI;
|
@@ -4899,27 +4988,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
4899
4988
|
}, {
|
4900
4989
|
key: "extractResultData",
|
4901
4990
|
value: function () {
|
4902
|
-
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4991
|
+
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
|
4903
4992
|
var t;
|
4904
|
-
return _regeneratorRuntime().wrap(function
|
4905
|
-
while (1) switch (
|
4993
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
4994
|
+
while (1) switch (_context39.prev = _context39.next) {
|
4906
4995
|
case 0:
|
4907
4996
|
if (!e.message) {
|
4908
|
-
|
4997
|
+
_context39.next = 2;
|
4909
4998
|
break;
|
4910
4999
|
}
|
4911
5000
|
throw e.message;
|
4912
5001
|
case 2:
|
4913
|
-
return
|
5002
|
+
return _context39.abrupt("return", {
|
4914
5003
|
text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
|
4915
5004
|
});
|
4916
5005
|
case 3:
|
4917
5006
|
case "end":
|
4918
|
-
return
|
5007
|
+
return _context39.stop();
|
4919
5008
|
}
|
4920
|
-
},
|
5009
|
+
}, _callee39);
|
4921
5010
|
}));
|
4922
|
-
function extractResultData(
|
5011
|
+
function extractResultData(_x70) {
|
4923
5012
|
return _extractResultData12.apply(this, arguments);
|
4924
5013
|
}
|
4925
5014
|
return extractResultData;
|
@@ -4949,13 +5038,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
4949
5038
|
}, {
|
4950
5039
|
key: "callServiceAPI",
|
4951
5040
|
value: function () {
|
4952
|
-
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5041
|
+
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
|
4953
5042
|
var n;
|
4954
|
-
return _regeneratorRuntime().wrap(function
|
4955
|
-
while (1) switch (
|
5043
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
5044
|
+
while (1) switch (_context40.prev = _context40.next) {
|
4956
5045
|
case 0:
|
4957
5046
|
if (this.requestSettings) {
|
4958
|
-
|
5047
|
+
_context40.next = 2;
|
4959
5048
|
break;
|
4960
5049
|
}
|
4961
5050
|
throw new Error("Request settings have not been set up");
|
@@ -4964,11 +5053,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
4964
5053
|
HTTPRequest.request(this, n, e);
|
4965
5054
|
case 4:
|
4966
5055
|
case "end":
|
4967
|
-
return
|
5056
|
+
return _context40.stop();
|
4968
5057
|
}
|
4969
|
-
},
|
5058
|
+
}, _callee40, this);
|
4970
5059
|
}));
|
4971
|
-
function callServiceAPI(
|
5060
|
+
function callServiceAPI(_x71, _x72) {
|
4972
5061
|
return _callServiceAPI9.apply(this, arguments);
|
4973
5062
|
}
|
4974
5063
|
return callServiceAPI;
|
@@ -4976,26 +5065,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
4976
5065
|
}, {
|
4977
5066
|
key: "extractResultData",
|
4978
5067
|
value: function () {
|
4979
|
-
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4980
|
-
return _regeneratorRuntime().wrap(function
|
4981
|
-
while (1) switch (
|
5068
|
+
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
|
5069
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
5070
|
+
while (1) switch (_context41.prev = _context41.next) {
|
4982
5071
|
case 0:
|
4983
5072
|
if (!e.message) {
|
4984
|
-
|
5073
|
+
_context41.next = 2;
|
4985
5074
|
break;
|
4986
5075
|
}
|
4987
5076
|
throw e.message;
|
4988
5077
|
case 2:
|
4989
|
-
return
|
5078
|
+
return _context41.abrupt("return", {
|
4990
5079
|
text: e.summary || ""
|
4991
5080
|
});
|
4992
5081
|
case 3:
|
4993
5082
|
case "end":
|
4994
|
-
return
|
5083
|
+
return _context41.stop();
|
4995
5084
|
}
|
4996
|
-
},
|
5085
|
+
}, _callee41);
|
4997
5086
|
}));
|
4998
|
-
function extractResultData(
|
5087
|
+
function extractResultData(_x73) {
|
4999
5088
|
return _extractResultData13.apply(this, arguments);
|
5000
5089
|
}
|
5001
5090
|
return extractResultData;
|
@@ -5152,13 +5241,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5152
5241
|
}, {
|
5153
5242
|
key: "callServiceAPI",
|
5154
5243
|
value: function () {
|
5155
|
-
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5244
|
+
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
|
5156
5245
|
var n;
|
5157
|
-
return _regeneratorRuntime().wrap(function
|
5158
|
-
while (1) switch (
|
5246
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
5247
|
+
while (1) switch (_context42.prev = _context42.next) {
|
5159
5248
|
case 0:
|
5160
5249
|
if (this.requestSettings) {
|
5161
|
-
|
5250
|
+
_context42.next = 2;
|
5162
5251
|
break;
|
5163
5252
|
}
|
5164
5253
|
throw new Error("Request settings have not been set up");
|
@@ -5167,11 +5256,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5167
5256
|
HTTPRequest.request(this, n, e), this.messages = e;
|
5168
5257
|
case 4:
|
5169
5258
|
case "end":
|
5170
|
-
return
|
5259
|
+
return _context42.stop();
|
5171
5260
|
}
|
5172
|
-
},
|
5261
|
+
}, _callee42, this);
|
5173
5262
|
}));
|
5174
|
-
function callServiceAPI(
|
5263
|
+
function callServiceAPI(_x74, _x75) {
|
5175
5264
|
return _callServiceAPI10.apply(this, arguments);
|
5176
5265
|
}
|
5177
5266
|
return callServiceAPI;
|
@@ -5179,13 +5268,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5179
5268
|
}, {
|
5180
5269
|
key: "extractResultData",
|
5181
5270
|
value: function () {
|
5182
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5271
|
+
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e) {
|
5183
5272
|
var t, n, s;
|
5184
|
-
return _regeneratorRuntime().wrap(function
|
5185
|
-
while (1) switch (
|
5273
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
5274
|
+
while (1) switch (_context43.prev = _context43.next) {
|
5186
5275
|
case 0:
|
5187
5276
|
if (!e.error) {
|
5188
|
-
|
5277
|
+
_context43.next = 2;
|
5189
5278
|
break;
|
5190
5279
|
}
|
5191
5280
|
throw e.error.message;
|
@@ -5197,16 +5286,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5197
5286
|
};
|
5198
5287
|
HTTPRequest.executePollRequest(this, n, s, this.messages);
|
5199
5288
|
}
|
5200
|
-
return
|
5289
|
+
return _context43.abrupt("return", {
|
5201
5290
|
pollingInAnotherRequest: !0
|
5202
5291
|
});
|
5203
5292
|
case 4:
|
5204
5293
|
case "end":
|
5205
|
-
return
|
5294
|
+
return _context43.stop();
|
5206
5295
|
}
|
5207
|
-
},
|
5296
|
+
}, _callee43, this);
|
5208
5297
|
}));
|
5209
|
-
function extractResultData(
|
5298
|
+
function extractResultData(_x76) {
|
5210
5299
|
return _extractResultData14.apply(this, arguments);
|
5211
5300
|
}
|
5212
5301
|
return extractResultData;
|
@@ -5214,33 +5303,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5214
5303
|
}, {
|
5215
5304
|
key: "extractPollResultData",
|
5216
5305
|
value: function () {
|
5217
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5306
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
|
5218
5307
|
var t, _iterator, _step, n;
|
5219
|
-
return _regeneratorRuntime().wrap(function
|
5220
|
-
while (1) switch (
|
5308
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
5309
|
+
while (1) switch (_context44.prev = _context44.next) {
|
5221
5310
|
case 0:
|
5222
5311
|
if (!e.error) {
|
5223
|
-
|
5312
|
+
_context44.next = 2;
|
5224
5313
|
break;
|
5225
5314
|
}
|
5226
5315
|
throw e.error;
|
5227
5316
|
case 2:
|
5228
5317
|
if (!(e.status === "running")) {
|
5229
|
-
|
5318
|
+
_context44.next = 4;
|
5230
5319
|
break;
|
5231
5320
|
}
|
5232
|
-
return
|
5321
|
+
return _context44.abrupt("return", {
|
5233
5322
|
timeoutMS: 2e3
|
5234
5323
|
});
|
5235
5324
|
case 4:
|
5236
5325
|
if (!(e.errors.length > 0)) {
|
5237
|
-
|
5326
|
+
_context44.next = 6;
|
5238
5327
|
break;
|
5239
5328
|
}
|
5240
5329
|
throw e.errors[0];
|
5241
5330
|
case 6:
|
5242
5331
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
5243
|
-
|
5332
|
+
_context44.next = 8;
|
5244
5333
|
break;
|
5245
5334
|
}
|
5246
5335
|
throw e.tasks.items[0].results.errors[0];
|
@@ -5257,16 +5346,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5257
5346
|
} finally {
|
5258
5347
|
_iterator.f();
|
5259
5348
|
}
|
5260
|
-
return
|
5349
|
+
return _context44.abrupt("return", {
|
5261
5350
|
text: t || ""
|
5262
5351
|
});
|
5263
5352
|
case 12:
|
5264
5353
|
case "end":
|
5265
|
-
return
|
5354
|
+
return _context44.stop();
|
5266
5355
|
}
|
5267
|
-
},
|
5356
|
+
}, _callee44);
|
5268
5357
|
}));
|
5269
|
-
function extractPollResultData(
|
5358
|
+
function extractPollResultData(_x77) {
|
5270
5359
|
return _extractPollResultData4.apply(this, arguments);
|
5271
5360
|
}
|
5272
5361
|
return extractPollResultData;
|
@@ -5365,13 +5454,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5365
5454
|
}, {
|
5366
5455
|
key: "callServiceAPI",
|
5367
5456
|
value: function () {
|
5368
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5457
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
|
5369
5458
|
var n;
|
5370
|
-
return _regeneratorRuntime().wrap(function
|
5371
|
-
while (1) switch (
|
5459
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
5460
|
+
while (1) switch (_context45.prev = _context45.next) {
|
5372
5461
|
case 0:
|
5373
5462
|
if (this.requestSettings) {
|
5374
|
-
|
5463
|
+
_context45.next = 2;
|
5375
5464
|
break;
|
5376
5465
|
}
|
5377
5466
|
throw new Error("Request settings have not been set up");
|
@@ -5380,11 +5469,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5380
5469
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
5381
5470
|
case 4:
|
5382
5471
|
case "end":
|
5383
|
-
return
|
5472
|
+
return _context45.stop();
|
5384
5473
|
}
|
5385
|
-
},
|
5474
|
+
}, _callee45, this);
|
5386
5475
|
}));
|
5387
|
-
function callServiceAPI(
|
5476
|
+
function callServiceAPI(_x78, _x79) {
|
5388
5477
|
return _callServiceAPI11.apply(this, arguments);
|
5389
5478
|
}
|
5390
5479
|
return callServiceAPI;
|
@@ -5392,27 +5481,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5392
5481
|
}, {
|
5393
5482
|
key: "extractResultData",
|
5394
5483
|
value: function () {
|
5395
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5484
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
|
5396
5485
|
var t;
|
5397
|
-
return _regeneratorRuntime().wrap(function
|
5398
|
-
while (1) switch (
|
5486
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
5487
|
+
while (1) switch (_context46.prev = _context46.next) {
|
5399
5488
|
case 0:
|
5400
5489
|
if (!e.error) {
|
5401
|
-
|
5490
|
+
_context46.next = 2;
|
5402
5491
|
break;
|
5403
5492
|
}
|
5404
5493
|
throw e.error.message;
|
5405
5494
|
case 2:
|
5406
|
-
return
|
5495
|
+
return _context46.abrupt("return", {
|
5407
5496
|
text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
|
5408
5497
|
});
|
5409
5498
|
case 3:
|
5410
5499
|
case "end":
|
5411
|
-
return
|
5500
|
+
return _context46.stop();
|
5412
5501
|
}
|
5413
|
-
},
|
5502
|
+
}, _callee46);
|
5414
5503
|
}));
|
5415
|
-
function extractResultData(
|
5504
|
+
function extractResultData(_x80) {
|
5416
5505
|
return _extractResultData15.apply(this, arguments);
|
5417
5506
|
}
|
5418
5507
|
return extractResultData;
|
@@ -5427,17 +5516,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5427
5516
|
_createClass(AssemblyAIUtils, null, [{
|
5428
5517
|
key: "poll",
|
5429
5518
|
value: function () {
|
5430
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5519
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
|
5431
5520
|
var n, l, c, d;
|
5432
|
-
return _regeneratorRuntime().wrap(function
|
5433
|
-
while (1) switch (
|
5521
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
5522
|
+
while (1) switch (_context47.prev = _context47.next) {
|
5434
5523
|
case 0:
|
5435
5524
|
n = {
|
5436
5525
|
authorization: e,
|
5437
5526
|
"content-type": "application/json"
|
5438
5527
|
};
|
5439
|
-
|
5440
|
-
|
5528
|
+
_context47.t0 = "https://api.assemblyai.com/v2/transcript/";
|
5529
|
+
_context47.next = 4;
|
5441
5530
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
5442
5531
|
method: "POST",
|
5443
5532
|
body: JSON.stringify({
|
@@ -5446,55 +5535,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5446
5535
|
headers: n
|
5447
5536
|
});
|
5448
5537
|
case 4:
|
5449
|
-
|
5450
|
-
return
|
5538
|
+
_context47.next = 6;
|
5539
|
+
return _context47.sent.json();
|
5451
5540
|
case 6:
|
5452
|
-
|
5453
|
-
l =
|
5541
|
+
_context47.t1 = _context47.sent.id;
|
5542
|
+
l = _context47.t0.concat.call(_context47.t0, _context47.t1);
|
5454
5543
|
case 8:
|
5455
5544
|
if (c) {
|
5456
|
-
|
5545
|
+
_context47.next = 24;
|
5457
5546
|
break;
|
5458
5547
|
}
|
5459
|
-
|
5548
|
+
_context47.next = 11;
|
5460
5549
|
return fetch(l, {
|
5461
5550
|
headers: n
|
5462
5551
|
});
|
5463
5552
|
case 11:
|
5464
|
-
|
5465
|
-
return
|
5553
|
+
_context47.next = 13;
|
5554
|
+
return _context47.sent.json();
|
5466
5555
|
case 13:
|
5467
|
-
d =
|
5556
|
+
d = _context47.sent;
|
5468
5557
|
if (!(d.status === "completed")) {
|
5469
|
-
|
5558
|
+
_context47.next = 18;
|
5470
5559
|
break;
|
5471
5560
|
}
|
5472
5561
|
c = d;
|
5473
|
-
|
5562
|
+
_context47.next = 22;
|
5474
5563
|
break;
|
5475
5564
|
case 18:
|
5476
5565
|
if (!(d.status === "error")) {
|
5477
|
-
|
5566
|
+
_context47.next = 20;
|
5478
5567
|
break;
|
5479
5568
|
}
|
5480
5569
|
throw new Error("Transcription failed: ".concat(d.error));
|
5481
5570
|
case 20:
|
5482
|
-
|
5571
|
+
_context47.next = 22;
|
5483
5572
|
return new Promise(function (h) {
|
5484
5573
|
return setTimeout(h, 3e3);
|
5485
5574
|
});
|
5486
5575
|
case 22:
|
5487
|
-
|
5576
|
+
_context47.next = 8;
|
5488
5577
|
break;
|
5489
5578
|
case 24:
|
5490
|
-
return
|
5579
|
+
return _context47.abrupt("return", c);
|
5491
5580
|
case 25:
|
5492
5581
|
case "end":
|
5493
|
-
return
|
5582
|
+
return _context47.stop();
|
5494
5583
|
}
|
5495
|
-
},
|
5584
|
+
}, _callee47);
|
5496
5585
|
}));
|
5497
|
-
function poll(
|
5586
|
+
function poll(_x81, _x82) {
|
5498
5587
|
return _poll2.apply(this, arguments);
|
5499
5588
|
}
|
5500
5589
|
return poll;
|
@@ -5542,19 +5631,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5542
5631
|
_createClass(AssemblyAIAudioIO, [{
|
5543
5632
|
key: "callServiceAPI",
|
5544
5633
|
value: function () {
|
5545
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5634
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t, n) {
|
5546
5635
|
var s;
|
5547
|
-
return _regeneratorRuntime().wrap(function
|
5548
|
-
while (1) switch (
|
5636
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
5637
|
+
while (1) switch (_context48.prev = _context48.next) {
|
5549
5638
|
case 0:
|
5550
5639
|
if ((s = this.requestSettings) != null && s.headers) {
|
5551
|
-
|
5640
|
+
_context48.next = 2;
|
5552
5641
|
break;
|
5553
5642
|
}
|
5554
5643
|
throw new Error("Request settings have not been set up");
|
5555
5644
|
case 2:
|
5556
5645
|
if (n != null && n[0]) {
|
5557
|
-
|
5646
|
+
_context48.next = 4;
|
5558
5647
|
break;
|
5559
5648
|
}
|
5560
5649
|
throw new Error("No file was added");
|
@@ -5562,11 +5651,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5562
5651
|
HTTPRequest.request(this, n[0], e, !1);
|
5563
5652
|
case 5:
|
5564
5653
|
case "end":
|
5565
|
-
return
|
5654
|
+
return _context48.stop();
|
5566
5655
|
}
|
5567
|
-
},
|
5656
|
+
}, _callee48, this);
|
5568
5657
|
}));
|
5569
|
-
function callServiceAPI(
|
5658
|
+
function callServiceAPI(_x83, _x84, _x85) {
|
5570
5659
|
return _callServiceAPI12.apply(this, arguments);
|
5571
5660
|
}
|
5572
5661
|
return callServiceAPI;
|
@@ -5574,32 +5663,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5574
5663
|
}, {
|
5575
5664
|
key: "extractResultData",
|
5576
5665
|
value: function () {
|
5577
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5666
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
|
5578
5667
|
var s, o, t;
|
5579
|
-
return _regeneratorRuntime().wrap(function
|
5580
|
-
while (1) switch (
|
5668
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
5669
|
+
while (1) switch (_context49.prev = _context49.next) {
|
5581
5670
|
case 0:
|
5582
5671
|
if (!e.error) {
|
5583
|
-
|
5672
|
+
_context49.next = 2;
|
5584
5673
|
break;
|
5585
5674
|
}
|
5586
5675
|
throw e.error;
|
5587
5676
|
case 2:
|
5588
5677
|
t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
|
5589
|
-
|
5678
|
+
_context49.next = 5;
|
5590
5679
|
return AssemblyAIUtils.poll(t, e.upload_url);
|
5591
5680
|
case 5:
|
5592
|
-
|
5593
|
-
return
|
5594
|
-
text:
|
5681
|
+
_context49.t0 = _context49.sent.text;
|
5682
|
+
return _context49.abrupt("return", {
|
5683
|
+
text: _context49.t0
|
5595
5684
|
});
|
5596
5685
|
case 7:
|
5597
5686
|
case "end":
|
5598
|
-
return
|
5687
|
+
return _context49.stop();
|
5599
5688
|
}
|
5600
|
-
},
|
5689
|
+
}, _callee49, this);
|
5601
5690
|
}));
|
5602
|
-
function extractResultData(
|
5691
|
+
function extractResultData(_x86) {
|
5603
5692
|
return _extractResultData16.apply(this, arguments);
|
5604
5693
|
}
|
5605
5694
|
return extractResultData;
|
@@ -5649,13 +5738,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5649
5738
|
}, {
|
5650
5739
|
key: "callServiceAPI",
|
5651
5740
|
value: function () {
|
5652
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5741
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t) {
|
5653
5742
|
var n;
|
5654
|
-
return _regeneratorRuntime().wrap(function
|
5655
|
-
while (1) switch (
|
5743
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
5744
|
+
while (1) switch (_context50.prev = _context50.next) {
|
5656
5745
|
case 0:
|
5657
5746
|
if (this.requestSettings) {
|
5658
|
-
|
5747
|
+
_context50.next = 2;
|
5659
5748
|
break;
|
5660
5749
|
}
|
5661
5750
|
throw new Error("Request settings have not been set up");
|
@@ -5664,11 +5753,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5664
5753
|
HTTPRequest.request(this, n, e, !1);
|
5665
5754
|
case 4:
|
5666
5755
|
case "end":
|
5667
|
-
return
|
5756
|
+
return _context50.stop();
|
5668
5757
|
}
|
5669
|
-
},
|
5758
|
+
}, _callee50, this);
|
5670
5759
|
}));
|
5671
|
-
function callServiceAPI(
|
5760
|
+
function callServiceAPI(_x87, _x88) {
|
5672
5761
|
return _callServiceAPI13.apply(this, arguments);
|
5673
5762
|
}
|
5674
5763
|
return callServiceAPI;
|
@@ -5676,11 +5765,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5676
5765
|
}, {
|
5677
5766
|
key: "extractResultData",
|
5678
5767
|
value: function () {
|
5679
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5680
|
-
return _regeneratorRuntime().wrap(function
|
5681
|
-
while (1) switch (
|
5768
|
+
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
|
5769
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
5770
|
+
while (1) switch (_context51.prev = _context51.next) {
|
5682
5771
|
case 0:
|
5683
|
-
return
|
5772
|
+
return _context51.abrupt("return", new Promise(function (t) {
|
5684
5773
|
var n = new FileReader();
|
5685
5774
|
n.readAsDataURL(e), n.onload = function (s) {
|
5686
5775
|
t({
|
@@ -5693,11 +5782,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5693
5782
|
}));
|
5694
5783
|
case 1:
|
5695
5784
|
case "end":
|
5696
|
-
return
|
5785
|
+
return _context51.stop();
|
5697
5786
|
}
|
5698
|
-
},
|
5787
|
+
}, _callee51);
|
5699
5788
|
}));
|
5700
|
-
function extractResultData(
|
5789
|
+
function extractResultData(_x89) {
|
5701
5790
|
return _extractResultData17.apply(this, arguments);
|
5702
5791
|
}
|
5703
5792
|
return extractResultData;
|
@@ -5710,11 +5799,11 @@ _AzureTextToSpeechIO.HELP_LINK =
|
|
5710
5799
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
5711
5800
|
var AzureTextToSpeechIO = _AzureTextToSpeechIO;
|
5712
5801
|
var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
5713
|
-
_inherits(
|
5714
|
-
var _super28 = _createSuper(
|
5715
|
-
function
|
5802
|
+
_inherits(U, _AzureSpeechIO2);
|
5803
|
+
var _super28 = _createSuper(U);
|
5804
|
+
function U(e) {
|
5716
5805
|
var _this21;
|
5717
|
-
_classCallCheck(this,
|
5806
|
+
_classCallCheck(this, U);
|
5718
5807
|
var a, l, c;
|
5719
5808
|
var t = (l = (a = e.directConnection) == null ? void 0 : a.azure) == null ? void 0 : l.speechToText,
|
5720
5809
|
n = (c = e.directConnection) == null ? void 0 : c.azure,
|
@@ -5725,27 +5814,27 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5725
5814
|
}
|
5726
5815
|
}
|
5727
5816
|
};
|
5728
|
-
_this21 = _super28.call(this, e, AzureUtils.buildSpeechToTextHeaders, t.region, n, s), _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(
|
5817
|
+
_this21 = _super28.call(this, e, AzureUtils.buildSpeechToTextHeaders, t.region, n, s), _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(U.HELP_LINK, "\">here</a> for more info.\n </p>"), _this21.url = "", _this21.isTextInputDisabled = !0, _this21.textInputPlaceholderText = "Upload an audio file", _this21.canSendMessage = U.canFileSendMessage;
|
5729
5818
|
var o = t.lang || "en-US";
|
5730
5819
|
_this21.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(o, "&format=detailed"), _this21.recordAudio = void 0;
|
5731
5820
|
return _this21;
|
5732
5821
|
}
|
5733
|
-
_createClass(
|
5822
|
+
_createClass(U, [{
|
5734
5823
|
key: "callServiceAPI",
|
5735
5824
|
value: function () {
|
5736
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5825
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t, n) {
|
5737
5826
|
var s, o;
|
5738
|
-
return _regeneratorRuntime().wrap(function
|
5739
|
-
while (1) switch (
|
5827
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
5828
|
+
while (1) switch (_context52.prev = _context52.next) {
|
5740
5829
|
case 0:
|
5741
5830
|
if ((s = this.requestSettings) != null && s.headers) {
|
5742
|
-
|
5831
|
+
_context52.next = 2;
|
5743
5832
|
break;
|
5744
5833
|
}
|
5745
5834
|
throw new Error("Request settings have not been set up");
|
5746
5835
|
case 2:
|
5747
5836
|
if (n != null && n[0]) {
|
5748
|
-
|
5837
|
+
_context52.next = 4;
|
5749
5838
|
break;
|
5750
5839
|
}
|
5751
5840
|
throw new Error("No file was added");
|
@@ -5753,11 +5842,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5753
5842
|
(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);
|
5754
5843
|
case 5:
|
5755
5844
|
case "end":
|
5756
|
-
return
|
5845
|
+
return _context52.stop();
|
5757
5846
|
}
|
5758
|
-
},
|
5847
|
+
}, _callee52, this);
|
5759
5848
|
}));
|
5760
|
-
function callServiceAPI(
|
5849
|
+
function callServiceAPI(_x90, _x91, _x92) {
|
5761
5850
|
return _callServiceAPI14.apply(this, arguments);
|
5762
5851
|
}
|
5763
5852
|
return callServiceAPI;
|
@@ -5765,26 +5854,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5765
5854
|
}, {
|
5766
5855
|
key: "extractResultData",
|
5767
5856
|
value: function () {
|
5768
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5769
|
-
return _regeneratorRuntime().wrap(function
|
5770
|
-
while (1) switch (
|
5857
|
+
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
|
5858
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
5859
|
+
while (1) switch (_context53.prev = _context53.next) {
|
5771
5860
|
case 0:
|
5772
5861
|
if (!e.error) {
|
5773
|
-
|
5862
|
+
_context53.next = 2;
|
5774
5863
|
break;
|
5775
5864
|
}
|
5776
5865
|
throw e.error;
|
5777
5866
|
case 2:
|
5778
|
-
return
|
5867
|
+
return _context53.abrupt("return", {
|
5779
5868
|
text: e.DisplayText || ""
|
5780
5869
|
});
|
5781
5870
|
case 3:
|
5782
5871
|
case "end":
|
5783
|
-
return
|
5872
|
+
return _context53.stop();
|
5784
5873
|
}
|
5785
|
-
},
|
5874
|
+
}, _callee53);
|
5786
5875
|
}));
|
5787
|
-
function extractResultData(
|
5876
|
+
function extractResultData(_x93) {
|
5788
5877
|
return _extractResultData18.apply(this, arguments);
|
5789
5878
|
}
|
5790
5879
|
return extractResultData;
|
@@ -5795,7 +5884,7 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5795
5884
|
return !!(t != null && t[0]);
|
5796
5885
|
}
|
5797
5886
|
}]);
|
5798
|
-
return
|
5887
|
+
return U;
|
5799
5888
|
}(AzureSpeechIO);
|
5800
5889
|
_AzureSpeechToTextIO.HELP_LINK =
|
5801
5890
|
// eslint-disable-next-line max-len
|
@@ -5827,13 +5916,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5827
5916
|
}, {
|
5828
5917
|
key: "callServiceAPI",
|
5829
5918
|
value: function () {
|
5830
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5919
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t) {
|
5831
5920
|
var n;
|
5832
|
-
return _regeneratorRuntime().wrap(function
|
5833
|
-
while (1) switch (
|
5921
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
5922
|
+
while (1) switch (_context54.prev = _context54.next) {
|
5834
5923
|
case 0:
|
5835
5924
|
if (this.requestSettings) {
|
5836
|
-
|
5925
|
+
_context54.next = 2;
|
5837
5926
|
break;
|
5838
5927
|
}
|
5839
5928
|
throw new Error("Request settings have not been set up");
|
@@ -5842,11 +5931,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5842
5931
|
HTTPRequest.request(this, n, e);
|
5843
5932
|
case 4:
|
5844
5933
|
case "end":
|
5845
|
-
return
|
5934
|
+
return _context54.stop();
|
5846
5935
|
}
|
5847
|
-
},
|
5936
|
+
}, _callee54, this);
|
5848
5937
|
}));
|
5849
|
-
function callServiceAPI(
|
5938
|
+
function callServiceAPI(_x94, _x95) {
|
5850
5939
|
return _callServiceAPI15.apply(this, arguments);
|
5851
5940
|
}
|
5852
5941
|
return callServiceAPI;
|
@@ -5854,27 +5943,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
5854
5943
|
}, {
|
5855
5944
|
key: "extractResultData",
|
5856
5945
|
value: function () {
|
5857
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5946
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
|
5858
5947
|
var t;
|
5859
|
-
return _regeneratorRuntime().wrap(function
|
5860
|
-
while (1) switch (
|
5948
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
5949
|
+
while (1) switch (_context55.prev = _context55.next) {
|
5861
5950
|
case 0:
|
5862
5951
|
if (!Array.isArray(e)) {
|
5863
|
-
|
5952
|
+
_context55.next = 2;
|
5864
5953
|
break;
|
5865
5954
|
}
|
5866
|
-
return
|
5955
|
+
return _context55.abrupt("return", {
|
5867
5956
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
5868
5957
|
});
|
5869
5958
|
case 2:
|
5870
5959
|
throw e.error;
|
5871
5960
|
case 3:
|
5872
5961
|
case "end":
|
5873
|
-
return
|
5962
|
+
return _context55.stop();
|
5874
5963
|
}
|
5875
|
-
},
|
5964
|
+
}, _callee55);
|
5876
5965
|
}));
|
5877
|
-
function extractResultData(
|
5966
|
+
function extractResultData(_x96) {
|
5878
5967
|
return _extractResultData19.apply(this, arguments);
|
5879
5968
|
}
|
5880
5969
|
return extractResultData;
|
@@ -5941,27 +6030,27 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
5941
6030
|
}, {
|
5942
6031
|
key: "callServiceAPI",
|
5943
6032
|
value: function () {
|
5944
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6033
|
+
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
|
5945
6034
|
var s, o;
|
5946
|
-
return _regeneratorRuntime().wrap(function
|
5947
|
-
while (1) switch (
|
6035
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
6036
|
+
while (1) switch (_context56.prev = _context56.next) {
|
5948
6037
|
case 0:
|
5949
6038
|
if ((s = this.requestSettings) != null && s.headers) {
|
5950
|
-
|
6039
|
+
_context56.next = 2;
|
5951
6040
|
break;
|
5952
6041
|
}
|
5953
6042
|
throw new Error("Request settings have not been set up");
|
5954
6043
|
case 2:
|
5955
6044
|
if (!(n != null && n[0])) {
|
5956
|
-
|
6045
|
+
_context56.next = 6;
|
5957
6046
|
break;
|
5958
6047
|
}
|
5959
6048
|
this.callApiWithImage(e, t, n);
|
5960
|
-
|
6049
|
+
_context56.next = 11;
|
5961
6050
|
break;
|
5962
6051
|
case 6:
|
5963
6052
|
if (this.requestSettings) {
|
5964
|
-
|
6053
|
+
_context56.next = 8;
|
5965
6054
|
break;
|
5966
6055
|
}
|
5967
6056
|
throw new Error("Request settings have not been set up");
|
@@ -5971,11 +6060,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
5971
6060
|
HTTPRequest.request(this, o, e);
|
5972
6061
|
case 11:
|
5973
6062
|
case "end":
|
5974
|
-
return
|
6063
|
+
return _context56.stop();
|
5975
6064
|
}
|
5976
|
-
},
|
6065
|
+
}, _callee56, this);
|
5977
6066
|
}));
|
5978
|
-
function callServiceAPI(
|
6067
|
+
function callServiceAPI(_x97, _x98, _x99) {
|
5979
6068
|
return _callServiceAPI16.apply(this, arguments);
|
5980
6069
|
}
|
5981
6070
|
return callServiceAPI;
|
@@ -5983,17 +6072,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
5983
6072
|
}, {
|
5984
6073
|
key: "extractResultData",
|
5985
6074
|
value: function () {
|
5986
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5987
|
-
return _regeneratorRuntime().wrap(function
|
5988
|
-
while (1) switch (
|
6075
|
+
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
|
6076
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
6077
|
+
while (1) switch (_context57.prev = _context57.next) {
|
5989
6078
|
case 0:
|
5990
6079
|
if (!e.error) {
|
5991
|
-
|
6080
|
+
_context57.next = 2;
|
5992
6081
|
break;
|
5993
6082
|
}
|
5994
6083
|
throw e.error.message;
|
5995
6084
|
case 2:
|
5996
|
-
return
|
6085
|
+
return _context57.abrupt("return", {
|
5997
6086
|
files: e.data.map(function (n) {
|
5998
6087
|
return n.url ? {
|
5999
6088
|
src: n.url,
|
@@ -6006,11 +6095,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6006
6095
|
});
|
6007
6096
|
case 3:
|
6008
6097
|
case "end":
|
6009
|
-
return
|
6098
|
+
return _context57.stop();
|
6010
6099
|
}
|
6011
|
-
},
|
6100
|
+
}, _callee57);
|
6012
6101
|
}));
|
6013
|
-
function extractResultData(
|
6102
|
+
function extractResultData(_x100) {
|
6014
6103
|
return _extractResultData20.apply(this, arguments);
|
6015
6104
|
}
|
6016
6105
|
return extractResultData;
|
@@ -6082,19 +6171,19 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6082
6171
|
}, {
|
6083
6172
|
key: "callServiceAPI",
|
6084
6173
|
value: function () {
|
6085
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6174
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, n) {
|
6086
6175
|
var a, s, o;
|
6087
|
-
return _regeneratorRuntime().wrap(function
|
6088
|
-
while (1) switch (
|
6176
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6177
|
+
while (1) switch (_context58.prev = _context58.next) {
|
6089
6178
|
case 0:
|
6090
6179
|
if ((a = this.requestSettings) != null && a.headers) {
|
6091
|
-
|
6180
|
+
_context58.next = 2;
|
6092
6181
|
break;
|
6093
6182
|
}
|
6094
6183
|
throw new Error("Request settings have not been set up");
|
6095
6184
|
case 2:
|
6096
6185
|
if (n != null && n[0]) {
|
6097
|
-
|
6186
|
+
_context58.next = 4;
|
6098
6187
|
break;
|
6099
6188
|
}
|
6100
6189
|
throw new Error("No file was added");
|
@@ -6104,11 +6193,11 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6104
6193
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
6105
6194
|
case 7:
|
6106
6195
|
case "end":
|
6107
|
-
return
|
6196
|
+
return _context58.stop();
|
6108
6197
|
}
|
6109
|
-
},
|
6198
|
+
}, _callee58, this);
|
6110
6199
|
}));
|
6111
|
-
function callServiceAPI(
|
6200
|
+
function callServiceAPI(_x101, _x102, _x103) {
|
6112
6201
|
return _callServiceAPI17.apply(this, arguments);
|
6113
6202
|
}
|
6114
6203
|
return callServiceAPI;
|
@@ -6116,26 +6205,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6116
6205
|
}, {
|
6117
6206
|
key: "extractResultData",
|
6118
6207
|
value: function () {
|
6119
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6120
|
-
return _regeneratorRuntime().wrap(function
|
6121
|
-
while (1) switch (
|
6208
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
6209
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
6210
|
+
while (1) switch (_context59.prev = _context59.next) {
|
6122
6211
|
case 0:
|
6123
6212
|
if (!e.error) {
|
6124
|
-
|
6213
|
+
_context59.next = 2;
|
6125
6214
|
break;
|
6126
6215
|
}
|
6127
6216
|
throw e.error.message;
|
6128
6217
|
case 2:
|
6129
|
-
return
|
6218
|
+
return _context59.abrupt("return", {
|
6130
6219
|
text: e.text
|
6131
6220
|
});
|
6132
6221
|
case 3:
|
6133
6222
|
case "end":
|
6134
|
-
return
|
6223
|
+
return _context59.stop();
|
6135
6224
|
}
|
6136
|
-
},
|
6225
|
+
}, _callee59);
|
6137
6226
|
}));
|
6138
|
-
function extractResultData(
|
6227
|
+
function extractResultData(_x104) {
|
6139
6228
|
return _extractResultData21.apply(this, arguments);
|
6140
6229
|
}
|
6141
6230
|
return extractResultData;
|
@@ -6201,13 +6290,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6201
6290
|
}, {
|
6202
6291
|
key: "callServiceAPI",
|
6203
6292
|
value: function () {
|
6204
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6293
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
|
6205
6294
|
var n;
|
6206
|
-
return _regeneratorRuntime().wrap(function
|
6207
|
-
while (1) switch (
|
6295
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
6296
|
+
while (1) switch (_context60.prev = _context60.next) {
|
6208
6297
|
case 0:
|
6209
6298
|
if (this.requestSettings) {
|
6210
|
-
|
6299
|
+
_context60.next = 2;
|
6211
6300
|
break;
|
6212
6301
|
}
|
6213
6302
|
throw new Error("Request settings have not been set up");
|
@@ -6216,11 +6305,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6216
6305
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
6217
6306
|
case 4:
|
6218
6307
|
case "end":
|
6219
|
-
return
|
6308
|
+
return _context60.stop();
|
6220
6309
|
}
|
6221
|
-
},
|
6310
|
+
}, _callee60, this);
|
6222
6311
|
}));
|
6223
|
-
function callServiceAPI(
|
6312
|
+
function callServiceAPI(_x105, _x106) {
|
6224
6313
|
return _callServiceAPI18.apply(this, arguments);
|
6225
6314
|
}
|
6226
6315
|
return callServiceAPI;
|
@@ -6228,17 +6317,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6228
6317
|
}, {
|
6229
6318
|
key: "extractResultData",
|
6230
6319
|
value: function () {
|
6231
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6232
|
-
return _regeneratorRuntime().wrap(function
|
6233
|
-
while (1) switch (
|
6320
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
|
6321
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
6322
|
+
while (1) switch (_context61.prev = _context61.next) {
|
6234
6323
|
case 0:
|
6235
6324
|
if (!e.error) {
|
6236
|
-
|
6325
|
+
_context61.next = 2;
|
6237
6326
|
break;
|
6238
6327
|
}
|
6239
6328
|
throw e.error.message;
|
6240
6329
|
case 2:
|
6241
|
-
return
|
6330
|
+
return _context61.abrupt("return", e.choices[0].delta ? {
|
6242
6331
|
text: e.choices[0].delta.content || ""
|
6243
6332
|
} : e.choices[0].message ? {
|
6244
6333
|
text: e.choices[0].message.content
|
@@ -6247,11 +6336,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6247
6336
|
});
|
6248
6337
|
case 3:
|
6249
6338
|
case "end":
|
6250
|
-
return
|
6339
|
+
return _context61.stop();
|
6251
6340
|
}
|
6252
|
-
},
|
6341
|
+
}, _callee61);
|
6253
6342
|
}));
|
6254
|
-
function extractResultData(
|
6343
|
+
function extractResultData(_x107) {
|
6255
6344
|
return _extractResultData22.apply(this, arguments);
|
6256
6345
|
}
|
6257
6346
|
return extractResultData;
|
@@ -6299,13 +6388,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6299
6388
|
}, {
|
6300
6389
|
key: "callServiceAPI",
|
6301
6390
|
value: function () {
|
6302
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6391
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
|
6303
6392
|
var n;
|
6304
|
-
return _regeneratorRuntime().wrap(function
|
6305
|
-
while (1) switch (
|
6393
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
6394
|
+
while (1) switch (_context62.prev = _context62.next) {
|
6306
6395
|
case 0:
|
6307
6396
|
if (this.requestSettings) {
|
6308
|
-
|
6397
|
+
_context62.next = 2;
|
6309
6398
|
break;
|
6310
6399
|
}
|
6311
6400
|
throw new Error("Request settings have not been set up");
|
@@ -6314,11 +6403,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6314
6403
|
HTTPRequest.request(this, n, e);
|
6315
6404
|
case 4:
|
6316
6405
|
case "end":
|
6317
|
-
return
|
6406
|
+
return _context62.stop();
|
6318
6407
|
}
|
6319
|
-
},
|
6408
|
+
}, _callee62, this);
|
6320
6409
|
}));
|
6321
|
-
function callServiceAPI(
|
6410
|
+
function callServiceAPI(_x108, _x109) {
|
6322
6411
|
return _callServiceAPI19.apply(this, arguments);
|
6323
6412
|
}
|
6324
6413
|
return callServiceAPI;
|
@@ -6326,26 +6415,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6326
6415
|
}, {
|
6327
6416
|
key: "extractResultData",
|
6328
6417
|
value: function () {
|
6329
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6330
|
-
return _regeneratorRuntime().wrap(function
|
6331
|
-
while (1) switch (
|
6418
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
6419
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
6420
|
+
while (1) switch (_context63.prev = _context63.next) {
|
6332
6421
|
case 0:
|
6333
6422
|
if (!e.message) {
|
6334
|
-
|
6423
|
+
_context63.next = 2;
|
6335
6424
|
break;
|
6336
6425
|
}
|
6337
6426
|
throw e.message;
|
6338
6427
|
case 2:
|
6339
|
-
return
|
6428
|
+
return _context63.abrupt("return", {
|
6340
6429
|
text: e.text
|
6341
6430
|
});
|
6342
6431
|
case 3:
|
6343
6432
|
case "end":
|
6344
|
-
return
|
6433
|
+
return _context63.stop();
|
6345
6434
|
}
|
6346
|
-
},
|
6435
|
+
}, _callee63);
|
6347
6436
|
}));
|
6348
|
-
function extractResultData(
|
6437
|
+
function extractResultData(_x110) {
|
6349
6438
|
return _extractResultData23.apply(this, arguments);
|
6350
6439
|
}
|
6351
6440
|
return extractResultData;
|
@@ -6678,7 +6767,7 @@ var _FileMessageUtils = /*#__PURE__*/function () {
|
|
6678
6767
|
})["catch"](function () {})["finally"](function () {
|
6679
6768
|
B.waitToLoadThenScroll(t);
|
6680
6769
|
});
|
6681
|
-
} catch (
|
6770
|
+
} catch (_unused5) {
|
6682
6771
|
t.scrollTop = t.scrollHeight;
|
6683
6772
|
}
|
6684
6773
|
}
|
@@ -6698,27 +6787,29 @@ var FileMessages = /*#__PURE__*/function () {
|
|
6698
6787
|
var n = new Image();
|
6699
6788
|
return n.src = e.src, FileMessageUtils.scrollDownOnImageLoad(n.src, t), FileMessageUtils.processContent(n, n.src);
|
6700
6789
|
}
|
6790
|
+
// WORK - should base64 images be clickable?
|
6791
|
+
// WORK - image still does not scroll down when loaded
|
6701
6792
|
}, {
|
6702
6793
|
key: "addNewImageMessage",
|
6703
6794
|
value: function () {
|
6704
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6795
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t, n) {
|
6705
6796
|
var s,
|
6706
6797
|
o,
|
6707
6798
|
a,
|
6708
|
-
|
6709
|
-
return _regeneratorRuntime().wrap(function
|
6710
|
-
while (1) switch (
|
6799
|
+
_args64 = arguments;
|
6800
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
6801
|
+
while (1) switch (_context64.prev = _context64.next) {
|
6711
6802
|
case 0:
|
6712
|
-
s =
|
6803
|
+
s = _args64.length > 3 && _args64[3] !== undefined ? _args64[3] : !1;
|
6713
6804
|
o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
|
6714
6805
|
a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
|
6715
6806
|
case 3:
|
6716
6807
|
case "end":
|
6717
|
-
return
|
6808
|
+
return _context64.stop();
|
6718
6809
|
}
|
6719
|
-
},
|
6810
|
+
}, _callee64);
|
6720
6811
|
}));
|
6721
|
-
function addNewImageMessage(
|
6812
|
+
function addNewImageMessage(_x111, _x112, _x113) {
|
6722
6813
|
return _addNewImageMessage.apply(this, arguments);
|
6723
6814
|
}
|
6724
6815
|
return addNewImageMessage;
|
@@ -6995,6 +7086,11 @@ var Messages = /*#__PURE__*/function () {
|
|
6995
7086
|
var e, t, n, s, o;
|
6996
7087
|
return (o = (s = (n = (t = (e = this.elementRef.children[this.elementRef.children.length - 1]) == null ? void 0 : e.children) == null ? void 0 : t[0]) == null ? void 0 : n.children) == null ? void 0 : s[0]) == null ? void 0 : o.classList.contains("error-message-text");
|
6997
7088
|
}
|
7089
|
+
}, {
|
7090
|
+
key: "removeError",
|
7091
|
+
value: function removeError() {
|
7092
|
+
this.isLastMessageError() && this.elementRef.children[this.elementRef.children.length - 1].remove();
|
7093
|
+
}
|
6998
7094
|
}, {
|
6999
7095
|
key: "addLoadingMessage",
|
7000
7096
|
value: function addLoadingMessage() {
|
@@ -7038,12 +7134,12 @@ var Messages = /*#__PURE__*/function () {
|
|
7038
7134
|
}, {
|
7039
7135
|
key: "addMultipleFiles",
|
7040
7136
|
value: function () {
|
7041
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7137
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e) {
|
7042
7138
|
var _this31 = this;
|
7043
|
-
return _regeneratorRuntime().wrap(function
|
7044
|
-
while (1) switch (
|
7139
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
7140
|
+
while (1) switch (_context65.prev = _context65.next) {
|
7045
7141
|
case 0:
|
7046
|
-
return
|
7142
|
+
return _context65.abrupt("return", Promise.all((e || []).map(function (t) {
|
7047
7143
|
return new Promise(function (n) {
|
7048
7144
|
if (!t.type || t.type === "any") {
|
7049
7145
|
var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
|
@@ -7068,11 +7164,11 @@ var Messages = /*#__PURE__*/function () {
|
|
7068
7164
|
})));
|
7069
7165
|
case 1:
|
7070
7166
|
case "end":
|
7071
|
-
return
|
7167
|
+
return _context65.stop();
|
7072
7168
|
}
|
7073
|
-
},
|
7169
|
+
}, _callee65);
|
7074
7170
|
}));
|
7075
|
-
function addMultipleFiles(
|
7171
|
+
function addMultipleFiles(_x114) {
|
7076
7172
|
return _addMultipleFiles.apply(this, arguments);
|
7077
7173
|
}
|
7078
7174
|
return addMultipleFiles;
|
@@ -7982,33 +8078,33 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
7982
8078
|
}, {
|
7983
8079
|
key: "completePlaceholders",
|
7984
8080
|
value: function () {
|
7985
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7986
|
-
return _regeneratorRuntime().wrap(function
|
7987
|
-
while (1) switch (
|
8081
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
|
8082
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
8083
|
+
while (1) switch (_context67.prev = _context67.next) {
|
7988
8084
|
case 0:
|
7989
|
-
|
8085
|
+
_context67.next = 2;
|
7990
8086
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
7991
|
-
var
|
8087
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e) {
|
7992
8088
|
var t;
|
7993
|
-
return _regeneratorRuntime().wrap(function
|
7994
|
-
while (1) switch (
|
8089
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
8090
|
+
while (1) switch (_context66.prev = _context66.next) {
|
7995
8091
|
case 0:
|
7996
|
-
return
|
8092
|
+
return _context66.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
7997
8093
|
case 1:
|
7998
8094
|
case "end":
|
7999
|
-
return
|
8095
|
+
return _context66.stop();
|
8000
8096
|
}
|
8001
|
-
},
|
8097
|
+
}, _callee66);
|
8002
8098
|
}));
|
8003
|
-
return function (
|
8004
|
-
return
|
8099
|
+
return function (_x115) {
|
8100
|
+
return _ref6.apply(this, arguments);
|
8005
8101
|
};
|
8006
8102
|
}()));
|
8007
8103
|
case 2:
|
8008
8104
|
case "end":
|
8009
|
-
return
|
8105
|
+
return _context67.stop();
|
8010
8106
|
}
|
8011
|
-
},
|
8107
|
+
}, _callee67, this);
|
8012
8108
|
}));
|
8013
8109
|
function completePlaceholders() {
|
8014
8110
|
return _completePlaceholders.apply(this, arguments);
|
@@ -9228,26 +9324,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9228
9324
|
}, {
|
9229
9325
|
key: "getNewSpeechConfig",
|
9230
9326
|
value: function () {
|
9231
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9232
|
-
return _regeneratorRuntime().wrap(function
|
9233
|
-
while (1) switch (
|
9327
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e, t) {
|
9328
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
9329
|
+
while (1) switch (_context68.prev = _context68.next) {
|
9234
9330
|
case 0:
|
9235
9331
|
if (!t.region) {
|
9236
|
-
|
9332
|
+
_context68.next = 2;
|
9237
9333
|
break;
|
9238
9334
|
}
|
9239
|
-
return
|
9335
|
+
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) {
|
9240
9336
|
return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
|
9241
9337
|
})["catch"](function (n) {
|
9242
9338
|
return console.error(n), null;
|
9243
9339
|
}) : null);
|
9244
9340
|
case 2:
|
9245
9341
|
case "end":
|
9246
|
-
return
|
9342
|
+
return _context68.stop();
|
9247
9343
|
}
|
9248
|
-
},
|
9344
|
+
}, _callee68);
|
9249
9345
|
}));
|
9250
|
-
function getNewSpeechConfig(
|
9346
|
+
function getNewSpeechConfig(_x116, _x117) {
|
9251
9347
|
return _getNewSpeechConfig.apply(this, arguments);
|
9252
9348
|
}
|
9253
9349
|
return getNewSpeechConfig;
|
@@ -9260,23 +9356,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9260
9356
|
}, {
|
9261
9357
|
key: "get",
|
9262
9358
|
value: function () {
|
9263
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9359
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e, t) {
|
9264
9360
|
var n;
|
9265
|
-
return _regeneratorRuntime().wrap(function
|
9266
|
-
while (1) switch (
|
9361
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
9362
|
+
while (1) switch (_context69.prev = _context69.next) {
|
9267
9363
|
case 0:
|
9268
|
-
|
9364
|
+
_context69.next = 2;
|
9269
9365
|
return AzureSpeechConfig.getNewSpeechConfig(e, t);
|
9270
9366
|
case 2:
|
9271
|
-
n =
|
9272
|
-
return
|
9367
|
+
n = _context69.sent;
|
9368
|
+
return _context69.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
|
9273
9369
|
case 4:
|
9274
9370
|
case "end":
|
9275
|
-
return
|
9371
|
+
return _context69.stop();
|
9276
9372
|
}
|
9277
|
-
},
|
9373
|
+
}, _callee69);
|
9278
9374
|
}));
|
9279
|
-
function get(
|
9375
|
+
function get(_x118, _x119) {
|
9280
9376
|
return _get.apply(this, arguments);
|
9281
9377
|
}
|
9282
9378
|
return get;
|
@@ -9366,28 +9462,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9366
9462
|
}, {
|
9367
9463
|
key: "startAsync",
|
9368
9464
|
value: function () {
|
9369
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9465
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e) {
|
9370
9466
|
var t;
|
9371
|
-
return _regeneratorRuntime().wrap(function
|
9372
|
-
while (1) switch (
|
9467
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
9468
|
+
while (1) switch (_context70.prev = _context70.next) {
|
9373
9469
|
case 0:
|
9374
|
-
|
9375
|
-
if (!
|
9376
|
-
|
9470
|
+
_context70.t0 = this.validate(e);
|
9471
|
+
if (!_context70.t0) {
|
9472
|
+
_context70.next = 6;
|
9377
9473
|
break;
|
9378
9474
|
}
|
9379
|
-
|
9475
|
+
_context70.next = 4;
|
9380
9476
|
return this.instantiateService(e);
|
9381
9477
|
case 4:
|
9382
9478
|
this._translations = e == null ? void 0 : e.translations;
|
9383
9479
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
9384
9480
|
case 6:
|
9385
9481
|
case "end":
|
9386
|
-
return
|
9482
|
+
return _context70.stop();
|
9387
9483
|
}
|
9388
|
-
},
|
9484
|
+
}, _callee70, this);
|
9389
9485
|
}));
|
9390
|
-
function startAsync(
|
9486
|
+
function startAsync(_x120) {
|
9391
9487
|
return _startAsync.apply(this, arguments);
|
9392
9488
|
}
|
9393
9489
|
return startAsync;
|
@@ -9400,28 +9496,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9400
9496
|
}, {
|
9401
9497
|
key: "instantiateService",
|
9402
9498
|
value: function () {
|
9403
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9499
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
|
9404
9500
|
var t, n, s, o;
|
9405
|
-
return _regeneratorRuntime().wrap(function
|
9406
|
-
while (1) switch (
|
9501
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
9502
|
+
while (1) switch (_context71.prev = _context71.next) {
|
9407
9503
|
case 0:
|
9408
9504
|
t = Azure.getAPI();
|
9409
9505
|
n = t.AudioConfig.fromDefaultMicrophoneInput();
|
9410
|
-
|
9506
|
+
_context71.next = 4;
|
9411
9507
|
return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
|
9412
9508
|
case 4:
|
9413
|
-
s =
|
9509
|
+
s = _context71.sent;
|
9414
9510
|
if (s) {
|
9415
9511
|
o = new t.SpeechRecognizer(s, n);
|
9416
9512
|
this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
9417
9513
|
} else this.error("Unable to contact Azure server");
|
9418
9514
|
case 6:
|
9419
9515
|
case "end":
|
9420
|
-
return
|
9516
|
+
return _context71.stop();
|
9421
9517
|
}
|
9422
|
-
},
|
9518
|
+
}, _callee71, this);
|
9423
9519
|
}));
|
9424
|
-
function instantiateService(
|
9520
|
+
function instantiateService(_x121) {
|
9425
9521
|
return _instantiateService.apply(this, arguments);
|
9426
9522
|
}
|
9427
9523
|
return instantiateService;
|
@@ -9795,82 +9891,91 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
9795
9891
|
}
|
9796
9892
|
// TO-DO - button should be disabled if validateMessageBeforeSending is not valid
|
9797
9893
|
// TO-DO - button should be disabled if websocket connection is not open
|
9894
|
+
// TO-DO - should be disabled when websocket is connecting and option when loading history
|
9895
|
+
// prettier-ignore
|
9798
9896
|
}, {
|
9799
9897
|
key: "submit",
|
9800
9898
|
value: function () {
|
9801
|
-
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9802
|
-
var
|
9803
|
-
return _regeneratorRuntime().wrap(function
|
9804
|
-
while (1) switch (
|
9899
|
+
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e, t) {
|
9900
|
+
var c, u, n, s, o, a, l;
|
9901
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
9902
|
+
while (1) switch (_context72.prev = _context72.next) {
|
9805
9903
|
case 0:
|
9806
|
-
|
9807
|
-
if (
|
9808
|
-
|
9904
|
+
_context72.t0 = e;
|
9905
|
+
if (_context72.t0) {
|
9906
|
+
_context72.next = 6;
|
9809
9907
|
break;
|
9810
9908
|
}
|
9811
|
-
|
9909
|
+
_context72.next = 4;
|
9812
9910
|
return this._fileAttachments.completePlaceholders();
|
9813
9911
|
case 4:
|
9814
9912
|
n = this._fileAttachments.getAllFileData();
|
9815
|
-
s = n == null ? void 0 : n.map(function (
|
9816
|
-
return
|
9913
|
+
s = n == null ? void 0 : n.map(function (d) {
|
9914
|
+
return d.file;
|
9817
9915
|
});
|
9818
9916
|
case 6:
|
9819
9917
|
o = t === "" ? void 0 : t;
|
9820
9918
|
if (!this._isRequestInProgress) {
|
9821
|
-
|
9919
|
+
_context72.next = 9;
|
9822
9920
|
break;
|
9823
9921
|
}
|
9824
|
-
return
|
9922
|
+
return _context72.abrupt("return");
|
9825
9923
|
case 9:
|
9826
|
-
|
9827
|
-
|
9924
|
+
a = this._serviceIO.websocket;
|
9925
|
+
if (!(a && (a === "pending" || a.readyState === void 0 || a.readyState !== a.OPEN))) {
|
9926
|
+
_context72.next = 12;
|
9927
|
+
break;
|
9928
|
+
}
|
9929
|
+
return _context72.abrupt("return");
|
9930
|
+
case 12:
|
9931
|
+
if (!((c = this._serviceIO.deepChat) != null && c.validateMessageBeforeSending)) {
|
9932
|
+
_context72.next = 17;
|
9828
9933
|
break;
|
9829
9934
|
}
|
9830
9935
|
if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
|
9831
|
-
|
9936
|
+
_context72.next = 15;
|
9832
9937
|
break;
|
9833
9938
|
}
|
9834
|
-
return
|
9835
|
-
case
|
9836
|
-
|
9939
|
+
return _context72.abrupt("return");
|
9940
|
+
case 15:
|
9941
|
+
_context72.next = 19;
|
9837
9942
|
break;
|
9838
|
-
case
|
9943
|
+
case 17:
|
9839
9944
|
if (this._serviceIO.canSendMessage(o, s)) {
|
9840
|
-
|
9945
|
+
_context72.next = 19;
|
9841
9946
|
break;
|
9842
9947
|
}
|
9843
|
-
return
|
9844
|
-
case
|
9948
|
+
return _context72.abrupt("return");
|
9949
|
+
case 19:
|
9845
9950
|
this.changeToLoadingIcon();
|
9846
9951
|
t !== "" && this._messages.addNewMessage({
|
9847
9952
|
text: t
|
9848
9953
|
}, !1, !0);
|
9849
|
-
|
9850
|
-
if (!
|
9851
|
-
|
9954
|
+
_context72.t1 = n;
|
9955
|
+
if (!_context72.t1) {
|
9956
|
+
_context72.next = 25;
|
9852
9957
|
break;
|
9853
9958
|
}
|
9854
|
-
|
9959
|
+
_context72.next = 25;
|
9855
9960
|
return this._messages.addMultipleFiles(n);
|
9856
|
-
case
|
9961
|
+
case 25:
|
9857
9962
|
this._messages.addLoadingMessage();
|
9858
9963
|
e || TextInputEl.clear(this._inputElementRef);
|
9859
|
-
|
9964
|
+
l = {
|
9860
9965
|
text: o,
|
9861
9966
|
files: s
|
9862
9967
|
};
|
9863
|
-
|
9864
|
-
return this._serviceIO.callAPI(
|
9865
|
-
case
|
9866
|
-
e || (
|
9867
|
-
case
|
9968
|
+
_context72.next = 30;
|
9969
|
+
return this._serviceIO.callAPI(l, this._messages);
|
9970
|
+
case 30:
|
9971
|
+
e || (u = this._fileAttachments) == null || u.removeAllFiles();
|
9972
|
+
case 31:
|
9868
9973
|
case "end":
|
9869
|
-
return
|
9974
|
+
return _context72.stop();
|
9870
9975
|
}
|
9871
|
-
},
|
9976
|
+
}, _callee72, this);
|
9872
9977
|
}));
|
9873
|
-
function submit(
|
9978
|
+
function submit(_x122, _x123) {
|
9874
9979
|
return _submit.apply(this, arguments);
|
9875
9980
|
}
|
9876
9981
|
return submit;
|
@@ -10175,7 +10280,7 @@ var ChatView = /*#__PURE__*/function () {
|
|
10175
10280
|
var s = document.createElement("div");
|
10176
10281
|
s.id = "chat-view";
|
10177
10282
|
var o = new Messages(e, t, n);
|
10178
|
-
t.websocket && Websocket.
|
10283
|
+
t.websocket && Websocket.createConnection(t, o);
|
10179
10284
|
var a = new Input(e, o, t, s);
|
10180
10285
|
return ElementUtils.addElements(s, o.elementRef, a.elementRef), s;
|
10181
10286
|
}
|
@@ -10202,10 +10307,7 @@ var DeepChat = /*#__PURE__*/function (_InternalHTML2) {
|
|
10202
10307
|
function DeepChat() {
|
10203
10308
|
var _this60;
|
10204
10309
|
_classCallCheck(this, DeepChat);
|
10205
|
-
_this60 = _super45.call(this), _this60.
|
10206
|
-
url: "ws://loasdasdsacalhost:8080",
|
10207
|
-
websocket: !0
|
10208
|
-
}, _this60.getMessages = function () {
|
10310
|
+
_this60 = _super45.call(this), _this60.getMessages = function () {
|
10209
10311
|
return [];
|
10210
10312
|
}, _this60.submitUserMessage = function () {
|
10211
10313
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
@@ -10229,7 +10331,7 @@ var DeepChat = /*#__PURE__*/function (_InternalHTML2) {
|
|
10229
10331
|
value: function onRender() {
|
10230
10332
|
var _this$_activeService, _this$_childElement;
|
10231
10333
|
var e, t, n;
|
10232
|
-
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = ServiceIOFactory.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (WebComponentStyleUtils.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Object.assign(this._elementRef.style, this.containerStyle), this._activeService.key && this._activeService.validateConfigKey ? ValidateKeyPropertyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : this._activeService instanceof DirectServiceIO && this._activeService.key || (e = this.request) != null && e.url || (t = this.request) != null && t.handler || (n = this.directConnection) != null && n.demo ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], ChatView.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof DirectServiceIO ? InsertKeyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) :
|
10334
|
+
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = ServiceIOFactory.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (WebComponentStyleUtils.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Object.assign(this._elementRef.style, this.containerStyle), this._activeService.key && this._activeService.validateConfigKey ? ValidateKeyPropertyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : this._activeService instanceof DirectServiceIO && this._activeService.key || (e = this.request) != null && e.url || (t = this.request) != null && t.handler || (n = this.directConnection) != null && n.demo ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], ChatView.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof DirectServiceIO ? InsertKeyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : ErrorView.render(this._elementRef, 'Please define "request" with a "url"'), this._hasBeenRendered = !0, FireEvents.onRender(this));
|
10233
10335
|
}
|
10234
10336
|
}]);
|
10235
10337
|
return DeepChat;
|