deep-chat-dev 9.0.159 → 9.0.160
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 +9090 -9051
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +759 -706
- 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/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
@@ -349,7 +349,7 @@ var Ae = /*#__PURE__*/function () {
|
|
349
349
|
}]);
|
350
350
|
}();
|
351
351
|
Ae.TEXT_INPUT_ID = "text-input";
|
352
|
-
var
|
352
|
+
var Ct = Ae;
|
353
353
|
var yi = /*#__PURE__*/function () {
|
354
354
|
function yi() {
|
355
355
|
_classCallCheck(this, yi);
|
@@ -365,7 +365,7 @@ var yi = /*#__PURE__*/function () {
|
|
365
365
|
}, {
|
366
366
|
key: "focusFromParentElement",
|
367
367
|
value: function focusFromParentElement(e) {
|
368
|
-
var t = e.querySelector("#".concat(
|
368
|
+
var t = e.querySelector("#".concat(Ct.TEXT_INPUT_ID));
|
369
369
|
t && yi.focusEndOfInput(t);
|
370
370
|
}
|
371
371
|
}]);
|
@@ -549,15 +549,15 @@ var he = /*#__PURE__*/function () {
|
|
549
549
|
}();
|
550
550
|
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
551
|
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,
|
552
|
+
te = /*#__PURE__*/function () {
|
553
|
+
function te() {
|
554
|
+
_classCallCheck(this, te);
|
555
555
|
}
|
556
|
-
return _createClass(
|
556
|
+
return _createClass(te, null, [{
|
557
557
|
key: "hide",
|
558
558
|
value: function hide(e) {
|
559
559
|
var t;
|
560
|
-
(t = e.getElementsByClassName(
|
560
|
+
(t = e.getElementsByClassName(te.CONTAINER_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
561
561
|
}
|
562
562
|
}, {
|
563
563
|
key: "applyCustomStylesToElements",
|
@@ -568,10 +568,10 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
568
568
|
key: "applyCustomStyles",
|
569
569
|
value: function applyCustomStyles(e, t, i, n) {
|
570
570
|
var r, o, a, l;
|
571
|
-
if ((r = i["default"]) != null && r.styles &&
|
572
|
-
(a = i.ai) != null && a.styles &&
|
571
|
+
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 {
|
572
|
+
(a = i.ai) != null && a.styles && te.applyCustomStylesToElements(e, t, i.ai.styles);
|
573
573
|
var c = (l = i[n]) == null ? void 0 : l.styles;
|
574
|
-
c &&
|
574
|
+
c && te.applyCustomStylesToElements(e, t, c);
|
575
575
|
}
|
576
576
|
}
|
577
577
|
}, {
|
@@ -581,7 +581,7 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
581
581
|
var i = document.createElement("img");
|
582
582
|
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
583
|
var n = document.createElement("div");
|
584
|
-
return n.classList.add(
|
584
|
+
return n.classList.add(te.CONTAINER_CLASS), n.appendChild(i), t && te.applyCustomStyles(n, i, t, e), n;
|
585
585
|
}
|
586
586
|
}, {
|
587
587
|
key: "getPosition",
|
@@ -595,14 +595,14 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
595
595
|
key: "add",
|
596
596
|
value: function add(e, t, i) {
|
597
597
|
var n = typeof i == "boolean" ? void 0 : i,
|
598
|
-
r =
|
599
|
-
o =
|
598
|
+
r = te.createAvatar(t, n),
|
599
|
+
o = te.getPosition(t, n);
|
600
600
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
601
601
|
}
|
602
602
|
}]);
|
603
603
|
}();
|
604
|
-
|
605
|
-
var Zt =
|
604
|
+
te.CONTAINER_CLASS = "avatar-container";
|
605
|
+
var Zt = te;
|
606
606
|
var ge = /*#__PURE__*/function () {
|
607
607
|
function ge() {
|
608
608
|
_classCallCheck(this, ge);
|
@@ -651,11 +651,11 @@ var ge = /*#__PURE__*/function () {
|
|
651
651
|
}();
|
652
652
|
ge.NAME_CLASS = "name";
|
653
653
|
var Yt = ge;
|
654
|
-
var
|
655
|
-
function
|
656
|
-
_classCallCheck(this,
|
654
|
+
var oe = /*#__PURE__*/function () {
|
655
|
+
function oe() {
|
656
|
+
_classCallCheck(this, oe);
|
657
657
|
}
|
658
|
-
return _createClass(
|
658
|
+
return _createClass(oe, null, [{
|
659
659
|
key: "getLastElementsByClass",
|
660
660
|
value: function getLastElementsByClass(e, t, i) {
|
661
661
|
var _loop = function _loop() {
|
@@ -696,8 +696,8 @@ var re = /*#__PURE__*/function () {
|
|
696
696
|
}, {
|
697
697
|
key: "overwriteMessage",
|
698
698
|
value: function overwriteMessage(e, t, i, n, r, o) {
|
699
|
-
var a =
|
700
|
-
l =
|
699
|
+
var a = oe.getLastElementsByClass(t, [oe.getRoleClass(n), o], ["loading-message-text"]),
|
700
|
+
l = oe.getLastMessage(e, n, r);
|
701
701
|
return l && (l[r] = i), a;
|
702
702
|
}
|
703
703
|
}, {
|
@@ -709,18 +709,18 @@ var re = /*#__PURE__*/function () {
|
|
709
709
|
}, {
|
710
710
|
key: "fillEmptyMessageElement",
|
711
711
|
value: function fillEmptyMessageElement(e, t) {
|
712
|
-
t.trim().length === 0 && (e.classList.add(
|
712
|
+
t.trim().length === 0 && (e.classList.add(oe.EMPTY_MESSAGE_CLASS), e.innerHTML = '<div style="color:#00000000">.</div>');
|
713
713
|
}
|
714
714
|
}, {
|
715
715
|
key: "unfillEmptyMessageElement",
|
716
716
|
value: function unfillEmptyMessageElement(e, t) {
|
717
|
-
e.classList.contains(
|
717
|
+
e.classList.contains(oe.EMPTY_MESSAGE_CLASS) && t.trim().length > 0 && e.replaceChildren();
|
718
718
|
}
|
719
719
|
}, {
|
720
720
|
key: "getLastMessageBubbleElement",
|
721
721
|
value: function getLastMessageBubbleElement(e) {
|
722
722
|
var t, i, n;
|
723
|
-
return Array.from(((n = (i = (t =
|
723
|
+
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
724
|
return r.classList.contains("message-bubble");
|
725
725
|
});
|
726
726
|
}
|
@@ -742,8 +742,8 @@ var re = /*#__PURE__*/function () {
|
|
742
742
|
}
|
743
743
|
}]);
|
744
744
|
}();
|
745
|
-
|
746
|
-
var b =
|
745
|
+
oe.AI_ROLE = "ai", oe.USER_ROLE = "user", oe.EMPTY_MESSAGE_CLASS = "empty-message";
|
746
|
+
var b = oe;
|
747
747
|
var qe = /*#__PURE__*/function () {
|
748
748
|
function qe() {
|
749
749
|
_classCallCheck(this, qe);
|
@@ -984,14 +984,14 @@ function $i(s) {
|
|
984
984
|
return String.fromCharCode(s);
|
985
985
|
}
|
986
986
|
var ws = /&([a-z#][a-z0-9]{1,31});/gi,
|
987
|
-
|
988
|
-
function
|
987
|
+
Ts = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
|
988
|
+
function Cs(s, e) {
|
989
989
|
var t = 0,
|
990
990
|
i = Yn(e);
|
991
|
-
return e !== i ? i : e.charCodeAt(0) === 35 &&
|
991
|
+
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
992
|
}
|
993
993
|
function Ge(s) {
|
994
|
-
return s.indexOf("&") < 0 ? s : s.replace(ws,
|
994
|
+
return s.indexOf("&") < 0 ? s : s.replace(ws, Cs);
|
995
995
|
}
|
996
996
|
var ks = /[&<>"]/,
|
997
997
|
As = /[&<>"]/g,
|
@@ -1237,14 +1237,14 @@ cn.prototype.render = function (s, e, t) {
|
|
1237
1237
|
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
1238
|
return o;
|
1239
1239
|
};
|
1240
|
-
function
|
1240
|
+
function Y() {
|
1241
1241
|
this.__rules__ = [], this.__cache__ = null;
|
1242
1242
|
}
|
1243
|
-
|
1243
|
+
Y.prototype.__find__ = function (s) {
|
1244
1244
|
for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === s) return t;
|
1245
1245
|
return -1;
|
1246
1246
|
};
|
1247
|
-
|
1247
|
+
Y.prototype.__compile__ = function () {
|
1248
1248
|
var s = this,
|
1249
1249
|
e = [""];
|
1250
1250
|
s.__rules__.forEach(function (t) {
|
@@ -1257,13 +1257,13 @@ Z.prototype.__compile__ = function () {
|
|
1257
1257
|
});
|
1258
1258
|
});
|
1259
1259
|
};
|
1260
|
-
|
1260
|
+
Y.prototype.at = function (s, e, t) {
|
1261
1261
|
var i = this.__find__(s),
|
1262
1262
|
n = t || {};
|
1263
1263
|
if (i === -1) throw new Error("Parser rule not found: " + s);
|
1264
1264
|
this.__rules__[i].fn = e, this.__rules__[i].alt = n.alt || [], this.__cache__ = null;
|
1265
1265
|
};
|
1266
|
-
|
1266
|
+
Y.prototype.before = function (s, e, t, i) {
|
1267
1267
|
var n = this.__find__(s),
|
1268
1268
|
r = i || {};
|
1269
1269
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1274,7 +1274,7 @@ Z.prototype.before = function (s, e, t, i) {
|
|
1274
1274
|
alt: r.alt || []
|
1275
1275
|
}), this.__cache__ = null;
|
1276
1276
|
};
|
1277
|
-
|
1277
|
+
Y.prototype.after = function (s, e, t, i) {
|
1278
1278
|
var n = this.__find__(s),
|
1279
1279
|
r = i || {};
|
1280
1280
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1285,7 +1285,7 @@ Z.prototype.after = function (s, e, t, i) {
|
|
1285
1285
|
alt: r.alt || []
|
1286
1286
|
}), this.__cache__ = null;
|
1287
1287
|
};
|
1288
|
-
|
1288
|
+
Y.prototype.push = function (s, e, t) {
|
1289
1289
|
var i = t || {};
|
1290
1290
|
this.__rules__.push({
|
1291
1291
|
name: s,
|
@@ -1294,7 +1294,7 @@ Z.prototype.push = function (s, e, t) {
|
|
1294
1294
|
alt: i.alt || []
|
1295
1295
|
}), this.__cache__ = null;
|
1296
1296
|
};
|
1297
|
-
|
1297
|
+
Y.prototype.enable = function (s, e) {
|
1298
1298
|
s = Array.isArray(s) ? s : [s], e && this.__rules__.forEach(function (t) {
|
1299
1299
|
t.enabled = !1;
|
1300
1300
|
}), s.forEach(function (t) {
|
@@ -1303,14 +1303,14 @@ Z.prototype.enable = function (s, e) {
|
|
1303
1303
|
this.__rules__[i].enabled = !0;
|
1304
1304
|
}, this), this.__cache__ = null;
|
1305
1305
|
};
|
1306
|
-
|
1306
|
+
Y.prototype.disable = function (s) {
|
1307
1307
|
s = Array.isArray(s) ? s : [s], s.forEach(function (e) {
|
1308
1308
|
var t = this.__find__(e);
|
1309
1309
|
if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
|
1310
1310
|
this.__rules__[t].enabled = !1;
|
1311
1311
|
}, this), this.__cache__ = null;
|
1312
1312
|
};
|
1313
|
-
|
1313
|
+
Y.prototype.getRules = function (s) {
|
1314
1314
|
return this.__cache__ === null && this.__compile__(), this.__cache__[s] || [];
|
1315
1315
|
};
|
1316
1316
|
function Is(s) {
|
@@ -1592,8 +1592,8 @@ function zs(s) {
|
|
1592
1592
|
var Vs = /['"]/,
|
1593
1593
|
wn = /['"]/g,
|
1594
1594
|
Gs = /[-\s()\[\]]/,
|
1595
|
-
|
1596
|
-
function
|
1595
|
+
Tn = "’";
|
1596
|
+
function Cn(s, e) {
|
1597
1597
|
return e < 0 || e >= s.length ? !1 : !Gs.test(s[e]);
|
1598
1598
|
}
|
1599
1599
|
function Qe(s, e, t) {
|
@@ -1607,8 +1607,8 @@ function Ws(s) {
|
|
1607
1607
|
for (a = E[e].level, f = S.length - 1; f >= 0 && !(S[f].level <= a); f--);
|
1608
1608
|
S.length = f + 1, i = t.content, r = 0, o = i.length;
|
1609
1609
|
e: for (; r < o && (wn.lastIndex = r, n = wn.exec(i), !!n);) {
|
1610
|
-
if (l = !
|
1611
|
-
m && (t.content = Qe(t.content, n.index,
|
1610
|
+
if (l = !Cn(i, n.index - 1), r = n.index + 1, m = n[0] === "'", c = !Cn(i, r), !c && !l) {
|
1611
|
+
m && (t.content = Qe(t.content, n.index, Tn));
|
1612
1612
|
continue;
|
1613
1613
|
}
|
1614
1614
|
if (h = !c, u = !l, u) {
|
@@ -1622,7 +1622,7 @@ function Ws(s) {
|
|
1622
1622
|
pos: n.index,
|
1623
1623
|
single: m,
|
1624
1624
|
level: a
|
1625
|
-
}) : u && m && (t.content = Qe(t.content, n.index,
|
1625
|
+
}) : u && m && (t.content = Qe(t.content, n.index, Tn));
|
1626
1626
|
}
|
1627
1627
|
}
|
1628
1628
|
}
|
@@ -1630,7 +1630,7 @@ function Ws(s) {
|
|
1630
1630
|
}
|
1631
1631
|
var Fi = [["block", Is], ["abbr", Ps], ["references", Ns], ["inline", Ds], ["footnote_tail", Fs], ["abbr2", Bs], ["replacements", zs], ["smartquotes", Ws]];
|
1632
1632
|
function rs() {
|
1633
|
-
this.options = {}, this.ruler = new
|
1633
|
+
this.options = {}, this.ruler = new Y();
|
1634
1634
|
for (var s = 0; s < Fi.length; s++) this.ruler.push(Fi[s][0], Fi[s][1]);
|
1635
1635
|
}
|
1636
1636
|
rs.prototype.process = function (s) {
|
@@ -1820,9 +1820,9 @@ function Ys(s, e, t, i) {
|
|
1820
1820
|
p,
|
1821
1821
|
E,
|
1822
1822
|
S,
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1823
|
+
Q,
|
1824
|
+
se,
|
1825
|
+
Te,
|
1826
1826
|
R,
|
1827
1827
|
W = !0,
|
1828
1828
|
$,
|
@@ -1832,20 +1832,20 @@ function Ys(s, e, t, i) {
|
|
1832
1832
|
if ((h = An(s, e)) >= 0) E = !0;else if ((h = kn(s, e)) >= 0) E = !1;else return !1;
|
1833
1833
|
if (s.level >= s.options.maxNesting) return !1;
|
1834
1834
|
if (p = s.src.charCodeAt(h - 1), i) return !0;
|
1835
|
-
for (
|
1835
|
+
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
1836
|
type: "ordered_list_open",
|
1837
1837
|
order: m,
|
1838
|
-
lines:
|
1838
|
+
lines: Te = [e, 0],
|
1839
1839
|
level: s.level++
|
1840
1840
|
})) : s.tokens.push({
|
1841
1841
|
type: "bullet_list_open",
|
1842
|
-
lines:
|
1842
|
+
lines: Te = [e, 0],
|
1843
1843
|
level: s.level++
|
1844
|
-
}), n = e,
|
1844
|
+
}), 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
1845
|
type: "list_item_open",
|
1846
1846
|
lines: R = [e, 0],
|
1847
1847
|
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 ||
|
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 || 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
1849
|
type: "list_item_close",
|
1850
1850
|
level: --s.level
|
1851
1851
|
}), n = e = s.line, R[1] = n, S = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
@@ -1862,7 +1862,7 @@ function Ys(s, e, t, i) {
|
|
1862
1862
|
return s.tokens.push({
|
1863
1863
|
type: E ? "ordered_list_close" : "bullet_list_close",
|
1864
1864
|
level: --s.level
|
1865
|
-
}),
|
1865
|
+
}), Te[1] = n, s.line = n, W && Zs(s, Q), !0;
|
1866
1866
|
}
|
1867
1867
|
function Qs(s, e, t, i) {
|
1868
1868
|
var n,
|
@@ -2144,7 +2144,7 @@ function cr(s, e) {
|
|
2144
2144
|
}
|
2145
2145
|
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
2146
|
function dn() {
|
2147
|
-
this.ruler = new
|
2147
|
+
this.ruler = new Y();
|
2148
2148
|
for (var s = 0; s < Wt.length; s++) this.ruler.push(Wt[s][0], Wt[s][1], {
|
2149
2149
|
alt: (Wt[s][2] || []).slice()
|
2150
2150
|
});
|
@@ -2441,7 +2441,7 @@ function Sr(s, e) {
|
|
2441
2441
|
}), s.pos = s.posMax + 1, s.posMax = n, !0);
|
2442
2442
|
}
|
2443
2443
|
var wr = /\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;
|
2444
|
-
function
|
2444
|
+
function Tr(s, e) {
|
2445
2445
|
var t,
|
2446
2446
|
i,
|
2447
2447
|
n = s.posMax,
|
@@ -2460,7 +2460,7 @@ function Cr(s, e) {
|
|
2460
2460
|
content: i.replace(wr, "$1")
|
2461
2461
|
}), s.pos = s.posMax + 1, s.posMax = n, !0);
|
2462
2462
|
}
|
2463
|
-
function
|
2463
|
+
function Cr(s, e) {
|
2464
2464
|
var t,
|
2465
2465
|
i,
|
2466
2466
|
n,
|
@@ -2627,9 +2627,9 @@ function Xr(s, e) {
|
|
2627
2627
|
}
|
2628
2628
|
return e || (s.pending += "&"), s.pos++, !0;
|
2629
2629
|
}
|
2630
|
-
var ji = [["text", pr], ["newline", mr], ["escape", gr], ["backticks", br], ["del", vr], ["ins", yr], ["mark", Er], ["emphasis", xr], ["sub", Sr], ["sup",
|
2630
|
+
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
2631
|
function xi() {
|
2632
|
-
this.ruler = new
|
2632
|
+
this.ruler = new Y();
|
2633
2633
|
for (var s = 0; s < ji.length; s++) this.ruler.push(ji[s][0], ji[s][1]);
|
2634
2634
|
this.validateLink = Zr;
|
2635
2635
|
}
|
@@ -2787,7 +2787,7 @@ function as(s, e, t) {
|
|
2787
2787
|
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
2788
|
}
|
2789
2789
|
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
|
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 Y(), this.options = {}, this.configure(to[s]), this.set(e || {});
|
2791
2791
|
}
|
2792
2792
|
_e.prototype.set = function (s) {
|
2793
2793
|
Qn(this.options, s);
|
@@ -3242,10 +3242,15 @@ var Re = /*#__PURE__*/function () {
|
|
3242
3242
|
}
|
3243
3243
|
}
|
3244
3244
|
}, {
|
3245
|
-
key: "
|
3246
|
-
value: function
|
3245
|
+
key: "markFileAdded",
|
3246
|
+
value: function markFileAdded() {
|
3247
3247
|
this._fileAdded = !0;
|
3248
3248
|
}
|
3249
|
+
}, {
|
3250
|
+
key: "newMessage",
|
3251
|
+
value: function newMessage() {
|
3252
|
+
this.finaliseStreamedMessage(), this._elements = void 0, this._streamedContent = "", this._fileAdded = !1, this._hasStreamEnded = !1, this._activeMessageRole = void 0;
|
3253
|
+
}
|
3249
3254
|
}]);
|
3250
3255
|
}();
|
3251
3256
|
Re.MESSAGE_CLASS = "streamed-message", Re.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
@@ -3383,29 +3388,29 @@ function io(_x10, _x11) {
|
|
3383
3388
|
return _io.apply(this, arguments);
|
3384
3389
|
}
|
3385
3390
|
function _io() {
|
3386
|
-
_io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3391
|
+
_io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee121(s, e) {
|
3387
3392
|
var t, i;
|
3388
|
-
return _regeneratorRuntime().wrap(function
|
3389
|
-
while (1) switch (
|
3393
|
+
return _regeneratorRuntime().wrap(function _callee121$(_context121) {
|
3394
|
+
while (1) switch (_context121.prev = _context121.next) {
|
3390
3395
|
case 0:
|
3391
3396
|
t = s.getReader();
|
3392
3397
|
case 1:
|
3393
|
-
|
3398
|
+
_context121.next = 3;
|
3394
3399
|
return t.read();
|
3395
3400
|
case 3:
|
3396
|
-
if ((i =
|
3397
|
-
|
3401
|
+
if ((i = _context121.sent).done) {
|
3402
|
+
_context121.next = 7;
|
3398
3403
|
break;
|
3399
3404
|
}
|
3400
3405
|
e(i.value);
|
3401
3406
|
case 5:
|
3402
|
-
|
3407
|
+
_context121.next = 1;
|
3403
3408
|
break;
|
3404
3409
|
case 7:
|
3405
3410
|
case "end":
|
3406
|
-
return
|
3411
|
+
return _context121.stop();
|
3407
3412
|
}
|
3408
|
-
},
|
3413
|
+
}, _callee121);
|
3409
3414
|
}));
|
3410
3415
|
return _io.apply(this, arguments);
|
3411
3416
|
}
|
@@ -3504,14 +3509,14 @@ function lo(s, e) {
|
|
3504
3509
|
l || document.addEventListener("visibilitychange", p);
|
3505
3510
|
var E = ao,
|
3506
3511
|
S = 0;
|
3507
|
-
function
|
3512
|
+
function Q() {
|
3508
3513
|
document.removeEventListener("visibilitychange", p), window.clearTimeout(S), m.abort();
|
3509
3514
|
}
|
3510
3515
|
t == null || t.addEventListener("abort", function () {
|
3511
|
-
|
3516
|
+
Q(), h();
|
3512
3517
|
});
|
3513
|
-
var
|
3514
|
-
|
3518
|
+
var se = c !== null && c !== void 0 ? c : window.fetch,
|
3519
|
+
Te = n !== null && n !== void 0 ? n : co;
|
3515
3520
|
function R() {
|
3516
3521
|
return _R.apply(this, arguments);
|
3517
3522
|
}
|
@@ -3524,14 +3529,14 @@ function lo(s, e) {
|
|
3524
3529
|
m = new AbortController();
|
3525
3530
|
_context3.prev = 1;
|
3526
3531
|
_context3.next = 4;
|
3527
|
-
return
|
3532
|
+
return se(s, Object.assign(Object.assign({}, d), {
|
3528
3533
|
headers: f,
|
3529
3534
|
signal: m.signal
|
3530
3535
|
}));
|
3531
3536
|
case 4:
|
3532
3537
|
$ = _context3.sent;
|
3533
3538
|
_context3.next = 7;
|
3534
|
-
return
|
3539
|
+
return Te($);
|
3535
3540
|
case 7:
|
3536
3541
|
_context3.next = 9;
|
3537
3542
|
return io($.body, no(so(function (N) {
|
@@ -3541,7 +3546,7 @@ function lo(s, e) {
|
|
3541
3546
|
}, r)));
|
3542
3547
|
case 9:
|
3543
3548
|
o == null || o();
|
3544
|
-
|
3549
|
+
Q();
|
3545
3550
|
h();
|
3546
3551
|
_context3.next = 17;
|
3547
3552
|
break;
|
@@ -3552,7 +3557,7 @@ function lo(s, e) {
|
|
3552
3557
|
N = (W = a == null ? void 0 : a(_context3.t0)) !== null && W !== void 0 ? W : E;
|
3553
3558
|
window.clearTimeout(S), S = window.setTimeout(R, N);
|
3554
3559
|
} catch (N) {
|
3555
|
-
|
3560
|
+
Q(), u(N);
|
3556
3561
|
}
|
3557
3562
|
case 17:
|
3558
3563
|
case "end":
|
@@ -3569,11 +3574,11 @@ function co(s) {
|
|
3569
3574
|
var e = s.headers.get("content-type");
|
3570
3575
|
if (!(e != null && e.startsWith(Ji))) throw new Error("Expected content-type to be ".concat(Ji, ", Actual: ").concat(e));
|
3571
3576
|
}
|
3572
|
-
var
|
3573
|
-
function
|
3574
|
-
_classCallCheck(this,
|
3577
|
+
var C = /*#__PURE__*/function () {
|
3578
|
+
function C() {
|
3579
|
+
_classCallCheck(this, C);
|
3575
3580
|
}
|
3576
|
-
return _createClass(
|
3581
|
+
return _createClass(C, null, [{
|
3577
3582
|
key: "request",
|
3578
3583
|
value: // prettier-ignore
|
3579
3584
|
function () {
|
@@ -3583,9 +3588,9 @@ var T = /*#__PURE__*/function () {
|
|
3583
3588
|
p,
|
3584
3589
|
E,
|
3585
3590
|
S,
|
3586
|
-
|
3587
|
-
|
3588
|
-
|
3591
|
+
Q,
|
3592
|
+
se,
|
3593
|
+
Te,
|
3589
3594
|
o,
|
3590
3595
|
_yield$v$processReque,
|
3591
3596
|
a,
|
@@ -3637,10 +3642,10 @@ var T = /*#__PURE__*/function () {
|
|
3637
3642
|
return _context6.abrupt("return", pe.requestStream(i, e.streamHandlers));
|
3638
3643
|
case 19:
|
3639
3644
|
f = new Se(i), m = v.fetch.bind(this, e, l, n);
|
3640
|
-
lo(((
|
3641
|
-
method: ((
|
3645
|
+
return _context6.abrupt("return", (lo(((Q = e.connectSettings) == null ? void 0 : Q.url) || e.url || "", {
|
3646
|
+
method: ((se = e.connectSettings) == null ? void 0 : se.method) || "POST",
|
3642
3647
|
headers: l,
|
3643
|
-
credentials: (
|
3648
|
+
credentials: (Te = e.connectSettings) == null ? void 0 : Te.credentials,
|
3644
3649
|
body: n ? JSON.stringify(a) : a,
|
3645
3650
|
openWhenHidden: !0,
|
3646
3651
|
// keep stream open when browser tab not open
|
@@ -3693,7 +3698,7 @@ var T = /*#__PURE__*/function () {
|
|
3693
3698
|
case 7:
|
3694
3699
|
pt = _context5.t0;
|
3695
3700
|
(N = e.extractResultData) == null || N.call(e, pt, m, a).then(function (Ne) {
|
3696
|
-
e.asyncCallInProgress && Ne && Ne.text !== "" ? (
|
3701
|
+
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
3702
|
})["catch"](function (Ne) {
|
3698
3703
|
return v.displayError(i, Ne);
|
3699
3704
|
});
|
@@ -3722,7 +3727,7 @@ var T = /*#__PURE__*/function () {
|
|
3722
3727
|
})["catch"](function ($) {
|
3723
3728
|
v.displayError(i, $);
|
3724
3729
|
});
|
3725
|
-
});
|
3730
|
+
}), f));
|
3726
3731
|
case 21:
|
3727
3732
|
case "end":
|
3728
3733
|
return _context6.stop();
|
@@ -3744,7 +3749,7 @@ var T = /*#__PURE__*/function () {
|
|
3744
3749
|
}, i), !1), i.text) {
|
3745
3750
|
t.onOpen();
|
3746
3751
|
var r = i.text.split("");
|
3747
|
-
|
3752
|
+
C.populateMessages(r, new Se(e), n);
|
3748
3753
|
}
|
3749
3754
|
}
|
3750
3755
|
}, {
|
@@ -3757,10 +3762,10 @@ var T = /*#__PURE__*/function () {
|
|
3757
3762
|
text: r
|
3758
3763
|
});
|
3759
3764
|
var o = setTimeout(function () {
|
3760
|
-
|
3765
|
+
C.populateMessages(e, t, i, n + 1);
|
3761
3766
|
}, i.simulationInterim || 6);
|
3762
3767
|
i.abortStream.abort = function () {
|
3763
|
-
|
3768
|
+
C.abort(o, t, i.onClose);
|
3764
3769
|
};
|
3765
3770
|
} else t.finaliseStreamedMessage(), i.onClose();
|
3766
3771
|
}
|
@@ -3772,7 +3777,7 @@ var T = /*#__PURE__*/function () {
|
|
3772
3777
|
}, {
|
3773
3778
|
key: "isSimulatable",
|
3774
3779
|
value: function isSimulatable(e, t) {
|
3775
|
-
return
|
3780
|
+
return C.isSimulation(e) && t && (t.text || t.html);
|
3776
3781
|
}
|
3777
3782
|
}, {
|
3778
3783
|
key: "abort",
|
@@ -3789,7 +3794,7 @@ var T = /*#__PURE__*/function () {
|
|
3789
3794
|
}
|
3790
3795
|
n != null && n.files && (e.addNewMessage({
|
3791
3796
|
files: n.files
|
3792
|
-
}), i == null || i.
|
3797
|
+
}), i == null || i.markFileAdded());
|
3793
3798
|
}
|
3794
3799
|
}]);
|
3795
3800
|
}();
|
@@ -3845,7 +3850,7 @@ var He = /*#__PURE__*/function () {
|
|
3845
3850
|
_context7.t0 = i;
|
3846
3851
|
case 5:
|
3847
3852
|
n = _context7.t0;
|
3848
|
-
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) :
|
3853
|
+
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
3854
|
case 7:
|
3850
3855
|
case "end":
|
3851
3856
|
return _context7.stop();
|
@@ -3859,7 +3864,7 @@ var He = /*#__PURE__*/function () {
|
|
3859
3864
|
value: function requestStream(e, t) {
|
3860
3865
|
setTimeout(function () {
|
3861
3866
|
var i = He.getResponse(e);
|
3862
|
-
|
3867
|
+
C.simulate(e, t, i);
|
3863
3868
|
}, 400);
|
3864
3869
|
}
|
3865
3870
|
}]);
|
@@ -3942,9 +3947,9 @@ var z = /*#__PURE__*/function () {
|
|
3942
3947
|
}
|
3943
3948
|
throw Error(A.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
3944
3949
|
case 14:
|
3945
|
-
if (
|
3950
|
+
if (C.isSimulation(e.stream)) {
|
3946
3951
|
h = z.stream.bind(_this6, e, i, n), u = n[l.role || b.AI_ROLE];
|
3947
|
-
|
3952
|
+
C.upsertWFiles(i, h, u, d);
|
3948
3953
|
} else i.addNewMessage(d);
|
3949
3954
|
_context8.next = 20;
|
3950
3955
|
break;
|
@@ -4052,7 +4057,7 @@ var z = /*#__PURE__*/function () {
|
|
4052
4057
|
var o = n.role || b.AI_ROLE,
|
4053
4058
|
a = i[o];
|
4054
4059
|
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
|
4060
|
+
} else C.simulate(t, e.streamHandlers, n);
|
4056
4061
|
}
|
4057
4062
|
}]);
|
4058
4063
|
}();
|
@@ -4093,7 +4098,7 @@ var Ee = /*#__PURE__*/function () {
|
|
4093
4098
|
_context10.t0 = c;
|
4094
4099
|
case 8:
|
4095
4100
|
d = _context10.t0;
|
4096
|
-
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) :
|
4101
|
+
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
4102
|
case 10:
|
4098
4103
|
case "end":
|
4099
4104
|
return _context10.stop();
|
@@ -4164,7 +4169,7 @@ var Ee = /*#__PURE__*/function () {
|
|
4164
4169
|
_context12.t0 = f;
|
4165
4170
|
case 7:
|
4166
4171
|
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) :
|
4172
|
+
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
4173
|
case 9:
|
4169
4174
|
case "end":
|
4170
4175
|
return _context12.stop();
|
@@ -4229,9 +4234,9 @@ var Ee = /*#__PURE__*/function () {
|
|
4229
4234
|
_context13.t0 = d;
|
4230
4235
|
case 7:
|
4231
4236
|
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 (
|
4237
|
+
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
4238
|
m = z.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
|
4234
|
-
|
4239
|
+
C.upsertWFiles(t, m, p, d);
|
4235
4240
|
} else t.addNewMessage(h);
|
4236
4241
|
case 9:
|
4237
4242
|
case "end":
|
@@ -4267,11 +4272,11 @@ var Ee = /*#__PURE__*/function () {
|
|
4267
4272
|
}
|
4268
4273
|
}]);
|
4269
4274
|
}();
|
4270
|
-
var
|
4271
|
-
function
|
4272
|
-
_classCallCheck(this,
|
4275
|
+
var T = /*#__PURE__*/function () {
|
4276
|
+
function T() {
|
4277
|
+
_classCallCheck(this, T);
|
4273
4278
|
}
|
4274
|
-
return _createClass(
|
4279
|
+
return _createClass(T, null, [{
|
4275
4280
|
key: "request",
|
4276
4281
|
value: // prettier-ignore
|
4277
4282
|
function () {
|
@@ -4331,7 +4336,7 @@ var C = /*#__PURE__*/function () {
|
|
4331
4336
|
return v.processResponseByType(p);
|
4332
4337
|
}).then( /*#__PURE__*/function () {
|
4333
4338
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(p) {
|
4334
|
-
var
|
4339
|
+
var Q, se, E, S;
|
4335
4340
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
4336
4341
|
while (1) switch (_context14.prev = _context14.next) {
|
4337
4342
|
case 0:
|
@@ -4342,7 +4347,7 @@ var C = /*#__PURE__*/function () {
|
|
4342
4347
|
return _context14.abrupt("return");
|
4343
4348
|
case 2:
|
4344
4349
|
_context14.next = 4;
|
4345
|
-
return (
|
4350
|
+
return (se = (Q = e.deepChat).responseInterceptor) == null ? void 0 : se.call(Q, p);
|
4346
4351
|
case 4:
|
4347
4352
|
_context14.t0 = _context14.sent;
|
4348
4353
|
if (_context14.t0) {
|
@@ -4368,7 +4373,7 @@ var C = /*#__PURE__*/function () {
|
|
4368
4373
|
}
|
4369
4374
|
throw Error(A.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, E));
|
4370
4375
|
case 15:
|
4371
|
-
S.makingAnotherRequest || (
|
4376
|
+
S.makingAnotherRequest || (C.isSimulatable(e.stream, S) ? C.simulate(i, e.streamHandlers, S) : (i.addNewMessage(S), c()));
|
4372
4377
|
case 16:
|
4373
4378
|
case "end":
|
4374
4379
|
return _context14.stop();
|
@@ -4427,8 +4432,8 @@ var C = /*#__PURE__*/function () {
|
|
4427
4432
|
case 11:
|
4428
4433
|
a = _context16.sent;
|
4429
4434
|
a.timeoutMS ? setTimeout(function () {
|
4430
|
-
|
4431
|
-
}, a.timeoutMS) :
|
4435
|
+
T.executePollRequest(e, t, i, n);
|
4436
|
+
}, a.timeoutMS) : C.isSimulatable(e.stream, a) ? C.simulate(n, e.streamHandlers, a) : (n.addNewMessage(a), r());
|
4432
4437
|
case 13:
|
4433
4438
|
case "end":
|
4434
4439
|
return _context16.stop();
|
@@ -4487,7 +4492,7 @@ var C = /*#__PURE__*/function () {
|
|
4487
4492
|
body: h,
|
4488
4493
|
headers: a
|
4489
4494
|
};
|
4490
|
-
e.connectSettings.credentials && (u.credentials = e.connectSettings.credentials),
|
4495
|
+
e.connectSettings.credentials && (u.credentials = e.connectSettings.credentials), T.executePollRequest(e, c, u, i);
|
4491
4496
|
case 12:
|
4492
4497
|
case "end":
|
4493
4498
|
return _context17.stop();
|
@@ -4691,7 +4696,7 @@ var We = /*#__PURE__*/function () {
|
|
4691
4696
|
while (1) switch (_context18.prev = _context18.next) {
|
4692
4697
|
case 0:
|
4693
4698
|
i = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : !0;
|
4694
|
-
return _context18.abrupt("return", this.stream && !
|
4699
|
+
return _context18.abrupt("return", this.stream && !C.isSimulation(this.stream) ? C.request(this, e, t, i) : T.request(this, e, t, i));
|
4695
4700
|
case 2:
|
4696
4701
|
case "end":
|
4697
4702
|
return _context18.stop();
|
@@ -4914,7 +4919,7 @@ var U = /*#__PURE__*/function (_We) {
|
|
4914
4919
|
o = _this$keyVerification.createHeaders,
|
4915
4920
|
a = _this$keyVerification.body,
|
4916
4921
|
l = (o == null ? void 0 : o(e)) || this.buildHeadersFunc(e);
|
4917
|
-
|
4922
|
+
T.verifyKey(e, i, l, n, this.keyAuthenticated.bind(this, t.onSuccess), t.onFail, t.onLoad, r, a);
|
4918
4923
|
}
|
4919
4924
|
}, {
|
4920
4925
|
key: "isDirectConnection",
|
@@ -4990,11 +4995,11 @@ be._attributes_ = {}, be._attributeToProperty_ = {};
|
|
4990
4995
|
var Xi = be;
|
4991
4996
|
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
4997
|
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,
|
4998
|
+
var Z = /*#__PURE__*/function () {
|
4999
|
+
function Z() {
|
5000
|
+
_classCallCheck(this, Z);
|
4996
5001
|
}
|
4997
|
-
return _createClass(
|
5002
|
+
return _createClass(Z, null, [{
|
4998
5003
|
key: "createSVGElement",
|
4999
5004
|
value: function createSVGElement(e) {
|
5000
5005
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
@@ -5015,7 +5020,7 @@ var Ie = /*#__PURE__*/function () {
|
|
5015
5020
|
}, {
|
5016
5021
|
key: "createIconElement",
|
5017
5022
|
value: function createIconElement(e, t) {
|
5018
|
-
var i =
|
5023
|
+
var i = Z.createSVGElement(e);
|
5019
5024
|
return i.id = t, i.classList.add("visibility-icon"), i;
|
5020
5025
|
}
|
5021
5026
|
// prettier-ignore
|
@@ -5953,7 +5958,7 @@ var St = /*#__PURE__*/function (_U) {
|
|
5953
5958
|
throw new Error("Request settings have not been set up");
|
5954
5959
|
case 2:
|
5955
5960
|
n = this.preprocessBody(this.rawBody, t, i);
|
5956
|
-
|
5961
|
+
T.request(this, n, e);
|
5957
5962
|
case 4:
|
5958
5963
|
case "end":
|
5959
5964
|
return _context35.stop();
|
@@ -6003,7 +6008,7 @@ var Dt = /*#__PURE__*/function (_we) {
|
|
6003
6008
|
}
|
6004
6009
|
throw new Error("No file was added");
|
6005
6010
|
case 4:
|
6006
|
-
|
6011
|
+
T.poll(this, i[0], e, !1);
|
6007
6012
|
case 5:
|
6008
6013
|
case "end":
|
6009
6014
|
return _context36.stop();
|
@@ -6213,7 +6218,7 @@ var ni = /*#__PURE__*/function (_i10) {
|
|
6213
6218
|
throw new Error("Image was not found");
|
6214
6219
|
case 4:
|
6215
6220
|
n = this.createFormDataBody(this.rawBody, i[0]);
|
6216
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
6221
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, n, e), !1);
|
6217
6222
|
case 6:
|
6218
6223
|
case "end":
|
6219
6224
|
return _context39.stop();
|
@@ -6320,7 +6325,7 @@ var si = /*#__PURE__*/function (_i11) {
|
|
6320
6325
|
throw new Error("Image was not found");
|
6321
6326
|
case 4:
|
6322
6327
|
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,
|
6328
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6324
6329
|
case 6:
|
6325
6330
|
case "end":
|
6326
6331
|
return _context41.stop();
|
@@ -6689,7 +6694,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6689
6694
|
throw new Error("Image was not found");
|
6690
6695
|
case 4:
|
6691
6696
|
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,
|
6697
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6693
6698
|
case 6:
|
6694
6699
|
case "end":
|
6695
6700
|
return _context48.stop();
|
@@ -6821,7 +6826,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6821
6826
|
throw new Error("Request settings have not been set up");
|
6822
6827
|
case 2:
|
6823
6828
|
i = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
6824
|
-
|
6829
|
+
T.request(this, i, e);
|
6825
6830
|
case 4:
|
6826
6831
|
case "end":
|
6827
6832
|
return _context51.stop();
|
@@ -6995,7 +7000,7 @@ var _o = /*#__PURE__*/function (_un) {
|
|
6995
7000
|
throw new Error("Request settings have not been set up");
|
6996
7001
|
case 2:
|
6997
7002
|
i = this.preprocessBody(this.rawBody, t);
|
6998
|
-
|
7003
|
+
T.request(this, i, e);
|
6999
7004
|
case 4:
|
7000
7005
|
case "end":
|
7001
7006
|
return _context54.stop();
|
@@ -7070,7 +7075,7 @@ var So = /*#__PURE__*/function (_un2) {
|
|
7070
7075
|
throw new Error("Request settings have not been set up");
|
7071
7076
|
case 2:
|
7072
7077
|
i = this.preprocessBody(this.rawBody, t);
|
7073
|
-
|
7078
|
+
T.request(this, i, e);
|
7074
7079
|
case 4:
|
7075
7080
|
case "end":
|
7076
7081
|
return _context56.stop();
|
@@ -7216,7 +7221,7 @@ var nt = /*#__PURE__*/function (_U4) {
|
|
7216
7221
|
case 2:
|
7217
7222
|
this.url = this.connectSettings.url || this.url;
|
7218
7223
|
i = this.preprocessBody(this.rawBody, t);
|
7219
|
-
|
7224
|
+
T.request(this, i, e);
|
7220
7225
|
case 5:
|
7221
7226
|
case "end":
|
7222
7227
|
return _context59.stop();
|
@@ -7275,26 +7280,26 @@ var nt = /*#__PURE__*/function (_U4) {
|
|
7275
7280
|
}(U);
|
7276
7281
|
nt.DEFAULT_MODEL = "tts-1", nt.DEFAULT_VOIDE = "alloy";
|
7277
7282
|
var Yi = nt;
|
7278
|
-
var
|
7279
|
-
function
|
7283
|
+
var ae = /*#__PURE__*/function (_U5) {
|
7284
|
+
function ae(e) {
|
7280
7285
|
var _o$model2;
|
7281
7286
|
var _this28;
|
7282
|
-
_classCallCheck(this,
|
7287
|
+
_classCallCheck(this, ae);
|
7283
7288
|
var r, o;
|
7284
7289
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7285
7290
|
i = t == null ? void 0 : t.openAI;
|
7286
|
-
_this28 = _callSuper(this,
|
7291
|
+
_this28 = _callSuper(this, ae, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i, {
|
7287
7292
|
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 =
|
7293
|
+
}]), _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
7294
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
7290
|
-
_typeof(n) == "object" && (_this28.processConfig(n),
|
7295
|
+
_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
7296
|
return _this28;
|
7292
7297
|
}
|
7293
|
-
_inherits(
|
7294
|
-
return _createClass(
|
7298
|
+
_inherits(ae, _U5);
|
7299
|
+
return _createClass(ae, [{
|
7295
7300
|
key: "processConfig",
|
7296
7301
|
value: function processConfig(e) {
|
7297
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
7302
|
+
e != null && e.type && e.type === "translation" && (this._service_url = ae.AUDIO_TRANSLATIONS_URL, delete e.language);
|
7298
7303
|
}
|
7299
7304
|
}, {
|
7300
7305
|
key: "preprocessBody",
|
@@ -7326,8 +7331,8 @@ var oe = /*#__PURE__*/function (_U5) {
|
|
7326
7331
|
throw new Error("No file was added");
|
7327
7332
|
case 4:
|
7328
7333
|
this.url = this.connectSettings.url || this._service_url;
|
7329
|
-
n = this.preprocessBody(this.rawBody, t), r =
|
7330
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
7334
|
+
n = this.preprocessBody(this.rawBody, t), r = ae.createFormDataBody(n, i[0]);
|
7335
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7331
7336
|
case 7:
|
7332
7337
|
case "end":
|
7333
7338
|
return _context61.stop();
|
@@ -7386,13 +7391,13 @@ var oe = /*#__PURE__*/function (_U5) {
|
|
7386
7391
|
}
|
7387
7392
|
}]);
|
7388
7393
|
}(U);
|
7389
|
-
|
7390
|
-
var Qi =
|
7391
|
-
var
|
7392
|
-
function
|
7393
|
-
_classCallCheck(this,
|
7394
|
+
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";
|
7395
|
+
var Qi = ae;
|
7396
|
+
var ne = /*#__PURE__*/function () {
|
7397
|
+
function ne() {
|
7398
|
+
_classCallCheck(this, ne);
|
7394
7399
|
}
|
7395
|
-
return _createClass(
|
7400
|
+
return _createClass(ne, null, [{
|
7396
7401
|
key: "buildTextToSpeechHeaders",
|
7397
7402
|
value: function buildTextToSpeechHeaders(e, t) {
|
7398
7403
|
return {
|
@@ -7426,7 +7431,7 @@ var ie = /*#__PURE__*/function () {
|
|
7426
7431
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7427
7432
|
};
|
7428
7433
|
},
|
7429
|
-
handleVerificationResult:
|
7434
|
+
handleVerificationResult: ne.handleSpeechVerificationResult
|
7430
7435
|
};
|
7431
7436
|
}
|
7432
7437
|
}, {
|
@@ -7455,7 +7460,7 @@ var ie = /*#__PURE__*/function () {
|
|
7455
7460
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7456
7461
|
};
|
7457
7462
|
},
|
7458
|
-
handleVerificationResult:
|
7463
|
+
handleVerificationResult: ne.handleLanguageVerificationResult
|
7459
7464
|
};
|
7460
7465
|
}
|
7461
7466
|
// prettier-ignore
|
@@ -7473,9 +7478,9 @@ var ie = /*#__PURE__*/function () {
|
|
7473
7478
|
url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
|
7474
7479
|
method: "POST",
|
7475
7480
|
createHeaders: function createHeaders(t) {
|
7476
|
-
return
|
7481
|
+
return ne.buildTranslationHeaders(e, t);
|
7477
7482
|
},
|
7478
|
-
handleVerificationResult:
|
7483
|
+
handleVerificationResult: ne.handleTranslationVerificationResult
|
7479
7484
|
};
|
7480
7485
|
}
|
7481
7486
|
}, {
|
@@ -7494,7 +7499,7 @@ var wo = /*#__PURE__*/function (_U6) {
|
|
7494
7499
|
function wo(e, t, i, n, r) {
|
7495
7500
|
var _this29;
|
7496
7501
|
_classCallCheck(this, wo);
|
7497
|
-
_this29 = _callSuper(this, wo, [e,
|
7502
|
+
_this29 = _callSuper(this, wo, [e, ne.buildLanguageKeyVerificationDetails(i), t, n, r]), _this29.insertKeyPlaceholderText = "Azure Language Subscription Key", _this29.keyHelpUrl =
|
7498
7503
|
// eslint-disable-next-line max-len
|
7499
7504
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this29.permittedErrorPrefixes = ["Access"];
|
7500
7505
|
return _this29;
|
@@ -7502,19 +7507,19 @@ var wo = /*#__PURE__*/function (_U6) {
|
|
7502
7507
|
_inherits(wo, _U6);
|
7503
7508
|
return _createClass(wo);
|
7504
7509
|
}(U);
|
7505
|
-
var
|
7506
|
-
function
|
7510
|
+
var To = /*#__PURE__*/function (_wo) {
|
7511
|
+
function To(e) {
|
7507
7512
|
var _a$language;
|
7508
7513
|
var _this30;
|
7509
|
-
_classCallCheck(this,
|
7514
|
+
_classCallCheck(this, To);
|
7510
7515
|
var n, r, o, a;
|
7511
7516
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.summarization,
|
7512
7517
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7513
|
-
_this30 = _callSuper(this,
|
7518
|
+
_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
7519
|
return _this30;
|
7515
7520
|
}
|
7516
|
-
_inherits(
|
7517
|
-
return _createClass(
|
7521
|
+
_inherits(To, _wo);
|
7522
|
+
return _createClass(To, [{
|
7518
7523
|
key: "preprocessBody",
|
7519
7524
|
value: function preprocessBody(e, t) {
|
7520
7525
|
var i = t[t.length - 1].text;
|
@@ -7546,7 +7551,7 @@ var Co = /*#__PURE__*/function (_wo) {
|
|
7546
7551
|
throw new Error("Request settings have not been set up");
|
7547
7552
|
case 2:
|
7548
7553
|
i = this.preprocessBody(this.rawBody, t);
|
7549
|
-
|
7554
|
+
T.request(this, i, e), this.messages = e;
|
7550
7555
|
case 4:
|
7551
7556
|
case "end":
|
7552
7557
|
return _context63.stop();
|
@@ -7577,7 +7582,7 @@ var Co = /*#__PURE__*/function (_wo) {
|
|
7577
7582
|
method: "GET",
|
7578
7583
|
headers: (t = this.connectSettings) == null ? void 0 : t.headers
|
7579
7584
|
};
|
7580
|
-
|
7585
|
+
T.executePollRequest(this, _i14, n, this.messages);
|
7581
7586
|
}
|
7582
7587
|
return _context64.abrupt("return", {
|
7583
7588
|
makingAnotherRequest: !0
|
@@ -7792,7 +7797,7 @@ var fn = /*#__PURE__*/function (_U7) {
|
|
7792
7797
|
}
|
7793
7798
|
throw new Error("No file was added");
|
7794
7799
|
case 4:
|
7795
|
-
|
7800
|
+
T.request(this, i[0], e, !1);
|
7796
7801
|
case 5:
|
7797
7802
|
case "end":
|
7798
7803
|
return _context67.stop();
|
@@ -7849,7 +7854,7 @@ var ls = /*#__PURE__*/function (_U8) {
|
|
7849
7854
|
function ls(e, t, i, n, r) {
|
7850
7855
|
var _this32;
|
7851
7856
|
_classCallCheck(this, ls);
|
7852
|
-
_this32 = _callSuper(this, ls, [e,
|
7857
|
+
_this32 = _callSuper(this, ls, [e, ne.buildSpeechKeyVerificationDetails(i), t, n, r]), _this32.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this32.keyHelpUrl =
|
7853
7858
|
// eslint-disable-next-line max-len
|
7854
7859
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
7855
7860
|
return _this32;
|
@@ -7866,7 +7871,7 @@ var vi = /*#__PURE__*/function (_ls) {
|
|
7866
7871
|
var n, r, o, a, l, c;
|
7867
7872
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.textToSpeech,
|
7868
7873
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7869
|
-
_this33 = _callSuper(this, vi, [e,
|
7874
|
+
_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
7875
|
return _this33;
|
7871
7876
|
}
|
7872
7877
|
_inherits(vi, _ls);
|
@@ -7891,7 +7896,7 @@ var vi = /*#__PURE__*/function (_ls) {
|
|
7891
7896
|
throw new Error("Request settings have not been set up");
|
7892
7897
|
case 2:
|
7893
7898
|
i = this.preprocessBody(this.rawBody, t);
|
7894
|
-
|
7899
|
+
T.request(this, i, e, !1);
|
7895
7900
|
case 4:
|
7896
7901
|
case "end":
|
7897
7902
|
return _context69.stop();
|
@@ -7952,7 +7957,7 @@ var wt = /*#__PURE__*/function (_ls2) {
|
|
7952
7957
|
}
|
7953
7958
|
}
|
7954
7959
|
};
|
7955
|
-
_this34 = _callSuper(this, wt, [e,
|
7960
|
+
_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
7961
|
var r = t.lang || "en-US";
|
7957
7962
|
_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
7963
|
return _this34;
|
@@ -7978,7 +7983,7 @@ var wt = /*#__PURE__*/function (_ls2) {
|
|
7978
7983
|
}
|
7979
7984
|
throw new Error("No file was added");
|
7980
7985
|
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"),
|
7986
|
+
(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
7987
|
case 5:
|
7983
7988
|
case "end":
|
7984
7989
|
return _context71.stop();
|
@@ -8028,21 +8033,21 @@ wt.HELP_LINK =
|
|
8028
8033
|
// eslint-disable-next-line max-len
|
8029
8034
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
8030
8035
|
var tn = wt;
|
8031
|
-
var
|
8036
|
+
var Co = /*#__PURE__*/function (_U9) {
|
8032
8037
|
// prettier-ignore
|
8033
|
-
function
|
8038
|
+
function Co(e) {
|
8034
8039
|
var _this35;
|
8035
|
-
_classCallCheck(this,
|
8040
|
+
_classCallCheck(this, Co);
|
8036
8041
|
var n, r, o;
|
8037
8042
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.translation,
|
8038
8043
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
8039
|
-
_this35 = _callSuper(this,
|
8044
|
+
_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
8045
|
// eslint-disable-next-line max-len
|
8041
8046
|
"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
8047
|
return _this35;
|
8043
8048
|
}
|
8044
|
-
_inherits(
|
8045
|
-
return _createClass(
|
8049
|
+
_inherits(Co, _U9);
|
8050
|
+
return _createClass(Co, [{
|
8046
8051
|
key: "preprocessBody",
|
8047
8052
|
value: function preprocessBody(e) {
|
8048
8053
|
var t = e[e.length - 1].text;
|
@@ -8065,7 +8070,7 @@ var To = /*#__PURE__*/function (_U9) {
|
|
8065
8070
|
throw new Error("Request settings have not been set up");
|
8066
8071
|
case 2:
|
8067
8072
|
i = this.preprocessBody(t);
|
8068
|
-
|
8073
|
+
T.request(this, i, e);
|
8069
8074
|
case 4:
|
8070
8075
|
case "end":
|
8071
8076
|
return _context73.stop();
|
@@ -8107,11 +8112,11 @@ var To = /*#__PURE__*/function (_U9) {
|
|
8107
8112
|
}()
|
8108
8113
|
}]);
|
8109
8114
|
}(U);
|
8110
|
-
var
|
8111
|
-
function
|
8112
|
-
_classCallCheck(this,
|
8115
|
+
var J = /*#__PURE__*/function () {
|
8116
|
+
function J() {
|
8117
|
+
_classCallCheck(this, J);
|
8113
8118
|
}
|
8114
|
-
return _createClass(
|
8119
|
+
return _createClass(J, null, [{
|
8115
8120
|
key: "storeFiles",
|
8116
8121
|
value: function () {
|
8117
8122
|
var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(e, t, i) {
|
@@ -8202,7 +8207,7 @@ var ce = /*#__PURE__*/function () {
|
|
8202
8207
|
l({
|
8203
8208
|
src: d.target.result,
|
8204
8209
|
name: t[a].name,
|
8205
|
-
type:
|
8210
|
+
type: J.getType(t, a)
|
8206
8211
|
});
|
8207
8212
|
};
|
8208
8213
|
});
|
@@ -8240,7 +8245,7 @@ var ce = /*#__PURE__*/function () {
|
|
8240
8245
|
l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
|
8241
8246
|
path: l.text,
|
8242
8247
|
fileId: l.file_path.file_id,
|
8243
|
-
name:
|
8248
|
+
name: J.getFileName(l.text)
|
8244
8249
|
});
|
8245
8250
|
});
|
8246
8251
|
}), t != null && t.image_file && i.push({
|
@@ -8262,7 +8267,7 @@ var ce = /*#__PURE__*/function () {
|
|
8262
8267
|
break;
|
8263
8268
|
}
|
8264
8269
|
_context78.next = 4;
|
8265
|
-
return
|
8270
|
+
return J.getFiles(e, t);
|
8266
8271
|
case 4:
|
8267
8272
|
r = _context78.sent;
|
8268
8273
|
(o = n == null ? void 0 : n.text) != null && o.value && r.forEach(function (l, c) {
|
@@ -8296,9 +8301,9 @@ var ce = /*#__PURE__*/function () {
|
|
8296
8301
|
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8297
8302
|
while (1) switch (_context79.prev = _context79.next) {
|
8298
8303
|
case 0:
|
8299
|
-
n =
|
8304
|
+
n = J.getFileDetails(t, i);
|
8300
8305
|
_context79.next = 3;
|
8301
|
-
return
|
8306
|
+
return J.getFilesAndNewText(e, n, t.role, i);
|
8302
8307
|
case 3:
|
8303
8308
|
return _context79.abrupt("return", _context79.sent);
|
8304
8309
|
case 4:
|
@@ -8313,8 +8318,8 @@ var ce = /*#__PURE__*/function () {
|
|
8313
8318
|
return getFilesAndText;
|
8314
8319
|
}()
|
8315
8320
|
}, {
|
8316
|
-
key: "
|
8317
|
-
value: function
|
8321
|
+
key: "parseResult",
|
8322
|
+
value: function parseResult(e, t) {
|
8318
8323
|
var i = [];
|
8319
8324
|
if (t) i = e.data;else for (var n = 0; n < e.data.length; n += 1) {
|
8320
8325
|
var r = e.data[n];
|
@@ -8325,8 +8330,8 @@ var ce = /*#__PURE__*/function () {
|
|
8325
8330
|
// test this using this prompt and it should give 2 text mesages and a file:
|
8326
8331
|
// "give example data for a csv and create a suitable bar chart"
|
8327
8332
|
}, {
|
8328
|
-
key: "
|
8329
|
-
value: function
|
8333
|
+
key: "parseMessages",
|
8334
|
+
value: function parseMessages(e, t) {
|
8330
8335
|
var i = [];
|
8331
8336
|
return t.forEach( /*#__PURE__*/function () {
|
8332
8337
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(n) {
|
@@ -8342,7 +8347,7 @@ var ce = /*#__PURE__*/function () {
|
|
8342
8347
|
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8343
8348
|
while (1) switch (_context80.prev = _context80.next) {
|
8344
8349
|
case 0:
|
8345
|
-
i.push(
|
8350
|
+
i.push(J.getFilesAndText(e, n, r));
|
8346
8351
|
case 1:
|
8347
8352
|
case "end":
|
8348
8353
|
return _context80.stop();
|
@@ -8362,25 +8367,47 @@ var ce = /*#__PURE__*/function () {
|
|
8362
8367
|
return function (_x150) {
|
8363
8368
|
return _ref11.apply(this, arguments);
|
8364
8369
|
};
|
8365
|
-
}()), i;
|
8370
|
+
}()), Promise.all(i);
|
8366
8371
|
}
|
8367
8372
|
}, {
|
8368
|
-
key: "
|
8373
|
+
key: "processSteamMessages",
|
8369
8374
|
value: function () {
|
8370
|
-
var
|
8371
|
-
var n, r;
|
8375
|
+
var _processSteamMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e, t) {
|
8372
8376
|
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8373
8377
|
while (1) switch (_context82.prev = _context82.next) {
|
8374
8378
|
case 0:
|
8375
|
-
|
8376
|
-
|
8377
|
-
|
8379
|
+
return _context82.abrupt("return", J.parseMessages(e, [{
|
8380
|
+
content: t,
|
8381
|
+
role: "assistant"
|
8382
|
+
}]));
|
8383
|
+
case 1:
|
8378
8384
|
case "end":
|
8379
8385
|
return _context82.stop();
|
8380
8386
|
}
|
8381
8387
|
}, _callee82);
|
8382
8388
|
}));
|
8383
|
-
function
|
8389
|
+
function processSteamMessages(_x152, _x153) {
|
8390
|
+
return _processSteamMessages.apply(this, arguments);
|
8391
|
+
}
|
8392
|
+
return processSteamMessages;
|
8393
|
+
}()
|
8394
|
+
}, {
|
8395
|
+
key: "processAPIMessages",
|
8396
|
+
value: function () {
|
8397
|
+
var _processAPIMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e, t, i) {
|
8398
|
+
var n;
|
8399
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8400
|
+
while (1) switch (_context83.prev = _context83.next) {
|
8401
|
+
case 0:
|
8402
|
+
n = J.parseResult(t, i);
|
8403
|
+
return _context83.abrupt("return", J.parseMessages(e, n));
|
8404
|
+
case 2:
|
8405
|
+
case "end":
|
8406
|
+
return _context83.stop();
|
8407
|
+
}
|
8408
|
+
}, _callee83);
|
8409
|
+
}));
|
8410
|
+
function processAPIMessages(_x154, _x155, _x156) {
|
8384
8411
|
return _processAPIMessages.apply(this, arguments);
|
8385
8412
|
}
|
8386
8413
|
return processAPIMessages;
|
@@ -8417,32 +8444,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8417
8444
|
return _createClass(F, [{
|
8418
8445
|
key: "fetchHistoryFunc",
|
8419
8446
|
value: function () {
|
8420
|
-
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8447
|
+
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
|
8421
8448
|
var _this37 = this;
|
8422
8449
|
var e;
|
8423
|
-
return _regeneratorRuntime().wrap(function
|
8424
|
-
while (1) switch (
|
8450
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8451
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8425
8452
|
case 0:
|
8426
8453
|
setTimeout(function () {
|
8427
8454
|
return _this37.deepChat.disableSubmitButton();
|
8428
8455
|
}, 2);
|
8429
|
-
|
8430
|
-
|
8456
|
+
_context84.prev = 1;
|
8457
|
+
_context84.next = 4;
|
8431
8458
|
return this.getThreadMessages(this.sessionId, !0);
|
8432
8459
|
case 4:
|
8433
|
-
e =
|
8434
|
-
return
|
8460
|
+
e = _context84.sent;
|
8461
|
+
return _context84.abrupt("return", (this.deepChat.disableSubmitButton(!1), e.reverse()));
|
8435
8462
|
case 8:
|
8436
|
-
|
8437
|
-
|
8438
|
-
return
|
8463
|
+
_context84.prev = 8;
|
8464
|
+
_context84.t0 = _context84["catch"](1);
|
8465
|
+
return _context84.abrupt("return", [{
|
8439
8466
|
error: "failed to fetch thread history"
|
8440
8467
|
}]);
|
8441
8468
|
case 11:
|
8442
8469
|
case "end":
|
8443
|
-
return
|
8470
|
+
return _context84.stop();
|
8444
8471
|
}
|
8445
|
-
},
|
8472
|
+
}, _callee84, this, [[1, 8]]);
|
8446
8473
|
}));
|
8447
8474
|
function fetchHistoryFunc() {
|
8448
8475
|
return _fetchHistoryFunc.apply(this, arguments);
|
@@ -8474,71 +8501,72 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8474
8501
|
if (this.messages = e, this.sessionId) {
|
8475
8502
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/messages");
|
8476
8503
|
var n = this.processMessage(t, i);
|
8477
|
-
|
8504
|
+
T.request(this, n, e);
|
8478
8505
|
} else {
|
8479
8506
|
this.url = "".concat(F.THREAD_PREFIX, "/runs");
|
8480
8507
|
var _n2 = this.createNewThreadMessages(this.rawBody, t, i);
|
8481
|
-
this.isSSEStream ? this.createStreamRun(_n2) :
|
8508
|
+
this.isSSEStream ? this.createStreamRun(_n2) : T.request(this, _n2, e);
|
8482
8509
|
}
|
8483
8510
|
}
|
8484
8511
|
}, {
|
8485
8512
|
key: "callServiceAPI",
|
8486
8513
|
value: function () {
|
8487
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8514
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e, t, i) {
|
8488
8515
|
var _r$assistant_id;
|
8489
8516
|
var r, n;
|
8490
|
-
return _regeneratorRuntime().wrap(function
|
8491
|
-
while (1) switch (
|
8517
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8518
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8492
8519
|
case 0:
|
8493
8520
|
if (!(this.waitingForStreamResponse = !1, !this.connectSettings)) {
|
8494
|
-
|
8521
|
+
_context85.next = 2;
|
8495
8522
|
break;
|
8496
8523
|
}
|
8497
8524
|
throw new Error("Request settings have not been set up");
|
8498
8525
|
case 2:
|
8499
8526
|
if (!((_r$assistant_id = (r = this.rawBody).assistant_id) !== null && _r$assistant_id !== void 0)) {
|
8500
|
-
|
8527
|
+
_context85.next = 6;
|
8501
8528
|
break;
|
8502
8529
|
}
|
8503
8530
|
_r$assistant_id;
|
8504
|
-
|
8531
|
+
_context85.next = 12;
|
8505
8532
|
break;
|
8506
8533
|
case 6:
|
8507
|
-
|
8508
|
-
if (
|
8509
|
-
|
8534
|
+
_context85.t0 = this.config.assistant_id;
|
8535
|
+
if (_context85.t0) {
|
8536
|
+
_context85.next = 11;
|
8510
8537
|
break;
|
8511
8538
|
}
|
8512
|
-
|
8539
|
+
_context85.next = 10;
|
8513
8540
|
return this.createNewAssistant();
|
8514
8541
|
case 10:
|
8515
|
-
|
8542
|
+
_context85.t0 = _context85.sent;
|
8516
8543
|
case 11:
|
8517
|
-
r.assistant_id =
|
8544
|
+
r.assistant_id = _context85.t0;
|
8518
8545
|
case 12:
|
8546
|
+
this.streamedMessageId = void 0;
|
8519
8547
|
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
|
8520
8548
|
if (!i) {
|
8521
|
-
|
8549
|
+
_context85.next = 20;
|
8522
8550
|
break;
|
8523
8551
|
}
|
8524
|
-
|
8525
|
-
return
|
8526
|
-
case
|
8527
|
-
|
8528
|
-
|
8552
|
+
_context85.next = 17;
|
8553
|
+
return J.storeFiles(this, e, i);
|
8554
|
+
case 17:
|
8555
|
+
_context85.t1 = _context85.sent;
|
8556
|
+
_context85.next = 21;
|
8529
8557
|
break;
|
8530
|
-
case 19:
|
8531
|
-
_context84.t1 = void 0;
|
8532
8558
|
case 20:
|
8533
|
-
|
8559
|
+
_context85.t1 = void 0;
|
8560
|
+
case 21:
|
8561
|
+
n = _context85.t1;
|
8534
8562
|
this.connectSettings.method = "POST", this.callService(e, t, n);
|
8535
|
-
case
|
8563
|
+
case 23:
|
8536
8564
|
case "end":
|
8537
|
-
return
|
8565
|
+
return _context85.stop();
|
8538
8566
|
}
|
8539
|
-
},
|
8567
|
+
}, _callee85, this);
|
8540
8568
|
}));
|
8541
|
-
function callServiceAPI(
|
8569
|
+
function callServiceAPI(_x157, _x158, _x159) {
|
8542
8570
|
return _callServiceAPI18.apply(this, arguments);
|
8543
8571
|
}
|
8544
8572
|
return callServiceAPI;
|
@@ -8546,27 +8574,27 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8546
8574
|
}, {
|
8547
8575
|
key: "createNewAssistant",
|
8548
8576
|
value: function () {
|
8549
|
-
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8577
|
+
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
|
8550
8578
|
var e;
|
8551
|
-
return _regeneratorRuntime().wrap(function
|
8552
|
-
while (1) switch (
|
8579
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8580
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8553
8581
|
case 0:
|
8554
|
-
|
8582
|
+
_context86.prev = 0;
|
8555
8583
|
this.url = F.NEW_ASSISTANT_URL;
|
8556
|
-
|
8584
|
+
_context86.next = 4;
|
8557
8585
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
|
8558
8586
|
case 4:
|
8559
|
-
e =
|
8560
|
-
return
|
8587
|
+
e = _context86.sent;
|
8588
|
+
return _context86.abrupt("return", (this.config.assistant_id = e.id, this.config.assistant_id));
|
8561
8589
|
case 8:
|
8562
|
-
|
8563
|
-
|
8564
|
-
console.error(
|
8590
|
+
_context86.prev = 8;
|
8591
|
+
_context86.t0 = _context86["catch"](0);
|
8592
|
+
console.error(_context86.t0), console.error("Failed to create a new assistant");
|
8565
8593
|
case 11:
|
8566
8594
|
case "end":
|
8567
|
-
return
|
8595
|
+
return _context86.stop();
|
8568
8596
|
}
|
8569
|
-
},
|
8597
|
+
}, _callee86, this, [[0, 8]]);
|
8570
8598
|
}));
|
8571
8599
|
function createNewAssistant() {
|
8572
8600
|
return _createNewAssistant.apply(this, arguments);
|
@@ -8585,43 +8613,43 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8585
8613
|
}, {
|
8586
8614
|
key: "extractResultData",
|
8587
8615
|
value: function () {
|
8588
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8616
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e) {
|
8589
8617
|
var n, t, i;
|
8590
|
-
return _regeneratorRuntime().wrap(function
|
8591
|
-
while (1) switch (
|
8618
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8619
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8592
8620
|
case 0:
|
8593
8621
|
if (!(this.waitingForStreamResponse || this.isSSEStream && this.sessionId)) {
|
8594
|
-
|
8622
|
+
_context87.next = 4;
|
8595
8623
|
break;
|
8596
8624
|
}
|
8597
|
-
|
8625
|
+
_context87.next = 3;
|
8598
8626
|
return this.handleStream(e);
|
8599
8627
|
case 3:
|
8600
|
-
return
|
8628
|
+
return _context87.abrupt("return", _context87.sent);
|
8601
8629
|
case 4:
|
8602
8630
|
if (!e.error) {
|
8603
|
-
|
8631
|
+
_context87.next = 6;
|
8604
8632
|
break;
|
8605
8633
|
}
|
8606
8634
|
throw e.error.message;
|
8607
8635
|
case 6:
|
8608
|
-
|
8636
|
+
_context87.next = 8;
|
8609
8637
|
return this.assignThreadAndRun(e);
|
8610
8638
|
case 8:
|
8611
8639
|
t = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
8612
8640
|
method: "GET",
|
8613
8641
|
headers: (n = this.connectSettings) == null ? void 0 : n.headers
|
8614
8642
|
};
|
8615
|
-
return
|
8643
|
+
return _context87.abrupt("return", (T.executePollRequest(this, t, i, this.messages), {
|
8616
8644
|
makingAnotherRequest: !0
|
8617
8645
|
}));
|
8618
8646
|
case 10:
|
8619
8647
|
case "end":
|
8620
|
-
return
|
8648
|
+
return _context87.stop();
|
8621
8649
|
}
|
8622
|
-
},
|
8650
|
+
}, _callee87, this);
|
8623
8651
|
}));
|
8624
|
-
function extractResultData(
|
8652
|
+
function extractResultData(_x160) {
|
8625
8653
|
return _extractResultData21.apply(this, arguments);
|
8626
8654
|
}
|
8627
8655
|
return extractResultData;
|
@@ -8629,32 +8657,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8629
8657
|
}, {
|
8630
8658
|
key: "assignThreadAndRun",
|
8631
8659
|
value: function () {
|
8632
|
-
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8660
|
+
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e) {
|
8633
8661
|
var t;
|
8634
|
-
return _regeneratorRuntime().wrap(function
|
8635
|
-
while (1) switch (
|
8662
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8663
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8636
8664
|
case 0:
|
8637
8665
|
if (!this.sessionId) {
|
8638
|
-
|
8666
|
+
_context88.next = 8;
|
8639
8667
|
break;
|
8640
8668
|
}
|
8641
8669
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8642
|
-
|
8670
|
+
_context88.next = 4;
|
8643
8671
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8644
8672
|
case 4:
|
8645
|
-
t =
|
8673
|
+
t = _context88.sent;
|
8646
8674
|
this.run_id = t.id;
|
8647
|
-
|
8675
|
+
_context88.next = 9;
|
8648
8676
|
break;
|
8649
8677
|
case 8:
|
8650
8678
|
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
|
8651
8679
|
case 9:
|
8652
8680
|
case "end":
|
8653
|
-
return
|
8681
|
+
return _context88.stop();
|
8654
8682
|
}
|
8655
|
-
},
|
8683
|
+
}, _callee88, this);
|
8656
8684
|
}));
|
8657
|
-
function assignThreadAndRun(
|
8685
|
+
function assignThreadAndRun(_x161) {
|
8658
8686
|
return _assignThreadAndRun.apply(this, arguments);
|
8659
8687
|
}
|
8660
8688
|
return assignThreadAndRun;
|
@@ -8662,39 +8690,39 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8662
8690
|
}, {
|
8663
8691
|
key: "getThreadMessages",
|
8664
8692
|
value: function () {
|
8665
|
-
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8693
|
+
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e) {
|
8666
8694
|
var t,
|
8667
8695
|
n,
|
8668
8696
|
r,
|
8669
8697
|
i,
|
8670
|
-
|
8671
|
-
return _regeneratorRuntime().wrap(function
|
8672
|
-
while (1) switch (
|
8698
|
+
_args89 = arguments;
|
8699
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
8700
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8673
8701
|
case 0:
|
8674
|
-
t =
|
8702
|
+
t = _args89.length > 1 && _args89[1] !== undefined ? _args89[1] : !1;
|
8675
8703
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(e, "/messages");
|
8676
|
-
|
8704
|
+
_context89.next = 4;
|
8677
8705
|
return P.directFetch(this, {}, "GET");
|
8678
8706
|
case 4:
|
8679
|
-
i =
|
8680
|
-
|
8681
|
-
if (!
|
8682
|
-
|
8707
|
+
i = _context89.sent;
|
8708
|
+
_context89.t0 = !t && this.deepChat.responseInterceptor;
|
8709
|
+
if (!_context89.t0) {
|
8710
|
+
_context89.next = 10;
|
8683
8711
|
break;
|
8684
8712
|
}
|
8685
|
-
|
8713
|
+
_context89.next = 9;
|
8686
8714
|
return (r = (n = this.deepChat).responseInterceptor) == null ? void 0 : r.call(n, i);
|
8687
8715
|
case 9:
|
8688
|
-
i =
|
8716
|
+
i = _context89.sent;
|
8689
8717
|
case 10:
|
8690
|
-
return
|
8718
|
+
return _context89.abrupt("return", J.processAPIMessages(this, i, t));
|
8691
8719
|
case 11:
|
8692
8720
|
case "end":
|
8693
|
-
return
|
8721
|
+
return _context89.stop();
|
8694
8722
|
}
|
8695
|
-
},
|
8723
|
+
}, _callee89, this);
|
8696
8724
|
}));
|
8697
|
-
function getThreadMessages(
|
8725
|
+
function getThreadMessages(_x162) {
|
8698
8726
|
return _getThreadMessages.apply(this, arguments);
|
8699
8727
|
}
|
8700
8728
|
return getThreadMessages;
|
@@ -8702,33 +8730,33 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8702
8730
|
}, {
|
8703
8731
|
key: "extractPollResultData",
|
8704
8732
|
value: function () {
|
8705
|
-
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8733
|
+
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
|
8706
8734
|
var _this38 = this;
|
8707
8735
|
var r, t, i, o, _o$pop, a, l, n;
|
8708
|
-
return _regeneratorRuntime().wrap(function
|
8709
|
-
while (1) switch (
|
8736
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
8737
|
+
while (1) switch (_context90.prev = _context90.next) {
|
8710
8738
|
case 0:
|
8711
8739
|
t = e.status, i = e.required_action;
|
8712
8740
|
if (!(t === "queued" || t === "in_progress")) {
|
8713
|
-
|
8741
|
+
_context90.next = 3;
|
8714
8742
|
break;
|
8715
8743
|
}
|
8716
|
-
return
|
8744
|
+
return _context90.abrupt("return", {
|
8717
8745
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8718
8746
|
});
|
8719
8747
|
case 3:
|
8720
8748
|
if (!(t === "completed" && this.messages)) {
|
8721
|
-
|
8749
|
+
_context90.next = 11;
|
8722
8750
|
break;
|
8723
8751
|
}
|
8724
|
-
|
8752
|
+
_context90.next = 6;
|
8725
8753
|
return this.getThreadMessages(e.thread_id);
|
8726
8754
|
case 6:
|
8727
|
-
o =
|
8755
|
+
o = _context90.sent;
|
8728
8756
|
_o$pop = o.pop();
|
8729
8757
|
a = _o$pop.text;
|
8730
8758
|
l = _o$pop.files;
|
8731
|
-
return
|
8759
|
+
return _context90.abrupt("return", (setTimeout(function () {
|
8732
8760
|
o.forEach(function (c) {
|
8733
8761
|
return _this38.deepChat.addMessage(c);
|
8734
8762
|
});
|
@@ -8740,22 +8768,22 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8740
8768
|
case 11:
|
8741
8769
|
n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
|
8742
8770
|
if (!(t === "requires_action" && n)) {
|
8743
|
-
|
8771
|
+
_context90.next = 16;
|
8744
8772
|
break;
|
8745
8773
|
}
|
8746
|
-
|
8774
|
+
_context90.next = 15;
|
8747
8775
|
return this.handleTools(n);
|
8748
8776
|
case 15:
|
8749
|
-
return
|
8777
|
+
return _context90.abrupt("return", _context90.sent);
|
8750
8778
|
case 16:
|
8751
8779
|
throw Error("Thread run status: ".concat(t));
|
8752
8780
|
case 17:
|
8753
8781
|
case "end":
|
8754
|
-
return
|
8782
|
+
return _context90.stop();
|
8755
8783
|
}
|
8756
|
-
},
|
8784
|
+
}, _callee90, this);
|
8757
8785
|
}));
|
8758
|
-
function extractPollResultData(
|
8786
|
+
function extractPollResultData(_x163) {
|
8759
8787
|
return _extractPollResultData5.apply(this, arguments);
|
8760
8788
|
}
|
8761
8789
|
return extractPollResultData;
|
@@ -8763,13 +8791,13 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8763
8791
|
}, {
|
8764
8792
|
key: "handleTools",
|
8765
8793
|
value: function () {
|
8766
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8794
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
|
8767
8795
|
var t, i, n;
|
8768
|
-
return _regeneratorRuntime().wrap(function
|
8769
|
-
while (1) switch (
|
8796
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
8797
|
+
while (1) switch (_context91.prev = _context91.next) {
|
8770
8798
|
case 0:
|
8771
8799
|
if (this._functionHandler) {
|
8772
|
-
|
8800
|
+
_context91.next = 2;
|
8773
8801
|
break;
|
8774
8802
|
}
|
8775
8803
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8780,14 +8808,14 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8780
8808
|
arguments: r["function"].arguments
|
8781
8809
|
};
|
8782
8810
|
});
|
8783
|
-
|
8811
|
+
_context91.next = 5;
|
8784
8812
|
return this._functionHandler(t);
|
8785
8813
|
case 5:
|
8786
|
-
i =
|
8814
|
+
i = _context91.sent;
|
8787
8815
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8788
8816
|
return typeof r != "string";
|
8789
8817
|
}) || e.length !== i.length)) {
|
8790
|
-
|
8818
|
+
_context91.next = 8;
|
8791
8819
|
break;
|
8792
8820
|
}
|
8793
8821
|
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 +8828,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8800
8828
|
});
|
8801
8829
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8802
8830
|
if (!this.isSSEStream) {
|
8803
|
-
|
8831
|
+
_context91.next = 15;
|
8804
8832
|
break;
|
8805
8833
|
}
|
8806
|
-
|
8834
|
+
_context91.next = 13;
|
8807
8835
|
return this.createStreamRun({
|
8808
8836
|
tool_outputs: n
|
8809
8837
|
});
|
8810
8838
|
case 13:
|
8811
|
-
|
8839
|
+
_context91.next = 17;
|
8812
8840
|
break;
|
8813
8841
|
case 15:
|
8814
|
-
|
8842
|
+
_context91.next = 17;
|
8815
8843
|
return P.directFetch(this, {
|
8816
8844
|
tool_outputs: n
|
8817
8845
|
}, "POST");
|
8818
8846
|
case 17:
|
8819
|
-
return
|
8847
|
+
return _context91.abrupt("return", {
|
8820
8848
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8821
8849
|
});
|
8822
8850
|
case 18:
|
8823
8851
|
case "end":
|
8824
|
-
return
|
8852
|
+
return _context91.stop();
|
8825
8853
|
}
|
8826
|
-
},
|
8854
|
+
}, _callee91, this);
|
8827
8855
|
}));
|
8828
|
-
function handleTools(
|
8856
|
+
function handleTools(_x164) {
|
8829
8857
|
return _handleTools.apply(this, arguments);
|
8830
8858
|
}
|
8831
8859
|
return handleTools;
|
@@ -8833,77 +8861,111 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8833
8861
|
}, {
|
8834
8862
|
key: "handleStream",
|
8835
8863
|
value: function () {
|
8836
|
-
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8864
|
+
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e) {
|
8837
8865
|
var i, n, t, r;
|
8838
|
-
return _regeneratorRuntime().wrap(function
|
8839
|
-
while (1) switch (
|
8866
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
8867
|
+
while (1) switch (_context92.prev = _context92.next) {
|
8840
8868
|
case 0:
|
8841
8869
|
t = (n = (i = e.required_action) == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : n.tool_calls;
|
8842
8870
|
if (!(e.status === "requires_action" && t)) {
|
8843
|
-
|
8871
|
+
_context92.next = 6;
|
8844
8872
|
break;
|
8845
8873
|
}
|
8846
8874
|
this.run_id = e.id;
|
8847
|
-
|
8875
|
+
_context92.next = 5;
|
8848
8876
|
return this.handleTools(t);
|
8849
8877
|
case 5:
|
8850
|
-
return
|
8878
|
+
return _context92.abrupt("return", _context92.sent);
|
8851
8879
|
case 6:
|
8852
8880
|
if (!this.waitingForStreamResponse) {
|
8853
|
-
|
8881
|
+
_context92.next = 8;
|
8854
8882
|
break;
|
8855
8883
|
}
|
8856
|
-
return
|
8884
|
+
return _context92.abrupt("return", this.parseStreamResult(e));
|
8857
8885
|
case 8:
|
8858
8886
|
if (this.isSSEStream && this.sessionId) {
|
8859
8887
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8860
8888
|
r = JSON.parse(JSON.stringify(this.rawBody));
|
8861
8889
|
this.createStreamRun(r);
|
8862
8890
|
}
|
8863
|
-
return
|
8891
|
+
return _context92.abrupt("return", {
|
8864
8892
|
makingAnotherRequest: !0
|
8865
8893
|
});
|
8866
8894
|
case 10:
|
8867
8895
|
case "end":
|
8868
|
-
return
|
8896
|
+
return _context92.stop();
|
8869
8897
|
}
|
8870
|
-
},
|
8898
|
+
}, _callee92, this);
|
8871
8899
|
}));
|
8872
|
-
function handleStream(
|
8900
|
+
function handleStream(_x165) {
|
8873
8901
|
return _handleStream.apply(this, arguments);
|
8874
8902
|
}
|
8875
8903
|
return handleStream;
|
8876
8904
|
}()
|
8877
8905
|
}, {
|
8878
8906
|
key: "parseStreamResult",
|
8879
|
-
value: function
|
8880
|
-
var
|
8881
|
-
|
8882
|
-
|
8883
|
-
|
8884
|
-
|
8885
|
-
|
8886
|
-
|
8887
|
-
|
8907
|
+
value: function () {
|
8908
|
+
var _parseStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e) {
|
8909
|
+
var t, i, n, r;
|
8910
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
8911
|
+
while (1) switch (_context93.prev = _context93.next) {
|
8912
|
+
case 0:
|
8913
|
+
if (!((t = e.delta) != null && t.content)) {
|
8914
|
+
_context93.next = 7;
|
8915
|
+
break;
|
8916
|
+
}
|
8917
|
+
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)) {
|
8918
|
+
_context93.next = 6;
|
8919
|
+
break;
|
8920
|
+
}
|
8921
|
+
_context93.next = 4;
|
8922
|
+
return J.processSteamMessages(this, e.delta.content);
|
8923
|
+
case 4:
|
8924
|
+
r = _context93.sent;
|
8925
|
+
return _context93.abrupt("return", {
|
8926
|
+
text: r[0].text,
|
8927
|
+
files: r[1].files
|
8928
|
+
});
|
8929
|
+
case 6:
|
8930
|
+
return _context93.abrupt("return", {
|
8931
|
+
text: (n = e.delta.content[0].text) == null ? void 0 : n.value
|
8932
|
+
});
|
8933
|
+
case 7:
|
8934
|
+
return _context93.abrupt("return", (!this.sessionId && e.thread_id && (this.sessionId = e.thread_id), {
|
8935
|
+
makingAnotherRequest: !0
|
8936
|
+
}));
|
8937
|
+
case 8:
|
8938
|
+
case "end":
|
8939
|
+
return _context93.stop();
|
8940
|
+
}
|
8941
|
+
}, _callee93, this);
|
8942
|
+
}));
|
8943
|
+
function parseStreamResult(_x166) {
|
8944
|
+
return _parseStreamResult.apply(this, arguments);
|
8945
|
+
}
|
8946
|
+
return parseStreamResult;
|
8947
|
+
}() // https://platform.openai.com/docs/api-reference/assistants-streaming
|
8888
8948
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8889
8949
|
}, {
|
8890
8950
|
key: "createStreamRun",
|
8891
8951
|
value: function () {
|
8892
|
-
var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8893
|
-
return _regeneratorRuntime().wrap(function
|
8894
|
-
while (1) switch (
|
8952
|
+
var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e) {
|
8953
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
8954
|
+
while (1) switch (_context94.prev = _context94.next) {
|
8895
8955
|
case 0:
|
8896
8956
|
e.stream = !0;
|
8897
8957
|
this.waitingForStreamResponse = !0;
|
8898
|
-
|
8899
|
-
return
|
8958
|
+
_context94.next = 4;
|
8959
|
+
return C.request(this, e, this.messages, !0, !0);
|
8900
8960
|
case 4:
|
8961
|
+
this.messageStream = _context94.sent;
|
8962
|
+
case 5:
|
8901
8963
|
case "end":
|
8902
|
-
return
|
8964
|
+
return _context94.stop();
|
8903
8965
|
}
|
8904
|
-
},
|
8966
|
+
}, _callee94, this);
|
8905
8967
|
}));
|
8906
|
-
function createStreamRun(
|
8968
|
+
function createStreamRun(_x167) {
|
8907
8969
|
return _createStreamRun.apply(this, arguments);
|
8908
8970
|
}
|
8909
8971
|
return createStreamRun;
|
@@ -8912,10 +8974,10 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8912
8974
|
}(U);
|
8913
8975
|
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
8976
|
var nn = F;
|
8915
|
-
var
|
8916
|
-
function
|
8977
|
+
var le = /*#__PURE__*/function (_U11) {
|
8978
|
+
function le(e) {
|
8917
8979
|
var _this39;
|
8918
|
-
_classCallCheck(this,
|
8980
|
+
_classCallCheck(this, le);
|
8919
8981
|
var o;
|
8920
8982
|
var t = e.directConnection,
|
8921
8983
|
i = t == null ? void 0 : t.openAI,
|
@@ -8927,7 +8989,7 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8927
8989
|
}
|
8928
8990
|
}
|
8929
8991
|
};
|
8930
|
-
_this39 = _callSuper(this,
|
8992
|
+
_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
8993
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
8932
8994
|
if (_this39.camera) {
|
8933
8995
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -8938,11 +9000,11 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8938
9000
|
}
|
8939
9001
|
};
|
8940
9002
|
}
|
8941
|
-
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage =
|
9003
|
+
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage = le.canFileSendMessage;
|
8942
9004
|
return _this39;
|
8943
9005
|
}
|
8944
|
-
_inherits(
|
8945
|
-
return _createClass(
|
9006
|
+
_inherits(le, _U11);
|
9007
|
+
return _createClass(le, [{
|
8946
9008
|
key: "preprocessBody",
|
8947
9009
|
value: function preprocessBody(e, t) {
|
8948
9010
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -8956,50 +9018,50 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8956
9018
|
var n;
|
8957
9019
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
8958
9020
|
if (i[1] || r && r !== "") {
|
8959
|
-
this.url =
|
9021
|
+
this.url = le.IMAGE_EDIT_URL;
|
8960
9022
|
var l = this.preprocessBody(this.rawBody, r);
|
8961
|
-
n =
|
8962
|
-
} else this.url =
|
8963
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
9023
|
+
n = le.createFormDataBody(l, i[0], i[1]);
|
9024
|
+
} else this.url = le.IMAGE_VARIATIONS_URL, n = le.createFormDataBody(this.rawBody, i[0]);
|
9025
|
+
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, n, e), !1);
|
8964
9026
|
}
|
8965
9027
|
}, {
|
8966
9028
|
key: "callServiceAPI",
|
8967
9029
|
value: function () {
|
8968
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9030
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i) {
|
8969
9031
|
var n, r;
|
8970
|
-
return _regeneratorRuntime().wrap(function
|
8971
|
-
while (1) switch (
|
9032
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
9033
|
+
while (1) switch (_context95.prev = _context95.next) {
|
8972
9034
|
case 0:
|
8973
9035
|
if ((n = this.connectSettings) != null && n.headers) {
|
8974
|
-
|
9036
|
+
_context95.next = 2;
|
8975
9037
|
break;
|
8976
9038
|
}
|
8977
9039
|
throw new Error("Request settings have not been set up");
|
8978
9040
|
case 2:
|
8979
9041
|
if (!(i != null && i[0])) {
|
8980
|
-
|
9042
|
+
_context95.next = 6;
|
8981
9043
|
break;
|
8982
9044
|
}
|
8983
9045
|
this.callApiWithImage(e, t, i);
|
8984
|
-
|
9046
|
+
_context95.next = 11;
|
8985
9047
|
break;
|
8986
9048
|
case 6:
|
8987
9049
|
if (this.connectSettings) {
|
8988
|
-
|
9050
|
+
_context95.next = 8;
|
8989
9051
|
break;
|
8990
9052
|
}
|
8991
9053
|
throw new Error("Request settings have not been set up");
|
8992
9054
|
case 8:
|
8993
|
-
this.url =
|
9055
|
+
this.url = le.IMAGE_GENERATION_URL;
|
8994
9056
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
8995
|
-
|
9057
|
+
T.request(this, r, e);
|
8996
9058
|
case 11:
|
8997
9059
|
case "end":
|
8998
|
-
return
|
9060
|
+
return _context95.stop();
|
8999
9061
|
}
|
9000
|
-
},
|
9062
|
+
}, _callee95, this);
|
9001
9063
|
}));
|
9002
|
-
function callServiceAPI(
|
9064
|
+
function callServiceAPI(_x168, _x169, _x170) {
|
9003
9065
|
return _callServiceAPI19.apply(this, arguments);
|
9004
9066
|
}
|
9005
9067
|
return callServiceAPI;
|
@@ -9007,17 +9069,17 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
9007
9069
|
}, {
|
9008
9070
|
key: "extractResultData",
|
9009
9071
|
value: function () {
|
9010
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9011
|
-
return _regeneratorRuntime().wrap(function
|
9012
|
-
while (1) switch (
|
9072
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e) {
|
9073
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
9074
|
+
while (1) switch (_context96.prev = _context96.next) {
|
9013
9075
|
case 0:
|
9014
9076
|
if (!e.error) {
|
9015
|
-
|
9077
|
+
_context96.next = 2;
|
9016
9078
|
break;
|
9017
9079
|
}
|
9018
9080
|
throw e.error.message;
|
9019
9081
|
case 2:
|
9020
|
-
return
|
9082
|
+
return _context96.abrupt("return", {
|
9021
9083
|
files: e.data.map(function (i) {
|
9022
9084
|
return i.url ? {
|
9023
9085
|
src: i.url,
|
@@ -9030,11 +9092,11 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
9030
9092
|
});
|
9031
9093
|
case 3:
|
9032
9094
|
case "end":
|
9033
|
-
return
|
9095
|
+
return _context96.stop();
|
9034
9096
|
}
|
9035
|
-
},
|
9097
|
+
}, _callee96);
|
9036
9098
|
}));
|
9037
|
-
function extractResultData(
|
9099
|
+
function extractResultData(_x171) {
|
9038
9100
|
return _extractResultData22.apply(this, arguments);
|
9039
9101
|
}
|
9040
9102
|
return extractResultData;
|
@@ -9062,8 +9124,8 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
9062
9124
|
}
|
9063
9125
|
}]);
|
9064
9126
|
}(U);
|
9065
|
-
|
9066
|
-
var sn =
|
9127
|
+
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";
|
9128
|
+
var sn = le;
|
9067
9129
|
var yt = /*#__PURE__*/function (_U12) {
|
9068
9130
|
function yt(e) {
|
9069
9131
|
var _this40$maxMessages, _l$model;
|
@@ -9109,26 +9171,26 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9109
9171
|
}, {
|
9110
9172
|
key: "callServiceAPI",
|
9111
9173
|
value: function () {
|
9112
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9174
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t) {
|
9113
9175
|
var i, n;
|
9114
|
-
return _regeneratorRuntime().wrap(function
|
9115
|
-
while (1) switch (
|
9176
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
9177
|
+
while (1) switch (_context97.prev = _context97.next) {
|
9116
9178
|
case 0:
|
9117
9179
|
if (this.connectSettings) {
|
9118
|
-
|
9180
|
+
_context97.next = 2;
|
9119
9181
|
break;
|
9120
9182
|
}
|
9121
9183
|
throw new Error("Request settings have not been set up");
|
9122
9184
|
case 2:
|
9123
9185
|
i = this.preprocessBody(this.rawBody, t), n = this.stream;
|
9124
|
-
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0,
|
9186
|
+
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, C.request(this, i, e)) : T.request(this, i, e);
|
9125
9187
|
case 4:
|
9126
9188
|
case "end":
|
9127
|
-
return
|
9189
|
+
return _context97.stop();
|
9128
9190
|
}
|
9129
|
-
},
|
9191
|
+
}, _callee97, this);
|
9130
9192
|
}));
|
9131
|
-
function callServiceAPI(
|
9193
|
+
function callServiceAPI(_x172, _x173) {
|
9132
9194
|
return _callServiceAPI20.apply(this, arguments);
|
9133
9195
|
}
|
9134
9196
|
return callServiceAPI;
|
@@ -9136,29 +9198,29 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9136
9198
|
}, {
|
9137
9199
|
key: "extractResultData",
|
9138
9200
|
value: function () {
|
9139
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9201
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e, t, i) {
|
9140
9202
|
var n, r, o, a;
|
9141
|
-
return _regeneratorRuntime().wrap(function
|
9142
|
-
while (1) switch (
|
9203
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
9204
|
+
while (1) switch (_context98.prev = _context98.next) {
|
9143
9205
|
case 0:
|
9144
9206
|
if (!e.error) {
|
9145
|
-
|
9207
|
+
_context98.next = 2;
|
9146
9208
|
break;
|
9147
9209
|
}
|
9148
9210
|
throw e.error.message;
|
9149
9211
|
case 2:
|
9150
|
-
return
|
9212
|
+
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
9213
|
text: e.choices[0].message.content
|
9152
9214
|
} : {
|
9153
9215
|
text: ""
|
9154
9216
|
});
|
9155
9217
|
case 3:
|
9156
9218
|
case "end":
|
9157
|
-
return
|
9219
|
+
return _context98.stop();
|
9158
9220
|
}
|
9159
|
-
},
|
9221
|
+
}, _callee98, this);
|
9160
9222
|
}));
|
9161
|
-
function extractResultData(
|
9223
|
+
function extractResultData(_x174, _x175, _x176) {
|
9162
9224
|
return _extractResultData23.apply(this, arguments);
|
9163
9225
|
}
|
9164
9226
|
return extractResultData;
|
@@ -9166,37 +9228,37 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9166
9228
|
}, {
|
9167
9229
|
key: "extractStreamResult",
|
9168
9230
|
value: function () {
|
9169
|
-
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9231
|
+
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t, i) {
|
9170
9232
|
var _this41 = this;
|
9171
9233
|
var n, r, o;
|
9172
|
-
return _regeneratorRuntime().wrap(function
|
9173
|
-
while (1) switch (
|
9234
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
9235
|
+
while (1) switch (_context99.prev = _context99.next) {
|
9174
9236
|
case 0:
|
9175
9237
|
n = e.delta, r = e.finish_reason;
|
9176
9238
|
if (!(r === "tool_calls")) {
|
9177
|
-
|
9239
|
+
_context99.next = 7;
|
9178
9240
|
break;
|
9179
9241
|
}
|
9180
9242
|
this.asyncCallInProgress = !0;
|
9181
9243
|
o = {
|
9182
9244
|
tool_calls: this._streamToolCalls
|
9183
9245
|
};
|
9184
|
-
return
|
9246
|
+
return _context99.abrupt("return", (this._streamToolCalls = void 0, this.handleTools(o, t, i)));
|
9185
9247
|
case 7:
|
9186
9248
|
n != null && n.tool_calls && (this._streamToolCalls ? n.tool_calls.forEach(function (o, a) {
|
9187
9249
|
_this41._streamToolCalls && (_this41._streamToolCalls[a]["function"].arguments += o["function"].arguments);
|
9188
9250
|
}) : this._streamToolCalls = n.tool_calls);
|
9189
9251
|
case 8:
|
9190
|
-
return
|
9252
|
+
return _context99.abrupt("return", {
|
9191
9253
|
text: (n == null ? void 0 : n.content) || ""
|
9192
9254
|
});
|
9193
9255
|
case 9:
|
9194
9256
|
case "end":
|
9195
|
-
return
|
9257
|
+
return _context99.stop();
|
9196
9258
|
}
|
9197
|
-
},
|
9259
|
+
}, _callee99, this);
|
9198
9260
|
}));
|
9199
|
-
function extractStreamResult(
|
9261
|
+
function extractStreamResult(_x177, _x178, _x179) {
|
9200
9262
|
return _extractStreamResult.apply(this, arguments);
|
9201
9263
|
}
|
9202
9264
|
return extractStreamResult;
|
@@ -9204,13 +9266,13 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9204
9266
|
}, {
|
9205
9267
|
key: "handleTools",
|
9206
9268
|
value: function () {
|
9207
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9269
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e, t, i) {
|
9208
9270
|
var a, l, c, d, h, n, r, o, u, _u;
|
9209
|
-
return _regeneratorRuntime().wrap(function
|
9210
|
-
while (1) switch (
|
9271
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
9272
|
+
while (1) switch (_context100.prev = _context100.next) {
|
9211
9273
|
case 0:
|
9212
9274
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
9213
|
-
|
9275
|
+
_context100.next = 2;
|
9214
9276
|
break;
|
9215
9277
|
}
|
9216
9278
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -9222,28 +9284,28 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9222
9284
|
arguments: u["function"].arguments
|
9223
9285
|
};
|
9224
9286
|
});
|
9225
|
-
|
9287
|
+
_context100.next = 6;
|
9226
9288
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
9227
9289
|
case 6:
|
9228
|
-
o =
|
9290
|
+
o = _context100.sent;
|
9229
9291
|
if (!o.text) {
|
9230
|
-
|
9292
|
+
_context100.next = 15;
|
9231
9293
|
break;
|
9232
9294
|
}
|
9233
9295
|
u = {
|
9234
9296
|
text: o.text
|
9235
9297
|
};
|
9236
|
-
|
9298
|
+
_context100.next = 11;
|
9237
9299
|
return (c = (l = this.deepChat).responseInterceptor) == null ? void 0 : c.call(l, u);
|
9238
9300
|
case 11:
|
9239
|
-
|
9240
|
-
if (
|
9241
|
-
|
9301
|
+
_context100.t0 = _context100.sent;
|
9302
|
+
if (_context100.t0) {
|
9303
|
+
_context100.next = 14;
|
9242
9304
|
break;
|
9243
9305
|
}
|
9244
|
-
|
9306
|
+
_context100.t0 = u;
|
9245
9307
|
case 14:
|
9246
|
-
return
|
9308
|
+
return _context100.abrupt("return", _context100.t0);
|
9247
9309
|
case 15:
|
9248
9310
|
if (!(n.messages.push({
|
9249
9311
|
tool_calls: e.tool_calls,
|
@@ -9252,7 +9314,7 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9252
9314
|
}), Array.isArray(o) && !o.find(function (u) {
|
9253
9315
|
return typeof u != "string";
|
9254
9316
|
}) || r.length === o.length)) {
|
9255
|
-
|
9317
|
+
_context100.next = 35;
|
9256
9318
|
break;
|
9257
9319
|
}
|
9258
9320
|
o.forEach(function (u, f) {
|
@@ -9265,46 +9327,46 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9265
9327
|
content: u.response
|
9266
9328
|
});
|
9267
9329
|
}), delete n.tools, delete n.tool_choice, delete n.stream;
|
9268
|
-
|
9269
|
-
|
9330
|
+
_context100.prev = 17;
|
9331
|
+
_context100.next = 20;
|
9270
9332
|
return t == null ? void 0 : t(n).then(function (f) {
|
9271
9333
|
return v.processResponseByType(f);
|
9272
9334
|
});
|
9273
9335
|
case 20:
|
9274
|
-
_u =
|
9275
|
-
|
9336
|
+
_u = _context100.sent;
|
9337
|
+
_context100.next = 23;
|
9276
9338
|
return (h = (d = this.deepChat).responseInterceptor) == null ? void 0 : h.call(d, _u);
|
9277
9339
|
case 23:
|
9278
|
-
|
9279
|
-
if (
|
9280
|
-
|
9340
|
+
_context100.t1 = _context100.sent;
|
9341
|
+
if (_context100.t1) {
|
9342
|
+
_context100.next = 26;
|
9281
9343
|
break;
|
9282
9344
|
}
|
9283
|
-
|
9345
|
+
_context100.t1 = _u;
|
9284
9346
|
case 26:
|
9285
|
-
_u =
|
9347
|
+
_u = _context100.t1;
|
9286
9348
|
if (!_u.error) {
|
9287
|
-
|
9349
|
+
_context100.next = 29;
|
9288
9350
|
break;
|
9289
9351
|
}
|
9290
9352
|
throw _u.error.message;
|
9291
9353
|
case 29:
|
9292
|
-
return
|
9354
|
+
return _context100.abrupt("return", {
|
9293
9355
|
text: _u.choices[0].message.content || ""
|
9294
9356
|
});
|
9295
9357
|
case 32:
|
9296
|
-
|
9297
|
-
|
9298
|
-
throw this.asyncCallInProgress = !1,
|
9358
|
+
_context100.prev = 32;
|
9359
|
+
_context100.t2 = _context100["catch"](17);
|
9360
|
+
throw this.asyncCallInProgress = !1, _context100.t2;
|
9299
9361
|
case 35:
|
9300
9362
|
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
9363
|
case 36:
|
9302
9364
|
case "end":
|
9303
|
-
return
|
9365
|
+
return _context100.stop();
|
9304
9366
|
}
|
9305
|
-
},
|
9367
|
+
}, _callee100, this, [[17, 32]]);
|
9306
9368
|
}));
|
9307
|
-
function handleTools(
|
9369
|
+
function handleTools(_x180, _x181, _x182) {
|
9308
9370
|
return _handleTools2.apply(this, arguments);
|
9309
9371
|
}
|
9310
9372
|
return handleTools;
|
@@ -9368,26 +9430,26 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9368
9430
|
}, {
|
9369
9431
|
key: "callServiceAPI",
|
9370
9432
|
value: function () {
|
9371
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9433
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e, t) {
|
9372
9434
|
var i;
|
9373
|
-
return _regeneratorRuntime().wrap(function
|
9374
|
-
while (1) switch (
|
9435
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
9436
|
+
while (1) switch (_context101.prev = _context101.next) {
|
9375
9437
|
case 0:
|
9376
9438
|
if (this.connectSettings) {
|
9377
|
-
|
9439
|
+
_context101.next = 2;
|
9378
9440
|
break;
|
9379
9441
|
}
|
9380
9442
|
throw new Error("Request settings have not been set up");
|
9381
9443
|
case 2:
|
9382
9444
|
i = this.preprocessBody(this.rawBody, t);
|
9383
|
-
|
9445
|
+
T.request(this, i, e);
|
9384
9446
|
case 4:
|
9385
9447
|
case "end":
|
9386
|
-
return
|
9448
|
+
return _context101.stop();
|
9387
9449
|
}
|
9388
|
-
},
|
9450
|
+
}, _callee101, this);
|
9389
9451
|
}));
|
9390
|
-
function callServiceAPI(
|
9452
|
+
function callServiceAPI(_x183, _x184) {
|
9391
9453
|
return _callServiceAPI21.apply(this, arguments);
|
9392
9454
|
}
|
9393
9455
|
return callServiceAPI;
|
@@ -9395,26 +9457,26 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9395
9457
|
}, {
|
9396
9458
|
key: "extractResultData",
|
9397
9459
|
value: function () {
|
9398
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9399
|
-
return _regeneratorRuntime().wrap(function
|
9400
|
-
while (1) switch (
|
9460
|
+
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e) {
|
9461
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
9462
|
+
while (1) switch (_context102.prev = _context102.next) {
|
9401
9463
|
case 0:
|
9402
9464
|
if (!e.message) {
|
9403
|
-
|
9465
|
+
_context102.next = 2;
|
9404
9466
|
break;
|
9405
9467
|
}
|
9406
9468
|
throw e.message;
|
9407
9469
|
case 2:
|
9408
|
-
return
|
9470
|
+
return _context102.abrupt("return", {
|
9409
9471
|
text: e.text
|
9410
9472
|
});
|
9411
9473
|
case 3:
|
9412
9474
|
case "end":
|
9413
|
-
return
|
9475
|
+
return _context102.stop();
|
9414
9476
|
}
|
9415
|
-
},
|
9477
|
+
}, _callee102);
|
9416
9478
|
}));
|
9417
|
-
function extractResultData(
|
9479
|
+
function extractResultData(_x185) {
|
9418
9480
|
return _extractResultData24.apply(this, arguments);
|
9419
9481
|
}
|
9420
9482
|
return extractResultData;
|
@@ -9486,26 +9548,26 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9486
9548
|
}, {
|
9487
9549
|
key: "callServiceAPI",
|
9488
9550
|
value: function () {
|
9489
|
-
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9551
|
+
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e, t) {
|
9490
9552
|
var i;
|
9491
|
-
return _regeneratorRuntime().wrap(function
|
9492
|
-
while (1) switch (
|
9553
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
9554
|
+
while (1) switch (_context103.prev = _context103.next) {
|
9493
9555
|
case 0:
|
9494
9556
|
if (this.connectSettings) {
|
9495
|
-
|
9557
|
+
_context103.next = 2;
|
9496
9558
|
break;
|
9497
9559
|
}
|
9498
9560
|
throw new Error("Request settings have not been set up");
|
9499
9561
|
case 2:
|
9500
9562
|
i = this.preprocessBody(this.rawBody, t);
|
9501
|
-
|
9563
|
+
T.request(this, i, e);
|
9502
9564
|
case 4:
|
9503
9565
|
case "end":
|
9504
|
-
return
|
9566
|
+
return _context103.stop();
|
9505
9567
|
}
|
9506
|
-
},
|
9568
|
+
}, _callee103, this);
|
9507
9569
|
}));
|
9508
|
-
function callServiceAPI(
|
9570
|
+
function callServiceAPI(_x186, _x187) {
|
9509
9571
|
return _callServiceAPI22.apply(this, arguments);
|
9510
9572
|
}
|
9511
9573
|
return callServiceAPI;
|
@@ -9513,26 +9575,26 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9513
9575
|
}, {
|
9514
9576
|
key: "extractResultData",
|
9515
9577
|
value: function () {
|
9516
|
-
var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9517
|
-
return _regeneratorRuntime().wrap(function
|
9518
|
-
while (1) switch (
|
9578
|
+
var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
|
9579
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
9580
|
+
while (1) switch (_context104.prev = _context104.next) {
|
9519
9581
|
case 0:
|
9520
9582
|
if (!e.message) {
|
9521
|
-
|
9583
|
+
_context104.next = 2;
|
9522
9584
|
break;
|
9523
9585
|
}
|
9524
9586
|
throw e.message;
|
9525
9587
|
case 2:
|
9526
|
-
return
|
9588
|
+
return _context104.abrupt("return", {
|
9527
9589
|
text: e.text
|
9528
9590
|
});
|
9529
9591
|
case 3:
|
9530
9592
|
case "end":
|
9531
|
-
return
|
9593
|
+
return _context104.stop();
|
9532
9594
|
}
|
9533
|
-
},
|
9595
|
+
}, _callee104);
|
9534
9596
|
}));
|
9535
|
-
function extractResultData(
|
9597
|
+
function extractResultData(_x188) {
|
9536
9598
|
return _extractResultData25.apply(this, arguments);
|
9537
9599
|
}
|
9538
9600
|
return extractResultData;
|
@@ -9561,8 +9623,8 @@ var Mo = /*#__PURE__*/function () {
|
|
9561
9623
|
if (t.azure) {
|
9562
9624
|
if (t.azure.speechToText) return new tn(e);
|
9563
9625
|
if (t.azure.textToSpeech) return new en(e);
|
9564
|
-
if (t.azure.summarization) return new
|
9565
|
-
if (t.azure.translation) return new
|
9626
|
+
if (t.azure.summarization) return new To(e);
|
9627
|
+
if (t.azure.translation) return new Co(e);
|
9566
9628
|
}
|
9567
9629
|
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
9630
|
if (t.mistral) return new Ao(e);
|
@@ -9680,11 +9742,11 @@ var Ro = /*#__PURE__*/function () {
|
|
9680
9742
|
}]);
|
9681
9743
|
}();
|
9682
9744
|
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,
|
9745
|
+
var Ce = /*#__PURE__*/function () {
|
9746
|
+
function Ce() {
|
9747
|
+
_classCallCheck(this, Ce);
|
9686
9748
|
}
|
9687
|
-
return _createClass(
|
9749
|
+
return _createClass(Ce, null, [{
|
9688
9750
|
key: "createImage",
|
9689
9751
|
value: function createImage(e, t) {
|
9690
9752
|
var i = new Image();
|
@@ -9694,20 +9756,20 @@ var Te = /*#__PURE__*/function () {
|
|
9694
9756
|
}, {
|
9695
9757
|
key: "addNewImageMessage",
|
9696
9758
|
value: function () {
|
9697
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9759
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e, t, i) {
|
9698
9760
|
var n, r;
|
9699
|
-
return _regeneratorRuntime().wrap(function
|
9700
|
-
while (1) switch (
|
9761
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
9762
|
+
while (1) switch (_context105.prev = _context105.next) {
|
9701
9763
|
case 0:
|
9702
|
-
n =
|
9764
|
+
n = Ce.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
9703
9765
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), q.addMessage(e, r, "image", i);
|
9704
9766
|
case 2:
|
9705
9767
|
case "end":
|
9706
|
-
return
|
9768
|
+
return _context105.stop();
|
9707
9769
|
}
|
9708
|
-
},
|
9770
|
+
}, _callee105);
|
9709
9771
|
}));
|
9710
|
-
function addNewImageMessage(
|
9772
|
+
function addNewImageMessage(_x189, _x190, _x191) {
|
9711
9773
|
return _addNewImageMessage.apply(this, arguments);
|
9712
9774
|
}
|
9713
9775
|
return addNewImageMessage;
|
@@ -9721,7 +9783,7 @@ var Te = /*#__PURE__*/function () {
|
|
9721
9783
|
}, {
|
9722
9784
|
key: "addNewAudioMessage",
|
9723
9785
|
value: function addNewAudioMessage(e, t, i) {
|
9724
|
-
var n =
|
9786
|
+
var n = Ce.createAudioElement(t, i),
|
9725
9787
|
r = e.createNewMessageElement("", i);
|
9726
9788
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"), q.addMessage(e, r, "audio", i);
|
9727
9789
|
}
|
@@ -9732,7 +9794,7 @@ var Te = /*#__PURE__*/function () {
|
|
9732
9794
|
t.classList.add("any-file-message-contents");
|
9733
9795
|
var i = document.createElement("div");
|
9734
9796
|
i.classList.add("any-file-message-icon-container");
|
9735
|
-
var n =
|
9797
|
+
var n = Z.createSVGElement(Io);
|
9736
9798
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9737
9799
|
var r = document.createElement("div");
|
9738
9800
|
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 +9803,7 @@ var Te = /*#__PURE__*/function () {
|
|
9741
9803
|
key: "addNewAnyFileMessage",
|
9742
9804
|
value: function addNewAnyFileMessage(e, t, i) {
|
9743
9805
|
var n = e.createNewMessageElement("", i),
|
9744
|
-
r =
|
9806
|
+
r = Ce.createAnyFile(t);
|
9745
9807
|
n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r), q.addMessage(e, n, "file", i);
|
9746
9808
|
}
|
9747
9809
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
@@ -9749,7 +9811,7 @@ var Te = /*#__PURE__*/function () {
|
|
9749
9811
|
key: "addMessages",
|
9750
9812
|
value: function addMessages(e, t, i) {
|
9751
9813
|
t.forEach(function (n) {
|
9752
|
-
n.ref && (n = q.removeFileRef(n)), q.isAudioFile(n) ?
|
9814
|
+
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
9815
|
});
|
9754
9816
|
}
|
9755
9817
|
}]);
|
@@ -9823,15 +9885,15 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9823
9885
|
}, {
|
9824
9886
|
key: "fetchHistory",
|
9825
9887
|
value: function () {
|
9826
|
-
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9888
|
+
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(e) {
|
9827
9889
|
var _this46 = this;
|
9828
|
-
return _regeneratorRuntime().wrap(function
|
9829
|
-
while (1) switch (
|
9890
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
9891
|
+
while (1) switch (_context106.prev = _context106.next) {
|
9830
9892
|
case 0:
|
9831
|
-
|
9893
|
+
_context106.next = 2;
|
9832
9894
|
return e();
|
9833
9895
|
case 2:
|
9834
|
-
|
9896
|
+
_context106.sent.forEach(function (i) {
|
9835
9897
|
return _this46.addAnyMessage(i, !0);
|
9836
9898
|
});
|
9837
9899
|
setTimeout(function () {
|
@@ -9839,11 +9901,11 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9839
9901
|
}, 0);
|
9840
9902
|
case 4:
|
9841
9903
|
case "end":
|
9842
|
-
return
|
9904
|
+
return _context106.stop();
|
9843
9905
|
}
|
9844
|
-
},
|
9906
|
+
}, _callee106);
|
9845
9907
|
}));
|
9846
|
-
function fetchHistory(
|
9908
|
+
function fetchHistory(_x192) {
|
9847
9909
|
return _fetchHistory.apply(this, arguments);
|
9848
9910
|
}
|
9849
9911
|
return fetchHistory;
|
@@ -9863,7 +9925,7 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9863
9925
|
n = {
|
9864
9926
|
status: e.overwrite
|
9865
9927
|
};
|
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) &&
|
9928
|
+
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
9929
|
var r = ct.add(this, i.html, i.role, this.messageElementRefs, n);
|
9868
9930
|
Le.isElementTemporary(r) && delete i.html;
|
9869
9931
|
}
|
@@ -9943,11 +10005,11 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9943
10005
|
}, {
|
9944
10006
|
key: "addMultipleFiles",
|
9945
10007
|
value: function () {
|
9946
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9947
|
-
return _regeneratorRuntime().wrap(function
|
9948
|
-
while (1) switch (
|
10008
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107(e) {
|
10009
|
+
return _regeneratorRuntime().wrap(function _callee107$(_context107) {
|
10010
|
+
while (1) switch (_context107.prev = _context107.next) {
|
9949
10011
|
case 0:
|
9950
|
-
return
|
10012
|
+
return _context107.abrupt("return", Promise.all((e || []).map(function (t) {
|
9951
10013
|
return new Promise(function (i) {
|
9952
10014
|
if (!t.type || t.type === "any") {
|
9953
10015
|
var n = t.file.name || q.DEFAULT_FILE_NAME;
|
@@ -9970,11 +10032,11 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9970
10032
|
})));
|
9971
10033
|
case 1:
|
9972
10034
|
case "end":
|
9973
|
-
return
|
10035
|
+
return _context107.stop();
|
9974
10036
|
}
|
9975
|
-
},
|
10037
|
+
}, _callee107);
|
9976
10038
|
}));
|
9977
|
-
function addMultipleFiles(
|
10039
|
+
function addMultipleFiles(_x193) {
|
9978
10040
|
return _addMultipleFiles.apply(this, arguments);
|
9979
10041
|
}
|
9980
10042
|
return addMultipleFiles;
|
@@ -10077,11 +10139,11 @@ var ht = /*#__PURE__*/function () {
|
|
10077
10139
|
}]);
|
10078
10140
|
}();
|
10079
10141
|
var Nn = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
10080
|
-
var
|
10081
|
-
function
|
10082
|
-
_classCallCheck(this,
|
10142
|
+
var X = /*#__PURE__*/function () {
|
10143
|
+
function X() {
|
10144
|
+
_classCallCheck(this, X);
|
10083
10145
|
}
|
10084
|
-
return _createClass(
|
10146
|
+
return _createClass(X, null, [{
|
10085
10147
|
key: "createTextElement",
|
10086
10148
|
value: function createTextElement(e) {
|
10087
10149
|
var t = document.createElement("div");
|
@@ -10090,15 +10152,15 @@ var J = /*#__PURE__*/function () {
|
|
10090
10152
|
}, {
|
10091
10153
|
key: "createElement",
|
10092
10154
|
value: function createElement(e, t) {
|
10093
|
-
return t ?
|
10155
|
+
return t ? X.createTextElement(e) : Z.createSVGElement(e);
|
10094
10156
|
}
|
10095
10157
|
}, {
|
10096
10158
|
key: "createCustomElement",
|
10097
10159
|
value: function createCustomElement(e, t) {
|
10098
10160
|
var n, r, o, a;
|
10099
10161
|
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
|
10162
|
+
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);
|
10163
|
+
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
10164
|
}
|
10103
10165
|
}, {
|
10104
10166
|
key: "processElement",
|
@@ -10111,7 +10173,7 @@ var J = /*#__PURE__*/function () {
|
|
10111
10173
|
key: "createSpecificStateElement",
|
10112
10174
|
value: function createSpecificStateElement(e, t, i) {
|
10113
10175
|
var n;
|
10114
|
-
return i && (n =
|
10176
|
+
return i && (n = X.createCustomElement(t, i)), X.processElement(e, n), n;
|
10115
10177
|
}
|
10116
10178
|
}]);
|
10117
10179
|
}();
|
@@ -10349,7 +10411,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10349
10411
|
}, {
|
10350
10412
|
key: "createInnerElement",
|
10351
10413
|
value: function createInnerElement(e, t, i) {
|
10352
|
-
return
|
10414
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
10353
10415
|
}
|
10354
10416
|
}, {
|
10355
10417
|
key: "addClickEvent",
|
@@ -10378,7 +10440,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10378
10440
|
}, {
|
10379
10441
|
key: "createSVGIconElement",
|
10380
10442
|
value: function createSVGIconElement() {
|
10381
|
-
return
|
10443
|
+
return Z.createSVGElement(Lo);
|
10382
10444
|
}
|
10383
10445
|
}, {
|
10384
10446
|
key: "createButtonContainer",
|
@@ -10519,7 +10581,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10519
10581
|
}, {
|
10520
10582
|
key: "createInnerElement",
|
10521
10583
|
value: function createInnerElement(e, t, i) {
|
10522
|
-
return
|
10584
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
10523
10585
|
}
|
10524
10586
|
}, {
|
10525
10587
|
key: "changeToActive",
|
@@ -10566,7 +10628,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10566
10628
|
}, {
|
10567
10629
|
key: "createSVGIconElement",
|
10568
10630
|
value: function createSVGIconElement() {
|
10569
|
-
var e =
|
10631
|
+
var e = Z.createSVGElement(Bo);
|
10570
10632
|
return e.id = "microphone-icon", e;
|
10571
10633
|
}
|
10572
10634
|
}]);
|
@@ -10686,16 +10748,16 @@ gt.IS_SAFARI = function () {
|
|
10686
10748
|
return gt._IS_SAFARI === void 0 && (gt._IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), gt._IS_SAFARI;
|
10687
10749
|
};
|
10688
10750
|
var Ut = {},
|
10689
|
-
|
10690
|
-
Object.defineProperty(
|
10751
|
+
Ti = {};
|
10752
|
+
Object.defineProperty(Ti, "__esModule", {
|
10691
10753
|
value: !0
|
10692
10754
|
});
|
10693
|
-
|
10694
|
-
var
|
10695
|
-
function
|
10696
|
-
_classCallCheck(this,
|
10755
|
+
Ti.EventListeners = void 0;
|
10756
|
+
var ie = /*#__PURE__*/function () {
|
10757
|
+
function ie() {
|
10758
|
+
_classCallCheck(this, ie);
|
10697
10759
|
}
|
10698
|
-
return _createClass(
|
10760
|
+
return _createClass(ie, null, [{
|
10699
10761
|
key: "getElementIfFocusedOnAvailable",
|
10700
10762
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
10701
10763
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -10706,14 +10768,14 @@ var te = /*#__PURE__*/function () {
|
|
10706
10768
|
key: "keyDownWindow",
|
10707
10769
|
value: function keyDownWindow(e) {
|
10708
10770
|
var _this51 = this;
|
10709
|
-
e.element &&
|
10710
|
-
|
10771
|
+
e.element && ie.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (ie.KEY_DOWN_TIMEOUT !== null && clearTimeout(ie.KEY_DOWN_TIMEOUT), ie.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10772
|
+
ie.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
|
10711
10773
|
}, 500));
|
10712
10774
|
}
|
10713
10775
|
}, {
|
10714
10776
|
key: "mouseDownWindow",
|
10715
10777
|
value: function mouseDownWindow(e, t) {
|
10716
|
-
this.mouseDownElement =
|
10778
|
+
this.mouseDownElement = ie.getElementIfFocusedOnAvailable(e, t.target);
|
10717
10779
|
}
|
10718
10780
|
}, {
|
10719
10781
|
key: "mouseUpWindow",
|
@@ -10724,7 +10786,7 @@ var te = /*#__PURE__*/function () {
|
|
10724
10786
|
key: "add",
|
10725
10787
|
value: function add(e, t) {
|
10726
10788
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
10727
|
-
t != null && t.element && i && (e.mouseDownEvent =
|
10789
|
+
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
10790
|
}
|
10729
10791
|
}, {
|
10730
10792
|
key: "remove",
|
@@ -10733,13 +10795,13 @@ var te = /*#__PURE__*/function () {
|
|
10733
10795
|
}
|
10734
10796
|
}]);
|
10735
10797
|
}();
|
10736
|
-
|
10737
|
-
|
10738
|
-
var
|
10739
|
-
Object.defineProperty(
|
10798
|
+
Ti.EventListeners = ie;
|
10799
|
+
ie.KEY_DOWN_TIMEOUT = null;
|
10800
|
+
var Ci = {};
|
10801
|
+
Object.defineProperty(Ci, "__esModule", {
|
10740
10802
|
value: !0
|
10741
10803
|
});
|
10742
|
-
|
10804
|
+
Ci.PreResultUtils = void 0;
|
10743
10805
|
var qo = /*#__PURE__*/function () {
|
10744
10806
|
function qo() {
|
10745
10807
|
_classCallCheck(this, qo);
|
@@ -10754,7 +10816,7 @@ var qo = /*#__PURE__*/function () {
|
|
10754
10816
|
}
|
10755
10817
|
}]);
|
10756
10818
|
}();
|
10757
|
-
|
10819
|
+
Ci.PreResultUtils = qo;
|
10758
10820
|
var Ht = {},
|
10759
10821
|
qt = {};
|
10760
10822
|
Object.defineProperty(qt, "__esModule", {
|
@@ -10944,11 +11006,11 @@ var Fn = qt,
|
|
10944
11006
|
Go = ft,
|
10945
11007
|
Bn = Ye,
|
10946
11008
|
jn = Xe;
|
10947
|
-
var
|
10948
|
-
function
|
10949
|
-
_classCallCheck(this,
|
11009
|
+
var ee = /*#__PURE__*/function () {
|
11010
|
+
function ee() {
|
11011
|
+
_classCallCheck(this, ee);
|
10950
11012
|
}
|
10951
|
-
return _createClass(
|
11013
|
+
return _createClass(ee, null, [{
|
10952
11014
|
key: "processCommand",
|
10953
11015
|
value: function processCommand(e, t) {
|
10954
11016
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? jn.Text.breakupIntoWordsArr(e) : e;
|
@@ -10959,7 +11021,7 @@ var Q = /*#__PURE__*/function () {
|
|
10959
11021
|
var t;
|
10960
11022
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (n, r) {
|
10961
11023
|
var o = e[r];
|
10962
|
-
return n[r] = typeof o == "string" ?
|
11024
|
+
return n[r] = typeof o == "string" ? ee.processCommand(o, e.settings) : o, n;
|
10963
11025
|
}, {});
|
10964
11026
|
}
|
10965
11027
|
}, {
|
@@ -10977,7 +11039,7 @@ var Q = /*#__PURE__*/function () {
|
|
10977
11039
|
}, {
|
10978
11040
|
key: "setText",
|
10979
11041
|
value: function setText(e, t, i, n) {
|
10980
|
-
|
11042
|
+
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
11043
|
return Fn.AutoScroll.scrollGeneric(e, n);
|
10982
11044
|
})), e.resetRecording(t);
|
10983
11045
|
}
|
@@ -11007,38 +11069,38 @@ var Q = /*#__PURE__*/function () {
|
|
11007
11069
|
if (!c || !n || !i) return;
|
11008
11070
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
11009
11071
|
h = jn.Text.breakupIntoWordsArr(d),
|
11010
|
-
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ?
|
11072
|
+
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? ee.checkIfMatchesWord : ee.checkIfMatchesSubstring;
|
11011
11073
|
if (c.commandMode && u(c.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
11012
|
-
return
|
11074
|
+
return ee.toggleCommandModeOn(e);
|
11013
11075
|
}), {
|
11014
11076
|
doNotProcessTranscription: !1
|
11015
11077
|
};
|
11016
11078
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
11017
|
-
if (c.stop && u(c.stop, d, h)) return
|
11079
|
+
if (c.stop && u(c.stop, d, h)) return ee.toggleCommandModeOff(e), setTimeout(function () {
|
11018
11080
|
return e.stop();
|
11019
11081
|
}), {
|
11020
11082
|
doNotProcessTranscription: !1
|
11021
11083
|
};
|
11022
|
-
if (c.pause && u(c.pause, d, h)) return
|
11084
|
+
if (c.pause && u(c.pause, d, h)) return ee.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11023
11085
|
var f;
|
11024
11086
|
e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
|
11025
11087
|
}), {
|
11026
11088
|
doNotProcessTranscription: !1
|
11027
11089
|
};
|
11028
|
-
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1),
|
11090
|
+
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
11091
|
doNotProcessTranscription: !0
|
11030
11092
|
};
|
11031
|
-
if (c.reset && u(c.reset, d, h)) return r !== void 0 &&
|
11093
|
+
if (c.reset && u(c.reset, d, h)) return r !== void 0 && ee.setText(e, i, r, n), {
|
11032
11094
|
doNotProcessTranscription: !0
|
11033
11095
|
};
|
11034
|
-
if (c.removeAllText && u(c.removeAllText, d, h)) return
|
11096
|
+
if (c.removeAllText && u(c.removeAllText, d, h)) return ee.setText(e, i, "", n), {
|
11035
11097
|
doNotProcessTranscription: !0
|
11036
11098
|
};
|
11037
11099
|
}
|
11038
11100
|
}
|
11039
11101
|
}]);
|
11040
11102
|
}();
|
11041
|
-
Ht.CommandUtils =
|
11103
|
+
Ht.CommandUtils = ee;
|
11042
11104
|
var ki = {};
|
11043
11105
|
Object.defineProperty(ki, "__esModule", {
|
11044
11106
|
value: !0
|
@@ -11165,8 +11227,8 @@ Object.defineProperty(Ut, "__esModule", {
|
|
11165
11227
|
value: !0
|
11166
11228
|
});
|
11167
11229
|
Ut.Speech = void 0;
|
11168
|
-
var Hn =
|
11169
|
-
Ko =
|
11230
|
+
var Hn = Ti,
|
11231
|
+
Ko = Ci,
|
11170
11232
|
qn = Ht,
|
11171
11233
|
$t = qt,
|
11172
11234
|
Ui = ki,
|
@@ -11425,26 +11487,26 @@ var fi = /*#__PURE__*/function () {
|
|
11425
11487
|
}, {
|
11426
11488
|
key: "getNewSpeechConfig",
|
11427
11489
|
value: function () {
|
11428
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11429
|
-
return _regeneratorRuntime().wrap(function
|
11430
|
-
while (1) switch (
|
11490
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee108(e, t) {
|
11491
|
+
return _regeneratorRuntime().wrap(function _callee108$(_context108) {
|
11492
|
+
while (1) switch (_context108.prev = _context108.next) {
|
11431
11493
|
case 0:
|
11432
11494
|
if (!t.region) {
|
11433
|
-
|
11495
|
+
_context108.next = 2;
|
11434
11496
|
break;
|
11435
11497
|
}
|
11436
|
-
return
|
11498
|
+
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
11499
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11438
11500
|
})["catch"](function (i) {
|
11439
11501
|
return console.error(i), null;
|
11440
11502
|
}) : null);
|
11441
11503
|
case 2:
|
11442
11504
|
case "end":
|
11443
|
-
return
|
11505
|
+
return _context108.stop();
|
11444
11506
|
}
|
11445
|
-
},
|
11507
|
+
}, _callee108);
|
11446
11508
|
}));
|
11447
|
-
function getNewSpeechConfig(
|
11509
|
+
function getNewSpeechConfig(_x194, _x195) {
|
11448
11510
|
return _getNewSpeechConfig.apply(this, arguments);
|
11449
11511
|
}
|
11450
11512
|
return getNewSpeechConfig;
|
@@ -11457,23 +11519,23 @@ var fi = /*#__PURE__*/function () {
|
|
11457
11519
|
}, {
|
11458
11520
|
key: "get",
|
11459
11521
|
value: function () {
|
11460
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11522
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee109(e, t) {
|
11461
11523
|
var i;
|
11462
|
-
return _regeneratorRuntime().wrap(function
|
11463
|
-
while (1) switch (
|
11524
|
+
return _regeneratorRuntime().wrap(function _callee109$(_context109) {
|
11525
|
+
while (1) switch (_context109.prev = _context109.next) {
|
11464
11526
|
case 0:
|
11465
|
-
|
11527
|
+
_context109.next = 2;
|
11466
11528
|
return fi.getNewSpeechConfig(e, t);
|
11467
11529
|
case 2:
|
11468
|
-
i =
|
11469
|
-
return
|
11530
|
+
i = _context109.sent;
|
11531
|
+
return _context109.abrupt("return", (i && fi.process(i, t), i));
|
11470
11532
|
case 4:
|
11471
11533
|
case "end":
|
11472
|
-
return
|
11534
|
+
return _context109.stop();
|
11473
11535
|
}
|
11474
|
-
},
|
11536
|
+
}, _callee109);
|
11475
11537
|
}));
|
11476
|
-
function get(
|
11538
|
+
function get(_x196, _x197) {
|
11477
11539
|
return _get.apply(this, arguments);
|
11478
11540
|
}
|
11479
11541
|
return get;
|
@@ -11559,28 +11621,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11559
11621
|
}, {
|
11560
11622
|
key: "startAsync",
|
11561
11623
|
value: function () {
|
11562
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11624
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee110(e) {
|
11563
11625
|
var t;
|
11564
|
-
return _regeneratorRuntime().wrap(function
|
11565
|
-
while (1) switch (
|
11626
|
+
return _regeneratorRuntime().wrap(function _callee110$(_context110) {
|
11627
|
+
while (1) switch (_context110.prev = _context110.next) {
|
11566
11628
|
case 0:
|
11567
|
-
|
11568
|
-
if (!
|
11569
|
-
|
11629
|
+
_context110.t0 = this.validate(e);
|
11630
|
+
if (!_context110.t0) {
|
11631
|
+
_context110.next = 6;
|
11570
11632
|
break;
|
11571
11633
|
}
|
11572
|
-
|
11634
|
+
_context110.next = 4;
|
11573
11635
|
return this.instantiateService(e);
|
11574
11636
|
case 4:
|
11575
11637
|
this._translations = e == null ? void 0 : e.translations;
|
11576
11638
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11577
11639
|
case 6:
|
11578
11640
|
case "end":
|
11579
|
-
return
|
11641
|
+
return _context110.stop();
|
11580
11642
|
}
|
11581
|
-
},
|
11643
|
+
}, _callee110, this);
|
11582
11644
|
}));
|
11583
|
-
function startAsync(
|
11645
|
+
function startAsync(_x198) {
|
11584
11646
|
return _startAsync.apply(this, arguments);
|
11585
11647
|
}
|
11586
11648
|
return startAsync;
|
@@ -11593,28 +11655,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11593
11655
|
}, {
|
11594
11656
|
key: "instantiateService",
|
11595
11657
|
value: function () {
|
11596
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11658
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee111(e) {
|
11597
11659
|
var t, i, n, r;
|
11598
|
-
return _regeneratorRuntime().wrap(function
|
11599
|
-
while (1) switch (
|
11660
|
+
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
11661
|
+
while (1) switch (_context111.prev = _context111.next) {
|
11600
11662
|
case 0:
|
11601
11663
|
t = pi.getAPI();
|
11602
11664
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11603
|
-
|
11665
|
+
_context111.next = 4;
|
11604
11666
|
return Kn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11605
11667
|
case 4:
|
11606
|
-
n =
|
11668
|
+
n = _context111.sent;
|
11607
11669
|
if (n) {
|
11608
11670
|
r = new t.SpeechRecognizer(n, i);
|
11609
11671
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11610
11672
|
} else this.error("Unable to contact Azure server");
|
11611
11673
|
case 6:
|
11612
11674
|
case "end":
|
11613
|
-
return
|
11675
|
+
return _context111.stop();
|
11614
11676
|
}
|
11615
|
-
},
|
11677
|
+
}, _callee111, this);
|
11616
11678
|
}));
|
11617
|
-
function instantiateService(
|
11679
|
+
function instantiateService(_x199) {
|
11618
11680
|
return _instantiateService.apply(this, arguments);
|
11619
11681
|
}
|
11620
11682
|
return instantiateService;
|
@@ -11715,7 +11777,7 @@ Object.defineProperty(cs, "__esModule", {
|
|
11715
11777
|
});
|
11716
11778
|
var Xn = Si,
|
11717
11779
|
ta = Ht,
|
11718
|
-
|
11780
|
+
re = Mi,
|
11719
11781
|
ia = Ri;
|
11720
11782
|
var tt = /*#__PURE__*/function () {
|
11721
11783
|
function tt() {
|
@@ -11726,12 +11788,12 @@ var tt = /*#__PURE__*/function () {
|
|
11726
11788
|
value: function toggle(e, t) {
|
11727
11789
|
var i, n;
|
11728
11790
|
var r = e.toLocaleLowerCase().trim();
|
11729
|
-
!((i =
|
11791
|
+
!((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
11792
|
}
|
11731
11793
|
}, {
|
11732
11794
|
key: "startWebSpeech",
|
11733
11795
|
value: function startWebSpeech(e) {
|
11734
|
-
tt.stop() || (
|
11796
|
+
tt.stop() || (re.GlobalState.service = new Xn.WebSpeech(), re.GlobalState.service.start(e));
|
11735
11797
|
}
|
11736
11798
|
}, {
|
11737
11799
|
key: "isWebSpeechSupported",
|
@@ -11742,18 +11804,18 @@ var tt = /*#__PURE__*/function () {
|
|
11742
11804
|
key: "startAzure",
|
11743
11805
|
value: function startAzure(e) {
|
11744
11806
|
var t;
|
11745
|
-
tt.stop() || !((t =
|
11807
|
+
tt.stop() || !((t = re.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (re.GlobalState.service = new ia.Azure(), re.GlobalState.service.start(e));
|
11746
11808
|
}
|
11747
11809
|
}, {
|
11748
11810
|
key: "stop",
|
11749
11811
|
value: function stop() {
|
11750
11812
|
var e;
|
11751
|
-
return
|
11813
|
+
return re.GlobalState.doubleClickDetector() ? !0 : (!((e = re.GlobalState.service) === null || e === void 0) && e.recognizing && re.GlobalState.service.stop(), !1);
|
11752
11814
|
}
|
11753
11815
|
}, {
|
11754
11816
|
key: "endCommandMode",
|
11755
11817
|
value: function endCommandMode() {
|
11756
|
-
|
11818
|
+
re.GlobalState.service && ta.CommandUtils.toggleCommandModeOff(re.GlobalState.service);
|
11757
11819
|
}
|
11758
11820
|
}]);
|
11759
11821
|
}();
|
@@ -11789,12 +11851,12 @@ var na = /*#__PURE__*/function () {
|
|
11789
11851
|
}
|
11790
11852
|
}]);
|
11791
11853
|
}();
|
11792
|
-
var
|
11793
|
-
function
|
11854
|
+
var Tt = /*#__PURE__*/function (_Lt) {
|
11855
|
+
function Tt(e, t, i) {
|
11794
11856
|
var _this56;
|
11795
|
-
_classCallCheck(this,
|
11857
|
+
_classCallCheck(this, Tt);
|
11796
11858
|
var o;
|
11797
|
-
_this56 = _callSuper(this,
|
11859
|
+
_this56 = _callSuper(this, Tt, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
|
11798
11860
|
var _this56$processConfig = _this56.processConfiguration(t, e.speechToText),
|
11799
11861
|
n = _this56$processConfig.serviceName,
|
11800
11862
|
r = _this56$processConfig.processedConfig;
|
@@ -11808,8 +11870,8 @@ var Ct = /*#__PURE__*/function (_Lt) {
|
|
11808
11870
|
return _this56;
|
11809
11871
|
}
|
11810
11872
|
// prettier-ignore
|
11811
|
-
_inherits(
|
11812
|
-
return _createClass(
|
11873
|
+
_inherits(Tt, _Lt);
|
11874
|
+
return _createClass(Tt, [{
|
11813
11875
|
key: "processConfiguration",
|
11814
11876
|
value: function processConfiguration(e, t) {
|
11815
11877
|
var _i$displayInterimResu, _i$textColor, _i$translations, _i$commands;
|
@@ -11833,7 +11895,7 @@ var Ct = /*#__PURE__*/function (_Lt) {
|
|
11833
11895
|
removeNewText: !0
|
11834
11896
|
}) : null;
|
11835
11897
|
}), i.submitAfterSilence && (this._silenceSubmit = new na(i.submitAfterSilence, i.stopAfterSubmit)), {
|
11836
|
-
serviceName:
|
11898
|
+
serviceName: Tt.getServiceName(i),
|
11837
11899
|
processedConfig: o
|
11838
11900
|
};
|
11839
11901
|
}
|
@@ -11885,12 +11947,12 @@ var Ct = /*#__PURE__*/function (_Lt) {
|
|
11885
11947
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
11886
11948
|
e.click(), t || setTimeout(function () {
|
11887
11949
|
return e.click();
|
11888
|
-
},
|
11950
|
+
}, Tt.MICROPHONE_RESET_TIMEOUT_MS);
|
11889
11951
|
}
|
11890
11952
|
}]);
|
11891
11953
|
}(Lt);
|
11892
|
-
|
11893
|
-
var Ot =
|
11954
|
+
Tt.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
11955
|
+
var Ot = Tt;
|
11894
11956
|
var xe = /*#__PURE__*/function () {
|
11895
11957
|
// prettier-ignore
|
11896
11958
|
function xe(e, t, i, n) {
|
@@ -12055,7 +12117,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12055
12117
|
i.classList.add("audio-placeholder-text-3-digits");
|
12056
12118
|
var n = document.createElement("div");
|
12057
12119
|
n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
|
12058
|
-
var r =
|
12120
|
+
var r = Z.createSVGElement(Zn);
|
12059
12121
|
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
12122
|
}
|
12061
12123
|
}, {
|
@@ -12111,9 +12173,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12111
12173
|
var i = e.parentElement ? j.cloneElement(e) : e,
|
12112
12174
|
n = document.createElement("audio");
|
12113
12175
|
n.src = t;
|
12114
|
-
var r =
|
12176
|
+
var r = Z.createSVGElement(sa);
|
12115
12177
|
r.classList.add("attachment-icon", "play-icon");
|
12116
|
-
var o =
|
12178
|
+
var o = Z.createSVGElement(Zn);
|
12117
12179
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
|
12118
12180
|
i.replaceChildren(o);
|
12119
12181
|
}, n.onpause = function () {
|
@@ -12189,33 +12251,33 @@ var zt = /*#__PURE__*/function () {
|
|
12189
12251
|
}, {
|
12190
12252
|
key: "completePlaceholders",
|
12191
12253
|
value: function () {
|
12192
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12193
|
-
return _regeneratorRuntime().wrap(function
|
12194
|
-
while (1) switch (
|
12254
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee113() {
|
12255
|
+
return _regeneratorRuntime().wrap(function _callee113$(_context113) {
|
12256
|
+
while (1) switch (_context113.prev = _context113.next) {
|
12195
12257
|
case 0:
|
12196
|
-
|
12258
|
+
_context113.next = 2;
|
12197
12259
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
12198
|
-
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12260
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee112(e) {
|
12199
12261
|
var t;
|
12200
|
-
return _regeneratorRuntime().wrap(function
|
12201
|
-
while (1) switch (
|
12262
|
+
return _regeneratorRuntime().wrap(function _callee112$(_context112) {
|
12263
|
+
while (1) switch (_context112.prev = _context112.next) {
|
12202
12264
|
case 0:
|
12203
|
-
return
|
12265
|
+
return _context112.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
12204
12266
|
case 1:
|
12205
12267
|
case "end":
|
12206
|
-
return
|
12268
|
+
return _context112.stop();
|
12207
12269
|
}
|
12208
|
-
},
|
12270
|
+
}, _callee112);
|
12209
12271
|
}));
|
12210
|
-
return function (
|
12272
|
+
return function (_x200) {
|
12211
12273
|
return _ref15.apply(this, arguments);
|
12212
12274
|
};
|
12213
12275
|
}()));
|
12214
12276
|
case 2:
|
12215
12277
|
case "end":
|
12216
|
-
return
|
12278
|
+
return _context113.stop();
|
12217
12279
|
}
|
12218
|
-
},
|
12280
|
+
}, _callee113, this);
|
12219
12281
|
}));
|
12220
12282
|
function completePlaceholders() {
|
12221
12283
|
return _completePlaceholders.apply(this, arguments);
|
@@ -12251,12 +12313,12 @@ var zt = /*#__PURE__*/function () {
|
|
12251
12313
|
}
|
12252
12314
|
}]);
|
12253
12315
|
}();
|
12254
|
-
var
|
12255
|
-
function
|
12256
|
-
_classCallCheck(this,
|
12257
|
-
this._isOpen = !1, this._contentRef =
|
12316
|
+
var ce = /*#__PURE__*/function () {
|
12317
|
+
function ce(e, t, i) {
|
12318
|
+
_classCallCheck(this, ce);
|
12319
|
+
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
12320
|
}
|
12259
|
-
return _createClass(
|
12321
|
+
return _createClass(ce, [{
|
12260
12322
|
key: "isOpen",
|
12261
12323
|
value: function isOpen() {
|
12262
12324
|
return this._isOpen;
|
@@ -12278,7 +12340,7 @@ var le = /*#__PURE__*/function () {
|
|
12278
12340
|
var _this62 = this;
|
12279
12341
|
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
12342
|
_this62._elementRef.style.display = "none", _this62._backgroundPanelRef.style.display = "none";
|
12281
|
-
},
|
12343
|
+
}, ce.MODAL_CLOSE_TIMEOUT_MS);
|
12282
12344
|
}
|
12283
12345
|
}, {
|
12284
12346
|
key: "displayModalElements",
|
@@ -12294,7 +12356,7 @@ var le = /*#__PURE__*/function () {
|
|
12294
12356
|
key: "addCloseButton",
|
12295
12357
|
value: function addCloseButton(e, t, i) {
|
12296
12358
|
var _this63 = this;
|
12297
|
-
var n = t ?
|
12359
|
+
var n = t ? ce.createSVGButton(e) : ce.createTextButton(e);
|
12298
12360
|
return this.addButtons(n), n.onclick = function () {
|
12299
12361
|
_this63.close(), setTimeout(function () {
|
12300
12362
|
i == null || i();
|
@@ -12348,7 +12410,7 @@ var le = /*#__PURE__*/function () {
|
|
12348
12410
|
value: function createSVGButton(e) {
|
12349
12411
|
var t = document.createElement("div");
|
12350
12412
|
t.classList.add("modal-button", "modal-svg-button");
|
12351
|
-
var i =
|
12413
|
+
var i = Z.createSVGElement(e);
|
12352
12414
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
12353
12415
|
}
|
12354
12416
|
}, {
|
@@ -12356,14 +12418,14 @@ var le = /*#__PURE__*/function () {
|
|
12356
12418
|
value: function createTextModalFunc(e, t, i) {
|
12357
12419
|
var n;
|
12358
12420
|
if (_typeof(t) == "object" && (n = t.files) != null && n.infoModal) {
|
12359
|
-
var r = new
|
12421
|
+
var r = new ce(e, ["modal-content"], t.files.infoModal.containerStyle);
|
12360
12422
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
12361
12423
|
}
|
12362
12424
|
}
|
12363
12425
|
}]);
|
12364
12426
|
}();
|
12365
|
-
|
12366
|
-
var ze =
|
12427
|
+
ce.MODAL_CLOSE_TIMEOUT_MS = 190;
|
12428
|
+
var ze = ce;
|
12367
12429
|
var xt = /*#__PURE__*/function (_Bt3) {
|
12368
12430
|
// prettier-ignore
|
12369
12431
|
function xt(e, t, i, n, r, o) {
|
@@ -12397,7 +12459,7 @@ var xt = /*#__PURE__*/function (_Bt3) {
|
|
12397
12459
|
}, {
|
12398
12460
|
key: "createInnerElement",
|
12399
12461
|
value: function createInnerElement(e, t, i) {
|
12400
|
-
return
|
12462
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
12401
12463
|
}
|
12402
12464
|
}, {
|
12403
12465
|
key: "addClickEvent",
|
@@ -12426,7 +12488,7 @@ var xt = /*#__PURE__*/function (_Bt3) {
|
|
12426
12488
|
}, {
|
12427
12489
|
key: "createSVGIconElement",
|
12428
12490
|
value: function createSVGIconElement(e, t) {
|
12429
|
-
var i =
|
12491
|
+
var i = Z.createSVGElement(t);
|
12430
12492
|
return i.id = e, i;
|
12431
12493
|
}
|
12432
12494
|
}]);
|
@@ -12500,26 +12562,26 @@ var Fe = /*#__PURE__*/function () {
|
|
12500
12562
|
}, {
|
12501
12563
|
key: "useValidationFunc",
|
12502
12564
|
value: function () {
|
12503
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12565
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee114(e, t, i, n) {
|
12504
12566
|
var r, o, a, l;
|
12505
|
-
return _regeneratorRuntime().wrap(function
|
12506
|
-
while (1) switch (
|
12567
|
+
return _regeneratorRuntime().wrap(function _callee114$(_context114) {
|
12568
|
+
while (1) switch (_context114.prev = _context114.next) {
|
12507
12569
|
case 0:
|
12508
12570
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
12509
|
-
|
12571
|
+
_context114.next = 3;
|
12510
12572
|
return i.completePlaceholders();
|
12511
12573
|
case 3:
|
12512
12574
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
12513
12575
|
return c.file;
|
12514
12576
|
});
|
12515
|
-
return
|
12577
|
+
return _context114.abrupt("return", Fe.validate(e, n, o, l));
|
12516
12578
|
case 5:
|
12517
12579
|
case "end":
|
12518
|
-
return
|
12580
|
+
return _context114.stop();
|
12519
12581
|
}
|
12520
|
-
},
|
12582
|
+
}, _callee114);
|
12521
12583
|
}));
|
12522
|
-
function useValidationFunc(
|
12584
|
+
function useValidationFunc(_x201, _x202, _x203, _x204) {
|
12523
12585
|
return _useValidationFunc.apply(this, arguments);
|
12524
12586
|
}
|
12525
12587
|
return useValidationFunc;
|
@@ -12527,22 +12589,22 @@ var Fe = /*#__PURE__*/function () {
|
|
12527
12589
|
}, {
|
12528
12590
|
key: "useValidationFuncProgrammatic",
|
12529
12591
|
value: function () {
|
12530
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12592
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee115(e, t, i) {
|
12531
12593
|
var r, n;
|
12532
|
-
return _regeneratorRuntime().wrap(function
|
12533
|
-
while (1) switch (
|
12594
|
+
return _regeneratorRuntime().wrap(function _callee115$(_context115) {
|
12595
|
+
while (1) switch (_context115.prev = _context115.next) {
|
12534
12596
|
case 0:
|
12535
12597
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
12536
12598
|
return o.file;
|
12537
12599
|
});
|
12538
|
-
return
|
12600
|
+
return _context115.abrupt("return", Fe.validate(e, i, t.text, n, !0));
|
12539
12601
|
case 2:
|
12540
12602
|
case "end":
|
12541
|
-
return
|
12603
|
+
return _context115.stop();
|
12542
12604
|
}
|
12543
|
-
},
|
12605
|
+
}, _callee115);
|
12544
12606
|
}));
|
12545
|
-
function useValidationFuncProgrammatic(
|
12607
|
+
function useValidationFuncProgrammatic(_x205, _x206, _x207) {
|
12546
12608
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
12547
12609
|
}
|
12548
12610
|
return useValidationFuncProgrammatic;
|
@@ -12558,26 +12620,26 @@ var Fe = /*#__PURE__*/function () {
|
|
12558
12620
|
value: function attach(e, t, i, n, r) {
|
12559
12621
|
var o = e.validateInput || he.processValidateInput(e);
|
12560
12622
|
e._validationHandler = /*#__PURE__*/function () {
|
12561
|
-
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12623
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee116(a) {
|
12562
12624
|
var l;
|
12563
|
-
return _regeneratorRuntime().wrap(function
|
12564
|
-
while (1) switch (
|
12625
|
+
return _regeneratorRuntime().wrap(function _callee116$(_context116) {
|
12626
|
+
while (1) switch (_context116.prev = _context116.next) {
|
12565
12627
|
case 0:
|
12566
12628
|
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Fe.validateWebsocket(t, r))) {
|
12567
|
-
|
12629
|
+
_context116.next = 2;
|
12568
12630
|
break;
|
12569
12631
|
}
|
12570
|
-
return
|
12632
|
+
return _context116.abrupt("return", !1);
|
12571
12633
|
case 2:
|
12572
12634
|
l = o || t.canSendMessage;
|
12573
|
-
return
|
12635
|
+
return _context116.abrupt("return", l ? a ? Fe.useValidationFuncProgrammatic(l, a, r) : Fe.useValidationFunc(l, i, n, r) : null);
|
12574
12636
|
case 4:
|
12575
12637
|
case "end":
|
12576
|
-
return
|
12638
|
+
return _context116.stop();
|
12577
12639
|
}
|
12578
|
-
},
|
12640
|
+
}, _callee116);
|
12579
12641
|
}));
|
12580
|
-
return function (
|
12642
|
+
return function (_x208) {
|
12581
12643
|
return _ref16.apply(this, arguments);
|
12582
12644
|
};
|
12583
12645
|
}();
|
@@ -12764,21 +12826,21 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12764
12826
|
key: "createCustomElements",
|
12765
12827
|
value: function createCustomElements() {
|
12766
12828
|
var _this70 = this;
|
12767
|
-
var e =
|
12829
|
+
var e = X.createSpecificStateElement(this.elementRef, "submit", this._customStyles),
|
12768
12830
|
t = {
|
12769
12831
|
loading: void 0,
|
12770
12832
|
stop: void 0
|
12771
12833
|
};
|
12772
12834
|
return Object.keys(t).forEach(function (i) {
|
12773
12835
|
var n = i,
|
12774
|
-
r =
|
12836
|
+
r = X.createCustomElement(n, _this70._customStyles);
|
12775
12837
|
r && (t[n] = r);
|
12776
12838
|
}), t.submit = e, t;
|
12777
12839
|
}
|
12778
12840
|
}, {
|
12779
12841
|
key: "createDisabledIconElement",
|
12780
12842
|
value: function createDisabledIconElement(e) {
|
12781
|
-
return
|
12843
|
+
return X.createCustomElement("disabled", this._customStyles) || e.cloneNode(!0);
|
12782
12844
|
}
|
12783
12845
|
// prettier-ignore
|
12784
12846
|
}, {
|
@@ -12817,12 +12879,12 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12817
12879
|
}, {
|
12818
12880
|
key: "submitFromInput",
|
12819
12881
|
value: function () {
|
12820
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12882
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee117() {
|
12821
12883
|
var t, e, _i22;
|
12822
|
-
return _regeneratorRuntime().wrap(function
|
12823
|
-
while (1) switch (
|
12884
|
+
return _regeneratorRuntime().wrap(function _callee117$(_context117) {
|
12885
|
+
while (1) switch (_context117.prev = _context117.next) {
|
12824
12886
|
case 0:
|
12825
|
-
|
12887
|
+
_context117.next = 2;
|
12826
12888
|
return this._fileAttachments.completePlaceholders();
|
12827
12889
|
case 2:
|
12828
12890
|
e = this._fileAttachments.getAllFileData();
|
@@ -12838,9 +12900,9 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12838
12900
|
}
|
12839
12901
|
case 4:
|
12840
12902
|
case "end":
|
12841
|
-
return
|
12903
|
+
return _context117.stop();
|
12842
12904
|
}
|
12843
|
-
},
|
12905
|
+
}, _callee117, this);
|
12844
12906
|
}));
|
12845
12907
|
function submitFromInput() {
|
12846
12908
|
return _submitFromInput.apply(this, arguments);
|
@@ -12850,11 +12912,11 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12850
12912
|
}, {
|
12851
12913
|
key: "programmaticSubmit",
|
12852
12914
|
value: function () {
|
12853
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12915
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee118(e) {
|
12854
12916
|
var _this71 = this;
|
12855
12917
|
var t;
|
12856
|
-
return _regeneratorRuntime().wrap(function
|
12857
|
-
while (1) switch (
|
12918
|
+
return _regeneratorRuntime().wrap(function _callee118$(_context118) {
|
12919
|
+
while (1) switch (_context118.prev = _context118.next) {
|
12858
12920
|
case 0:
|
12859
12921
|
typeof e == "string" && (e = he.processSubmitUserMessage(e));
|
12860
12922
|
t = {
|
@@ -12870,11 +12932,11 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12870
12932
|
});
|
12871
12933
|
case 3:
|
12872
12934
|
case "end":
|
12873
|
-
return
|
12935
|
+
return _context118.stop();
|
12874
12936
|
}
|
12875
|
-
},
|
12937
|
+
}, _callee118);
|
12876
12938
|
}));
|
12877
|
-
function programmaticSubmit(
|
12939
|
+
function programmaticSubmit(_x209) {
|
12878
12940
|
return _programmaticSubmit.apply(this, arguments);
|
12879
12941
|
}
|
12880
12942
|
return programmaticSubmit;
|
@@ -12882,52 +12944,52 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12882
12944
|
}, {
|
12883
12945
|
key: "attemptSubmit",
|
12884
12946
|
value: function () {
|
12885
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12947
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee119(e) {
|
12886
12948
|
var t,
|
12887
12949
|
r,
|
12888
12950
|
o,
|
12889
12951
|
a,
|
12890
12952
|
i,
|
12891
12953
|
n,
|
12892
|
-
|
12893
|
-
return _regeneratorRuntime().wrap(function
|
12894
|
-
while (1) switch (
|
12954
|
+
_args119 = arguments;
|
12955
|
+
return _regeneratorRuntime().wrap(function _callee119$(_context119) {
|
12956
|
+
while (1) switch (_context119.prev = _context119.next) {
|
12895
12957
|
case 0:
|
12896
|
-
t =
|
12897
|
-
|
12958
|
+
t = _args119.length > 1 && _args119[1] !== undefined ? _args119[1] : !1;
|
12959
|
+
_context119.next = 3;
|
12898
12960
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12899
12961
|
case 3:
|
12900
|
-
|
12901
|
-
|
12902
|
-
if (!(
|
12903
|
-
|
12962
|
+
_context119.t0 = _context119.sent;
|
12963
|
+
_context119.t1 = !1;
|
12964
|
+
if (!(_context119.t0 === _context119.t1)) {
|
12965
|
+
_context119.next = 7;
|
12904
12966
|
break;
|
12905
12967
|
}
|
12906
|
-
return
|
12968
|
+
return _context119.abrupt("return");
|
12907
12969
|
case 7:
|
12908
12970
|
this.changeToLoadingIcon();
|
12909
|
-
|
12971
|
+
_context119.next = 10;
|
12910
12972
|
return this.addNewMessage(e);
|
12911
12973
|
case 10:
|
12912
12974
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
12913
|
-
|
12975
|
+
Ct.clear(this._inputElementRef);
|
12914
12976
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
12915
12977
|
return l.file;
|
12916
12978
|
}), n = {
|
12917
12979
|
text: e.text === "" ? void 0 : e.text,
|
12918
12980
|
files: i
|
12919
12981
|
};
|
12920
|
-
|
12982
|
+
_context119.next = 15;
|
12921
12983
|
return this._serviceIO.callAPI(n, this._messages);
|
12922
12984
|
case 15:
|
12923
12985
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12924
12986
|
case 16:
|
12925
12987
|
case "end":
|
12926
|
-
return
|
12988
|
+
return _context119.stop();
|
12927
12989
|
}
|
12928
|
-
},
|
12990
|
+
}, _callee119, this);
|
12929
12991
|
}));
|
12930
|
-
function attemptSubmit(
|
12992
|
+
function attemptSubmit(_x210) {
|
12931
12993
|
return _attemptSubmit.apply(this, arguments);
|
12932
12994
|
}
|
12933
12995
|
return attemptSubmit;
|
@@ -12935,35 +12997,35 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12935
12997
|
}, {
|
12936
12998
|
key: "addNewMessage",
|
12937
12999
|
value: function () {
|
12938
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
13000
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee120(_ref17) {
|
12939
13001
|
var e, t, i;
|
12940
|
-
return _regeneratorRuntime().wrap(function
|
12941
|
-
while (1) switch (
|
13002
|
+
return _regeneratorRuntime().wrap(function _callee120$(_context120) {
|
13003
|
+
while (1) switch (_context120.prev = _context120.next) {
|
12942
13004
|
case 0:
|
12943
13005
|
e = _ref17.text, t = _ref17.files;
|
12944
13006
|
i = {
|
12945
13007
|
role: b.USER_ROLE
|
12946
13008
|
};
|
12947
13009
|
e && (i.text = e);
|
12948
|
-
|
12949
|
-
if (!
|
12950
|
-
|
13010
|
+
_context120.t0 = t;
|
13011
|
+
if (!_context120.t0) {
|
13012
|
+
_context120.next = 8;
|
12951
13013
|
break;
|
12952
13014
|
}
|
12953
|
-
|
13015
|
+
_context120.next = 7;
|
12954
13016
|
return this._messages.addMultipleFiles(t);
|
12955
13017
|
case 7:
|
12956
|
-
i.files =
|
13018
|
+
i.files = _context120.sent;
|
12957
13019
|
case 8:
|
12958
13020
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12959
13021
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12960
13022
|
case 10:
|
12961
13023
|
case "end":
|
12962
|
-
return
|
13024
|
+
return _context120.stop();
|
12963
13025
|
}
|
12964
|
-
},
|
13026
|
+
}, _callee120, this);
|
12965
13027
|
}));
|
12966
|
-
function addNewMessage(
|
13028
|
+
function addNewMessage(_x211) {
|
12967
13029
|
return _addNewMessage.apply(this, arguments);
|
12968
13030
|
}
|
12969
13031
|
return addNewMessage;
|
@@ -13016,7 +13078,7 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
13016
13078
|
}, {
|
13017
13079
|
key: "createSubmitIconElement",
|
13018
13080
|
value: function createSubmitIconElement() {
|
13019
|
-
var e =
|
13081
|
+
var e = Z.createSVGElement(aa);
|
13020
13082
|
return e.id = "submit-icon", e;
|
13021
13083
|
}
|
13022
13084
|
}, {
|
@@ -13048,7 +13110,7 @@ var bn = /*#__PURE__*/function (_ze) {
|
|
13048
13110
|
var _this73$addButtonsAnd = _this73.addButtonsAndTheirEvents(t),
|
13049
13111
|
r = _this73$addButtonsAnd.captureButton,
|
13050
13112
|
o = _this73$addButtonsAnd.submitButton;
|
13051
|
-
_this73._captureButton = r, _this73._submitButton = o, _this73._captureIcon = _this73._captureButton.children[0], _this73._refreshIcon =
|
13113
|
+
_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
13114
|
return _this73;
|
13053
13115
|
}
|
13054
13116
|
_inherits(bn, _ze);
|
@@ -13174,7 +13236,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13174
13236
|
}, {
|
13175
13237
|
key: "createInnerElement",
|
13176
13238
|
value: function createInnerElement(e, t, i) {
|
13177
|
-
return
|
13239
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
13178
13240
|
}
|
13179
13241
|
}, {
|
13180
13242
|
key: "addClickEvent",
|
@@ -13193,7 +13255,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13193
13255
|
}, {
|
13194
13256
|
key: "createSVGIconElement",
|
13195
13257
|
value: function createSVGIconElement() {
|
13196
|
-
var e =
|
13258
|
+
var e = Z.createSVGElement(ua);
|
13197
13259
|
return e.id = "camera-icon", e;
|
13198
13260
|
}
|
13199
13261
|
}]);
|
@@ -13202,7 +13264,7 @@ var _t = /*#__PURE__*/function () {
|
|
13202
13264
|
function _t(e, t, i, n) {
|
13203
13265
|
_classCallCheck(this, _t);
|
13204
13266
|
this.elementRef = _t.createPanelElement(e.inputAreaStyle);
|
13205
|
-
var r = new
|
13267
|
+
var r = new Ct(e, i),
|
13206
13268
|
o = {},
|
13207
13269
|
a = this.createFileUploadComponents(e, i, n, o);
|
13208
13270
|
e.speechToText && !o.microphone && (o.microphone = {
|
@@ -13305,16 +13367,7 @@ var y = /*#__PURE__*/function (_Xi) {
|
|
13305
13367
|
function y() {
|
13306
13368
|
var _this78;
|
13307
13369
|
_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 () {
|
13370
|
+
_this78 = _callSuper(this, y), _this78.getMessages = function () {
|
13318
13371
|
return [];
|
13319
13372
|
}, _this78.submitUserMessage = function () {
|
13320
13373
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|