deep-chat-dev 9.0.159 → 9.0.161
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 +12292 -12247
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +779 -721
- package/dist/services/openAI/openAIAssistantIO.d.ts +2 -0
- package/dist/services/openAI/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/utils/{openAIAssistantFiles.d.ts → openAIAssistantUtils.d.ts} +8 -4
- package/dist/services/openAI/utils/{openAIAssistantFiles.d.ts.map → openAIAssistantUtils.d.ts.map} +1 -1
- package/dist/types/openAIResult.d.ts +1 -5
- package/dist/types/openAIResult.d.ts.map +1 -1
- package/dist/utils/HTTP/stream.d.ts +1 -1
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/views/chat/input/textInput/textInput.d.ts +2 -1
- package/dist/views/chat/input/textInput/textInput.d.ts.map +1 -1
- package/dist/views/chat/input/textInput/textInputEvents.d.ts +2 -1
- package/dist/views/chat/input/textInput/textInputEvents.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts +2 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -212,8 +212,13 @@ var je = /*#__PURE__*/function () {
|
|
212
212
|
}
|
213
213
|
return _createClass(je, null, [{
|
214
214
|
key: "add",
|
215
|
-
value:
|
216
|
-
|
215
|
+
value:
|
216
|
+
// prettier-ignore
|
217
|
+
function add(e, t, i, n) {
|
218
|
+
i !== void 0 && e.addEventListener("keydown", je.onKeyDown.bind(this, i)), e.oninput = je.onInput.bind(this, i, n), e.onpaste = function (r) {
|
219
|
+
var o;
|
220
|
+
r.preventDefault(), (o = r.clipboardData) != null && o.files.length && t.addFilesToAnyType(Array.from(r.clipboardData.files));
|
221
|
+
};
|
217
222
|
}
|
218
223
|
// preventing insertion early for a nicer UX
|
219
224
|
// prettier-ignore
|
@@ -254,14 +259,14 @@ var us = /*#__PURE__*/function () {
|
|
254
259
|
}]);
|
255
260
|
}();
|
256
261
|
var Ae = /*#__PURE__*/function () {
|
257
|
-
function Ae(e, t) {
|
262
|
+
function Ae(e, t, i) {
|
258
263
|
var _this = this;
|
259
264
|
_classCallCheck(this, Ae);
|
260
|
-
var
|
261
|
-
var
|
262
|
-
this.elementRef = Ae.createContainerElement((
|
263
|
-
var
|
264
|
-
Gi.add(_this.inputElementRef, (
|
265
|
+
var r;
|
266
|
+
var n = Ae.processConfig(t, e.textInput);
|
267
|
+
this.elementRef = Ae.createContainerElement((r = n == null ? void 0 : n.styles) == null ? void 0 : r.container), this.inputElementRef = this.createInputElement(n), this._config = n, this.elementRef.appendChild(this.inputElementRef), setTimeout(function () {
|
268
|
+
var o;
|
269
|
+
Gi.add(_this.inputElementRef, i, (o = e.textInput) == null ? void 0 : o.characterLimit, e._validationHandler);
|
265
270
|
});
|
266
271
|
}
|
267
272
|
return _createClass(Ae, [{
|
@@ -349,7 +354,7 @@ var Ae = /*#__PURE__*/function () {
|
|
349
354
|
}]);
|
350
355
|
}();
|
351
356
|
Ae.TEXT_INPUT_ID = "text-input";
|
352
|
-
var
|
357
|
+
var Ct = Ae;
|
353
358
|
var yi = /*#__PURE__*/function () {
|
354
359
|
function yi() {
|
355
360
|
_classCallCheck(this, yi);
|
@@ -365,7 +370,7 @@ var yi = /*#__PURE__*/function () {
|
|
365
370
|
}, {
|
366
371
|
key: "focusFromParentElement",
|
367
372
|
value: function focusFromParentElement(e) {
|
368
|
-
var t = e.querySelector("#".concat(
|
373
|
+
var t = e.querySelector("#".concat(Ct.TEXT_INPUT_ID));
|
369
374
|
t && yi.focusEndOfInput(t);
|
370
375
|
}
|
371
376
|
}]);
|
@@ -549,15 +554,15 @@ var he = /*#__PURE__*/function () {
|
|
549
554
|
}();
|
550
555
|
var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20fill='%23000000'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2032%2032'%20xml:space='preserve'%3e%3cpath%20d='M23,30.36H9c-2.404,0-4.36-1.956-4.36-4.36V15c0-2.404,1.956-4.36,4.36-4.36h3.659%20c0.167-1.566,1.415-2.813,2.981-2.981V5.333c-1.131-0.174-2-1.154-2-2.333c0-1.301,1.059-2.36,2.36-2.36%20c1.302,0,2.36,1.059,2.36,2.36c0,1.179-0.869,2.159-2,2.333V7.66c1.566,0.167,2.814,1.415,2.981,2.981H23%20c2.404,0,4.36,1.956,4.36,4.36v11C27.36,28.404,25.404,30.36,23,30.36z%20M9,11.36c-2.007,0-3.64,1.633-3.64,3.64v11%20c0,2.007,1.633,3.64,3.64,3.64h14c2.007,0,3.64-1.633,3.64-3.64V15c0-2.007-1.633-3.64-3.64-3.64H9z%20M13.384,10.64h5.231%20C18.439,9.354,17.334,8.36,16,8.36C14.667,8.36,13.561,9.354,13.384,10.64z%20M16,1.36c-0.904,0-1.64,0.736-1.64,1.64%20S15.096,4.64,16,4.64c0.904,0,1.64-0.736,1.64-1.64S16.904,1.36,16,1.36z%20M20,27.36h-8c-1.301,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36h8c1.302,0,2.36,1.059,2.36,2.36S21.302,27.36,20,27.36z%20M12,23.36c-0.904,0-1.64,0.735-1.64,1.64%20s0.736,1.64,1.64,1.64h8c0.904,0,1.64-0.735,1.64-1.64s-0.735-1.64-1.64-1.64H12z%20M31,23.86h-2c-0.199,0-0.36-0.161-0.36-0.36V15%20c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5C31.36,23.699,31.199,23.86,31,23.86z%20M29.36,23.14h1.279v-7.78%20H29.36V23.14z%20M3,23.86H1c-0.199,0-0.36-0.161-0.36-0.36V15c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5%20C3.36,23.699,3.199,23.86,3,23.86z%20M1.36,23.14h1.28v-7.78H1.36V23.14z%20M20,20.36c-1.302,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36s2.36,1.059,2.36,2.36C22.36,19.302,21.302,20.36,20,20.36z%20M20,16.36c-0.904,0-1.64,0.736-1.64,1.64%20s0.735,1.64,1.64,1.64s1.64-0.735,1.64-1.64S20.904,16.36,20,16.36z%20M12,20.36c-1.301,0-2.36-1.059-2.36-2.36s1.059-2.36,2.36-2.36%20s2.36,1.059,2.36,2.36C14.36,19.302,13.301,20.36,12,20.36z%20M12,16.36c-0.904,0-1.64,0.736-1.64,1.64s0.736,1.64,1.64,1.64%20s1.64-0.735,1.64-1.64S12.904,16.36,12,16.36z'/%3e%3crect%20style='fill:none;'%20width='32'%20height='32'/%3e%3c/svg%3e",
|
551
556
|
vs = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==",
|
552
|
-
|
553
|
-
function
|
554
|
-
_classCallCheck(this,
|
557
|
+
te = /*#__PURE__*/function () {
|
558
|
+
function te() {
|
559
|
+
_classCallCheck(this, te);
|
555
560
|
}
|
556
|
-
return _createClass(
|
561
|
+
return _createClass(te, null, [{
|
557
562
|
key: "hide",
|
558
563
|
value: function hide(e) {
|
559
564
|
var t;
|
560
|
-
(t = e.getElementsByClassName(
|
565
|
+
(t = e.getElementsByClassName(te.CONTAINER_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
561
566
|
}
|
562
567
|
}, {
|
563
568
|
key: "applyCustomStylesToElements",
|
@@ -568,10 +573,10 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
568
573
|
key: "applyCustomStyles",
|
569
574
|
value: function applyCustomStyles(e, t, i, n) {
|
570
575
|
var r, o, a, l;
|
571
|
-
if ((r = i["default"]) != null && r.styles &&
|
572
|
-
(a = i.ai) != null && a.styles &&
|
576
|
+
if ((r = i["default"]) != null && r.styles && te.applyCustomStylesToElements(e, t, i["default"].styles), n === b.USER_ROLE) (o = i.user) != null && o.styles && te.applyCustomStylesToElements(e, t, i.user.styles);else {
|
577
|
+
(a = i.ai) != null && a.styles && te.applyCustomStylesToElements(e, t, i.ai.styles);
|
573
578
|
var c = (l = i[n]) == null ? void 0 : l.styles;
|
574
|
-
c &&
|
579
|
+
c && te.applyCustomStylesToElements(e, t, c);
|
575
580
|
}
|
576
581
|
}
|
577
582
|
}, {
|
@@ -581,7 +586,7 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
581
586
|
var i = document.createElement("img");
|
582
587
|
e === b.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || vs : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || bs, i.classList.add("avatar");
|
583
588
|
var n = document.createElement("div");
|
584
|
-
return n.classList.add(
|
589
|
+
return n.classList.add(te.CONTAINER_CLASS), n.appendChild(i), t && te.applyCustomStyles(n, i, t, e), n;
|
585
590
|
}
|
586
591
|
}, {
|
587
592
|
key: "getPosition",
|
@@ -595,14 +600,14 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
595
600
|
key: "add",
|
596
601
|
value: function add(e, t, i) {
|
597
602
|
var n = typeof i == "boolean" ? void 0 : i,
|
598
|
-
r =
|
599
|
-
o =
|
603
|
+
r = te.createAvatar(t, n),
|
604
|
+
o = te.getPosition(t, n);
|
600
605
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
601
606
|
}
|
602
607
|
}]);
|
603
608
|
}();
|
604
|
-
|
605
|
-
var Zt =
|
609
|
+
te.CONTAINER_CLASS = "avatar-container";
|
610
|
+
var Zt = te;
|
606
611
|
var ge = /*#__PURE__*/function () {
|
607
612
|
function ge() {
|
608
613
|
_classCallCheck(this, ge);
|
@@ -651,11 +656,11 @@ var ge = /*#__PURE__*/function () {
|
|
651
656
|
}();
|
652
657
|
ge.NAME_CLASS = "name";
|
653
658
|
var Yt = ge;
|
654
|
-
var
|
655
|
-
function
|
656
|
-
_classCallCheck(this,
|
659
|
+
var oe = /*#__PURE__*/function () {
|
660
|
+
function oe() {
|
661
|
+
_classCallCheck(this, oe);
|
657
662
|
}
|
658
|
-
return _createClass(
|
663
|
+
return _createClass(oe, null, [{
|
659
664
|
key: "getLastElementsByClass",
|
660
665
|
value: function getLastElementsByClass(e, t, i) {
|
661
666
|
var _loop = function _loop() {
|
@@ -696,8 +701,8 @@ var re = /*#__PURE__*/function () {
|
|
696
701
|
}, {
|
697
702
|
key: "overwriteMessage",
|
698
703
|
value: function overwriteMessage(e, t, i, n, r, o) {
|
699
|
-
var a =
|
700
|
-
l =
|
704
|
+
var a = oe.getLastElementsByClass(t, [oe.getRoleClass(n), o], ["loading-message-text"]),
|
705
|
+
l = oe.getLastMessage(e, n, r);
|
701
706
|
return l && (l[r] = i), a;
|
702
707
|
}
|
703
708
|
}, {
|
@@ -709,18 +714,18 @@ var re = /*#__PURE__*/function () {
|
|
709
714
|
}, {
|
710
715
|
key: "fillEmptyMessageElement",
|
711
716
|
value: function fillEmptyMessageElement(e, t) {
|
712
|
-
t.trim().length === 0 && (e.classList.add(
|
717
|
+
t.trim().length === 0 && (e.classList.add(oe.EMPTY_MESSAGE_CLASS), e.innerHTML = '<div style="color:#00000000">.</div>');
|
713
718
|
}
|
714
719
|
}, {
|
715
720
|
key: "unfillEmptyMessageElement",
|
716
721
|
value: function unfillEmptyMessageElement(e, t) {
|
717
|
-
e.classList.contains(
|
722
|
+
e.classList.contains(oe.EMPTY_MESSAGE_CLASS) && t.trim().length > 0 && e.replaceChildren();
|
718
723
|
}
|
719
724
|
}, {
|
720
725
|
key: "getLastMessageBubbleElement",
|
721
726
|
value: function getLastMessageBubbleElement(e) {
|
722
727
|
var t, i, n;
|
723
|
-
return Array.from(((n = (i = (t =
|
728
|
+
return Array.from(((n = (i = (t = oe.getLastMessageElement(e)) == null ? void 0 : t.children) == null ? void 0 : i[0]) == null ? void 0 : n.children) || []).find(function (r) {
|
724
729
|
return r.classList.contains("message-bubble");
|
725
730
|
});
|
726
731
|
}
|
@@ -742,8 +747,8 @@ var re = /*#__PURE__*/function () {
|
|
742
747
|
}
|
743
748
|
}]);
|
744
749
|
}();
|
745
|
-
|
746
|
-
var b =
|
750
|
+
oe.AI_ROLE = "ai", oe.USER_ROLE = "user", oe.EMPTY_MESSAGE_CLASS = "empty-message";
|
751
|
+
var b = oe;
|
747
752
|
var qe = /*#__PURE__*/function () {
|
748
753
|
function qe() {
|
749
754
|
_classCallCheck(this, qe);
|
@@ -984,14 +989,14 @@ function $i(s) {
|
|
984
989
|
return String.fromCharCode(s);
|
985
990
|
}
|
986
991
|
var ws = /&([a-z#][a-z0-9]{1,31});/gi,
|
987
|
-
|
988
|
-
function
|
992
|
+
Ts = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
|
993
|
+
function Cs(s, e) {
|
989
994
|
var t = 0,
|
990
995
|
i = Yn(e);
|
991
|
-
return e !== i ? i : e.charCodeAt(0) === 35 &&
|
996
|
+
return e !== i ? i : e.charCodeAt(0) === 35 && Ts.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), es(t)) ? $i(t) : s;
|
992
997
|
}
|
993
998
|
function Ge(s) {
|
994
|
-
return s.indexOf("&") < 0 ? s : s.replace(ws,
|
999
|
+
return s.indexOf("&") < 0 ? s : s.replace(ws, Cs);
|
995
1000
|
}
|
996
1001
|
var ks = /[&<>"]/,
|
997
1002
|
As = /[&<>"]/g,
|
@@ -1237,14 +1242,14 @@ cn.prototype.render = function (s, e, t) {
|
|
1237
1242
|
for (var i = this.rules, n = s.length, r = -1, o = ""; ++r < n;) s[r].type === "inline" ? o += this.renderInline(s[r].children, e, t) : o += i[s[r].type](s, r, e, t, this);
|
1238
1243
|
return o;
|
1239
1244
|
};
|
1240
|
-
function
|
1245
|
+
function Y() {
|
1241
1246
|
this.__rules__ = [], this.__cache__ = null;
|
1242
1247
|
}
|
1243
|
-
|
1248
|
+
Y.prototype.__find__ = function (s) {
|
1244
1249
|
for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === s) return t;
|
1245
1250
|
return -1;
|
1246
1251
|
};
|
1247
|
-
|
1252
|
+
Y.prototype.__compile__ = function () {
|
1248
1253
|
var s = this,
|
1249
1254
|
e = [""];
|
1250
1255
|
s.__rules__.forEach(function (t) {
|
@@ -1257,13 +1262,13 @@ Z.prototype.__compile__ = function () {
|
|
1257
1262
|
});
|
1258
1263
|
});
|
1259
1264
|
};
|
1260
|
-
|
1265
|
+
Y.prototype.at = function (s, e, t) {
|
1261
1266
|
var i = this.__find__(s),
|
1262
1267
|
n = t || {};
|
1263
1268
|
if (i === -1) throw new Error("Parser rule not found: " + s);
|
1264
1269
|
this.__rules__[i].fn = e, this.__rules__[i].alt = n.alt || [], this.__cache__ = null;
|
1265
1270
|
};
|
1266
|
-
|
1271
|
+
Y.prototype.before = function (s, e, t, i) {
|
1267
1272
|
var n = this.__find__(s),
|
1268
1273
|
r = i || {};
|
1269
1274
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1274,7 +1279,7 @@ Z.prototype.before = function (s, e, t, i) {
|
|
1274
1279
|
alt: r.alt || []
|
1275
1280
|
}), this.__cache__ = null;
|
1276
1281
|
};
|
1277
|
-
|
1282
|
+
Y.prototype.after = function (s, e, t, i) {
|
1278
1283
|
var n = this.__find__(s),
|
1279
1284
|
r = i || {};
|
1280
1285
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1285,7 +1290,7 @@ Z.prototype.after = function (s, e, t, i) {
|
|
1285
1290
|
alt: r.alt || []
|
1286
1291
|
}), this.__cache__ = null;
|
1287
1292
|
};
|
1288
|
-
|
1293
|
+
Y.prototype.push = function (s, e, t) {
|
1289
1294
|
var i = t || {};
|
1290
1295
|
this.__rules__.push({
|
1291
1296
|
name: s,
|
@@ -1294,7 +1299,7 @@ Z.prototype.push = function (s, e, t) {
|
|
1294
1299
|
alt: i.alt || []
|
1295
1300
|
}), this.__cache__ = null;
|
1296
1301
|
};
|
1297
|
-
|
1302
|
+
Y.prototype.enable = function (s, e) {
|
1298
1303
|
s = Array.isArray(s) ? s : [s], e && this.__rules__.forEach(function (t) {
|
1299
1304
|
t.enabled = !1;
|
1300
1305
|
}), s.forEach(function (t) {
|
@@ -1303,14 +1308,14 @@ Z.prototype.enable = function (s, e) {
|
|
1303
1308
|
this.__rules__[i].enabled = !0;
|
1304
1309
|
}, this), this.__cache__ = null;
|
1305
1310
|
};
|
1306
|
-
|
1311
|
+
Y.prototype.disable = function (s) {
|
1307
1312
|
s = Array.isArray(s) ? s : [s], s.forEach(function (e) {
|
1308
1313
|
var t = this.__find__(e);
|
1309
1314
|
if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
|
1310
1315
|
this.__rules__[t].enabled = !1;
|
1311
1316
|
}, this), this.__cache__ = null;
|
1312
1317
|
};
|
1313
|
-
|
1318
|
+
Y.prototype.getRules = function (s) {
|
1314
1319
|
return this.__cache__ === null && this.__compile__(), this.__cache__[s] || [];
|
1315
1320
|
};
|
1316
1321
|
function Is(s) {
|
@@ -1592,8 +1597,8 @@ function zs(s) {
|
|
1592
1597
|
var Vs = /['"]/,
|
1593
1598
|
wn = /['"]/g,
|
1594
1599
|
Gs = /[-\s()\[\]]/,
|
1595
|
-
|
1596
|
-
function
|
1600
|
+
Tn = "’";
|
1601
|
+
function Cn(s, e) {
|
1597
1602
|
return e < 0 || e >= s.length ? !1 : !Gs.test(s[e]);
|
1598
1603
|
}
|
1599
1604
|
function Qe(s, e, t) {
|
@@ -1607,8 +1612,8 @@ function Ws(s) {
|
|
1607
1612
|
for (a = E[e].level, f = S.length - 1; f >= 0 && !(S[f].level <= a); f--);
|
1608
1613
|
S.length = f + 1, i = t.content, r = 0, o = i.length;
|
1609
1614
|
e: for (; r < o && (wn.lastIndex = r, n = wn.exec(i), !!n);) {
|
1610
|
-
if (l = !
|
1611
|
-
m && (t.content = Qe(t.content, n.index,
|
1615
|
+
if (l = !Cn(i, n.index - 1), r = n.index + 1, m = n[0] === "'", c = !Cn(i, r), !c && !l) {
|
1616
|
+
m && (t.content = Qe(t.content, n.index, Tn));
|
1612
1617
|
continue;
|
1613
1618
|
}
|
1614
1619
|
if (h = !c, u = !l, u) {
|
@@ -1622,7 +1627,7 @@ function Ws(s) {
|
|
1622
1627
|
pos: n.index,
|
1623
1628
|
single: m,
|
1624
1629
|
level: a
|
1625
|
-
}) : u && m && (t.content = Qe(t.content, n.index,
|
1630
|
+
}) : u && m && (t.content = Qe(t.content, n.index, Tn));
|
1626
1631
|
}
|
1627
1632
|
}
|
1628
1633
|
}
|
@@ -1630,7 +1635,7 @@ function Ws(s) {
|
|
1630
1635
|
}
|
1631
1636
|
var Fi = [["block", Is], ["abbr", Ps], ["references", Ns], ["inline", Ds], ["footnote_tail", Fs], ["abbr2", Bs], ["replacements", zs], ["smartquotes", Ws]];
|
1632
1637
|
function rs() {
|
1633
|
-
this.options = {}, this.ruler = new
|
1638
|
+
this.options = {}, this.ruler = new Y();
|
1634
1639
|
for (var s = 0; s < Fi.length; s++) this.ruler.push(Fi[s][0], Fi[s][1]);
|
1635
1640
|
}
|
1636
1641
|
rs.prototype.process = function (s) {
|
@@ -1820,9 +1825,9 @@ function Ys(s, e, t, i) {
|
|
1820
1825
|
p,
|
1821
1826
|
E,
|
1822
1827
|
S,
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1828
|
+
Q,
|
1829
|
+
se,
|
1830
|
+
Te,
|
1826
1831
|
R,
|
1827
1832
|
W = !0,
|
1828
1833
|
$,
|
@@ -1832,20 +1837,20 @@ function Ys(s, e, t, i) {
|
|
1832
1837
|
if ((h = An(s, e)) >= 0) E = !0;else if ((h = kn(s, e)) >= 0) E = !1;else return !1;
|
1833
1838
|
if (s.level >= s.options.maxNesting) return !1;
|
1834
1839
|
if (p = s.src.charCodeAt(h - 1), i) return !0;
|
1835
|
-
for (
|
1840
|
+
for (Q = s.tokens.length, E ? (d = s.bMarks[e] + s.tShift[e], m = Number(s.src.substr(d, h - d - 1)), s.tokens.push({
|
1836
1841
|
type: "ordered_list_open",
|
1837
1842
|
order: m,
|
1838
|
-
lines:
|
1843
|
+
lines: Te = [e, 0],
|
1839
1844
|
level: s.level++
|
1840
1845
|
})) : s.tokens.push({
|
1841
1846
|
type: "bullet_list_open",
|
1842
|
-
lines:
|
1847
|
+
lines: Te = [e, 0],
|
1843
1848
|
level: s.level++
|
1844
|
-
}), n = e,
|
1849
|
+
}), n = e, se = !1, $ = s.parser.ruler.getRules("list"); n < t && (S = s.skipSpaces(h), u = s.eMarks[n], S >= u ? f = 1 : f = S - h, f > 4 && (f = 1), f < 1 && (f = 1), r = h - s.bMarks[n] + f, s.tokens.push({
|
1845
1850
|
type: "list_item_open",
|
1846
1851
|
lines: R = [e, 0],
|
1847
1852
|
level: s.level++
|
1848
|
-
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight ||
|
1853
|
+
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight || se) && (W = !1), se = s.line - e > 1 && s.isEmpty(s.line - 1), s.blkIndent = a, s.tShift[e] = o, s.tight = l, s.parentType = c, s.tokens.push({
|
1849
1854
|
type: "list_item_close",
|
1850
1855
|
level: --s.level
|
1851
1856
|
}), n = e = s.line, R[1] = n, S = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
@@ -1862,7 +1867,7 @@ function Ys(s, e, t, i) {
|
|
1862
1867
|
return s.tokens.push({
|
1863
1868
|
type: E ? "ordered_list_close" : "bullet_list_close",
|
1864
1869
|
level: --s.level
|
1865
|
-
}),
|
1870
|
+
}), Te[1] = n, s.line = n, W && Zs(s, Q), !0;
|
1866
1871
|
}
|
1867
1872
|
function Qs(s, e, t, i) {
|
1868
1873
|
var n,
|
@@ -2144,7 +2149,7 @@ function cr(s, e) {
|
|
2144
2149
|
}
|
2145
2150
|
var Wt = [["code", $s], ["fences", Ks, ["paragraph", "blockquote", "list"]], ["blockquote", Js, ["paragraph", "blockquote", "list"]], ["hr", Xs, ["paragraph", "blockquote", "list"]], ["list", Ys, ["paragraph", "blockquote"]], ["footnote", Qs, ["paragraph"]], ["heading", er, ["paragraph", "blockquote"]], ["lheading", tr], ["htmlblock", rr, ["paragraph", "blockquote"]], ["table", or, ["paragraph"]], ["deflist", lr, ["paragraph"]], ["paragraph", cr]];
|
2146
2151
|
function dn() {
|
2147
|
-
this.ruler = new
|
2152
|
+
this.ruler = new Y();
|
2148
2153
|
for (var s = 0; s < Wt.length; s++) this.ruler.push(Wt[s][0], Wt[s][1], {
|
2149
2154
|
alt: (Wt[s][2] || []).slice()
|
2150
2155
|
});
|
@@ -2441,7 +2446,7 @@ function Sr(s, e) {
|
|
2441
2446
|
}), s.pos = s.posMax + 1, s.posMax = n, !0);
|
2442
2447
|
}
|
2443
2448
|
var wr = /\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;
|
2444
|
-
function
|
2449
|
+
function Tr(s, e) {
|
2445
2450
|
var t,
|
2446
2451
|
i,
|
2447
2452
|
n = s.posMax,
|
@@ -2460,7 +2465,7 @@ function Cr(s, e) {
|
|
2460
2465
|
content: i.replace(wr, "$1")
|
2461
2466
|
}), s.pos = s.posMax + 1, s.posMax = n, !0);
|
2462
2467
|
}
|
2463
|
-
function
|
2468
|
+
function Cr(s, e) {
|
2464
2469
|
var t,
|
2465
2470
|
i,
|
2466
2471
|
n,
|
@@ -2627,9 +2632,9 @@ function Xr(s, e) {
|
|
2627
2632
|
}
|
2628
2633
|
return e || (s.pending += "&"), s.pos++, !0;
|
2629
2634
|
}
|
2630
|
-
var ji = [["text", pr], ["newline", mr], ["escape", gr], ["backticks", br], ["del", vr], ["ins", yr], ["mark", Er], ["emphasis", xr], ["sub", Sr], ["sup",
|
2635
|
+
var ji = [["text", pr], ["newline", mr], ["escape", gr], ["backticks", br], ["del", vr], ["ins", yr], ["mark", Er], ["emphasis", xr], ["sub", Sr], ["sup", Tr], ["links", Cr], ["footnote_inline", kr], ["footnote_ref", Ar], ["autolink", Lr], ["htmltag", $r], ["entity", Xr]];
|
2631
2636
|
function xi() {
|
2632
|
-
this.ruler = new
|
2637
|
+
this.ruler = new Y();
|
2633
2638
|
for (var s = 0; s < ji.length; s++) this.ruler.push(ji[s][0], ji[s][1]);
|
2634
2639
|
this.validateLink = Zr;
|
2635
2640
|
}
|
@@ -2787,7 +2792,7 @@ function as(s, e, t) {
|
|
2787
2792
|
this.src = e, this.env = t, this.options = s.options, this.tokens = [], this.inlineMode = !1, this.inline = s.inline, this.block = s.block, this.renderer = s.renderer, this.typographer = s.typographer;
|
2788
2793
|
}
|
2789
2794
|
function _e(s, e) {
|
2790
|
-
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new xi(), this.block = new dn(), this.core = new rs(), this.renderer = new cn(), this.ruler = new
|
2795
|
+
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new xi(), this.block = new dn(), this.core = new rs(), this.renderer = new cn(), this.ruler = new Y(), this.options = {}, this.configure(to[s]), this.set(e || {});
|
2791
2796
|
}
|
2792
2797
|
_e.prototype.set = function (s) {
|
2793
2798
|
Qn(this.options, s);
|
@@ -3242,10 +3247,15 @@ var Re = /*#__PURE__*/function () {
|
|
3242
3247
|
}
|
3243
3248
|
}
|
3244
3249
|
}, {
|
3245
|
-
key: "
|
3246
|
-
value: function
|
3250
|
+
key: "markFileAdded",
|
3251
|
+
value: function markFileAdded() {
|
3247
3252
|
this._fileAdded = !0;
|
3248
3253
|
}
|
3254
|
+
}, {
|
3255
|
+
key: "newMessage",
|
3256
|
+
value: function newMessage() {
|
3257
|
+
this.finaliseStreamedMessage(), this._elements = void 0, this._streamedContent = "", this._fileAdded = !1, this._hasStreamEnded = !1, this._activeMessageRole = void 0;
|
3258
|
+
}
|
3249
3259
|
}]);
|
3250
3260
|
}();
|
3251
3261
|
Re.MESSAGE_CLASS = "streamed-message", Re.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
@@ -3383,29 +3393,29 @@ function io(_x10, _x11) {
|
|
3383
3393
|
return _io.apply(this, arguments);
|
3384
3394
|
}
|
3385
3395
|
function _io() {
|
3386
|
-
_io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3396
|
+
_io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee121(s, e) {
|
3387
3397
|
var t, i;
|
3388
|
-
return _regeneratorRuntime().wrap(function
|
3389
|
-
while (1) switch (
|
3398
|
+
return _regeneratorRuntime().wrap(function _callee121$(_context121) {
|
3399
|
+
while (1) switch (_context121.prev = _context121.next) {
|
3390
3400
|
case 0:
|
3391
3401
|
t = s.getReader();
|
3392
3402
|
case 1:
|
3393
|
-
|
3403
|
+
_context121.next = 3;
|
3394
3404
|
return t.read();
|
3395
3405
|
case 3:
|
3396
|
-
if ((i =
|
3397
|
-
|
3406
|
+
if ((i = _context121.sent).done) {
|
3407
|
+
_context121.next = 7;
|
3398
3408
|
break;
|
3399
3409
|
}
|
3400
3410
|
e(i.value);
|
3401
3411
|
case 5:
|
3402
|
-
|
3412
|
+
_context121.next = 1;
|
3403
3413
|
break;
|
3404
3414
|
case 7:
|
3405
3415
|
case "end":
|
3406
|
-
return
|
3416
|
+
return _context121.stop();
|
3407
3417
|
}
|
3408
|
-
},
|
3418
|
+
}, _callee121);
|
3409
3419
|
}));
|
3410
3420
|
return _io.apply(this, arguments);
|
3411
3421
|
}
|
@@ -3504,14 +3514,14 @@ function lo(s, e) {
|
|
3504
3514
|
l || document.addEventListener("visibilitychange", p);
|
3505
3515
|
var E = ao,
|
3506
3516
|
S = 0;
|
3507
|
-
function
|
3517
|
+
function Q() {
|
3508
3518
|
document.removeEventListener("visibilitychange", p), window.clearTimeout(S), m.abort();
|
3509
3519
|
}
|
3510
3520
|
t == null || t.addEventListener("abort", function () {
|
3511
|
-
|
3521
|
+
Q(), h();
|
3512
3522
|
});
|
3513
|
-
var
|
3514
|
-
|
3523
|
+
var se = c !== null && c !== void 0 ? c : window.fetch,
|
3524
|
+
Te = n !== null && n !== void 0 ? n : co;
|
3515
3525
|
function R() {
|
3516
3526
|
return _R.apply(this, arguments);
|
3517
3527
|
}
|
@@ -3524,14 +3534,14 @@ function lo(s, e) {
|
|
3524
3534
|
m = new AbortController();
|
3525
3535
|
_context3.prev = 1;
|
3526
3536
|
_context3.next = 4;
|
3527
|
-
return
|
3537
|
+
return se(s, Object.assign(Object.assign({}, d), {
|
3528
3538
|
headers: f,
|
3529
3539
|
signal: m.signal
|
3530
3540
|
}));
|
3531
3541
|
case 4:
|
3532
3542
|
$ = _context3.sent;
|
3533
3543
|
_context3.next = 7;
|
3534
|
-
return
|
3544
|
+
return Te($);
|
3535
3545
|
case 7:
|
3536
3546
|
_context3.next = 9;
|
3537
3547
|
return io($.body, no(so(function (N) {
|
@@ -3541,7 +3551,7 @@ function lo(s, e) {
|
|
3541
3551
|
}, r)));
|
3542
3552
|
case 9:
|
3543
3553
|
o == null || o();
|
3544
|
-
|
3554
|
+
Q();
|
3545
3555
|
h();
|
3546
3556
|
_context3.next = 17;
|
3547
3557
|
break;
|
@@ -3552,7 +3562,7 @@ function lo(s, e) {
|
|
3552
3562
|
N = (W = a == null ? void 0 : a(_context3.t0)) !== null && W !== void 0 ? W : E;
|
3553
3563
|
window.clearTimeout(S), S = window.setTimeout(R, N);
|
3554
3564
|
} catch (N) {
|
3555
|
-
|
3565
|
+
Q(), u(N);
|
3556
3566
|
}
|
3557
3567
|
case 17:
|
3558
3568
|
case "end":
|
@@ -3569,11 +3579,11 @@ function co(s) {
|
|
3569
3579
|
var e = s.headers.get("content-type");
|
3570
3580
|
if (!(e != null && e.startsWith(Ji))) throw new Error("Expected content-type to be ".concat(Ji, ", Actual: ").concat(e));
|
3571
3581
|
}
|
3572
|
-
var
|
3573
|
-
function
|
3574
|
-
_classCallCheck(this,
|
3582
|
+
var C = /*#__PURE__*/function () {
|
3583
|
+
function C() {
|
3584
|
+
_classCallCheck(this, C);
|
3575
3585
|
}
|
3576
|
-
return _createClass(
|
3586
|
+
return _createClass(C, null, [{
|
3577
3587
|
key: "request",
|
3578
3588
|
value: // prettier-ignore
|
3579
3589
|
function () {
|
@@ -3583,9 +3593,9 @@ var T = /*#__PURE__*/function () {
|
|
3583
3593
|
p,
|
3584
3594
|
E,
|
3585
3595
|
S,
|
3586
|
-
|
3587
|
-
|
3588
|
-
|
3596
|
+
Q,
|
3597
|
+
se,
|
3598
|
+
Te,
|
3589
3599
|
o,
|
3590
3600
|
_yield$v$processReque,
|
3591
3601
|
a,
|
@@ -3637,10 +3647,10 @@ var T = /*#__PURE__*/function () {
|
|
3637
3647
|
return _context6.abrupt("return", pe.requestStream(i, e.streamHandlers));
|
3638
3648
|
case 19:
|
3639
3649
|
f = new Se(i), m = v.fetch.bind(this, e, l, n);
|
3640
|
-
lo(((
|
3641
|
-
method: ((
|
3650
|
+
return _context6.abrupt("return", (lo(((Q = e.connectSettings) == null ? void 0 : Q.url) || e.url || "", {
|
3651
|
+
method: ((se = e.connectSettings) == null ? void 0 : se.method) || "POST",
|
3642
3652
|
headers: l,
|
3643
|
-
credentials: (
|
3653
|
+
credentials: (Te = e.connectSettings) == null ? void 0 : Te.credentials,
|
3644
3654
|
body: n ? JSON.stringify(a) : a,
|
3645
3655
|
openWhenHidden: !0,
|
3646
3656
|
// keep stream open when browser tab not open
|
@@ -3693,7 +3703,7 @@ var T = /*#__PURE__*/function () {
|
|
3693
3703
|
case 7:
|
3694
3704
|
pt = _context5.t0;
|
3695
3705
|
(N = e.extractResultData) == null || N.call(e, pt, m, a).then(function (Ne) {
|
3696
|
-
e.asyncCallInProgress && Ne && Ne.text !== "" ? (
|
3706
|
+
e.asyncCallInProgress && Ne && Ne.text !== "" ? (C.simulate(i, e.streamHandlers, Ne), h(), e.asyncCallInProgress = !1) : C.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, Ne);
|
3697
3707
|
})["catch"](function (Ne) {
|
3698
3708
|
return v.displayError(i, Ne);
|
3699
3709
|
});
|
@@ -3722,7 +3732,7 @@ var T = /*#__PURE__*/function () {
|
|
3722
3732
|
})["catch"](function ($) {
|
3723
3733
|
v.displayError(i, $);
|
3724
3734
|
});
|
3725
|
-
});
|
3735
|
+
}), f));
|
3726
3736
|
case 21:
|
3727
3737
|
case "end":
|
3728
3738
|
return _context6.stop();
|
@@ -3744,7 +3754,7 @@ var T = /*#__PURE__*/function () {
|
|
3744
3754
|
}, i), !1), i.text) {
|
3745
3755
|
t.onOpen();
|
3746
3756
|
var r = i.text.split("");
|
3747
|
-
|
3757
|
+
C.populateMessages(r, new Se(e), n);
|
3748
3758
|
}
|
3749
3759
|
}
|
3750
3760
|
}, {
|
@@ -3757,10 +3767,10 @@ var T = /*#__PURE__*/function () {
|
|
3757
3767
|
text: r
|
3758
3768
|
});
|
3759
3769
|
var o = setTimeout(function () {
|
3760
|
-
|
3770
|
+
C.populateMessages(e, t, i, n + 1);
|
3761
3771
|
}, i.simulationInterim || 6);
|
3762
3772
|
i.abortStream.abort = function () {
|
3763
|
-
|
3773
|
+
C.abort(o, t, i.onClose);
|
3764
3774
|
};
|
3765
3775
|
} else t.finaliseStreamedMessage(), i.onClose();
|
3766
3776
|
}
|
@@ -3772,7 +3782,7 @@ var T = /*#__PURE__*/function () {
|
|
3772
3782
|
}, {
|
3773
3783
|
key: "isSimulatable",
|
3774
3784
|
value: function isSimulatable(e, t) {
|
3775
|
-
return
|
3785
|
+
return C.isSimulation(e) && t && (t.text || t.html);
|
3776
3786
|
}
|
3777
3787
|
}, {
|
3778
3788
|
key: "abort",
|
@@ -3789,7 +3799,7 @@ var T = /*#__PURE__*/function () {
|
|
3789
3799
|
}
|
3790
3800
|
n != null && n.files && (e.addNewMessage({
|
3791
3801
|
files: n.files
|
3792
|
-
}), i == null || i.
|
3802
|
+
}), i == null || i.markFileAdded());
|
3793
3803
|
}
|
3794
3804
|
}]);
|
3795
3805
|
}();
|
@@ -3845,7 +3855,7 @@ var He = /*#__PURE__*/function () {
|
|
3845
3855
|
_context7.t0 = i;
|
3846
3856
|
case 5:
|
3847
3857
|
n = _context7.t0;
|
3848
|
-
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) :
|
3858
|
+
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) : C.isSimulatable(e.stream, n) ? C.simulate(t, e.streamHandlers, n) : (t.addNewMessage(n), e.completionsHandlers.onFinish());
|
3849
3859
|
case 7:
|
3850
3860
|
case "end":
|
3851
3861
|
return _context7.stop();
|
@@ -3859,7 +3869,7 @@ var He = /*#__PURE__*/function () {
|
|
3859
3869
|
value: function requestStream(e, t) {
|
3860
3870
|
setTimeout(function () {
|
3861
3871
|
var i = He.getResponse(e);
|
3862
|
-
|
3872
|
+
C.simulate(e, t, i);
|
3863
3873
|
}, 400);
|
3864
3874
|
}
|
3865
3875
|
}]);
|
@@ -3942,9 +3952,9 @@ var z = /*#__PURE__*/function () {
|
|
3942
3952
|
}
|
3943
3953
|
throw Error(A.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
3944
3954
|
case 14:
|
3945
|
-
if (
|
3955
|
+
if (C.isSimulation(e.stream)) {
|
3946
3956
|
h = z.stream.bind(_this6, e, i, n), u = n[l.role || b.AI_ROLE];
|
3947
|
-
|
3957
|
+
C.upsertWFiles(i, h, u, d);
|
3948
3958
|
} else i.addNewMessage(d);
|
3949
3959
|
_context8.next = 20;
|
3950
3960
|
break;
|
@@ -4052,7 +4062,7 @@ var z = /*#__PURE__*/function () {
|
|
4052
4062
|
var o = n.role || b.AI_ROLE,
|
4053
4063
|
a = i[o];
|
4054
4064
|
n.text === r || n.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new Se(t), i[o].upsertStreamedMessage(n));
|
4055
|
-
} else
|
4065
|
+
} else C.simulate(t, e.streamHandlers, n);
|
4056
4066
|
}
|
4057
4067
|
}]);
|
4058
4068
|
}();
|
@@ -4093,7 +4103,7 @@ var Ee = /*#__PURE__*/function () {
|
|
4093
4103
|
_context10.t0 = c;
|
4094
4104
|
case 8:
|
4095
4105
|
d = _context10.t0;
|
4096
|
-
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) :
|
4106
|
+
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : C.isSimulatable(e.stream, d) ? C.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(A.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
4097
4107
|
case 10:
|
4098
4108
|
case "end":
|
4099
4109
|
return _context10.stop();
|
@@ -4164,7 +4174,7 @@ var Ee = /*#__PURE__*/function () {
|
|
4164
4174
|
_context12.t0 = f;
|
4165
4175
|
case 7:
|
4166
4176
|
m = _context12.t0;
|
4167
|
-
v.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), n = !1) :
|
4177
|
+
v.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), n = !1) : C.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(A.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
|
4168
4178
|
case 9:
|
4169
4179
|
case "end":
|
4170
4180
|
return _context12.stop();
|
@@ -4229,9 +4239,9 @@ var Ee = /*#__PURE__*/function () {
|
|
4229
4239
|
_context13.t0 = d;
|
4230
4240
|
case 7:
|
4231
4241
|
h = _context13.t0;
|
4232
|
-
if (!v.validateResponseFormat(h)) console.error(A.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (
|
4242
|
+
if (!v.validateResponseFormat(h)) console.error(A.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (C.isSimulation(e.stream)) {
|
4233
4243
|
m = z.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
|
4234
|
-
|
4244
|
+
C.upsertWFiles(t, m, p, d);
|
4235
4245
|
} else t.addNewMessage(h);
|
4236
4246
|
case 9:
|
4237
4247
|
case "end":
|
@@ -4267,11 +4277,11 @@ var Ee = /*#__PURE__*/function () {
|
|
4267
4277
|
}
|
4268
4278
|
}]);
|
4269
4279
|
}();
|
4270
|
-
var
|
4271
|
-
function
|
4272
|
-
_classCallCheck(this,
|
4280
|
+
var T = /*#__PURE__*/function () {
|
4281
|
+
function T() {
|
4282
|
+
_classCallCheck(this, T);
|
4273
4283
|
}
|
4274
|
-
return _createClass(
|
4284
|
+
return _createClass(T, null, [{
|
4275
4285
|
key: "request",
|
4276
4286
|
value: // prettier-ignore
|
4277
4287
|
function () {
|
@@ -4331,7 +4341,7 @@ var C = /*#__PURE__*/function () {
|
|
4331
4341
|
return v.processResponseByType(p);
|
4332
4342
|
}).then( /*#__PURE__*/function () {
|
4333
4343
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(p) {
|
4334
|
-
var
|
4344
|
+
var Q, se, E, S;
|
4335
4345
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
4336
4346
|
while (1) switch (_context14.prev = _context14.next) {
|
4337
4347
|
case 0:
|
@@ -4342,7 +4352,7 @@ var C = /*#__PURE__*/function () {
|
|
4342
4352
|
return _context14.abrupt("return");
|
4343
4353
|
case 2:
|
4344
4354
|
_context14.next = 4;
|
4345
|
-
return (
|
4355
|
+
return (se = (Q = e.deepChat).responseInterceptor) == null ? void 0 : se.call(Q, p);
|
4346
4356
|
case 4:
|
4347
4357
|
_context14.t0 = _context14.sent;
|
4348
4358
|
if (_context14.t0) {
|
@@ -4368,7 +4378,7 @@ var C = /*#__PURE__*/function () {
|
|
4368
4378
|
}
|
4369
4379
|
throw Error(A.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, E));
|
4370
4380
|
case 15:
|
4371
|
-
S.makingAnotherRequest || (
|
4381
|
+
S.makingAnotherRequest || (C.isSimulatable(e.stream, S) ? C.simulate(i, e.streamHandlers, S) : (i.addNewMessage(S), c()));
|
4372
4382
|
case 16:
|
4373
4383
|
case "end":
|
4374
4384
|
return _context14.stop();
|
@@ -4427,8 +4437,8 @@ var C = /*#__PURE__*/function () {
|
|
4427
4437
|
case 11:
|
4428
4438
|
a = _context16.sent;
|
4429
4439
|
a.timeoutMS ? setTimeout(function () {
|
4430
|
-
|
4431
|
-
}, a.timeoutMS) :
|
4440
|
+
T.executePollRequest(e, t, i, n);
|
4441
|
+
}, a.timeoutMS) : C.isSimulatable(e.stream, a) ? C.simulate(n, e.streamHandlers, a) : (n.addNewMessage(a), r());
|
4432
4442
|
case 13:
|
4433
4443
|
case "end":
|
4434
4444
|
return _context16.stop();
|
@@ -4487,7 +4497,7 @@ var C = /*#__PURE__*/function () {
|
|
4487
4497
|
body: h,
|
4488
4498
|
headers: a
|
4489
4499
|
};
|
4490
|
-
e.connectSettings.credentials && (u.credentials = e.connectSettings.credentials),
|
4500
|
+
e.connectSettings.credentials && (u.credentials = e.connectSettings.credentials), T.executePollRequest(e, c, u, i);
|
4491
4501
|
case 12:
|
4492
4502
|
case "end":
|
4493
4503
|
return _context17.stop();
|
@@ -4691,7 +4701,7 @@ var We = /*#__PURE__*/function () {
|
|
4691
4701
|
while (1) switch (_context18.prev = _context18.next) {
|
4692
4702
|
case 0:
|
4693
4703
|
i = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : !0;
|
4694
|
-
return _context18.abrupt("return", this.stream && !
|
4704
|
+
return _context18.abrupt("return", this.stream && !C.isSimulation(this.stream) ? C.request(this, e, t, i) : T.request(this, e, t, i));
|
4695
4705
|
case 2:
|
4696
4706
|
case "end":
|
4697
4707
|
return _context18.stop();
|
@@ -4914,7 +4924,7 @@ var U = /*#__PURE__*/function (_We) {
|
|
4914
4924
|
o = _this$keyVerification.createHeaders,
|
4915
4925
|
a = _this$keyVerification.body,
|
4916
4926
|
l = (o == null ? void 0 : o(e)) || this.buildHeadersFunc(e);
|
4917
|
-
|
4927
|
+
T.verifyKey(e, i, l, n, this.keyAuthenticated.bind(this, t.onSuccess), t.onFail, t.onLoad, r, a);
|
4918
4928
|
}
|
4919
4929
|
}, {
|
4920
4930
|
key: "isDirectConnection",
|
@@ -4990,11 +5000,11 @@ be._attributes_ = {}, be._attributeToProperty_ = {};
|
|
4990
5000
|
var Xi = be;
|
4991
5001
|
var ho = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
|
4992
5002
|
uo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
|
4993
|
-
var
|
4994
|
-
function
|
4995
|
-
_classCallCheck(this,
|
5003
|
+
var Z = /*#__PURE__*/function () {
|
5004
|
+
function Z() {
|
5005
|
+
_classCallCheck(this, Z);
|
4996
5006
|
}
|
4997
|
-
return _createClass(
|
5007
|
+
return _createClass(Z, null, [{
|
4998
5008
|
key: "createSVGElement",
|
4999
5009
|
value: function createSVGElement(e) {
|
5000
5010
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
@@ -5015,7 +5025,7 @@ var Ie = /*#__PURE__*/function () {
|
|
5015
5025
|
}, {
|
5016
5026
|
key: "createIconElement",
|
5017
5027
|
value: function createIconElement(e, t) {
|
5018
|
-
var i =
|
5028
|
+
var i = Z.createSVGElement(e);
|
5019
5029
|
return i.id = t, i.classList.add("visibility-icon"), i;
|
5020
5030
|
}
|
5021
5031
|
// prettier-ignore
|
@@ -5953,7 +5963,7 @@ var St = /*#__PURE__*/function (_U) {
|
|
5953
5963
|
throw new Error("Request settings have not been set up");
|
5954
5964
|
case 2:
|
5955
5965
|
n = this.preprocessBody(this.rawBody, t, i);
|
5956
|
-
|
5966
|
+
T.request(this, n, e);
|
5957
5967
|
case 4:
|
5958
5968
|
case "end":
|
5959
5969
|
return _context35.stop();
|
@@ -6003,7 +6013,7 @@ var Dt = /*#__PURE__*/function (_we) {
|
|
6003
6013
|
}
|
6004
6014
|
throw new Error("No file was added");
|
6005
6015
|
case 4:
|
6006
|
-
|
6016
|
+
T.poll(this, i[0], e, !1);
|
6007
6017
|
case 5:
|
6008
6018
|
case "end":
|
6009
6019
|
return _context36.stop();
|
@@ -6213,7 +6223,7 @@ var ni = /*#__PURE__*/function (_i10) {
|
|
6213
6223
|
throw new Error("Image was not found");
|
6214
6224
|
case 4:
|
6215
6225
|
n = this.createFormDataBody(this.rawBody, i[0]);
|
6216
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
6226
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, n, e), !1);
|
6217
6227
|
case 6:
|
6218
6228
|
case "end":
|
6219
6229
|
return _context39.stop();
|
@@ -6320,7 +6330,7 @@ var si = /*#__PURE__*/function (_i11) {
|
|
6320
6330
|
throw new Error("Image was not found");
|
6321
6331
|
case 4:
|
6322
6332
|
n = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], i[1], n);
|
6323
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
6333
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6324
6334
|
case 6:
|
6325
6335
|
case "end":
|
6326
6336
|
return _context41.stop();
|
@@ -6689,7 +6699,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6689
6699
|
throw new Error("Image was not found");
|
6690
6700
|
case 4:
|
6691
6701
|
n = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], n);
|
6692
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
6702
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6693
6703
|
case 6:
|
6694
6704
|
case "end":
|
6695
6705
|
return _context48.stop();
|
@@ -6821,7 +6831,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6821
6831
|
throw new Error("Request settings have not been set up");
|
6822
6832
|
case 2:
|
6823
6833
|
i = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
6824
|
-
|
6834
|
+
T.request(this, i, e);
|
6825
6835
|
case 4:
|
6826
6836
|
case "end":
|
6827
6837
|
return _context51.stop();
|
@@ -6995,7 +7005,7 @@ var _o = /*#__PURE__*/function (_un) {
|
|
6995
7005
|
throw new Error("Request settings have not been set up");
|
6996
7006
|
case 2:
|
6997
7007
|
i = this.preprocessBody(this.rawBody, t);
|
6998
|
-
|
7008
|
+
T.request(this, i, e);
|
6999
7009
|
case 4:
|
7000
7010
|
case "end":
|
7001
7011
|
return _context54.stop();
|
@@ -7070,7 +7080,7 @@ var So = /*#__PURE__*/function (_un2) {
|
|
7070
7080
|
throw new Error("Request settings have not been set up");
|
7071
7081
|
case 2:
|
7072
7082
|
i = this.preprocessBody(this.rawBody, t);
|
7073
|
-
|
7083
|
+
T.request(this, i, e);
|
7074
7084
|
case 4:
|
7075
7085
|
case "end":
|
7076
7086
|
return _context56.stop();
|
@@ -7216,7 +7226,7 @@ var nt = /*#__PURE__*/function (_U4) {
|
|
7216
7226
|
case 2:
|
7217
7227
|
this.url = this.connectSettings.url || this.url;
|
7218
7228
|
i = this.preprocessBody(this.rawBody, t);
|
7219
|
-
|
7229
|
+
T.request(this, i, e);
|
7220
7230
|
case 5:
|
7221
7231
|
case "end":
|
7222
7232
|
return _context59.stop();
|
@@ -7275,26 +7285,26 @@ var nt = /*#__PURE__*/function (_U4) {
|
|
7275
7285
|
}(U);
|
7276
7286
|
nt.DEFAULT_MODEL = "tts-1", nt.DEFAULT_VOIDE = "alloy";
|
7277
7287
|
var Yi = nt;
|
7278
|
-
var
|
7279
|
-
function
|
7288
|
+
var ae = /*#__PURE__*/function (_U5) {
|
7289
|
+
function ae(e) {
|
7280
7290
|
var _o$model2;
|
7281
7291
|
var _this28;
|
7282
|
-
_classCallCheck(this,
|
7292
|
+
_classCallCheck(this, ae);
|
7283
7293
|
var r, o;
|
7284
7294
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7285
7295
|
i = t == null ? void 0 : t.openAI;
|
7286
|
-
_this28 = _callSuper(this,
|
7296
|
+
_this28 = _callSuper(this, ae, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i, {
|
7287
7297
|
audio: {}
|
7288
|
-
}]), _this28.insertKeyPlaceholderText = "OpenAI API Key", _this28.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this28.url = "", _this28.permittedErrorPrefixes = ["Invalid"], _this28.textInputPlaceholderText = "Upload an audio file", _this28._service_url =
|
7298
|
+
}]), _this28.insertKeyPlaceholderText = "OpenAI API Key", _this28.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this28.url = "", _this28.permittedErrorPrefixes = ["Invalid"], _this28.textInputPlaceholderText = "Upload an audio file", _this28._service_url = ae.AUDIO_TRANSCRIPTIONS_URL;
|
7289
7299
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
7290
|
-
_typeof(n) == "object" && (_this28.processConfig(n),
|
7300
|
+
_typeof(n) == "object" && (_this28.processConfig(n), ae.cleanConfig(n), Object.assign(_this28.rawBody, n)), (_o$model2 = (o = _this28.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = ae.DEFAULT_MODEL, _this28.rawBody.response_format = "json", _this28.canSendMessage = ae.canSendFileMessage;
|
7291
7301
|
return _this28;
|
7292
7302
|
}
|
7293
|
-
_inherits(
|
7294
|
-
return _createClass(
|
7303
|
+
_inherits(ae, _U5);
|
7304
|
+
return _createClass(ae, [{
|
7295
7305
|
key: "processConfig",
|
7296
7306
|
value: function processConfig(e) {
|
7297
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
7307
|
+
e != null && e.type && e.type === "translation" && (this._service_url = ae.AUDIO_TRANSLATIONS_URL, delete e.language);
|
7298
7308
|
}
|
7299
7309
|
}, {
|
7300
7310
|
key: "preprocessBody",
|
@@ -7326,8 +7336,8 @@ var oe = /*#__PURE__*/function (_U5) {
|
|
7326
7336
|
throw new Error("No file was added");
|
7327
7337
|
case 4:
|
7328
7338
|
this.url = this.connectSettings.url || this._service_url;
|
7329
|
-
n = this.preprocessBody(this.rawBody, t), r =
|
7330
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
7339
|
+
n = this.preprocessBody(this.rawBody, t), r = ae.createFormDataBody(n, i[0]);
|
7340
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7331
7341
|
case 7:
|
7332
7342
|
case "end":
|
7333
7343
|
return _context61.stop();
|
@@ -7386,13 +7396,13 @@ var oe = /*#__PURE__*/function (_U5) {
|
|
7386
7396
|
}
|
7387
7397
|
}]);
|
7388
7398
|
}(U);
|
7389
|
-
|
7390
|
-
var Qi =
|
7391
|
-
var
|
7392
|
-
function
|
7393
|
-
_classCallCheck(this,
|
7399
|
+
ae.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", ae.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", ae.DEFAULT_MODEL = "whisper-1";
|
7400
|
+
var Qi = ae;
|
7401
|
+
var ne = /*#__PURE__*/function () {
|
7402
|
+
function ne() {
|
7403
|
+
_classCallCheck(this, ne);
|
7394
7404
|
}
|
7395
|
-
return _createClass(
|
7405
|
+
return _createClass(ne, null, [{
|
7396
7406
|
key: "buildTextToSpeechHeaders",
|
7397
7407
|
value: function buildTextToSpeechHeaders(e, t) {
|
7398
7408
|
return {
|
@@ -7426,7 +7436,7 @@ var ie = /*#__PURE__*/function () {
|
|
7426
7436
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7427
7437
|
};
|
7428
7438
|
},
|
7429
|
-
handleVerificationResult:
|
7439
|
+
handleVerificationResult: ne.handleSpeechVerificationResult
|
7430
7440
|
};
|
7431
7441
|
}
|
7432
7442
|
}, {
|
@@ -7455,7 +7465,7 @@ var ie = /*#__PURE__*/function () {
|
|
7455
7465
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7456
7466
|
};
|
7457
7467
|
},
|
7458
|
-
handleVerificationResult:
|
7468
|
+
handleVerificationResult: ne.handleLanguageVerificationResult
|
7459
7469
|
};
|
7460
7470
|
}
|
7461
7471
|
// prettier-ignore
|
@@ -7473,9 +7483,9 @@ var ie = /*#__PURE__*/function () {
|
|
7473
7483
|
url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
|
7474
7484
|
method: "POST",
|
7475
7485
|
createHeaders: function createHeaders(t) {
|
7476
|
-
return
|
7486
|
+
return ne.buildTranslationHeaders(e, t);
|
7477
7487
|
},
|
7478
|
-
handleVerificationResult:
|
7488
|
+
handleVerificationResult: ne.handleTranslationVerificationResult
|
7479
7489
|
};
|
7480
7490
|
}
|
7481
7491
|
}, {
|
@@ -7494,7 +7504,7 @@ var wo = /*#__PURE__*/function (_U6) {
|
|
7494
7504
|
function wo(e, t, i, n, r) {
|
7495
7505
|
var _this29;
|
7496
7506
|
_classCallCheck(this, wo);
|
7497
|
-
_this29 = _callSuper(this, wo, [e,
|
7507
|
+
_this29 = _callSuper(this, wo, [e, ne.buildLanguageKeyVerificationDetails(i), t, n, r]), _this29.insertKeyPlaceholderText = "Azure Language Subscription Key", _this29.keyHelpUrl =
|
7498
7508
|
// eslint-disable-next-line max-len
|
7499
7509
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this29.permittedErrorPrefixes = ["Access"];
|
7500
7510
|
return _this29;
|
@@ -7502,19 +7512,19 @@ var wo = /*#__PURE__*/function (_U6) {
|
|
7502
7512
|
_inherits(wo, _U6);
|
7503
7513
|
return _createClass(wo);
|
7504
7514
|
}(U);
|
7505
|
-
var
|
7506
|
-
function
|
7515
|
+
var To = /*#__PURE__*/function (_wo) {
|
7516
|
+
function To(e) {
|
7507
7517
|
var _a$language;
|
7508
7518
|
var _this30;
|
7509
|
-
_classCallCheck(this,
|
7519
|
+
_classCallCheck(this, To);
|
7510
7520
|
var n, r, o, a;
|
7511
7521
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.summarization,
|
7512
7522
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7513
|
-
_this30 = _callSuper(this,
|
7523
|
+
_this30 = _callSuper(this, To, [e, ne.buildSummarizationHeader, t.endpoint, i]), _this30.url = "", _this30.textInputPlaceholderText = "Insert text to summarize", (_a$language = (a = _this30.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this30.rawBody, t), _this30.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview");
|
7514
7524
|
return _this30;
|
7515
7525
|
}
|
7516
|
-
_inherits(
|
7517
|
-
return _createClass(
|
7526
|
+
_inherits(To, _wo);
|
7527
|
+
return _createClass(To, [{
|
7518
7528
|
key: "preprocessBody",
|
7519
7529
|
value: function preprocessBody(e, t) {
|
7520
7530
|
var i = t[t.length - 1].text;
|
@@ -7546,7 +7556,7 @@ var Co = /*#__PURE__*/function (_wo) {
|
|
7546
7556
|
throw new Error("Request settings have not been set up");
|
7547
7557
|
case 2:
|
7548
7558
|
i = this.preprocessBody(this.rawBody, t);
|
7549
|
-
|
7559
|
+
T.request(this, i, e), this.messages = e;
|
7550
7560
|
case 4:
|
7551
7561
|
case "end":
|
7552
7562
|
return _context63.stop();
|
@@ -7577,7 +7587,7 @@ var Co = /*#__PURE__*/function (_wo) {
|
|
7577
7587
|
method: "GET",
|
7578
7588
|
headers: (t = this.connectSettings) == null ? void 0 : t.headers
|
7579
7589
|
};
|
7580
|
-
|
7590
|
+
T.executePollRequest(this, _i14, n, this.messages);
|
7581
7591
|
}
|
7582
7592
|
return _context64.abrupt("return", {
|
7583
7593
|
makingAnotherRequest: !0
|
@@ -7792,7 +7802,7 @@ var fn = /*#__PURE__*/function (_U7) {
|
|
7792
7802
|
}
|
7793
7803
|
throw new Error("No file was added");
|
7794
7804
|
case 4:
|
7795
|
-
|
7805
|
+
T.request(this, i[0], e, !1);
|
7796
7806
|
case 5:
|
7797
7807
|
case "end":
|
7798
7808
|
return _context67.stop();
|
@@ -7849,7 +7859,7 @@ var ls = /*#__PURE__*/function (_U8) {
|
|
7849
7859
|
function ls(e, t, i, n, r) {
|
7850
7860
|
var _this32;
|
7851
7861
|
_classCallCheck(this, ls);
|
7852
|
-
_this32 = _callSuper(this, ls, [e,
|
7862
|
+
_this32 = _callSuper(this, ls, [e, ne.buildSpeechKeyVerificationDetails(i), t, n, r]), _this32.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this32.keyHelpUrl =
|
7853
7863
|
// eslint-disable-next-line max-len
|
7854
7864
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
7855
7865
|
return _this32;
|
@@ -7866,7 +7876,7 @@ var vi = /*#__PURE__*/function (_ls) {
|
|
7866
7876
|
var n, r, o, a, l, c;
|
7867
7877
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.textToSpeech,
|
7868
7878
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7869
|
-
_this33 = _callSuper(this, vi, [e,
|
7879
|
+
_this33 = _callSuper(this, vi, [e, ne.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this33.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(vi.HELP_LINK, "\">here</a> for more info.\n </p>"), _this33.url = "", Object.assign(_this33.rawBody, t), (_a$lang = (a = _this33.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this33.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this33.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this33.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1");
|
7870
7880
|
return _this33;
|
7871
7881
|
}
|
7872
7882
|
_inherits(vi, _ls);
|
@@ -7891,7 +7901,7 @@ var vi = /*#__PURE__*/function (_ls) {
|
|
7891
7901
|
throw new Error("Request settings have not been set up");
|
7892
7902
|
case 2:
|
7893
7903
|
i = this.preprocessBody(this.rawBody, t);
|
7894
|
-
|
7904
|
+
T.request(this, i, e, !1);
|
7895
7905
|
case 4:
|
7896
7906
|
case "end":
|
7897
7907
|
return _context69.stop();
|
@@ -7952,7 +7962,7 @@ var wt = /*#__PURE__*/function (_ls2) {
|
|
7952
7962
|
}
|
7953
7963
|
}
|
7954
7964
|
};
|
7955
|
-
_this34 = _callSuper(this, wt, [e,
|
7965
|
+
_this34 = _callSuper(this, wt, [e, ne.buildSpeechToTextHeaders, t.region, i, n]), _this34.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(wt.HELP_LINK, "\">here</a> for more info.\n </p>"), _this34.url = "", _this34.isTextInputDisabled = !0, _this34.textInputPlaceholderText = "Upload an audio file", _this34.canSendMessage = wt.canFileSendMessage;
|
7956
7966
|
var r = t.lang || "en-US";
|
7957
7967
|
_this34.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(r, "&format=detailed"), _this34.recordAudio = void 0;
|
7958
7968
|
return _this34;
|
@@ -7978,7 +7988,7 @@ var wt = /*#__PURE__*/function (_ls2) {
|
|
7978
7988
|
}
|
7979
7989
|
throw new Error("No file was added");
|
7980
7990
|
case 4:
|
7981
|
-
(r = this.connectSettings) != null && r.headers && (this.connectSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"),
|
7991
|
+
(r = this.connectSettings) != null && r.headers && (this.connectSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), T.request(this, i[0], e, !1);
|
7982
7992
|
case 5:
|
7983
7993
|
case "end":
|
7984
7994
|
return _context71.stop();
|
@@ -8028,21 +8038,21 @@ wt.HELP_LINK =
|
|
8028
8038
|
// eslint-disable-next-line max-len
|
8029
8039
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
8030
8040
|
var tn = wt;
|
8031
|
-
var
|
8041
|
+
var Co = /*#__PURE__*/function (_U9) {
|
8032
8042
|
// prettier-ignore
|
8033
|
-
function
|
8043
|
+
function Co(e) {
|
8034
8044
|
var _this35;
|
8035
|
-
_classCallCheck(this,
|
8045
|
+
_classCallCheck(this, Co);
|
8036
8046
|
var n, r, o;
|
8037
8047
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.translation,
|
8038
8048
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
8039
|
-
_this35 = _callSuper(this,
|
8049
|
+
_this35 = _callSuper(this, Co, [e, ne.buildTranslationKeyVerificationDetails(t.region), ne.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this35.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this35.keyHelpUrl =
|
8040
8050
|
// eslint-disable-next-line max-len
|
8041
8051
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this35.url = "", _this35.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
8042
8052
|
return _this35;
|
8043
8053
|
}
|
8044
|
-
_inherits(
|
8045
|
-
return _createClass(
|
8054
|
+
_inherits(Co, _U9);
|
8055
|
+
return _createClass(Co, [{
|
8046
8056
|
key: "preprocessBody",
|
8047
8057
|
value: function preprocessBody(e) {
|
8048
8058
|
var t = e[e.length - 1].text;
|
@@ -8065,7 +8075,7 @@ var To = /*#__PURE__*/function (_U9) {
|
|
8065
8075
|
throw new Error("Request settings have not been set up");
|
8066
8076
|
case 2:
|
8067
8077
|
i = this.preprocessBody(t);
|
8068
|
-
|
8078
|
+
T.request(this, i, e);
|
8069
8079
|
case 4:
|
8070
8080
|
case "end":
|
8071
8081
|
return _context73.stop();
|
@@ -8107,11 +8117,11 @@ var To = /*#__PURE__*/function (_U9) {
|
|
8107
8117
|
}()
|
8108
8118
|
}]);
|
8109
8119
|
}(U);
|
8110
|
-
var
|
8111
|
-
function
|
8112
|
-
_classCallCheck(this,
|
8120
|
+
var J = /*#__PURE__*/function () {
|
8121
|
+
function J() {
|
8122
|
+
_classCallCheck(this, J);
|
8113
8123
|
}
|
8114
|
-
return _createClass(
|
8124
|
+
return _createClass(J, null, [{
|
8115
8125
|
key: "storeFiles",
|
8116
8126
|
value: function () {
|
8117
8127
|
var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(e, t, i) {
|
@@ -8202,7 +8212,7 @@ var ce = /*#__PURE__*/function () {
|
|
8202
8212
|
l({
|
8203
8213
|
src: d.target.result,
|
8204
8214
|
name: t[a].name,
|
8205
|
-
type:
|
8215
|
+
type: J.getType(t, a)
|
8206
8216
|
});
|
8207
8217
|
};
|
8208
8218
|
});
|
@@ -8240,7 +8250,7 @@ var ce = /*#__PURE__*/function () {
|
|
8240
8250
|
l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
|
8241
8251
|
path: l.text,
|
8242
8252
|
fileId: l.file_path.file_id,
|
8243
|
-
name:
|
8253
|
+
name: J.getFileName(l.text)
|
8244
8254
|
});
|
8245
8255
|
});
|
8246
8256
|
}), t != null && t.image_file && i.push({
|
@@ -8262,7 +8272,7 @@ var ce = /*#__PURE__*/function () {
|
|
8262
8272
|
break;
|
8263
8273
|
}
|
8264
8274
|
_context78.next = 4;
|
8265
|
-
return
|
8275
|
+
return J.getFiles(e, t);
|
8266
8276
|
case 4:
|
8267
8277
|
r = _context78.sent;
|
8268
8278
|
(o = n == null ? void 0 : n.text) != null && o.value && r.forEach(function (l, c) {
|
@@ -8296,9 +8306,9 @@ var ce = /*#__PURE__*/function () {
|
|
8296
8306
|
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8297
8307
|
while (1) switch (_context79.prev = _context79.next) {
|
8298
8308
|
case 0:
|
8299
|
-
n =
|
8309
|
+
n = J.getFileDetails(t, i);
|
8300
8310
|
_context79.next = 3;
|
8301
|
-
return
|
8311
|
+
return J.getFilesAndNewText(e, n, t.role, i);
|
8302
8312
|
case 3:
|
8303
8313
|
return _context79.abrupt("return", _context79.sent);
|
8304
8314
|
case 4:
|
@@ -8313,8 +8323,8 @@ var ce = /*#__PURE__*/function () {
|
|
8313
8323
|
return getFilesAndText;
|
8314
8324
|
}()
|
8315
8325
|
}, {
|
8316
|
-
key: "
|
8317
|
-
value: function
|
8326
|
+
key: "parseResult",
|
8327
|
+
value: function parseResult(e, t) {
|
8318
8328
|
var i = [];
|
8319
8329
|
if (t) i = e.data;else for (var n = 0; n < e.data.length; n += 1) {
|
8320
8330
|
var r = e.data[n];
|
@@ -8325,8 +8335,8 @@ var ce = /*#__PURE__*/function () {
|
|
8325
8335
|
// test this using this prompt and it should give 2 text mesages and a file:
|
8326
8336
|
// "give example data for a csv and create a suitable bar chart"
|
8327
8337
|
}, {
|
8328
|
-
key: "
|
8329
|
-
value: function
|
8338
|
+
key: "parseMessages",
|
8339
|
+
value: function parseMessages(e, t) {
|
8330
8340
|
var i = [];
|
8331
8341
|
return t.forEach( /*#__PURE__*/function () {
|
8332
8342
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(n) {
|
@@ -8342,7 +8352,7 @@ var ce = /*#__PURE__*/function () {
|
|
8342
8352
|
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8343
8353
|
while (1) switch (_context80.prev = _context80.next) {
|
8344
8354
|
case 0:
|
8345
|
-
i.push(
|
8355
|
+
i.push(J.getFilesAndText(e, n, r));
|
8346
8356
|
case 1:
|
8347
8357
|
case "end":
|
8348
8358
|
return _context80.stop();
|
@@ -8362,25 +8372,47 @@ var ce = /*#__PURE__*/function () {
|
|
8362
8372
|
return function (_x150) {
|
8363
8373
|
return _ref11.apply(this, arguments);
|
8364
8374
|
};
|
8365
|
-
}()), i;
|
8375
|
+
}()), Promise.all(i);
|
8366
8376
|
}
|
8367
8377
|
}, {
|
8368
|
-
key: "
|
8378
|
+
key: "processSteamMessages",
|
8369
8379
|
value: function () {
|
8370
|
-
var
|
8371
|
-
var n, r;
|
8380
|
+
var _processSteamMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e, t) {
|
8372
8381
|
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8373
8382
|
while (1) switch (_context82.prev = _context82.next) {
|
8374
8383
|
case 0:
|
8375
|
-
|
8376
|
-
|
8377
|
-
|
8384
|
+
return _context82.abrupt("return", J.parseMessages(e, [{
|
8385
|
+
content: t,
|
8386
|
+
role: "assistant"
|
8387
|
+
}]));
|
8388
|
+
case 1:
|
8378
8389
|
case "end":
|
8379
8390
|
return _context82.stop();
|
8380
8391
|
}
|
8381
8392
|
}, _callee82);
|
8382
8393
|
}));
|
8383
|
-
function
|
8394
|
+
function processSteamMessages(_x152, _x153) {
|
8395
|
+
return _processSteamMessages.apply(this, arguments);
|
8396
|
+
}
|
8397
|
+
return processSteamMessages;
|
8398
|
+
}()
|
8399
|
+
}, {
|
8400
|
+
key: "processAPIMessages",
|
8401
|
+
value: function () {
|
8402
|
+
var _processAPIMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e, t, i) {
|
8403
|
+
var n;
|
8404
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8405
|
+
while (1) switch (_context83.prev = _context83.next) {
|
8406
|
+
case 0:
|
8407
|
+
n = J.parseResult(t, i);
|
8408
|
+
return _context83.abrupt("return", J.parseMessages(e, n));
|
8409
|
+
case 2:
|
8410
|
+
case "end":
|
8411
|
+
return _context83.stop();
|
8412
|
+
}
|
8413
|
+
}, _callee83);
|
8414
|
+
}));
|
8415
|
+
function processAPIMessages(_x154, _x155, _x156) {
|
8384
8416
|
return _processAPIMessages.apply(this, arguments);
|
8385
8417
|
}
|
8386
8418
|
return processAPIMessages;
|
@@ -8417,32 +8449,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8417
8449
|
return _createClass(F, [{
|
8418
8450
|
key: "fetchHistoryFunc",
|
8419
8451
|
value: function () {
|
8420
|
-
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8452
|
+
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
|
8421
8453
|
var _this37 = this;
|
8422
8454
|
var e;
|
8423
|
-
return _regeneratorRuntime().wrap(function
|
8424
|
-
while (1) switch (
|
8455
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8456
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8425
8457
|
case 0:
|
8426
8458
|
setTimeout(function () {
|
8427
8459
|
return _this37.deepChat.disableSubmitButton();
|
8428
8460
|
}, 2);
|
8429
|
-
|
8430
|
-
|
8461
|
+
_context84.prev = 1;
|
8462
|
+
_context84.next = 4;
|
8431
8463
|
return this.getThreadMessages(this.sessionId, !0);
|
8432
8464
|
case 4:
|
8433
|
-
e =
|
8434
|
-
return
|
8465
|
+
e = _context84.sent;
|
8466
|
+
return _context84.abrupt("return", (this.deepChat.disableSubmitButton(!1), e.reverse()));
|
8435
8467
|
case 8:
|
8436
|
-
|
8437
|
-
|
8438
|
-
return
|
8468
|
+
_context84.prev = 8;
|
8469
|
+
_context84.t0 = _context84["catch"](1);
|
8470
|
+
return _context84.abrupt("return", [{
|
8439
8471
|
error: "failed to fetch thread history"
|
8440
8472
|
}]);
|
8441
8473
|
case 11:
|
8442
8474
|
case "end":
|
8443
|
-
return
|
8475
|
+
return _context84.stop();
|
8444
8476
|
}
|
8445
|
-
},
|
8477
|
+
}, _callee84, this, [[1, 8]]);
|
8446
8478
|
}));
|
8447
8479
|
function fetchHistoryFunc() {
|
8448
8480
|
return _fetchHistoryFunc.apply(this, arguments);
|
@@ -8474,71 +8506,72 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8474
8506
|
if (this.messages = e, this.sessionId) {
|
8475
8507
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/messages");
|
8476
8508
|
var n = this.processMessage(t, i);
|
8477
|
-
|
8509
|
+
T.request(this, n, e);
|
8478
8510
|
} else {
|
8479
8511
|
this.url = "".concat(F.THREAD_PREFIX, "/runs");
|
8480
8512
|
var _n2 = this.createNewThreadMessages(this.rawBody, t, i);
|
8481
|
-
this.isSSEStream ? this.createStreamRun(_n2) :
|
8513
|
+
this.isSSEStream ? this.createStreamRun(_n2) : T.request(this, _n2, e);
|
8482
8514
|
}
|
8483
8515
|
}
|
8484
8516
|
}, {
|
8485
8517
|
key: "callServiceAPI",
|
8486
8518
|
value: function () {
|
8487
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8519
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e, t, i) {
|
8488
8520
|
var _r$assistant_id;
|
8489
8521
|
var r, n;
|
8490
|
-
return _regeneratorRuntime().wrap(function
|
8491
|
-
while (1) switch (
|
8522
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8523
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8492
8524
|
case 0:
|
8493
8525
|
if (!(this.waitingForStreamResponse = !1, !this.connectSettings)) {
|
8494
|
-
|
8526
|
+
_context85.next = 2;
|
8495
8527
|
break;
|
8496
8528
|
}
|
8497
8529
|
throw new Error("Request settings have not been set up");
|
8498
8530
|
case 2:
|
8499
8531
|
if (!((_r$assistant_id = (r = this.rawBody).assistant_id) !== null && _r$assistant_id !== void 0)) {
|
8500
|
-
|
8532
|
+
_context85.next = 6;
|
8501
8533
|
break;
|
8502
8534
|
}
|
8503
8535
|
_r$assistant_id;
|
8504
|
-
|
8536
|
+
_context85.next = 12;
|
8505
8537
|
break;
|
8506
8538
|
case 6:
|
8507
|
-
|
8508
|
-
if (
|
8509
|
-
|
8539
|
+
_context85.t0 = this.config.assistant_id;
|
8540
|
+
if (_context85.t0) {
|
8541
|
+
_context85.next = 11;
|
8510
8542
|
break;
|
8511
8543
|
}
|
8512
|
-
|
8544
|
+
_context85.next = 10;
|
8513
8545
|
return this.createNewAssistant();
|
8514
8546
|
case 10:
|
8515
|
-
|
8547
|
+
_context85.t0 = _context85.sent;
|
8516
8548
|
case 11:
|
8517
|
-
r.assistant_id =
|
8549
|
+
r.assistant_id = _context85.t0;
|
8518
8550
|
case 12:
|
8551
|
+
this.streamedMessageId = void 0;
|
8519
8552
|
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
|
8520
8553
|
if (!i) {
|
8521
|
-
|
8554
|
+
_context85.next = 20;
|
8522
8555
|
break;
|
8523
8556
|
}
|
8524
|
-
|
8525
|
-
return
|
8526
|
-
case
|
8527
|
-
|
8528
|
-
|
8557
|
+
_context85.next = 17;
|
8558
|
+
return J.storeFiles(this, e, i);
|
8559
|
+
case 17:
|
8560
|
+
_context85.t1 = _context85.sent;
|
8561
|
+
_context85.next = 21;
|
8529
8562
|
break;
|
8530
|
-
case 19:
|
8531
|
-
_context84.t1 = void 0;
|
8532
8563
|
case 20:
|
8533
|
-
|
8564
|
+
_context85.t1 = void 0;
|
8565
|
+
case 21:
|
8566
|
+
n = _context85.t1;
|
8534
8567
|
this.connectSettings.method = "POST", this.callService(e, t, n);
|
8535
|
-
case
|
8568
|
+
case 23:
|
8536
8569
|
case "end":
|
8537
|
-
return
|
8570
|
+
return _context85.stop();
|
8538
8571
|
}
|
8539
|
-
},
|
8572
|
+
}, _callee85, this);
|
8540
8573
|
}));
|
8541
|
-
function callServiceAPI(
|
8574
|
+
function callServiceAPI(_x157, _x158, _x159) {
|
8542
8575
|
return _callServiceAPI18.apply(this, arguments);
|
8543
8576
|
}
|
8544
8577
|
return callServiceAPI;
|
@@ -8546,27 +8579,27 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8546
8579
|
}, {
|
8547
8580
|
key: "createNewAssistant",
|
8548
8581
|
value: function () {
|
8549
|
-
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8582
|
+
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
|
8550
8583
|
var e;
|
8551
|
-
return _regeneratorRuntime().wrap(function
|
8552
|
-
while (1) switch (
|
8584
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8585
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8553
8586
|
case 0:
|
8554
|
-
|
8587
|
+
_context86.prev = 0;
|
8555
8588
|
this.url = F.NEW_ASSISTANT_URL;
|
8556
|
-
|
8589
|
+
_context86.next = 4;
|
8557
8590
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
|
8558
8591
|
case 4:
|
8559
|
-
e =
|
8560
|
-
return
|
8592
|
+
e = _context86.sent;
|
8593
|
+
return _context86.abrupt("return", (this.config.assistant_id = e.id, this.config.assistant_id));
|
8561
8594
|
case 8:
|
8562
|
-
|
8563
|
-
|
8564
|
-
console.error(
|
8595
|
+
_context86.prev = 8;
|
8596
|
+
_context86.t0 = _context86["catch"](0);
|
8597
|
+
console.error(_context86.t0), console.error("Failed to create a new assistant");
|
8565
8598
|
case 11:
|
8566
8599
|
case "end":
|
8567
|
-
return
|
8600
|
+
return _context86.stop();
|
8568
8601
|
}
|
8569
|
-
},
|
8602
|
+
}, _callee86, this, [[0, 8]]);
|
8570
8603
|
}));
|
8571
8604
|
function createNewAssistant() {
|
8572
8605
|
return _createNewAssistant.apply(this, arguments);
|
@@ -8585,43 +8618,43 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8585
8618
|
}, {
|
8586
8619
|
key: "extractResultData",
|
8587
8620
|
value: function () {
|
8588
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8621
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e) {
|
8589
8622
|
var n, t, i;
|
8590
|
-
return _regeneratorRuntime().wrap(function
|
8591
|
-
while (1) switch (
|
8623
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8624
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8592
8625
|
case 0:
|
8593
8626
|
if (!(this.waitingForStreamResponse || this.isSSEStream && this.sessionId)) {
|
8594
|
-
|
8627
|
+
_context87.next = 4;
|
8595
8628
|
break;
|
8596
8629
|
}
|
8597
|
-
|
8630
|
+
_context87.next = 3;
|
8598
8631
|
return this.handleStream(e);
|
8599
8632
|
case 3:
|
8600
|
-
return
|
8633
|
+
return _context87.abrupt("return", _context87.sent);
|
8601
8634
|
case 4:
|
8602
8635
|
if (!e.error) {
|
8603
|
-
|
8636
|
+
_context87.next = 6;
|
8604
8637
|
break;
|
8605
8638
|
}
|
8606
8639
|
throw e.error.message;
|
8607
8640
|
case 6:
|
8608
|
-
|
8641
|
+
_context87.next = 8;
|
8609
8642
|
return this.assignThreadAndRun(e);
|
8610
8643
|
case 8:
|
8611
8644
|
t = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
8612
8645
|
method: "GET",
|
8613
8646
|
headers: (n = this.connectSettings) == null ? void 0 : n.headers
|
8614
8647
|
};
|
8615
|
-
return
|
8648
|
+
return _context87.abrupt("return", (T.executePollRequest(this, t, i, this.messages), {
|
8616
8649
|
makingAnotherRequest: !0
|
8617
8650
|
}));
|
8618
8651
|
case 10:
|
8619
8652
|
case "end":
|
8620
|
-
return
|
8653
|
+
return _context87.stop();
|
8621
8654
|
}
|
8622
|
-
},
|
8655
|
+
}, _callee87, this);
|
8623
8656
|
}));
|
8624
|
-
function extractResultData(
|
8657
|
+
function extractResultData(_x160) {
|
8625
8658
|
return _extractResultData21.apply(this, arguments);
|
8626
8659
|
}
|
8627
8660
|
return extractResultData;
|
@@ -8629,32 +8662,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8629
8662
|
}, {
|
8630
8663
|
key: "assignThreadAndRun",
|
8631
8664
|
value: function () {
|
8632
|
-
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8665
|
+
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e) {
|
8633
8666
|
var t;
|
8634
|
-
return _regeneratorRuntime().wrap(function
|
8635
|
-
while (1) switch (
|
8667
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8668
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8636
8669
|
case 0:
|
8637
8670
|
if (!this.sessionId) {
|
8638
|
-
|
8671
|
+
_context88.next = 8;
|
8639
8672
|
break;
|
8640
8673
|
}
|
8641
8674
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8642
|
-
|
8675
|
+
_context88.next = 4;
|
8643
8676
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8644
8677
|
case 4:
|
8645
|
-
t =
|
8678
|
+
t = _context88.sent;
|
8646
8679
|
this.run_id = t.id;
|
8647
|
-
|
8680
|
+
_context88.next = 9;
|
8648
8681
|
break;
|
8649
8682
|
case 8:
|
8650
8683
|
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
|
8651
8684
|
case 9:
|
8652
8685
|
case "end":
|
8653
|
-
return
|
8686
|
+
return _context88.stop();
|
8654
8687
|
}
|
8655
|
-
},
|
8688
|
+
}, _callee88, this);
|
8656
8689
|
}));
|
8657
|
-
function assignThreadAndRun(
|
8690
|
+
function assignThreadAndRun(_x161) {
|
8658
8691
|
return _assignThreadAndRun.apply(this, arguments);
|
8659
8692
|
}
|
8660
8693
|
return assignThreadAndRun;
|
@@ -8662,39 +8695,39 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8662
8695
|
}, {
|
8663
8696
|
key: "getThreadMessages",
|
8664
8697
|
value: function () {
|
8665
|
-
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8698
|
+
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e) {
|
8666
8699
|
var t,
|
8667
8700
|
n,
|
8668
8701
|
r,
|
8669
8702
|
i,
|
8670
|
-
|
8671
|
-
return _regeneratorRuntime().wrap(function
|
8672
|
-
while (1) switch (
|
8703
|
+
_args89 = arguments;
|
8704
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
8705
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8673
8706
|
case 0:
|
8674
|
-
t =
|
8707
|
+
t = _args89.length > 1 && _args89[1] !== undefined ? _args89[1] : !1;
|
8675
8708
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(e, "/messages");
|
8676
|
-
|
8709
|
+
_context89.next = 4;
|
8677
8710
|
return P.directFetch(this, {}, "GET");
|
8678
8711
|
case 4:
|
8679
|
-
i =
|
8680
|
-
|
8681
|
-
if (!
|
8682
|
-
|
8712
|
+
i = _context89.sent;
|
8713
|
+
_context89.t0 = !t && this.deepChat.responseInterceptor;
|
8714
|
+
if (!_context89.t0) {
|
8715
|
+
_context89.next = 10;
|
8683
8716
|
break;
|
8684
8717
|
}
|
8685
|
-
|
8718
|
+
_context89.next = 9;
|
8686
8719
|
return (r = (n = this.deepChat).responseInterceptor) == null ? void 0 : r.call(n, i);
|
8687
8720
|
case 9:
|
8688
|
-
i =
|
8721
|
+
i = _context89.sent;
|
8689
8722
|
case 10:
|
8690
|
-
return
|
8723
|
+
return _context89.abrupt("return", J.processAPIMessages(this, i, t));
|
8691
8724
|
case 11:
|
8692
8725
|
case "end":
|
8693
|
-
return
|
8726
|
+
return _context89.stop();
|
8694
8727
|
}
|
8695
|
-
},
|
8728
|
+
}, _callee89, this);
|
8696
8729
|
}));
|
8697
|
-
function getThreadMessages(
|
8730
|
+
function getThreadMessages(_x162) {
|
8698
8731
|
return _getThreadMessages.apply(this, arguments);
|
8699
8732
|
}
|
8700
8733
|
return getThreadMessages;
|
@@ -8702,33 +8735,33 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8702
8735
|
}, {
|
8703
8736
|
key: "extractPollResultData",
|
8704
8737
|
value: function () {
|
8705
|
-
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8738
|
+
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
|
8706
8739
|
var _this38 = this;
|
8707
8740
|
var r, t, i, o, _o$pop, a, l, n;
|
8708
|
-
return _regeneratorRuntime().wrap(function
|
8709
|
-
while (1) switch (
|
8741
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
8742
|
+
while (1) switch (_context90.prev = _context90.next) {
|
8710
8743
|
case 0:
|
8711
8744
|
t = e.status, i = e.required_action;
|
8712
8745
|
if (!(t === "queued" || t === "in_progress")) {
|
8713
|
-
|
8746
|
+
_context90.next = 3;
|
8714
8747
|
break;
|
8715
8748
|
}
|
8716
|
-
return
|
8749
|
+
return _context90.abrupt("return", {
|
8717
8750
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8718
8751
|
});
|
8719
8752
|
case 3:
|
8720
8753
|
if (!(t === "completed" && this.messages)) {
|
8721
|
-
|
8754
|
+
_context90.next = 11;
|
8722
8755
|
break;
|
8723
8756
|
}
|
8724
|
-
|
8757
|
+
_context90.next = 6;
|
8725
8758
|
return this.getThreadMessages(e.thread_id);
|
8726
8759
|
case 6:
|
8727
|
-
o =
|
8760
|
+
o = _context90.sent;
|
8728
8761
|
_o$pop = o.pop();
|
8729
8762
|
a = _o$pop.text;
|
8730
8763
|
l = _o$pop.files;
|
8731
|
-
return
|
8764
|
+
return _context90.abrupt("return", (setTimeout(function () {
|
8732
8765
|
o.forEach(function (c) {
|
8733
8766
|
return _this38.deepChat.addMessage(c);
|
8734
8767
|
});
|
@@ -8740,22 +8773,22 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8740
8773
|
case 11:
|
8741
8774
|
n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
|
8742
8775
|
if (!(t === "requires_action" && n)) {
|
8743
|
-
|
8776
|
+
_context90.next = 16;
|
8744
8777
|
break;
|
8745
8778
|
}
|
8746
|
-
|
8779
|
+
_context90.next = 15;
|
8747
8780
|
return this.handleTools(n);
|
8748
8781
|
case 15:
|
8749
|
-
return
|
8782
|
+
return _context90.abrupt("return", _context90.sent);
|
8750
8783
|
case 16:
|
8751
8784
|
throw Error("Thread run status: ".concat(t));
|
8752
8785
|
case 17:
|
8753
8786
|
case "end":
|
8754
|
-
return
|
8787
|
+
return _context90.stop();
|
8755
8788
|
}
|
8756
|
-
},
|
8789
|
+
}, _callee90, this);
|
8757
8790
|
}));
|
8758
|
-
function extractPollResultData(
|
8791
|
+
function extractPollResultData(_x163) {
|
8759
8792
|
return _extractPollResultData5.apply(this, arguments);
|
8760
8793
|
}
|
8761
8794
|
return extractPollResultData;
|
@@ -8763,13 +8796,13 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8763
8796
|
}, {
|
8764
8797
|
key: "handleTools",
|
8765
8798
|
value: function () {
|
8766
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8799
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
|
8767
8800
|
var t, i, n;
|
8768
|
-
return _regeneratorRuntime().wrap(function
|
8769
|
-
while (1) switch (
|
8801
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
8802
|
+
while (1) switch (_context91.prev = _context91.next) {
|
8770
8803
|
case 0:
|
8771
8804
|
if (this._functionHandler) {
|
8772
|
-
|
8805
|
+
_context91.next = 2;
|
8773
8806
|
break;
|
8774
8807
|
}
|
8775
8808
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8780,14 +8813,14 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8780
8813
|
arguments: r["function"].arguments
|
8781
8814
|
};
|
8782
8815
|
});
|
8783
|
-
|
8816
|
+
_context91.next = 5;
|
8784
8817
|
return this._functionHandler(t);
|
8785
8818
|
case 5:
|
8786
|
-
i =
|
8819
|
+
i = _context91.sent;
|
8787
8820
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8788
8821
|
return typeof r != "string";
|
8789
8822
|
}) || e.length !== i.length)) {
|
8790
|
-
|
8823
|
+
_context91.next = 8;
|
8791
8824
|
break;
|
8792
8825
|
}
|
8793
8826
|
throw Error("Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.");
|
@@ -8800,32 +8833,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8800
8833
|
});
|
8801
8834
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8802
8835
|
if (!this.isSSEStream) {
|
8803
|
-
|
8836
|
+
_context91.next = 15;
|
8804
8837
|
break;
|
8805
8838
|
}
|
8806
|
-
|
8839
|
+
_context91.next = 13;
|
8807
8840
|
return this.createStreamRun({
|
8808
8841
|
tool_outputs: n
|
8809
8842
|
});
|
8810
8843
|
case 13:
|
8811
|
-
|
8844
|
+
_context91.next = 17;
|
8812
8845
|
break;
|
8813
8846
|
case 15:
|
8814
|
-
|
8847
|
+
_context91.next = 17;
|
8815
8848
|
return P.directFetch(this, {
|
8816
8849
|
tool_outputs: n
|
8817
8850
|
}, "POST");
|
8818
8851
|
case 17:
|
8819
|
-
return
|
8852
|
+
return _context91.abrupt("return", {
|
8820
8853
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8821
8854
|
});
|
8822
8855
|
case 18:
|
8823
8856
|
case "end":
|
8824
|
-
return
|
8857
|
+
return _context91.stop();
|
8825
8858
|
}
|
8826
|
-
},
|
8859
|
+
}, _callee91, this);
|
8827
8860
|
}));
|
8828
|
-
function handleTools(
|
8861
|
+
function handleTools(_x164) {
|
8829
8862
|
return _handleTools.apply(this, arguments);
|
8830
8863
|
}
|
8831
8864
|
return handleTools;
|
@@ -8833,77 +8866,111 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8833
8866
|
}, {
|
8834
8867
|
key: "handleStream",
|
8835
8868
|
value: function () {
|
8836
|
-
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8869
|
+
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e) {
|
8837
8870
|
var i, n, t, r;
|
8838
|
-
return _regeneratorRuntime().wrap(function
|
8839
|
-
while (1) switch (
|
8871
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
8872
|
+
while (1) switch (_context92.prev = _context92.next) {
|
8840
8873
|
case 0:
|
8841
8874
|
t = (n = (i = e.required_action) == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : n.tool_calls;
|
8842
8875
|
if (!(e.status === "requires_action" && t)) {
|
8843
|
-
|
8876
|
+
_context92.next = 6;
|
8844
8877
|
break;
|
8845
8878
|
}
|
8846
8879
|
this.run_id = e.id;
|
8847
|
-
|
8880
|
+
_context92.next = 5;
|
8848
8881
|
return this.handleTools(t);
|
8849
8882
|
case 5:
|
8850
|
-
return
|
8883
|
+
return _context92.abrupt("return", _context92.sent);
|
8851
8884
|
case 6:
|
8852
8885
|
if (!this.waitingForStreamResponse) {
|
8853
|
-
|
8886
|
+
_context92.next = 8;
|
8854
8887
|
break;
|
8855
8888
|
}
|
8856
|
-
return
|
8889
|
+
return _context92.abrupt("return", this.parseStreamResult(e));
|
8857
8890
|
case 8:
|
8858
8891
|
if (this.isSSEStream && this.sessionId) {
|
8859
8892
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8860
8893
|
r = JSON.parse(JSON.stringify(this.rawBody));
|
8861
8894
|
this.createStreamRun(r);
|
8862
8895
|
}
|
8863
|
-
return
|
8896
|
+
return _context92.abrupt("return", {
|
8864
8897
|
makingAnotherRequest: !0
|
8865
8898
|
});
|
8866
8899
|
case 10:
|
8867
8900
|
case "end":
|
8868
|
-
return
|
8901
|
+
return _context92.stop();
|
8869
8902
|
}
|
8870
|
-
},
|
8903
|
+
}, _callee92, this);
|
8871
8904
|
}));
|
8872
|
-
function handleStream(
|
8905
|
+
function handleStream(_x165) {
|
8873
8906
|
return _handleStream.apply(this, arguments);
|
8874
8907
|
}
|
8875
8908
|
return handleStream;
|
8876
8909
|
}()
|
8877
8910
|
}, {
|
8878
8911
|
key: "parseStreamResult",
|
8879
|
-
value: function
|
8880
|
-
var
|
8881
|
-
|
8882
|
-
|
8883
|
-
|
8884
|
-
|
8885
|
-
|
8886
|
-
|
8887
|
-
|
8912
|
+
value: function () {
|
8913
|
+
var _parseStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e) {
|
8914
|
+
var t, i, n, r;
|
8915
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
8916
|
+
while (1) switch (_context93.prev = _context93.next) {
|
8917
|
+
case 0:
|
8918
|
+
if (!((t = e.delta) != null && t.content)) {
|
8919
|
+
_context93.next = 7;
|
8920
|
+
break;
|
8921
|
+
}
|
8922
|
+
if (!(this.streamedMessageId ? this.streamedMessageId !== e.id && (this.streamedMessageId = e.id, (i = this.messageStream) == null || i.newMessage()) : this.streamedMessageId = e.id, e.delta.content.length > 1)) {
|
8923
|
+
_context93.next = 6;
|
8924
|
+
break;
|
8925
|
+
}
|
8926
|
+
_context93.next = 4;
|
8927
|
+
return J.processSteamMessages(this, e.delta.content);
|
8928
|
+
case 4:
|
8929
|
+
r = _context93.sent;
|
8930
|
+
return _context93.abrupt("return", {
|
8931
|
+
text: r[0].text,
|
8932
|
+
files: r[1].files
|
8933
|
+
});
|
8934
|
+
case 6:
|
8935
|
+
return _context93.abrupt("return", {
|
8936
|
+
text: (n = e.delta.content[0].text) == null ? void 0 : n.value
|
8937
|
+
});
|
8938
|
+
case 7:
|
8939
|
+
return _context93.abrupt("return", (!this.sessionId && e.thread_id && (this.sessionId = e.thread_id), {
|
8940
|
+
makingAnotherRequest: !0
|
8941
|
+
}));
|
8942
|
+
case 8:
|
8943
|
+
case "end":
|
8944
|
+
return _context93.stop();
|
8945
|
+
}
|
8946
|
+
}, _callee93, this);
|
8947
|
+
}));
|
8948
|
+
function parseStreamResult(_x166) {
|
8949
|
+
return _parseStreamResult.apply(this, arguments);
|
8950
|
+
}
|
8951
|
+
return parseStreamResult;
|
8952
|
+
}() // https://platform.openai.com/docs/api-reference/assistants-streaming
|
8888
8953
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8889
8954
|
}, {
|
8890
8955
|
key: "createStreamRun",
|
8891
8956
|
value: function () {
|
8892
|
-
var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8893
|
-
return _regeneratorRuntime().wrap(function
|
8894
|
-
while (1) switch (
|
8957
|
+
var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e) {
|
8958
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
8959
|
+
while (1) switch (_context94.prev = _context94.next) {
|
8895
8960
|
case 0:
|
8896
8961
|
e.stream = !0;
|
8897
8962
|
this.waitingForStreamResponse = !0;
|
8898
|
-
|
8899
|
-
return
|
8963
|
+
_context94.next = 4;
|
8964
|
+
return C.request(this, e, this.messages, !0, !0);
|
8900
8965
|
case 4:
|
8966
|
+
this.messageStream = _context94.sent;
|
8967
|
+
case 5:
|
8901
8968
|
case "end":
|
8902
|
-
return
|
8969
|
+
return _context94.stop();
|
8903
8970
|
}
|
8904
|
-
},
|
8971
|
+
}, _callee94, this);
|
8905
8972
|
}));
|
8906
|
-
function createStreamRun(
|
8973
|
+
function createStreamRun(_x167) {
|
8907
8974
|
return _createStreamRun.apply(this, arguments);
|
8908
8975
|
}
|
8909
8976
|
return createStreamRun;
|
@@ -8912,10 +8979,10 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8912
8979
|
}(U);
|
8913
8980
|
F.THREAD_PREFIX = "https://api.openai.com/v1/threads", F.NEW_ASSISTANT_URL = "https://api.openai.com/v1/assistants", F.POLLING_TIMEOUT_MS = 800;
|
8914
8981
|
var nn = F;
|
8915
|
-
var
|
8916
|
-
function
|
8982
|
+
var le = /*#__PURE__*/function (_U11) {
|
8983
|
+
function le(e) {
|
8917
8984
|
var _this39;
|
8918
|
-
_classCallCheck(this,
|
8985
|
+
_classCallCheck(this, le);
|
8919
8986
|
var o;
|
8920
8987
|
var t = e.directConnection,
|
8921
8988
|
i = t == null ? void 0 : t.openAI,
|
@@ -8927,7 +8994,7 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8927
8994
|
}
|
8928
8995
|
}
|
8929
8996
|
};
|
8930
|
-
_this39 = _callSuper(this,
|
8997
|
+
_this39 = _callSuper(this, le, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i, n]), _this39.insertKeyPlaceholderText = "OpenAI API Key", _this39.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this39.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this39.url = "", _this39.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
8931
8998
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
8932
8999
|
if (_this39.camera) {
|
8933
9000
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -8938,11 +9005,11 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8938
9005
|
}
|
8939
9006
|
};
|
8940
9007
|
}
|
8941
|
-
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage =
|
9008
|
+
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage = le.canFileSendMessage;
|
8942
9009
|
return _this39;
|
8943
9010
|
}
|
8944
|
-
_inherits(
|
8945
|
-
return _createClass(
|
9011
|
+
_inherits(le, _U11);
|
9012
|
+
return _createClass(le, [{
|
8946
9013
|
key: "preprocessBody",
|
8947
9014
|
value: function preprocessBody(e, t) {
|
8948
9015
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -8956,50 +9023,50 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8956
9023
|
var n;
|
8957
9024
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
8958
9025
|
if (i[1] || r && r !== "") {
|
8959
|
-
this.url =
|
9026
|
+
this.url = le.IMAGE_EDIT_URL;
|
8960
9027
|
var l = this.preprocessBody(this.rawBody, r);
|
8961
|
-
n =
|
8962
|
-
} else this.url =
|
8963
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
9028
|
+
n = le.createFormDataBody(l, i[0], i[1]);
|
9029
|
+
} else this.url = le.IMAGE_VARIATIONS_URL, n = le.createFormDataBody(this.rawBody, i[0]);
|
9030
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, n, e), !1);
|
8964
9031
|
}
|
8965
9032
|
}, {
|
8966
9033
|
key: "callServiceAPI",
|
8967
9034
|
value: function () {
|
8968
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9035
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i) {
|
8969
9036
|
var n, r;
|
8970
|
-
return _regeneratorRuntime().wrap(function
|
8971
|
-
while (1) switch (
|
9037
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
9038
|
+
while (1) switch (_context95.prev = _context95.next) {
|
8972
9039
|
case 0:
|
8973
9040
|
if ((n = this.connectSettings) != null && n.headers) {
|
8974
|
-
|
9041
|
+
_context95.next = 2;
|
8975
9042
|
break;
|
8976
9043
|
}
|
8977
9044
|
throw new Error("Request settings have not been set up");
|
8978
9045
|
case 2:
|
8979
9046
|
if (!(i != null && i[0])) {
|
8980
|
-
|
9047
|
+
_context95.next = 6;
|
8981
9048
|
break;
|
8982
9049
|
}
|
8983
9050
|
this.callApiWithImage(e, t, i);
|
8984
|
-
|
9051
|
+
_context95.next = 11;
|
8985
9052
|
break;
|
8986
9053
|
case 6:
|
8987
9054
|
if (this.connectSettings) {
|
8988
|
-
|
9055
|
+
_context95.next = 8;
|
8989
9056
|
break;
|
8990
9057
|
}
|
8991
9058
|
throw new Error("Request settings have not been set up");
|
8992
9059
|
case 8:
|
8993
|
-
this.url =
|
9060
|
+
this.url = le.IMAGE_GENERATION_URL;
|
8994
9061
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
8995
|
-
|
9062
|
+
T.request(this, r, e);
|
8996
9063
|
case 11:
|
8997
9064
|
case "end":
|
8998
|
-
return
|
9065
|
+
return _context95.stop();
|
8999
9066
|
}
|
9000
|
-
},
|
9067
|
+
}, _callee95, this);
|
9001
9068
|
}));
|
9002
|
-
function callServiceAPI(
|
9069
|
+
function callServiceAPI(_x168, _x169, _x170) {
|
9003
9070
|
return _callServiceAPI19.apply(this, arguments);
|
9004
9071
|
}
|
9005
9072
|
return callServiceAPI;
|
@@ -9007,17 +9074,17 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
9007
9074
|
}, {
|
9008
9075
|
key: "extractResultData",
|
9009
9076
|
value: function () {
|
9010
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9011
|
-
return _regeneratorRuntime().wrap(function
|
9012
|
-
while (1) switch (
|
9077
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e) {
|
9078
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
9079
|
+
while (1) switch (_context96.prev = _context96.next) {
|
9013
9080
|
case 0:
|
9014
9081
|
if (!e.error) {
|
9015
|
-
|
9082
|
+
_context96.next = 2;
|
9016
9083
|
break;
|
9017
9084
|
}
|
9018
9085
|
throw e.error.message;
|
9019
9086
|
case 2:
|
9020
|
-
return
|
9087
|
+
return _context96.abrupt("return", {
|
9021
9088
|
files: e.data.map(function (i) {
|
9022
9089
|
return i.url ? {
|
9023
9090
|
src: i.url,
|
@@ -9030,11 +9097,11 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
9030
9097
|
});
|
9031
9098
|
case 3:
|
9032
9099
|
case "end":
|
9033
|
-
return
|
9100
|
+
return _context96.stop();
|
9034
9101
|
}
|
9035
|
-
},
|
9102
|
+
}, _callee96);
|
9036
9103
|
}));
|
9037
|
-
function extractResultData(
|
9104
|
+
function extractResultData(_x171) {
|
9038
9105
|
return _extractResultData22.apply(this, arguments);
|
9039
9106
|
}
|
9040
9107
|
return extractResultData;
|
@@ -9062,8 +9129,8 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
9062
9129
|
}
|
9063
9130
|
}]);
|
9064
9131
|
}(U);
|
9065
|
-
|
9066
|
-
var sn =
|
9132
|
+
le.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", le.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", le.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
9133
|
+
var sn = le;
|
9067
9134
|
var yt = /*#__PURE__*/function (_U12) {
|
9068
9135
|
function yt(e) {
|
9069
9136
|
var _this40$maxMessages, _l$model;
|
@@ -9109,26 +9176,26 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9109
9176
|
}, {
|
9110
9177
|
key: "callServiceAPI",
|
9111
9178
|
value: function () {
|
9112
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9179
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t) {
|
9113
9180
|
var i, n;
|
9114
|
-
return _regeneratorRuntime().wrap(function
|
9115
|
-
while (1) switch (
|
9181
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
9182
|
+
while (1) switch (_context97.prev = _context97.next) {
|
9116
9183
|
case 0:
|
9117
9184
|
if (this.connectSettings) {
|
9118
|
-
|
9185
|
+
_context97.next = 2;
|
9119
9186
|
break;
|
9120
9187
|
}
|
9121
9188
|
throw new Error("Request settings have not been set up");
|
9122
9189
|
case 2:
|
9123
9190
|
i = this.preprocessBody(this.rawBody, t), n = this.stream;
|
9124
|
-
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0,
|
9191
|
+
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, C.request(this, i, e)) : T.request(this, i, e);
|
9125
9192
|
case 4:
|
9126
9193
|
case "end":
|
9127
|
-
return
|
9194
|
+
return _context97.stop();
|
9128
9195
|
}
|
9129
|
-
},
|
9196
|
+
}, _callee97, this);
|
9130
9197
|
}));
|
9131
|
-
function callServiceAPI(
|
9198
|
+
function callServiceAPI(_x172, _x173) {
|
9132
9199
|
return _callServiceAPI20.apply(this, arguments);
|
9133
9200
|
}
|
9134
9201
|
return callServiceAPI;
|
@@ -9136,29 +9203,29 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9136
9203
|
}, {
|
9137
9204
|
key: "extractResultData",
|
9138
9205
|
value: function () {
|
9139
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9206
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e, t, i) {
|
9140
9207
|
var n, r, o, a;
|
9141
|
-
return _regeneratorRuntime().wrap(function
|
9142
|
-
while (1) switch (
|
9208
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
9209
|
+
while (1) switch (_context98.prev = _context98.next) {
|
9143
9210
|
case 0:
|
9144
9211
|
if (!e.error) {
|
9145
|
-
|
9212
|
+
_context98.next = 2;
|
9146
9213
|
break;
|
9147
9214
|
}
|
9148
9215
|
throw e.error.message;
|
9149
9216
|
case 2:
|
9150
|
-
return
|
9217
|
+
return _context98.abrupt("return", (r = (n = e.choices) == null ? void 0 : n[0]) != null && r.delta ? this.extractStreamResult(e.choices[0], t, i) : (a = (o = e.choices) == null ? void 0 : o[0]) != null && a.message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
|
9151
9218
|
text: e.choices[0].message.content
|
9152
9219
|
} : {
|
9153
9220
|
text: ""
|
9154
9221
|
});
|
9155
9222
|
case 3:
|
9156
9223
|
case "end":
|
9157
|
-
return
|
9224
|
+
return _context98.stop();
|
9158
9225
|
}
|
9159
|
-
},
|
9226
|
+
}, _callee98, this);
|
9160
9227
|
}));
|
9161
|
-
function extractResultData(
|
9228
|
+
function extractResultData(_x174, _x175, _x176) {
|
9162
9229
|
return _extractResultData23.apply(this, arguments);
|
9163
9230
|
}
|
9164
9231
|
return extractResultData;
|
@@ -9166,37 +9233,37 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9166
9233
|
}, {
|
9167
9234
|
key: "extractStreamResult",
|
9168
9235
|
value: function () {
|
9169
|
-
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9236
|
+
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t, i) {
|
9170
9237
|
var _this41 = this;
|
9171
9238
|
var n, r, o;
|
9172
|
-
return _regeneratorRuntime().wrap(function
|
9173
|
-
while (1) switch (
|
9239
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
9240
|
+
while (1) switch (_context99.prev = _context99.next) {
|
9174
9241
|
case 0:
|
9175
9242
|
n = e.delta, r = e.finish_reason;
|
9176
9243
|
if (!(r === "tool_calls")) {
|
9177
|
-
|
9244
|
+
_context99.next = 7;
|
9178
9245
|
break;
|
9179
9246
|
}
|
9180
9247
|
this.asyncCallInProgress = !0;
|
9181
9248
|
o = {
|
9182
9249
|
tool_calls: this._streamToolCalls
|
9183
9250
|
};
|
9184
|
-
return
|
9251
|
+
return _context99.abrupt("return", (this._streamToolCalls = void 0, this.handleTools(o, t, i)));
|
9185
9252
|
case 7:
|
9186
9253
|
n != null && n.tool_calls && (this._streamToolCalls ? n.tool_calls.forEach(function (o, a) {
|
9187
9254
|
_this41._streamToolCalls && (_this41._streamToolCalls[a]["function"].arguments += o["function"].arguments);
|
9188
9255
|
}) : this._streamToolCalls = n.tool_calls);
|
9189
9256
|
case 8:
|
9190
|
-
return
|
9257
|
+
return _context99.abrupt("return", {
|
9191
9258
|
text: (n == null ? void 0 : n.content) || ""
|
9192
9259
|
});
|
9193
9260
|
case 9:
|
9194
9261
|
case "end":
|
9195
|
-
return
|
9262
|
+
return _context99.stop();
|
9196
9263
|
}
|
9197
|
-
},
|
9264
|
+
}, _callee99, this);
|
9198
9265
|
}));
|
9199
|
-
function extractStreamResult(
|
9266
|
+
function extractStreamResult(_x177, _x178, _x179) {
|
9200
9267
|
return _extractStreamResult.apply(this, arguments);
|
9201
9268
|
}
|
9202
9269
|
return extractStreamResult;
|
@@ -9204,13 +9271,13 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9204
9271
|
}, {
|
9205
9272
|
key: "handleTools",
|
9206
9273
|
value: function () {
|
9207
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9274
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e, t, i) {
|
9208
9275
|
var a, l, c, d, h, n, r, o, u, _u;
|
9209
|
-
return _regeneratorRuntime().wrap(function
|
9210
|
-
while (1) switch (
|
9276
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
9277
|
+
while (1) switch (_context100.prev = _context100.next) {
|
9211
9278
|
case 0:
|
9212
9279
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
9213
|
-
|
9280
|
+
_context100.next = 2;
|
9214
9281
|
break;
|
9215
9282
|
}
|
9216
9283
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -9222,28 +9289,28 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9222
9289
|
arguments: u["function"].arguments
|
9223
9290
|
};
|
9224
9291
|
});
|
9225
|
-
|
9292
|
+
_context100.next = 6;
|
9226
9293
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
9227
9294
|
case 6:
|
9228
|
-
o =
|
9295
|
+
o = _context100.sent;
|
9229
9296
|
if (!o.text) {
|
9230
|
-
|
9297
|
+
_context100.next = 15;
|
9231
9298
|
break;
|
9232
9299
|
}
|
9233
9300
|
u = {
|
9234
9301
|
text: o.text
|
9235
9302
|
};
|
9236
|
-
|
9303
|
+
_context100.next = 11;
|
9237
9304
|
return (c = (l = this.deepChat).responseInterceptor) == null ? void 0 : c.call(l, u);
|
9238
9305
|
case 11:
|
9239
|
-
|
9240
|
-
if (
|
9241
|
-
|
9306
|
+
_context100.t0 = _context100.sent;
|
9307
|
+
if (_context100.t0) {
|
9308
|
+
_context100.next = 14;
|
9242
9309
|
break;
|
9243
9310
|
}
|
9244
|
-
|
9311
|
+
_context100.t0 = u;
|
9245
9312
|
case 14:
|
9246
|
-
return
|
9313
|
+
return _context100.abrupt("return", _context100.t0);
|
9247
9314
|
case 15:
|
9248
9315
|
if (!(n.messages.push({
|
9249
9316
|
tool_calls: e.tool_calls,
|
@@ -9252,7 +9319,7 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9252
9319
|
}), Array.isArray(o) && !o.find(function (u) {
|
9253
9320
|
return typeof u != "string";
|
9254
9321
|
}) || r.length === o.length)) {
|
9255
|
-
|
9322
|
+
_context100.next = 35;
|
9256
9323
|
break;
|
9257
9324
|
}
|
9258
9325
|
o.forEach(function (u, f) {
|
@@ -9265,46 +9332,46 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9265
9332
|
content: u.response
|
9266
9333
|
});
|
9267
9334
|
}), delete n.tools, delete n.tool_choice, delete n.stream;
|
9268
|
-
|
9269
|
-
|
9335
|
+
_context100.prev = 17;
|
9336
|
+
_context100.next = 20;
|
9270
9337
|
return t == null ? void 0 : t(n).then(function (f) {
|
9271
9338
|
return v.processResponseByType(f);
|
9272
9339
|
});
|
9273
9340
|
case 20:
|
9274
|
-
_u =
|
9275
|
-
|
9341
|
+
_u = _context100.sent;
|
9342
|
+
_context100.next = 23;
|
9276
9343
|
return (h = (d = this.deepChat).responseInterceptor) == null ? void 0 : h.call(d, _u);
|
9277
9344
|
case 23:
|
9278
|
-
|
9279
|
-
if (
|
9280
|
-
|
9345
|
+
_context100.t1 = _context100.sent;
|
9346
|
+
if (_context100.t1) {
|
9347
|
+
_context100.next = 26;
|
9281
9348
|
break;
|
9282
9349
|
}
|
9283
|
-
|
9350
|
+
_context100.t1 = _u;
|
9284
9351
|
case 26:
|
9285
|
-
_u =
|
9352
|
+
_u = _context100.t1;
|
9286
9353
|
if (!_u.error) {
|
9287
|
-
|
9354
|
+
_context100.next = 29;
|
9288
9355
|
break;
|
9289
9356
|
}
|
9290
9357
|
throw _u.error.message;
|
9291
9358
|
case 29:
|
9292
|
-
return
|
9359
|
+
return _context100.abrupt("return", {
|
9293
9360
|
text: _u.choices[0].message.content || ""
|
9294
9361
|
});
|
9295
9362
|
case 32:
|
9296
|
-
|
9297
|
-
|
9298
|
-
throw this.asyncCallInProgress = !1,
|
9363
|
+
_context100.prev = 32;
|
9364
|
+
_context100.t2 = _context100["catch"](17);
|
9365
|
+
throw this.asyncCallInProgress = !1, _context100.t2;
|
9299
9366
|
case 35:
|
9300
9367
|
throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");
|
9301
9368
|
case 36:
|
9302
9369
|
case "end":
|
9303
|
-
return
|
9370
|
+
return _context100.stop();
|
9304
9371
|
}
|
9305
|
-
},
|
9372
|
+
}, _callee100, this, [[17, 32]]);
|
9306
9373
|
}));
|
9307
|
-
function handleTools(
|
9374
|
+
function handleTools(_x180, _x181, _x182) {
|
9308
9375
|
return _handleTools2.apply(this, arguments);
|
9309
9376
|
}
|
9310
9377
|
return handleTools;
|
@@ -9368,26 +9435,26 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9368
9435
|
}, {
|
9369
9436
|
key: "callServiceAPI",
|
9370
9437
|
value: function () {
|
9371
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9438
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e, t) {
|
9372
9439
|
var i;
|
9373
|
-
return _regeneratorRuntime().wrap(function
|
9374
|
-
while (1) switch (
|
9440
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
9441
|
+
while (1) switch (_context101.prev = _context101.next) {
|
9375
9442
|
case 0:
|
9376
9443
|
if (this.connectSettings) {
|
9377
|
-
|
9444
|
+
_context101.next = 2;
|
9378
9445
|
break;
|
9379
9446
|
}
|
9380
9447
|
throw new Error("Request settings have not been set up");
|
9381
9448
|
case 2:
|
9382
9449
|
i = this.preprocessBody(this.rawBody, t);
|
9383
|
-
|
9450
|
+
T.request(this, i, e);
|
9384
9451
|
case 4:
|
9385
9452
|
case "end":
|
9386
|
-
return
|
9453
|
+
return _context101.stop();
|
9387
9454
|
}
|
9388
|
-
},
|
9455
|
+
}, _callee101, this);
|
9389
9456
|
}));
|
9390
|
-
function callServiceAPI(
|
9457
|
+
function callServiceAPI(_x183, _x184) {
|
9391
9458
|
return _callServiceAPI21.apply(this, arguments);
|
9392
9459
|
}
|
9393
9460
|
return callServiceAPI;
|
@@ -9395,26 +9462,26 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9395
9462
|
}, {
|
9396
9463
|
key: "extractResultData",
|
9397
9464
|
value: function () {
|
9398
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9399
|
-
return _regeneratorRuntime().wrap(function
|
9400
|
-
while (1) switch (
|
9465
|
+
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e) {
|
9466
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
9467
|
+
while (1) switch (_context102.prev = _context102.next) {
|
9401
9468
|
case 0:
|
9402
9469
|
if (!e.message) {
|
9403
|
-
|
9470
|
+
_context102.next = 2;
|
9404
9471
|
break;
|
9405
9472
|
}
|
9406
9473
|
throw e.message;
|
9407
9474
|
case 2:
|
9408
|
-
return
|
9475
|
+
return _context102.abrupt("return", {
|
9409
9476
|
text: e.text
|
9410
9477
|
});
|
9411
9478
|
case 3:
|
9412
9479
|
case "end":
|
9413
|
-
return
|
9480
|
+
return _context102.stop();
|
9414
9481
|
}
|
9415
|
-
},
|
9482
|
+
}, _callee102);
|
9416
9483
|
}));
|
9417
|
-
function extractResultData(
|
9484
|
+
function extractResultData(_x185) {
|
9418
9485
|
return _extractResultData24.apply(this, arguments);
|
9419
9486
|
}
|
9420
9487
|
return extractResultData;
|
@@ -9486,26 +9553,26 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9486
9553
|
}, {
|
9487
9554
|
key: "callServiceAPI",
|
9488
9555
|
value: function () {
|
9489
|
-
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9556
|
+
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e, t) {
|
9490
9557
|
var i;
|
9491
|
-
return _regeneratorRuntime().wrap(function
|
9492
|
-
while (1) switch (
|
9558
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
9559
|
+
while (1) switch (_context103.prev = _context103.next) {
|
9493
9560
|
case 0:
|
9494
9561
|
if (this.connectSettings) {
|
9495
|
-
|
9562
|
+
_context103.next = 2;
|
9496
9563
|
break;
|
9497
9564
|
}
|
9498
9565
|
throw new Error("Request settings have not been set up");
|
9499
9566
|
case 2:
|
9500
9567
|
i = this.preprocessBody(this.rawBody, t);
|
9501
|
-
|
9568
|
+
T.request(this, i, e);
|
9502
9569
|
case 4:
|
9503
9570
|
case "end":
|
9504
|
-
return
|
9571
|
+
return _context103.stop();
|
9505
9572
|
}
|
9506
|
-
},
|
9573
|
+
}, _callee103, this);
|
9507
9574
|
}));
|
9508
|
-
function callServiceAPI(
|
9575
|
+
function callServiceAPI(_x186, _x187) {
|
9509
9576
|
return _callServiceAPI22.apply(this, arguments);
|
9510
9577
|
}
|
9511
9578
|
return callServiceAPI;
|
@@ -9513,26 +9580,26 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9513
9580
|
}, {
|
9514
9581
|
key: "extractResultData",
|
9515
9582
|
value: function () {
|
9516
|
-
var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9517
|
-
return _regeneratorRuntime().wrap(function
|
9518
|
-
while (1) switch (
|
9583
|
+
var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
|
9584
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
9585
|
+
while (1) switch (_context104.prev = _context104.next) {
|
9519
9586
|
case 0:
|
9520
9587
|
if (!e.message) {
|
9521
|
-
|
9588
|
+
_context104.next = 2;
|
9522
9589
|
break;
|
9523
9590
|
}
|
9524
9591
|
throw e.message;
|
9525
9592
|
case 2:
|
9526
|
-
return
|
9593
|
+
return _context104.abrupt("return", {
|
9527
9594
|
text: e.text
|
9528
9595
|
});
|
9529
9596
|
case 3:
|
9530
9597
|
case "end":
|
9531
|
-
return
|
9598
|
+
return _context104.stop();
|
9532
9599
|
}
|
9533
|
-
},
|
9600
|
+
}, _callee104);
|
9534
9601
|
}));
|
9535
|
-
function extractResultData(
|
9602
|
+
function extractResultData(_x188) {
|
9536
9603
|
return _extractResultData25.apply(this, arguments);
|
9537
9604
|
}
|
9538
9605
|
return extractResultData;
|
@@ -9561,8 +9628,8 @@ var Mo = /*#__PURE__*/function () {
|
|
9561
9628
|
if (t.azure) {
|
9562
9629
|
if (t.azure.speechToText) return new tn(e);
|
9563
9630
|
if (t.azure.textToSpeech) return new en(e);
|
9564
|
-
if (t.azure.summarization) return new
|
9565
|
-
if (t.azure.translation) return new
|
9631
|
+
if (t.azure.summarization) return new To(e);
|
9632
|
+
if (t.azure.translation) return new Co(e);
|
9566
9633
|
}
|
9567
9634
|
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new ri(e) : t.stabilityAI.imageToImageUpscale ? new ni(e) : t.stabilityAI.imageToImageMasking ? new si(e) : new oi(e);
|
9568
9635
|
if (t.mistral) return new Ao(e);
|
@@ -9680,11 +9747,11 @@ var Ro = /*#__PURE__*/function () {
|
|
9680
9747
|
}]);
|
9681
9748
|
}();
|
9682
9749
|
var Io = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>";
|
9683
|
-
var
|
9684
|
-
function
|
9685
|
-
_classCallCheck(this,
|
9750
|
+
var Ce = /*#__PURE__*/function () {
|
9751
|
+
function Ce() {
|
9752
|
+
_classCallCheck(this, Ce);
|
9686
9753
|
}
|
9687
|
-
return _createClass(
|
9754
|
+
return _createClass(Ce, null, [{
|
9688
9755
|
key: "createImage",
|
9689
9756
|
value: function createImage(e, t) {
|
9690
9757
|
var i = new Image();
|
@@ -9694,20 +9761,20 @@ var Te = /*#__PURE__*/function () {
|
|
9694
9761
|
}, {
|
9695
9762
|
key: "addNewImageMessage",
|
9696
9763
|
value: function () {
|
9697
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9764
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e, t, i) {
|
9698
9765
|
var n, r;
|
9699
|
-
return _regeneratorRuntime().wrap(function
|
9700
|
-
while (1) switch (
|
9766
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
9767
|
+
while (1) switch (_context105.prev = _context105.next) {
|
9701
9768
|
case 0:
|
9702
|
-
n =
|
9769
|
+
n = Ce.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
9703
9770
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), q.addMessage(e, r, "image", i);
|
9704
9771
|
case 2:
|
9705
9772
|
case "end":
|
9706
|
-
return
|
9773
|
+
return _context105.stop();
|
9707
9774
|
}
|
9708
|
-
},
|
9775
|
+
}, _callee105);
|
9709
9776
|
}));
|
9710
|
-
function addNewImageMessage(
|
9777
|
+
function addNewImageMessage(_x189, _x190, _x191) {
|
9711
9778
|
return _addNewImageMessage.apply(this, arguments);
|
9712
9779
|
}
|
9713
9780
|
return addNewImageMessage;
|
@@ -9721,7 +9788,7 @@ var Te = /*#__PURE__*/function () {
|
|
9721
9788
|
}, {
|
9722
9789
|
key: "addNewAudioMessage",
|
9723
9790
|
value: function addNewAudioMessage(e, t, i) {
|
9724
|
-
var n =
|
9791
|
+
var n = Ce.createAudioElement(t, i),
|
9725
9792
|
r = e.createNewMessageElement("", i);
|
9726
9793
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"), q.addMessage(e, r, "audio", i);
|
9727
9794
|
}
|
@@ -9732,7 +9799,7 @@ var Te = /*#__PURE__*/function () {
|
|
9732
9799
|
t.classList.add("any-file-message-contents");
|
9733
9800
|
var i = document.createElement("div");
|
9734
9801
|
i.classList.add("any-file-message-icon-container");
|
9735
|
-
var n =
|
9802
|
+
var n = Z.createSVGElement(Io);
|
9736
9803
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9737
9804
|
var r = document.createElement("div");
|
9738
9805
|
return r.classList.add("any-file-message-text"), r.textContent = e.name || q.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), q.processContent("any", t, e.src, r.textContent);
|
@@ -9741,7 +9808,7 @@ var Te = /*#__PURE__*/function () {
|
|
9741
9808
|
key: "addNewAnyFileMessage",
|
9742
9809
|
value: function addNewAnyFileMessage(e, t, i) {
|
9743
9810
|
var n = e.createNewMessageElement("", i),
|
9744
|
-
r =
|
9811
|
+
r = Ce.createAnyFile(t);
|
9745
9812
|
n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r), q.addMessage(e, n, "file", i);
|
9746
9813
|
}
|
9747
9814
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
@@ -9749,7 +9816,7 @@ var Te = /*#__PURE__*/function () {
|
|
9749
9816
|
key: "addMessages",
|
9750
9817
|
value: function addMessages(e, t, i) {
|
9751
9818
|
t.forEach(function (n) {
|
9752
|
-
n.ref && (n = q.removeFileRef(n)), q.isAudioFile(n) ?
|
9819
|
+
n.ref && (n = q.removeFileRef(n)), q.isAudioFile(n) ? Ce.addNewAudioMessage(e, n, i) : q.isImageFile(n) ? Ce.addNewImageMessage(e, n, i) : Ce.addNewAnyFileMessage(e, n, i);
|
9753
9820
|
});
|
9754
9821
|
}
|
9755
9822
|
}]);
|
@@ -9823,15 +9890,15 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9823
9890
|
}, {
|
9824
9891
|
key: "fetchHistory",
|
9825
9892
|
value: function () {
|
9826
|
-
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9893
|
+
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(e) {
|
9827
9894
|
var _this46 = this;
|
9828
|
-
return _regeneratorRuntime().wrap(function
|
9829
|
-
while (1) switch (
|
9895
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
9896
|
+
while (1) switch (_context106.prev = _context106.next) {
|
9830
9897
|
case 0:
|
9831
|
-
|
9898
|
+
_context106.next = 2;
|
9832
9899
|
return e();
|
9833
9900
|
case 2:
|
9834
|
-
|
9901
|
+
_context106.sent.forEach(function (i) {
|
9835
9902
|
return _this46.addAnyMessage(i, !0);
|
9836
9903
|
});
|
9837
9904
|
setTimeout(function () {
|
@@ -9839,11 +9906,11 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9839
9906
|
}, 0);
|
9840
9907
|
case 4:
|
9841
9908
|
case "end":
|
9842
|
-
return
|
9909
|
+
return _context106.stop();
|
9843
9910
|
}
|
9844
|
-
},
|
9911
|
+
}, _callee106);
|
9845
9912
|
}));
|
9846
|
-
function fetchHistory(
|
9913
|
+
function fetchHistory(_x192) {
|
9847
9914
|
return _fetchHistory.apply(this, arguments);
|
9848
9915
|
}
|
9849
9916
|
return fetchHistory;
|
@@ -9863,7 +9930,7 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9863
9930
|
n = {
|
9864
9931
|
status: e.overwrite
|
9865
9932
|
};
|
9866
|
-
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, n), !t && this.textToSpeech && i.role !== b.USER_ROLE && rt.speak(i.text, this.textToSpeech)), i.files && Array.isArray(i.files) &&
|
9933
|
+
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, n), !t && this.textToSpeech && i.role !== b.USER_ROLE && rt.speak(i.text, this.textToSpeech)), i.files && Array.isArray(i.files) && Ce.addMessages(this, i.files, i.role), i.html !== void 0 && i.html !== null) {
|
9867
9934
|
var r = ct.add(this, i.html, i.role, this.messageElementRefs, n);
|
9868
9935
|
Le.isElementTemporary(r) && delete i.html;
|
9869
9936
|
}
|
@@ -9943,11 +10010,11 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9943
10010
|
}, {
|
9944
10011
|
key: "addMultipleFiles",
|
9945
10012
|
value: function () {
|
9946
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9947
|
-
return _regeneratorRuntime().wrap(function
|
9948
|
-
while (1) switch (
|
10013
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107(e) {
|
10014
|
+
return _regeneratorRuntime().wrap(function _callee107$(_context107) {
|
10015
|
+
while (1) switch (_context107.prev = _context107.next) {
|
9949
10016
|
case 0:
|
9950
|
-
return
|
10017
|
+
return _context107.abrupt("return", Promise.all((e || []).map(function (t) {
|
9951
10018
|
return new Promise(function (i) {
|
9952
10019
|
if (!t.type || t.type === "any") {
|
9953
10020
|
var n = t.file.name || q.DEFAULT_FILE_NAME;
|
@@ -9970,11 +10037,11 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9970
10037
|
})));
|
9971
10038
|
case 1:
|
9972
10039
|
case "end":
|
9973
|
-
return
|
10040
|
+
return _context107.stop();
|
9974
10041
|
}
|
9975
|
-
},
|
10042
|
+
}, _callee107);
|
9976
10043
|
}));
|
9977
|
-
function addMultipleFiles(
|
10044
|
+
function addMultipleFiles(_x193) {
|
9978
10045
|
return _addMultipleFiles.apply(this, arguments);
|
9979
10046
|
}
|
9980
10047
|
return addMultipleFiles;
|
@@ -10077,11 +10144,11 @@ var ht = /*#__PURE__*/function () {
|
|
10077
10144
|
}]);
|
10078
10145
|
}();
|
10079
10146
|
var Nn = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
10080
|
-
var
|
10081
|
-
function
|
10082
|
-
_classCallCheck(this,
|
10147
|
+
var X = /*#__PURE__*/function () {
|
10148
|
+
function X() {
|
10149
|
+
_classCallCheck(this, X);
|
10083
10150
|
}
|
10084
|
-
return _createClass(
|
10151
|
+
return _createClass(X, null, [{
|
10085
10152
|
key: "createTextElement",
|
10086
10153
|
value: function createTextElement(e) {
|
10087
10154
|
var t = document.createElement("div");
|
@@ -10090,15 +10157,15 @@ var J = /*#__PURE__*/function () {
|
|
10090
10157
|
}, {
|
10091
10158
|
key: "createElement",
|
10092
10159
|
value: function createElement(e, t) {
|
10093
|
-
return t ?
|
10160
|
+
return t ? X.createTextElement(e) : Z.createSVGElement(e);
|
10094
10161
|
}
|
10095
10162
|
}, {
|
10096
10163
|
key: "createCustomElement",
|
10097
10164
|
value: function createCustomElement(e, t) {
|
10098
10165
|
var n, r, o, a;
|
10099
10166
|
var i = t == null ? void 0 : t[e];
|
10100
|
-
if ((n = i == null ? void 0 : i.text) != null && n.content) return
|
10101
|
-
if ((o = i == null ? void 0 : i.svg) != null && o.content) return
|
10167
|
+
if ((n = i == null ? void 0 : i.text) != null && n.content) return X.createElement((r = i == null ? void 0 : i.text) == null ? void 0 : r.content, !0);
|
10168
|
+
if ((o = i == null ? void 0 : i.svg) != null && o.content) return X.createElement((a = i == null ? void 0 : i.svg) == null ? void 0 : a.content, !1);
|
10102
10169
|
}
|
10103
10170
|
}, {
|
10104
10171
|
key: "processElement",
|
@@ -10111,7 +10178,7 @@ var J = /*#__PURE__*/function () {
|
|
10111
10178
|
key: "createSpecificStateElement",
|
10112
10179
|
value: function createSpecificStateElement(e, t, i) {
|
10113
10180
|
var n;
|
10114
|
-
return i && (n =
|
10181
|
+
return i && (n = X.createCustomElement(t, i)), X.processElement(e, n), n;
|
10115
10182
|
}
|
10116
10183
|
}]);
|
10117
10184
|
}();
|
@@ -10349,7 +10416,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10349
10416
|
}, {
|
10350
10417
|
key: "createInnerElement",
|
10351
10418
|
value: function createInnerElement(e, t, i) {
|
10352
|
-
return
|
10419
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
10353
10420
|
}
|
10354
10421
|
}, {
|
10355
10422
|
key: "addClickEvent",
|
@@ -10378,7 +10445,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10378
10445
|
}, {
|
10379
10446
|
key: "createSVGIconElement",
|
10380
10447
|
value: function createSVGIconElement() {
|
10381
|
-
return
|
10448
|
+
return Z.createSVGElement(Lo);
|
10382
10449
|
}
|
10383
10450
|
}, {
|
10384
10451
|
key: "createButtonContainer",
|
@@ -10519,7 +10586,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10519
10586
|
}, {
|
10520
10587
|
key: "createInnerElement",
|
10521
10588
|
value: function createInnerElement(e, t, i) {
|
10522
|
-
return
|
10589
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
10523
10590
|
}
|
10524
10591
|
}, {
|
10525
10592
|
key: "changeToActive",
|
@@ -10566,7 +10633,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10566
10633
|
}, {
|
10567
10634
|
key: "createSVGIconElement",
|
10568
10635
|
value: function createSVGIconElement() {
|
10569
|
-
var e =
|
10636
|
+
var e = Z.createSVGElement(Bo);
|
10570
10637
|
return e.id = "microphone-icon", e;
|
10571
10638
|
}
|
10572
10639
|
}]);
|
@@ -10686,16 +10753,16 @@ gt.IS_SAFARI = function () {
|
|
10686
10753
|
return gt._IS_SAFARI === void 0 && (gt._IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), gt._IS_SAFARI;
|
10687
10754
|
};
|
10688
10755
|
var Ut = {},
|
10689
|
-
|
10690
|
-
Object.defineProperty(
|
10756
|
+
Ti = {};
|
10757
|
+
Object.defineProperty(Ti, "__esModule", {
|
10691
10758
|
value: !0
|
10692
10759
|
});
|
10693
|
-
|
10694
|
-
var
|
10695
|
-
function
|
10696
|
-
_classCallCheck(this,
|
10760
|
+
Ti.EventListeners = void 0;
|
10761
|
+
var ie = /*#__PURE__*/function () {
|
10762
|
+
function ie() {
|
10763
|
+
_classCallCheck(this, ie);
|
10697
10764
|
}
|
10698
|
-
return _createClass(
|
10765
|
+
return _createClass(ie, null, [{
|
10699
10766
|
key: "getElementIfFocusedOnAvailable",
|
10700
10767
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
10701
10768
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -10706,14 +10773,14 @@ var te = /*#__PURE__*/function () {
|
|
10706
10773
|
key: "keyDownWindow",
|
10707
10774
|
value: function keyDownWindow(e) {
|
10708
10775
|
var _this51 = this;
|
10709
|
-
e.element &&
|
10710
|
-
|
10776
|
+
e.element && ie.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (ie.KEY_DOWN_TIMEOUT !== null && clearTimeout(ie.KEY_DOWN_TIMEOUT), ie.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10777
|
+
ie.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
|
10711
10778
|
}, 500));
|
10712
10779
|
}
|
10713
10780
|
}, {
|
10714
10781
|
key: "mouseDownWindow",
|
10715
10782
|
value: function mouseDownWindow(e, t) {
|
10716
|
-
this.mouseDownElement =
|
10783
|
+
this.mouseDownElement = ie.getElementIfFocusedOnAvailable(e, t.target);
|
10717
10784
|
}
|
10718
10785
|
}, {
|
10719
10786
|
key: "mouseUpWindow",
|
@@ -10724,7 +10791,7 @@ var te = /*#__PURE__*/function () {
|
|
10724
10791
|
key: "add",
|
10725
10792
|
value: function add(e, t) {
|
10726
10793
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
10727
|
-
t != null && t.element && i && (e.mouseDownEvent =
|
10794
|
+
t != null && t.element && i && (e.mouseDownEvent = ie.mouseDownWindow.bind(e, t.element), document.addEventListener("mousedown", e.mouseDownEvent), e.mouseUpEvent = ie.mouseUpWindow.bind(e, t), document.addEventListener("mouseup", e.mouseUpEvent), e.keyDownEvent = ie.keyDownWindow.bind(e, t), document.addEventListener("keydown", e.keyDownEvent));
|
10728
10795
|
}
|
10729
10796
|
}, {
|
10730
10797
|
key: "remove",
|
@@ -10733,13 +10800,13 @@ var te = /*#__PURE__*/function () {
|
|
10733
10800
|
}
|
10734
10801
|
}]);
|
10735
10802
|
}();
|
10736
|
-
|
10737
|
-
|
10738
|
-
var
|
10739
|
-
Object.defineProperty(
|
10803
|
+
Ti.EventListeners = ie;
|
10804
|
+
ie.KEY_DOWN_TIMEOUT = null;
|
10805
|
+
var Ci = {};
|
10806
|
+
Object.defineProperty(Ci, "__esModule", {
|
10740
10807
|
value: !0
|
10741
10808
|
});
|
10742
|
-
|
10809
|
+
Ci.PreResultUtils = void 0;
|
10743
10810
|
var qo = /*#__PURE__*/function () {
|
10744
10811
|
function qo() {
|
10745
10812
|
_classCallCheck(this, qo);
|
@@ -10754,7 +10821,7 @@ var qo = /*#__PURE__*/function () {
|
|
10754
10821
|
}
|
10755
10822
|
}]);
|
10756
10823
|
}();
|
10757
|
-
|
10824
|
+
Ci.PreResultUtils = qo;
|
10758
10825
|
var Ht = {},
|
10759
10826
|
qt = {};
|
10760
10827
|
Object.defineProperty(qt, "__esModule", {
|
@@ -10944,11 +11011,11 @@ var Fn = qt,
|
|
10944
11011
|
Go = ft,
|
10945
11012
|
Bn = Ye,
|
10946
11013
|
jn = Xe;
|
10947
|
-
var
|
10948
|
-
function
|
10949
|
-
_classCallCheck(this,
|
11014
|
+
var ee = /*#__PURE__*/function () {
|
11015
|
+
function ee() {
|
11016
|
+
_classCallCheck(this, ee);
|
10950
11017
|
}
|
10951
|
-
return _createClass(
|
11018
|
+
return _createClass(ee, null, [{
|
10952
11019
|
key: "processCommand",
|
10953
11020
|
value: function processCommand(e, t) {
|
10954
11021
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? jn.Text.breakupIntoWordsArr(e) : e;
|
@@ -10959,7 +11026,7 @@ var Q = /*#__PURE__*/function () {
|
|
10959
11026
|
var t;
|
10960
11027
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (n, r) {
|
10961
11028
|
var o = e[r];
|
10962
|
-
return n[r] = typeof o == "string" ?
|
11029
|
+
return n[r] = typeof o == "string" ? ee.processCommand(o, e.settings) : o, n;
|
10963
11030
|
}, {});
|
10964
11031
|
}
|
10965
11032
|
}, {
|
@@ -10977,7 +11044,7 @@ var Q = /*#__PURE__*/function () {
|
|
10977
11044
|
}, {
|
10978
11045
|
key: "setText",
|
10979
11046
|
value: function setText(e, t, i, n) {
|
10980
|
-
|
11047
|
+
ee.toggleCommandModeOff(e), Vo.Elements.isPrimitiveElement(n) ? (n.value = i, e.isTargetInShadow || Bn.Cursor.setOffsetForPrimitive(n, i.length, !0), Go.Browser.IS_SAFARI() && e.autoScroll && Fn.AutoScroll.scrollSafariPrimitiveToEnd(n)) : (n.textContent = i, e.isTargetInShadow || Bn.Cursor.focusEndOfGeneric(n), setTimeout(function () {
|
10981
11048
|
return Fn.AutoScroll.scrollGeneric(e, n);
|
10982
11049
|
})), e.resetRecording(t);
|
10983
11050
|
}
|
@@ -11007,38 +11074,38 @@ var Q = /*#__PURE__*/function () {
|
|
11007
11074
|
if (!c || !n || !i) return;
|
11008
11075
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
11009
11076
|
h = jn.Text.breakupIntoWordsArr(d),
|
11010
|
-
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ?
|
11077
|
+
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? ee.checkIfMatchesWord : ee.checkIfMatchesSubstring;
|
11011
11078
|
if (c.commandMode && u(c.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
11012
|
-
return
|
11079
|
+
return ee.toggleCommandModeOn(e);
|
11013
11080
|
}), {
|
11014
11081
|
doNotProcessTranscription: !1
|
11015
11082
|
};
|
11016
11083
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
11017
|
-
if (c.stop && u(c.stop, d, h)) return
|
11084
|
+
if (c.stop && u(c.stop, d, h)) return ee.toggleCommandModeOff(e), setTimeout(function () {
|
11018
11085
|
return e.stop();
|
11019
11086
|
}), {
|
11020
11087
|
doNotProcessTranscription: !1
|
11021
11088
|
};
|
11022
|
-
if (c.pause && u(c.pause, d, h)) return
|
11089
|
+
if (c.pause && u(c.pause, d, h)) return ee.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11023
11090
|
var f;
|
11024
11091
|
e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
|
11025
11092
|
}), {
|
11026
11093
|
doNotProcessTranscription: !1
|
11027
11094
|
};
|
11028
|
-
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1),
|
11095
|
+
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), ee.toggleCommandModeOff(e), e.resetRecording(i), {
|
11029
11096
|
doNotProcessTranscription: !0
|
11030
11097
|
};
|
11031
|
-
if (c.reset && u(c.reset, d, h)) return r !== void 0 &&
|
11098
|
+
if (c.reset && u(c.reset, d, h)) return r !== void 0 && ee.setText(e, i, r, n), {
|
11032
11099
|
doNotProcessTranscription: !0
|
11033
11100
|
};
|
11034
|
-
if (c.removeAllText && u(c.removeAllText, d, h)) return
|
11101
|
+
if (c.removeAllText && u(c.removeAllText, d, h)) return ee.setText(e, i, "", n), {
|
11035
11102
|
doNotProcessTranscription: !0
|
11036
11103
|
};
|
11037
11104
|
}
|
11038
11105
|
}
|
11039
11106
|
}]);
|
11040
11107
|
}();
|
11041
|
-
Ht.CommandUtils =
|
11108
|
+
Ht.CommandUtils = ee;
|
11042
11109
|
var ki = {};
|
11043
11110
|
Object.defineProperty(ki, "__esModule", {
|
11044
11111
|
value: !0
|
@@ -11165,8 +11232,8 @@ Object.defineProperty(Ut, "__esModule", {
|
|
11165
11232
|
value: !0
|
11166
11233
|
});
|
11167
11234
|
Ut.Speech = void 0;
|
11168
|
-
var Hn =
|
11169
|
-
Ko =
|
11235
|
+
var Hn = Ti,
|
11236
|
+
Ko = Ci,
|
11170
11237
|
qn = Ht,
|
11171
11238
|
$t = qt,
|
11172
11239
|
Ui = ki,
|
@@ -11425,26 +11492,26 @@ var fi = /*#__PURE__*/function () {
|
|
11425
11492
|
}, {
|
11426
11493
|
key: "getNewSpeechConfig",
|
11427
11494
|
value: function () {
|
11428
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11429
|
-
return _regeneratorRuntime().wrap(function
|
11430
|
-
while (1) switch (
|
11495
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee108(e, t) {
|
11496
|
+
return _regeneratorRuntime().wrap(function _callee108$(_context108) {
|
11497
|
+
while (1) switch (_context108.prev = _context108.next) {
|
11431
11498
|
case 0:
|
11432
11499
|
if (!t.region) {
|
11433
|
-
|
11500
|
+
_context108.next = 2;
|
11434
11501
|
break;
|
11435
11502
|
}
|
11436
|
-
return
|
11503
|
+
return _context108.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 (i) {
|
11437
11504
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11438
11505
|
})["catch"](function (i) {
|
11439
11506
|
return console.error(i), null;
|
11440
11507
|
}) : null);
|
11441
11508
|
case 2:
|
11442
11509
|
case "end":
|
11443
|
-
return
|
11510
|
+
return _context108.stop();
|
11444
11511
|
}
|
11445
|
-
},
|
11512
|
+
}, _callee108);
|
11446
11513
|
}));
|
11447
|
-
function getNewSpeechConfig(
|
11514
|
+
function getNewSpeechConfig(_x194, _x195) {
|
11448
11515
|
return _getNewSpeechConfig.apply(this, arguments);
|
11449
11516
|
}
|
11450
11517
|
return getNewSpeechConfig;
|
@@ -11457,23 +11524,23 @@ var fi = /*#__PURE__*/function () {
|
|
11457
11524
|
}, {
|
11458
11525
|
key: "get",
|
11459
11526
|
value: function () {
|
11460
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11527
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee109(e, t) {
|
11461
11528
|
var i;
|
11462
|
-
return _regeneratorRuntime().wrap(function
|
11463
|
-
while (1) switch (
|
11529
|
+
return _regeneratorRuntime().wrap(function _callee109$(_context109) {
|
11530
|
+
while (1) switch (_context109.prev = _context109.next) {
|
11464
11531
|
case 0:
|
11465
|
-
|
11532
|
+
_context109.next = 2;
|
11466
11533
|
return fi.getNewSpeechConfig(e, t);
|
11467
11534
|
case 2:
|
11468
|
-
i =
|
11469
|
-
return
|
11535
|
+
i = _context109.sent;
|
11536
|
+
return _context109.abrupt("return", (i && fi.process(i, t), i));
|
11470
11537
|
case 4:
|
11471
11538
|
case "end":
|
11472
|
-
return
|
11539
|
+
return _context109.stop();
|
11473
11540
|
}
|
11474
|
-
},
|
11541
|
+
}, _callee109);
|
11475
11542
|
}));
|
11476
|
-
function get(
|
11543
|
+
function get(_x196, _x197) {
|
11477
11544
|
return _get.apply(this, arguments);
|
11478
11545
|
}
|
11479
11546
|
return get;
|
@@ -11559,28 +11626,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11559
11626
|
}, {
|
11560
11627
|
key: "startAsync",
|
11561
11628
|
value: function () {
|
11562
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11629
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee110(e) {
|
11563
11630
|
var t;
|
11564
|
-
return _regeneratorRuntime().wrap(function
|
11565
|
-
while (1) switch (
|
11631
|
+
return _regeneratorRuntime().wrap(function _callee110$(_context110) {
|
11632
|
+
while (1) switch (_context110.prev = _context110.next) {
|
11566
11633
|
case 0:
|
11567
|
-
|
11568
|
-
if (!
|
11569
|
-
|
11634
|
+
_context110.t0 = this.validate(e);
|
11635
|
+
if (!_context110.t0) {
|
11636
|
+
_context110.next = 6;
|
11570
11637
|
break;
|
11571
11638
|
}
|
11572
|
-
|
11639
|
+
_context110.next = 4;
|
11573
11640
|
return this.instantiateService(e);
|
11574
11641
|
case 4:
|
11575
11642
|
this._translations = e == null ? void 0 : e.translations;
|
11576
11643
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11577
11644
|
case 6:
|
11578
11645
|
case "end":
|
11579
|
-
return
|
11646
|
+
return _context110.stop();
|
11580
11647
|
}
|
11581
|
-
},
|
11648
|
+
}, _callee110, this);
|
11582
11649
|
}));
|
11583
|
-
function startAsync(
|
11650
|
+
function startAsync(_x198) {
|
11584
11651
|
return _startAsync.apply(this, arguments);
|
11585
11652
|
}
|
11586
11653
|
return startAsync;
|
@@ -11593,28 +11660,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11593
11660
|
}, {
|
11594
11661
|
key: "instantiateService",
|
11595
11662
|
value: function () {
|
11596
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11663
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee111(e) {
|
11597
11664
|
var t, i, n, r;
|
11598
|
-
return _regeneratorRuntime().wrap(function
|
11599
|
-
while (1) switch (
|
11665
|
+
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
11666
|
+
while (1) switch (_context111.prev = _context111.next) {
|
11600
11667
|
case 0:
|
11601
11668
|
t = pi.getAPI();
|
11602
11669
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11603
|
-
|
11670
|
+
_context111.next = 4;
|
11604
11671
|
return Kn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11605
11672
|
case 4:
|
11606
|
-
n =
|
11673
|
+
n = _context111.sent;
|
11607
11674
|
if (n) {
|
11608
11675
|
r = new t.SpeechRecognizer(n, i);
|
11609
11676
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11610
11677
|
} else this.error("Unable to contact Azure server");
|
11611
11678
|
case 6:
|
11612
11679
|
case "end":
|
11613
|
-
return
|
11680
|
+
return _context111.stop();
|
11614
11681
|
}
|
11615
|
-
},
|
11682
|
+
}, _callee111, this);
|
11616
11683
|
}));
|
11617
|
-
function instantiateService(
|
11684
|
+
function instantiateService(_x199) {
|
11618
11685
|
return _instantiateService.apply(this, arguments);
|
11619
11686
|
}
|
11620
11687
|
return instantiateService;
|
@@ -11715,7 +11782,7 @@ Object.defineProperty(cs, "__esModule", {
|
|
11715
11782
|
});
|
11716
11783
|
var Xn = Si,
|
11717
11784
|
ta = Ht,
|
11718
|
-
|
11785
|
+
re = Mi,
|
11719
11786
|
ia = Ri;
|
11720
11787
|
var tt = /*#__PURE__*/function () {
|
11721
11788
|
function tt() {
|
@@ -11726,12 +11793,12 @@ var tt = /*#__PURE__*/function () {
|
|
11726
11793
|
value: function toggle(e, t) {
|
11727
11794
|
var i, n;
|
11728
11795
|
var r = e.toLocaleLowerCase().trim();
|
11729
|
-
!((i =
|
11796
|
+
!((i = re.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? tt.startWebSpeech(t) : r === "azure" ? tt.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (n = t == null ? void 0 : t.onError) === null || n === void 0 || n.call(t, "service not found - must be either 'webspeech' or 'azure'"));
|
11730
11797
|
}
|
11731
11798
|
}, {
|
11732
11799
|
key: "startWebSpeech",
|
11733
11800
|
value: function startWebSpeech(e) {
|
11734
|
-
tt.stop() || (
|
11801
|
+
tt.stop() || (re.GlobalState.service = new Xn.WebSpeech(), re.GlobalState.service.start(e));
|
11735
11802
|
}
|
11736
11803
|
}, {
|
11737
11804
|
key: "isWebSpeechSupported",
|
@@ -11742,18 +11809,18 @@ var tt = /*#__PURE__*/function () {
|
|
11742
11809
|
key: "startAzure",
|
11743
11810
|
value: function startAzure(e) {
|
11744
11811
|
var t;
|
11745
|
-
tt.stop() || !((t =
|
11812
|
+
tt.stop() || !((t = re.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (re.GlobalState.service = new ia.Azure(), re.GlobalState.service.start(e));
|
11746
11813
|
}
|
11747
11814
|
}, {
|
11748
11815
|
key: "stop",
|
11749
11816
|
value: function stop() {
|
11750
11817
|
var e;
|
11751
|
-
return
|
11818
|
+
return re.GlobalState.doubleClickDetector() ? !0 : (!((e = re.GlobalState.service) === null || e === void 0) && e.recognizing && re.GlobalState.service.stop(), !1);
|
11752
11819
|
}
|
11753
11820
|
}, {
|
11754
11821
|
key: "endCommandMode",
|
11755
11822
|
value: function endCommandMode() {
|
11756
|
-
|
11823
|
+
re.GlobalState.service && ta.CommandUtils.toggleCommandModeOff(re.GlobalState.service);
|
11757
11824
|
}
|
11758
11825
|
}]);
|
11759
11826
|
}();
|
@@ -11789,12 +11856,12 @@ var na = /*#__PURE__*/function () {
|
|
11789
11856
|
}
|
11790
11857
|
}]);
|
11791
11858
|
}();
|
11792
|
-
var
|
11793
|
-
function
|
11859
|
+
var Tt = /*#__PURE__*/function (_Lt) {
|
11860
|
+
function Tt(e, t, i) {
|
11794
11861
|
var _this56;
|
11795
|
-
_classCallCheck(this,
|
11862
|
+
_classCallCheck(this, Tt);
|
11796
11863
|
var o;
|
11797
|
-
_this56 = _callSuper(this,
|
11864
|
+
_this56 = _callSuper(this, Tt, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
|
11798
11865
|
var _this56$processConfig = _this56.processConfiguration(t, e.speechToText),
|
11799
11866
|
n = _this56$processConfig.serviceName,
|
11800
11867
|
r = _this56$processConfig.processedConfig;
|
@@ -11808,8 +11875,8 @@ var Ct = /*#__PURE__*/function (_Lt) {
|
|
11808
11875
|
return _this56;
|
11809
11876
|
}
|
11810
11877
|
// prettier-ignore
|
11811
|
-
_inherits(
|
11812
|
-
return _createClass(
|
11878
|
+
_inherits(Tt, _Lt);
|
11879
|
+
return _createClass(Tt, [{
|
11813
11880
|
key: "processConfiguration",
|
11814
11881
|
value: function processConfiguration(e, t) {
|
11815
11882
|
var _i$displayInterimResu, _i$textColor, _i$translations, _i$commands;
|
@@ -11833,7 +11900,7 @@ var Ct = /*#__PURE__*/function (_Lt) {
|
|
11833
11900
|
removeNewText: !0
|
11834
11901
|
}) : null;
|
11835
11902
|
}), i.submitAfterSilence && (this._silenceSubmit = new na(i.submitAfterSilence, i.stopAfterSubmit)), {
|
11836
|
-
serviceName:
|
11903
|
+
serviceName: Tt.getServiceName(i),
|
11837
11904
|
processedConfig: o
|
11838
11905
|
};
|
11839
11906
|
}
|
@@ -11885,12 +11952,12 @@ var Ct = /*#__PURE__*/function (_Lt) {
|
|
11885
11952
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
11886
11953
|
e.click(), t || setTimeout(function () {
|
11887
11954
|
return e.click();
|
11888
|
-
},
|
11955
|
+
}, Tt.MICROPHONE_RESET_TIMEOUT_MS);
|
11889
11956
|
}
|
11890
11957
|
}]);
|
11891
11958
|
}(Lt);
|
11892
|
-
|
11893
|
-
var Ot =
|
11959
|
+
Tt.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
11960
|
+
var Ot = Tt;
|
11894
11961
|
var xe = /*#__PURE__*/function () {
|
11895
11962
|
// prettier-ignore
|
11896
11963
|
function xe(e, t, i, n) {
|
@@ -12055,7 +12122,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12055
12122
|
i.classList.add("audio-placeholder-text-3-digits");
|
12056
12123
|
var n = document.createElement("div");
|
12057
12124
|
n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
|
12058
|
-
var r =
|
12125
|
+
var r = Z.createSVGElement(Zn);
|
12059
12126
|
return r.classList.add("attachment-icon", "stop-icon", "not-removable-attachment-icon"), i.textContent = "0:00", this._activePlaceholderTimer = this.createTimer(i, e), t.appendChild(n), this.addPlaceholderAudioAttachmentEvents(t, r, n), t;
|
12060
12127
|
}
|
12061
12128
|
}, {
|
@@ -12111,9 +12178,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12111
12178
|
var i = e.parentElement ? j.cloneElement(e) : e,
|
12112
12179
|
n = document.createElement("audio");
|
12113
12180
|
n.src = t;
|
12114
|
-
var r =
|
12181
|
+
var r = Z.createSVGElement(sa);
|
12115
12182
|
r.classList.add("attachment-icon", "play-icon");
|
12116
|
-
var o =
|
12183
|
+
var o = Z.createSVGElement(Zn);
|
12117
12184
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
|
12118
12185
|
i.replaceChildren(o);
|
12119
12186
|
}, n.onpause = function () {
|
@@ -12189,33 +12256,33 @@ var zt = /*#__PURE__*/function () {
|
|
12189
12256
|
}, {
|
12190
12257
|
key: "completePlaceholders",
|
12191
12258
|
value: function () {
|
12192
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12193
|
-
return _regeneratorRuntime().wrap(function
|
12194
|
-
while (1) switch (
|
12259
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee113() {
|
12260
|
+
return _regeneratorRuntime().wrap(function _callee113$(_context113) {
|
12261
|
+
while (1) switch (_context113.prev = _context113.next) {
|
12195
12262
|
case 0:
|
12196
|
-
|
12263
|
+
_context113.next = 2;
|
12197
12264
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
12198
|
-
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12265
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee112(e) {
|
12199
12266
|
var t;
|
12200
|
-
return _regeneratorRuntime().wrap(function
|
12201
|
-
while (1) switch (
|
12267
|
+
return _regeneratorRuntime().wrap(function _callee112$(_context112) {
|
12268
|
+
while (1) switch (_context112.prev = _context112.next) {
|
12202
12269
|
case 0:
|
12203
|
-
return
|
12270
|
+
return _context112.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
12204
12271
|
case 1:
|
12205
12272
|
case "end":
|
12206
|
-
return
|
12273
|
+
return _context112.stop();
|
12207
12274
|
}
|
12208
|
-
},
|
12275
|
+
}, _callee112);
|
12209
12276
|
}));
|
12210
|
-
return function (
|
12277
|
+
return function (_x200) {
|
12211
12278
|
return _ref15.apply(this, arguments);
|
12212
12279
|
};
|
12213
12280
|
}()));
|
12214
12281
|
case 2:
|
12215
12282
|
case "end":
|
12216
|
-
return
|
12283
|
+
return _context113.stop();
|
12217
12284
|
}
|
12218
|
-
},
|
12285
|
+
}, _callee113, this);
|
12219
12286
|
}));
|
12220
12287
|
function completePlaceholders() {
|
12221
12288
|
return _completePlaceholders.apply(this, arguments);
|
@@ -12251,12 +12318,12 @@ var zt = /*#__PURE__*/function () {
|
|
12251
12318
|
}
|
12252
12319
|
}]);
|
12253
12320
|
}();
|
12254
|
-
var
|
12255
|
-
function
|
12256
|
-
_classCallCheck(this,
|
12257
|
-
this._isOpen = !1, this._contentRef =
|
12321
|
+
var ce = /*#__PURE__*/function () {
|
12322
|
+
function ce(e, t, i) {
|
12323
|
+
_classCallCheck(this, ce);
|
12324
|
+
this._isOpen = !1, this._contentRef = ce.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = ce.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = ce.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = ce.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents(e);
|
12258
12325
|
}
|
12259
|
-
return _createClass(
|
12326
|
+
return _createClass(ce, [{
|
12260
12327
|
key: "isOpen",
|
12261
12328
|
value: function isOpen() {
|
12262
12329
|
return this._isOpen;
|
@@ -12278,7 +12345,7 @@ var le = /*#__PURE__*/function () {
|
|
12278
12345
|
var _this62 = this;
|
12279
12346
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
12280
12347
|
_this62._elementRef.style.display = "none", _this62._backgroundPanelRef.style.display = "none";
|
12281
|
-
},
|
12348
|
+
}, ce.MODAL_CLOSE_TIMEOUT_MS);
|
12282
12349
|
}
|
12283
12350
|
}, {
|
12284
12351
|
key: "displayModalElements",
|
@@ -12294,7 +12361,7 @@ var le = /*#__PURE__*/function () {
|
|
12294
12361
|
key: "addCloseButton",
|
12295
12362
|
value: function addCloseButton(e, t, i) {
|
12296
12363
|
var _this63 = this;
|
12297
|
-
var n = t ?
|
12364
|
+
var n = t ? ce.createSVGButton(e) : ce.createTextButton(e);
|
12298
12365
|
return this.addButtons(n), n.onclick = function () {
|
12299
12366
|
_this63.close(), setTimeout(function () {
|
12300
12367
|
i == null || i();
|
@@ -12348,7 +12415,7 @@ var le = /*#__PURE__*/function () {
|
|
12348
12415
|
value: function createSVGButton(e) {
|
12349
12416
|
var t = document.createElement("div");
|
12350
12417
|
t.classList.add("modal-button", "modal-svg-button");
|
12351
|
-
var i =
|
12418
|
+
var i = Z.createSVGElement(e);
|
12352
12419
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
12353
12420
|
}
|
12354
12421
|
}, {
|
@@ -12356,14 +12423,14 @@ var le = /*#__PURE__*/function () {
|
|
12356
12423
|
value: function createTextModalFunc(e, t, i) {
|
12357
12424
|
var n;
|
12358
12425
|
if (_typeof(t) == "object" && (n = t.files) != null && n.infoModal) {
|
12359
|
-
var r = new
|
12426
|
+
var r = new ce(e, ["modal-content"], t.files.infoModal.containerStyle);
|
12360
12427
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
12361
12428
|
}
|
12362
12429
|
}
|
12363
12430
|
}]);
|
12364
12431
|
}();
|
12365
|
-
|
12366
|
-
var ze =
|
12432
|
+
ce.MODAL_CLOSE_TIMEOUT_MS = 190;
|
12433
|
+
var ze = ce;
|
12367
12434
|
var xt = /*#__PURE__*/function (_Bt3) {
|
12368
12435
|
// prettier-ignore
|
12369
12436
|
function xt(e, t, i, n, r, o) {
|
@@ -12397,7 +12464,7 @@ var xt = /*#__PURE__*/function (_Bt3) {
|
|
12397
12464
|
}, {
|
12398
12465
|
key: "createInnerElement",
|
12399
12466
|
value: function createInnerElement(e, t, i) {
|
12400
|
-
return
|
12467
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
12401
12468
|
}
|
12402
12469
|
}, {
|
12403
12470
|
key: "addClickEvent",
|
@@ -12426,7 +12493,7 @@ var xt = /*#__PURE__*/function (_Bt3) {
|
|
12426
12493
|
}, {
|
12427
12494
|
key: "createSVGIconElement",
|
12428
12495
|
value: function createSVGIconElement(e, t) {
|
12429
|
-
var i =
|
12496
|
+
var i = Z.createSVGElement(t);
|
12430
12497
|
return i.id = e, i;
|
12431
12498
|
}
|
12432
12499
|
}]);
|
@@ -12500,26 +12567,26 @@ var Fe = /*#__PURE__*/function () {
|
|
12500
12567
|
}, {
|
12501
12568
|
key: "useValidationFunc",
|
12502
12569
|
value: function () {
|
12503
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12570
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee114(e, t, i, n) {
|
12504
12571
|
var r, o, a, l;
|
12505
|
-
return _regeneratorRuntime().wrap(function
|
12506
|
-
while (1) switch (
|
12572
|
+
return _regeneratorRuntime().wrap(function _callee114$(_context114) {
|
12573
|
+
while (1) switch (_context114.prev = _context114.next) {
|
12507
12574
|
case 0:
|
12508
12575
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
12509
|
-
|
12576
|
+
_context114.next = 3;
|
12510
12577
|
return i.completePlaceholders();
|
12511
12578
|
case 3:
|
12512
12579
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
12513
12580
|
return c.file;
|
12514
12581
|
});
|
12515
|
-
return
|
12582
|
+
return _context114.abrupt("return", Fe.validate(e, n, o, l));
|
12516
12583
|
case 5:
|
12517
12584
|
case "end":
|
12518
|
-
return
|
12585
|
+
return _context114.stop();
|
12519
12586
|
}
|
12520
|
-
},
|
12587
|
+
}, _callee114);
|
12521
12588
|
}));
|
12522
|
-
function useValidationFunc(
|
12589
|
+
function useValidationFunc(_x201, _x202, _x203, _x204) {
|
12523
12590
|
return _useValidationFunc.apply(this, arguments);
|
12524
12591
|
}
|
12525
12592
|
return useValidationFunc;
|
@@ -12527,22 +12594,22 @@ var Fe = /*#__PURE__*/function () {
|
|
12527
12594
|
}, {
|
12528
12595
|
key: "useValidationFuncProgrammatic",
|
12529
12596
|
value: function () {
|
12530
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12597
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee115(e, t, i) {
|
12531
12598
|
var r, n;
|
12532
|
-
return _regeneratorRuntime().wrap(function
|
12533
|
-
while (1) switch (
|
12599
|
+
return _regeneratorRuntime().wrap(function _callee115$(_context115) {
|
12600
|
+
while (1) switch (_context115.prev = _context115.next) {
|
12534
12601
|
case 0:
|
12535
12602
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
12536
12603
|
return o.file;
|
12537
12604
|
});
|
12538
|
-
return
|
12605
|
+
return _context115.abrupt("return", Fe.validate(e, i, t.text, n, !0));
|
12539
12606
|
case 2:
|
12540
12607
|
case "end":
|
12541
|
-
return
|
12608
|
+
return _context115.stop();
|
12542
12609
|
}
|
12543
|
-
},
|
12610
|
+
}, _callee115);
|
12544
12611
|
}));
|
12545
|
-
function useValidationFuncProgrammatic(
|
12612
|
+
function useValidationFuncProgrammatic(_x205, _x206, _x207) {
|
12546
12613
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
12547
12614
|
}
|
12548
12615
|
return useValidationFuncProgrammatic;
|
@@ -12558,26 +12625,26 @@ var Fe = /*#__PURE__*/function () {
|
|
12558
12625
|
value: function attach(e, t, i, n, r) {
|
12559
12626
|
var o = e.validateInput || he.processValidateInput(e);
|
12560
12627
|
e._validationHandler = /*#__PURE__*/function () {
|
12561
|
-
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12628
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee116(a) {
|
12562
12629
|
var l;
|
12563
|
-
return _regeneratorRuntime().wrap(function
|
12564
|
-
while (1) switch (
|
12630
|
+
return _regeneratorRuntime().wrap(function _callee116$(_context116) {
|
12631
|
+
while (1) switch (_context116.prev = _context116.next) {
|
12565
12632
|
case 0:
|
12566
12633
|
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Fe.validateWebsocket(t, r))) {
|
12567
|
-
|
12634
|
+
_context116.next = 2;
|
12568
12635
|
break;
|
12569
12636
|
}
|
12570
|
-
return
|
12637
|
+
return _context116.abrupt("return", !1);
|
12571
12638
|
case 2:
|
12572
12639
|
l = o || t.canSendMessage;
|
12573
|
-
return
|
12640
|
+
return _context116.abrupt("return", l ? a ? Fe.useValidationFuncProgrammatic(l, a, r) : Fe.useValidationFunc(l, i, n, r) : null);
|
12574
12641
|
case 4:
|
12575
12642
|
case "end":
|
12576
|
-
return
|
12643
|
+
return _context116.stop();
|
12577
12644
|
}
|
12578
|
-
},
|
12645
|
+
}, _callee116);
|
12579
12646
|
}));
|
12580
|
-
return function (
|
12647
|
+
return function (_x208) {
|
12581
12648
|
return _ref16.apply(this, arguments);
|
12582
12649
|
};
|
12583
12650
|
}();
|
@@ -12764,21 +12831,21 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12764
12831
|
key: "createCustomElements",
|
12765
12832
|
value: function createCustomElements() {
|
12766
12833
|
var _this70 = this;
|
12767
|
-
var e =
|
12834
|
+
var e = X.createSpecificStateElement(this.elementRef, "submit", this._customStyles),
|
12768
12835
|
t = {
|
12769
12836
|
loading: void 0,
|
12770
12837
|
stop: void 0
|
12771
12838
|
};
|
12772
12839
|
return Object.keys(t).forEach(function (i) {
|
12773
12840
|
var n = i,
|
12774
|
-
r =
|
12841
|
+
r = X.createCustomElement(n, _this70._customStyles);
|
12775
12842
|
r && (t[n] = r);
|
12776
12843
|
}), t.submit = e, t;
|
12777
12844
|
}
|
12778
12845
|
}, {
|
12779
12846
|
key: "createDisabledIconElement",
|
12780
12847
|
value: function createDisabledIconElement(e) {
|
12781
|
-
return
|
12848
|
+
return X.createCustomElement("disabled", this._customStyles) || e.cloneNode(!0);
|
12782
12849
|
}
|
12783
12850
|
// prettier-ignore
|
12784
12851
|
}, {
|
@@ -12817,12 +12884,12 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12817
12884
|
}, {
|
12818
12885
|
key: "submitFromInput",
|
12819
12886
|
value: function () {
|
12820
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12887
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee117() {
|
12821
12888
|
var t, e, _i22;
|
12822
|
-
return _regeneratorRuntime().wrap(function
|
12823
|
-
while (1) switch (
|
12889
|
+
return _regeneratorRuntime().wrap(function _callee117$(_context117) {
|
12890
|
+
while (1) switch (_context117.prev = _context117.next) {
|
12824
12891
|
case 0:
|
12825
|
-
|
12892
|
+
_context117.next = 2;
|
12826
12893
|
return this._fileAttachments.completePlaceholders();
|
12827
12894
|
case 2:
|
12828
12895
|
e = this._fileAttachments.getAllFileData();
|
@@ -12838,9 +12905,9 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12838
12905
|
}
|
12839
12906
|
case 4:
|
12840
12907
|
case "end":
|
12841
|
-
return
|
12908
|
+
return _context117.stop();
|
12842
12909
|
}
|
12843
|
-
},
|
12910
|
+
}, _callee117, this);
|
12844
12911
|
}));
|
12845
12912
|
function submitFromInput() {
|
12846
12913
|
return _submitFromInput.apply(this, arguments);
|
@@ -12850,11 +12917,11 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12850
12917
|
}, {
|
12851
12918
|
key: "programmaticSubmit",
|
12852
12919
|
value: function () {
|
12853
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12920
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee118(e) {
|
12854
12921
|
var _this71 = this;
|
12855
12922
|
var t;
|
12856
|
-
return _regeneratorRuntime().wrap(function
|
12857
|
-
while (1) switch (
|
12923
|
+
return _regeneratorRuntime().wrap(function _callee118$(_context118) {
|
12924
|
+
while (1) switch (_context118.prev = _context118.next) {
|
12858
12925
|
case 0:
|
12859
12926
|
typeof e == "string" && (e = he.processSubmitUserMessage(e));
|
12860
12927
|
t = {
|
@@ -12870,11 +12937,11 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12870
12937
|
});
|
12871
12938
|
case 3:
|
12872
12939
|
case "end":
|
12873
|
-
return
|
12940
|
+
return _context118.stop();
|
12874
12941
|
}
|
12875
|
-
},
|
12942
|
+
}, _callee118);
|
12876
12943
|
}));
|
12877
|
-
function programmaticSubmit(
|
12944
|
+
function programmaticSubmit(_x209) {
|
12878
12945
|
return _programmaticSubmit.apply(this, arguments);
|
12879
12946
|
}
|
12880
12947
|
return programmaticSubmit;
|
@@ -12882,52 +12949,52 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12882
12949
|
}, {
|
12883
12950
|
key: "attemptSubmit",
|
12884
12951
|
value: function () {
|
12885
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12952
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee119(e) {
|
12886
12953
|
var t,
|
12887
12954
|
r,
|
12888
12955
|
o,
|
12889
12956
|
a,
|
12890
12957
|
i,
|
12891
12958
|
n,
|
12892
|
-
|
12893
|
-
return _regeneratorRuntime().wrap(function
|
12894
|
-
while (1) switch (
|
12959
|
+
_args119 = arguments;
|
12960
|
+
return _regeneratorRuntime().wrap(function _callee119$(_context119) {
|
12961
|
+
while (1) switch (_context119.prev = _context119.next) {
|
12895
12962
|
case 0:
|
12896
|
-
t =
|
12897
|
-
|
12963
|
+
t = _args119.length > 1 && _args119[1] !== undefined ? _args119[1] : !1;
|
12964
|
+
_context119.next = 3;
|
12898
12965
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12899
12966
|
case 3:
|
12900
|
-
|
12901
|
-
|
12902
|
-
if (!(
|
12903
|
-
|
12967
|
+
_context119.t0 = _context119.sent;
|
12968
|
+
_context119.t1 = !1;
|
12969
|
+
if (!(_context119.t0 === _context119.t1)) {
|
12970
|
+
_context119.next = 7;
|
12904
12971
|
break;
|
12905
12972
|
}
|
12906
|
-
return
|
12973
|
+
return _context119.abrupt("return");
|
12907
12974
|
case 7:
|
12908
12975
|
this.changeToLoadingIcon();
|
12909
|
-
|
12976
|
+
_context119.next = 10;
|
12910
12977
|
return this.addNewMessage(e);
|
12911
12978
|
case 10:
|
12912
12979
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
12913
|
-
|
12980
|
+
Ct.clear(this._inputElementRef);
|
12914
12981
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
12915
12982
|
return l.file;
|
12916
12983
|
}), n = {
|
12917
12984
|
text: e.text === "" ? void 0 : e.text,
|
12918
12985
|
files: i
|
12919
12986
|
};
|
12920
|
-
|
12987
|
+
_context119.next = 15;
|
12921
12988
|
return this._serviceIO.callAPI(n, this._messages);
|
12922
12989
|
case 15:
|
12923
12990
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12924
12991
|
case 16:
|
12925
12992
|
case "end":
|
12926
|
-
return
|
12993
|
+
return _context119.stop();
|
12927
12994
|
}
|
12928
|
-
},
|
12995
|
+
}, _callee119, this);
|
12929
12996
|
}));
|
12930
|
-
function attemptSubmit(
|
12997
|
+
function attemptSubmit(_x210) {
|
12931
12998
|
return _attemptSubmit.apply(this, arguments);
|
12932
12999
|
}
|
12933
13000
|
return attemptSubmit;
|
@@ -12935,35 +13002,35 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12935
13002
|
}, {
|
12936
13003
|
key: "addNewMessage",
|
12937
13004
|
value: function () {
|
12938
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
13005
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee120(_ref17) {
|
12939
13006
|
var e, t, i;
|
12940
|
-
return _regeneratorRuntime().wrap(function
|
12941
|
-
while (1) switch (
|
13007
|
+
return _regeneratorRuntime().wrap(function _callee120$(_context120) {
|
13008
|
+
while (1) switch (_context120.prev = _context120.next) {
|
12942
13009
|
case 0:
|
12943
13010
|
e = _ref17.text, t = _ref17.files;
|
12944
13011
|
i = {
|
12945
13012
|
role: b.USER_ROLE
|
12946
13013
|
};
|
12947
13014
|
e && (i.text = e);
|
12948
|
-
|
12949
|
-
if (!
|
12950
|
-
|
13015
|
+
_context120.t0 = t;
|
13016
|
+
if (!_context120.t0) {
|
13017
|
+
_context120.next = 8;
|
12951
13018
|
break;
|
12952
13019
|
}
|
12953
|
-
|
13020
|
+
_context120.next = 7;
|
12954
13021
|
return this._messages.addMultipleFiles(t);
|
12955
13022
|
case 7:
|
12956
|
-
i.files =
|
13023
|
+
i.files = _context120.sent;
|
12957
13024
|
case 8:
|
12958
13025
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12959
13026
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12960
13027
|
case 10:
|
12961
13028
|
case "end":
|
12962
|
-
return
|
13029
|
+
return _context120.stop();
|
12963
13030
|
}
|
12964
|
-
},
|
13031
|
+
}, _callee120, this);
|
12965
13032
|
}));
|
12966
|
-
function addNewMessage(
|
13033
|
+
function addNewMessage(_x211) {
|
12967
13034
|
return _addNewMessage.apply(this, arguments);
|
12968
13035
|
}
|
12969
13036
|
return addNewMessage;
|
@@ -13016,7 +13083,7 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
13016
13083
|
}, {
|
13017
13084
|
key: "createSubmitIconElement",
|
13018
13085
|
value: function createSubmitIconElement() {
|
13019
|
-
var e =
|
13086
|
+
var e = Z.createSVGElement(aa);
|
13020
13087
|
return e.id = "submit-icon", e;
|
13021
13088
|
}
|
13022
13089
|
}, {
|
@@ -13048,7 +13115,7 @@ var bn = /*#__PURE__*/function (_ze) {
|
|
13048
13115
|
var _this73$addButtonsAnd = _this73.addButtonsAndTheirEvents(t),
|
13049
13116
|
r = _this73$addButtonsAnd.captureButton,
|
13050
13117
|
o = _this73$addButtonsAnd.submitButton;
|
13051
|
-
_this73._captureButton = r, _this73._submitButton = o, _this73._captureIcon = _this73._captureButton.children[0], _this73._refreshIcon =
|
13118
|
+
_this73._captureButton = r, _this73._submitButton = o, _this73._captureIcon = _this73._captureButton.children[0], _this73._refreshIcon = Z.createSVGElement(la), _this73._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this73._format = "image/jpeg"), n != null && n.dimensions && (_this73._dimensions = n.dimensions), _this73._contentRef.appendChild(_this73._canvas), _this73.extensionCloseCallback = _this73.stop;
|
13052
13119
|
return _this73;
|
13053
13120
|
}
|
13054
13121
|
_inherits(bn, _ze);
|
@@ -13174,7 +13241,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13174
13241
|
}, {
|
13175
13242
|
key: "createInnerElement",
|
13176
13243
|
value: function createInnerElement(e, t, i) {
|
13177
|
-
return
|
13244
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
13178
13245
|
}
|
13179
13246
|
}, {
|
13180
13247
|
key: "addClickEvent",
|
@@ -13193,7 +13260,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13193
13260
|
}, {
|
13194
13261
|
key: "createSVGIconElement",
|
13195
13262
|
value: function createSVGIconElement() {
|
13196
|
-
var e =
|
13263
|
+
var e = Z.createSVGElement(ua);
|
13197
13264
|
return e.id = "camera-icon", e;
|
13198
13265
|
}
|
13199
13266
|
}]);
|
@@ -13202,16 +13269,16 @@ var _t = /*#__PURE__*/function () {
|
|
13202
13269
|
function _t(e, t, i, n) {
|
13203
13270
|
_classCallCheck(this, _t);
|
13204
13271
|
this.elementRef = _t.createPanelElement(e.inputAreaStyle);
|
13205
|
-
var r =
|
13206
|
-
o =
|
13207
|
-
a =
|
13208
|
-
e.speechToText && !
|
13209
|
-
button: new Ot(e,
|
13272
|
+
var r = {},
|
13273
|
+
o = this.createFileUploadComponents(e, i, n, r),
|
13274
|
+
a = new Ct(e, i, o);
|
13275
|
+
e.speechToText && !r.microphone && (r.microphone = {
|
13276
|
+
button: new Ot(e, a, t.addNewErrorMessage.bind(t))
|
13210
13277
|
});
|
13211
|
-
var l = new an(e,
|
13212
|
-
|
13278
|
+
var l = new an(e, a.inputElementRef, t, i, o, r);
|
13279
|
+
a.submit = l.submitFromInput.bind(l), Fe.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
|
13213
13280
|
button: l
|
13214
|
-
}, _t.addElements(this.elementRef,
|
13281
|
+
}, _t.addElements(this.elementRef, a, r, n, o, e.dropupStyles);
|
13215
13282
|
}
|
13216
13283
|
return _createClass(_t, [{
|
13217
13284
|
key: "createFileUploadComponents",
|
@@ -13305,16 +13372,7 @@ var y = /*#__PURE__*/function (_Xi) {
|
|
13305
13372
|
function y() {
|
13306
13373
|
var _this78;
|
13307
13374
|
_classCallCheck(this, y);
|
13308
|
-
_this78 = _callSuper(this, y), _this78.
|
13309
|
-
// stream: true,
|
13310
|
-
}, _this78.directConnection = {
|
13311
|
-
openAI: {
|
13312
|
-
assistant: {
|
13313
|
-
assistant_id: "asst_dDy5gBApC0nd2puFgj8pEecp"
|
13314
|
-
},
|
13315
|
-
key: "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"
|
13316
|
-
}
|
13317
|
-
}, _this78.getMessages = function () {
|
13375
|
+
_this78 = _callSuper(this, y), _this78.getMessages = function () {
|
13318
13376
|
return [];
|
13319
13377
|
}, _this78.submitUserMessage = function () {
|
13320
13378
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|