deep-chat-dev 9.0.158 → 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 +7254 -7147
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +956 -841
- package/dist/services/openAI/openAIAssistantIO.d.ts +3 -2
- package/dist/services/openAI/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/utils/openAIAssistantUtils.d.ts +29 -0
- package/dist/services/openAI/utils/openAIAssistantUtils.d.ts.map +1 -0
- 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/services/openAI/utils/openAIAssistantFiles.d.ts +0 -18
- package/dist/services/openAI/utils/openAIAssistantFiles.d.ts.map +0 -1
package/dist/deepChat.js
CHANGED
@@ -253,29 +253,29 @@ var us = /*#__PURE__*/function () {
|
|
253
253
|
}
|
254
254
|
}]);
|
255
255
|
}();
|
256
|
-
var
|
257
|
-
function
|
256
|
+
var Ae = /*#__PURE__*/function () {
|
257
|
+
function Ae(e, t) {
|
258
258
|
var _this = this;
|
259
|
-
_classCallCheck(this,
|
259
|
+
_classCallCheck(this, Ae);
|
260
260
|
var n;
|
261
|
-
var i =
|
262
|
-
this.elementRef =
|
261
|
+
var i = Ae.processConfig(t, e.textInput);
|
262
|
+
this.elementRef = Ae.createContainerElement((n = i == null ? void 0 : i.styles) == null ? void 0 : n.container), this.inputElementRef = this.createInputElement(i), this._config = i, this.elementRef.appendChild(this.inputElementRef), setTimeout(function () {
|
263
263
|
var r;
|
264
264
|
Gi.add(_this.inputElementRef, (r = e.textInput) == null ? void 0 : r.characterLimit, e._validationHandler);
|
265
265
|
});
|
266
266
|
}
|
267
|
-
return _createClass(
|
267
|
+
return _createClass(Ae, [{
|
268
268
|
key: "createInputElement",
|
269
269
|
value: function createInputElement(e) {
|
270
270
|
var i, n, r;
|
271
271
|
var t = document.createElement("div");
|
272
|
-
return t.id =
|
272
|
+
return t.id = Ae.TEXT_INPUT_ID, t.classList.add("text-input-styling", "text-input-placeholder"), t.innerText = ((i = e == null ? void 0 : e.placeholder) == null ? void 0 : i.text) || "Ask me anything!", st.IS_CHROMIUM && Ae.preventAutomaticScrollUpOnNewLine(t), typeof (e == null ? void 0 : e.disabled) == "boolean" && e.disabled === !0 ? (t.contentEditable = "false", t.classList.add("text-input-disabled")) : (t.contentEditable = "true", this.addEventListeners(t, e)), Object.assign(t.style, (n = e == null ? void 0 : e.styles) == null ? void 0 : n.text), Object.assign(t.style, (r = e == null ? void 0 : e.placeholder) == null ? void 0 : r.style), t;
|
273
273
|
}
|
274
274
|
}, {
|
275
275
|
key: "removeTextIfPlaceholder",
|
276
276
|
value: function removeTextIfPlaceholder() {
|
277
277
|
var e, t, i, n;
|
278
|
-
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (M.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (n = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : n.text)),
|
278
|
+
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (M.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (n = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : n.text)), Ae.clear(this.inputElementRef), this.inputElementRef.classList.remove("text-input-placeholder"));
|
279
279
|
}
|
280
280
|
}, {
|
281
281
|
key: "addEventListeners",
|
@@ -348,8 +348,8 @@ var ke = /*#__PURE__*/function () {
|
|
348
348
|
}
|
349
349
|
}]);
|
350
350
|
}();
|
351
|
-
|
352
|
-
var Ct =
|
351
|
+
Ae.TEXT_INPUT_ID = "text-input";
|
352
|
+
var Ct = Ae;
|
353
353
|
var yi = /*#__PURE__*/function () {
|
354
354
|
function yi() {
|
355
355
|
_classCallCheck(this, yi);
|
@@ -477,11 +477,11 @@ var bi = /*#__PURE__*/function () {
|
|
477
477
|
}();
|
478
478
|
bi.LOAD_VOICES_MS = 200;
|
479
479
|
var rt = bi;
|
480
|
-
var
|
481
|
-
function
|
482
|
-
_classCallCheck(this,
|
480
|
+
var he = /*#__PURE__*/function () {
|
481
|
+
function he() {
|
482
|
+
_classCallCheck(this, he);
|
483
483
|
}
|
484
|
-
return _createClass(
|
484
|
+
return _createClass(he, null, [{
|
485
485
|
key: "checkForContainerStyles",
|
486
486
|
value: function checkForContainerStyles(e, t) {
|
487
487
|
var i = e.containerStyle;
|
@@ -549,15 +549,15 @@ var de = /*#__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,23 +595,23 @@ 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 =
|
606
|
-
var
|
607
|
-
function
|
608
|
-
_classCallCheck(this,
|
604
|
+
te.CONTAINER_CLASS = "avatar-container";
|
605
|
+
var Zt = te;
|
606
|
+
var ge = /*#__PURE__*/function () {
|
607
|
+
function ge() {
|
608
|
+
_classCallCheck(this, ge);
|
609
609
|
}
|
610
|
-
return _createClass(
|
610
|
+
return _createClass(ge, null, [{
|
611
611
|
key: "hide",
|
612
612
|
value: function hide(e) {
|
613
613
|
var t;
|
614
|
-
(t = e.getElementsByClassName(
|
614
|
+
(t = e.getElementsByClassName(ge.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
615
615
|
}
|
616
616
|
}, {
|
617
617
|
key: "getPosition",
|
@@ -637,25 +637,25 @@ var me = /*#__PURE__*/function () {
|
|
637
637
|
key: "createName",
|
638
638
|
value: function createName(e, t) {
|
639
639
|
var i = document.createElement("div");
|
640
|
-
return i.classList.add(
|
640
|
+
return i.classList.add(ge.NAME_CLASS), i.textContent = ge.getNameText(e, t), ge.applyStyle(i, e, t), i;
|
641
641
|
}
|
642
642
|
}, {
|
643
643
|
key: "add",
|
644
644
|
value: function add(e, t, i) {
|
645
645
|
var n = typeof i == "boolean" ? {} : i,
|
646
|
-
r =
|
647
|
-
o =
|
646
|
+
r = ge.createName(t, n),
|
647
|
+
o = ge.getPosition(t, n);
|
648
648
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
649
649
|
}
|
650
650
|
}]);
|
651
651
|
}();
|
652
|
-
|
653
|
-
var Yt =
|
654
|
-
var
|
655
|
-
function
|
656
|
-
_classCallCheck(this,
|
652
|
+
ge.NAME_CLASS = "name";
|
653
|
+
var Yt = ge;
|
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);
|
@@ -859,7 +859,7 @@ var Le = /*#__PURE__*/function () {
|
|
859
859
|
var o = i.getElementsByClassName(r);
|
860
860
|
Array.from(o || []).forEach(function (a) {
|
861
861
|
var l = Le.getProcessedStyles(t, a, r);
|
862
|
-
|
862
|
+
fe.applyStylesToElement(a, l), Le.applyEvents(a, r);
|
863
863
|
});
|
864
864
|
});
|
865
865
|
var n = i.getElementsByClassName(Es);
|
@@ -869,11 +869,11 @@ var Le = /*#__PURE__*/function () {
|
|
869
869
|
}
|
870
870
|
}]);
|
871
871
|
}();
|
872
|
-
var
|
873
|
-
function
|
874
|
-
_classCallCheck(this,
|
872
|
+
var fe = /*#__PURE__*/function () {
|
873
|
+
function fe() {
|
874
|
+
_classCallCheck(this, fe);
|
875
875
|
}
|
876
|
-
return _createClass(
|
876
|
+
return _createClass(fe, null, [{
|
877
877
|
key: "applyStylesToElement",
|
878
878
|
value: function applyStylesToElement(e, t) {
|
879
879
|
var i = M.processStateful(t, {}, {});
|
@@ -892,7 +892,7 @@ var ue = /*#__PURE__*/function () {
|
|
892
892
|
value: function applyClassUtilitiesToElement(e, t) {
|
893
893
|
var i = t.events,
|
894
894
|
n = t.styles;
|
895
|
-
i &&
|
895
|
+
i && fe.applyEventsToElement(e, i), n && !Le.doesElementContainDeepChatClass(e) && fe.applyStylesToElement(e, n);
|
896
896
|
}
|
897
897
|
}, {
|
898
898
|
key: "applyCustomClassUtilities",
|
@@ -900,14 +900,14 @@ var ue = /*#__PURE__*/function () {
|
|
900
900
|
Object.keys(e).forEach(function (i) {
|
901
901
|
var n = t.getElementsByClassName(i);
|
902
902
|
Array.from(n).forEach(function (r) {
|
903
|
-
e[i] &&
|
903
|
+
e[i] && fe.applyClassUtilitiesToElement(r, e[i]);
|
904
904
|
});
|
905
905
|
});
|
906
906
|
}
|
907
907
|
}, {
|
908
908
|
key: "apply",
|
909
909
|
value: function apply(e, t) {
|
910
|
-
Le.applyDeepChatUtilities(e, e.htmlClassUtilities, t),
|
910
|
+
Le.applyDeepChatUtilities(e, e.htmlClassUtilities, t), fe.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
911
911
|
}
|
912
912
|
}]);
|
913
913
|
}();
|
@@ -931,7 +931,7 @@ var ct = /*#__PURE__*/function () {
|
|
931
931
|
value: function overwrite(e, t, i, n) {
|
932
932
|
var r = e.messages,
|
933
933
|
o = b.overwriteMessage(r, n, t, i, "html", "html-message");
|
934
|
-
return o && (o.bubbleElement.innerHTML = t,
|
934
|
+
return o && (o.bubbleElement.innerHTML = t, fe.apply(e, o.outerContainer), he.flagHTMLUpdateClass(o.bubbleElement)), o;
|
935
935
|
}
|
936
936
|
// prettier-ignore
|
937
937
|
}, {
|
@@ -944,7 +944,7 @@ var ct = /*#__PURE__*/function () {
|
|
944
944
|
r.status = !1;
|
945
945
|
}
|
946
946
|
var o = ct.createElements(e, t, i);
|
947
|
-
return b.fillEmptyMessageElement(o.bubbleElement, t),
|
947
|
+
return b.fillEmptyMessageElement(o.bubbleElement, t), fe.apply(e, o.outerContainer), he.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), ct.addElement(e, o.outerContainer), o;
|
948
948
|
}
|
949
949
|
}]);
|
950
950
|
}();
|
@@ -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) {
|
@@ -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
|
});
|
@@ -2629,7 +2629,7 @@ function Xr(s, e) {
|
|
2629
2629
|
}
|
2630
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
|
}
|
@@ -2786,34 +2786,34 @@ var Yr = {
|
|
2786
2786
|
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
|
-
function
|
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
|
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 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);
|
2794
2794
|
};
|
2795
|
-
|
2795
|
+
_e.prototype.configure = function (s) {
|
2796
2796
|
var e = this;
|
2797
2797
|
if (!s) throw new Error("Wrong `remarkable` preset, check name/content");
|
2798
2798
|
s.options && e.set(s.options), s.components && Object.keys(s.components).forEach(function (t) {
|
2799
2799
|
s.components[t].rules && e[t].ruler.enable(s.components[t].rules, !0);
|
2800
2800
|
});
|
2801
2801
|
};
|
2802
|
-
|
2802
|
+
_e.prototype.use = function (s, e) {
|
2803
2803
|
return s(this, e), this;
|
2804
2804
|
};
|
2805
|
-
|
2805
|
+
_e.prototype.parse = function (s, e) {
|
2806
2806
|
var t = new as(this, s, e);
|
2807
2807
|
return this.core.process(t), t.tokens;
|
2808
2808
|
};
|
2809
|
-
|
2809
|
+
_e.prototype.render = function (s, e) {
|
2810
2810
|
return e = e || {}, this.renderer.render(this.parse(s, e), this.options, e);
|
2811
2811
|
};
|
2812
|
-
|
2812
|
+
_e.prototype.parseInline = function (s, e) {
|
2813
2813
|
var t = new as(this, s, e);
|
2814
2814
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2815
2815
|
};
|
2816
|
-
|
2816
|
+
_e.prototype.renderInline = function (s, e) {
|
2817
2817
|
return e = e || {}, this.renderer.render(this.parseInline(s, e), this.options, e);
|
2818
2818
|
};
|
2819
2819
|
var Mt = /*#__PURE__*/function () {
|
@@ -2824,7 +2824,7 @@ var Mt = /*#__PURE__*/function () {
|
|
2824
2824
|
key: "instantiate",
|
2825
2825
|
value: function instantiate() {
|
2826
2826
|
var e = window.hljs;
|
2827
|
-
return e ? new
|
2827
|
+
return e ? new _e({
|
2828
2828
|
highlight: function highlight(t, i) {
|
2829
2829
|
if (i && e.getLanguage(i)) try {
|
2830
2830
|
return e.highlight(i, t).value;
|
@@ -2850,7 +2850,7 @@ var Mt = /*#__PURE__*/function () {
|
|
2850
2850
|
// set target to open in a new tab
|
2851
2851
|
typographer: !0
|
2852
2852
|
// Enable smartypants and other sweet transforms
|
2853
|
-
}) : new
|
2853
|
+
}) : new _e({
|
2854
2854
|
linkTarget: "_blank"
|
2855
2855
|
// set target to open in a new tab
|
2856
2856
|
});
|
@@ -2865,11 +2865,11 @@ var Mt = /*#__PURE__*/function () {
|
|
2865
2865
|
}
|
2866
2866
|
}]);
|
2867
2867
|
}();
|
2868
|
-
var
|
2869
|
-
function
|
2870
|
-
_classCallCheck(this,
|
2868
|
+
var Me = /*#__PURE__*/function () {
|
2869
|
+
function Me() {
|
2870
|
+
_classCallCheck(this, Me);
|
2871
2871
|
}
|
2872
|
-
return _createClass(
|
2872
|
+
return _createClass(Me, null, [{
|
2873
2873
|
key: "addMessage",
|
2874
2874
|
value: function addMessage(e, t, i, n) {
|
2875
2875
|
var r;
|
@@ -2879,7 +2879,7 @@ var Ae = /*#__PURE__*/function () {
|
|
2879
2879
|
key: "wrapInLink",
|
2880
2880
|
value: function wrapInLink(e, t, i) {
|
2881
2881
|
var n = document.createElement("a");
|
2882
|
-
return n.href = t, n.download = i ||
|
2882
|
+
return n.href = t, n.download = i || Me.DEFAULT_FILE_NAME, n.target = "_blank", n.appendChild(e), n;
|
2883
2883
|
}
|
2884
2884
|
}, {
|
2885
2885
|
key: "isNonLinkableDataUrl",
|
@@ -2889,7 +2889,7 @@ var Ae = /*#__PURE__*/function () {
|
|
2889
2889
|
}, {
|
2890
2890
|
key: "processContent",
|
2891
2891
|
value: function processContent(e, t, i, n) {
|
2892
|
-
return !i ||
|
2892
|
+
return !i || Me.isNonLinkableDataUrl(e, i) ? t : Me.wrapInLink(t, i, n);
|
2893
2893
|
}
|
2894
2894
|
}, {
|
2895
2895
|
key: "waitToLoadThenScroll",
|
@@ -2901,11 +2901,11 @@ var Ae = /*#__PURE__*/function () {
|
|
2901
2901
|
}, {
|
2902
2902
|
key: "scrollDownOnImageLoad",
|
2903
2903
|
value: function scrollDownOnImageLoad(e, t) {
|
2904
|
-
if (e.startsWith("data"))
|
2904
|
+
if (e.startsWith("data")) Me.waitToLoadThenScroll(t);else try {
|
2905
2905
|
fetch(e, {
|
2906
2906
|
mode: "no-cors"
|
2907
2907
|
})["catch"](function () {})["finally"](function () {
|
2908
|
-
|
2908
|
+
Me.waitToLoadThenScroll(t);
|
2909
2909
|
});
|
2910
2910
|
} catch (_unused5) {
|
2911
2911
|
t.scrollTop = t.scrollHeight;
|
@@ -2948,8 +2948,8 @@ var Ae = /*#__PURE__*/function () {
|
|
2948
2948
|
}
|
2949
2949
|
}]);
|
2950
2950
|
}();
|
2951
|
-
|
2952
|
-
var q =
|
2951
|
+
Me.DEFAULT_FILE_NAME = "file";
|
2952
|
+
var q = Me;
|
2953
2953
|
var Qt = /*#__PURE__*/function () {
|
2954
2954
|
function Qt() {
|
2955
2955
|
_classCallCheck(this, Qt);
|
@@ -2965,7 +2965,7 @@ var Qt = /*#__PURE__*/function () {
|
|
2965
2965
|
}));
|
2966
2966
|
q.reAddFileRefToObject(t, n), (r = e.onMessage) == null || r.call(e, n), e.dispatchEvent(new CustomEvent("message", {
|
2967
2967
|
detail: n
|
2968
|
-
})),
|
2968
|
+
})), he.fireOnNewMessage(e, n);
|
2969
2969
|
}
|
2970
2970
|
}, {
|
2971
2971
|
key: "onClearMessages",
|
@@ -3183,13 +3183,13 @@ var ot = /*#__PURE__*/function () {
|
|
3183
3183
|
}
|
3184
3184
|
}]);
|
3185
3185
|
}();
|
3186
|
-
var
|
3186
|
+
var Re = /*#__PURE__*/function () {
|
3187
3187
|
// used for extracting at end and for isStreaming
|
3188
|
-
function
|
3189
|
-
_classCallCheck(this,
|
3188
|
+
function Re(e) {
|
3189
|
+
_classCallCheck(this, Re);
|
3190
3190
|
this._fileAdded = !1, this._streamedContent = "", this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
|
3191
3191
|
}
|
3192
|
-
return _createClass(
|
3192
|
+
return _createClass(Re, [{
|
3193
3193
|
key: "upsertStreamedMessage",
|
3194
3194
|
value: function upsertStreamedMessage(e) {
|
3195
3195
|
var r;
|
@@ -3208,7 +3208,7 @@ var Me = /*#__PURE__*/function () {
|
|
3208
3208
|
key: "setInitialState",
|
3209
3209
|
value: function setInitialState(e, t, i) {
|
3210
3210
|
var _i8;
|
3211
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : ct.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(
|
3211
|
+
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : ct.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(Re.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i, this._message = _defineProperty({
|
3212
3212
|
role: this._activeMessageRole
|
3213
3213
|
}, e, this._streamedContent), this._messages.messages.push(this._message);
|
3214
3214
|
}
|
@@ -3228,7 +3228,7 @@ var Me = /*#__PURE__*/function () {
|
|
3228
3228
|
value: function updateHTML(e, t, i) {
|
3229
3229
|
if (i) this._streamedContent = e, t.innerHTML = e;else {
|
3230
3230
|
var n = document.createElement("span");
|
3231
|
-
n.innerHTML = e, t.appendChild(n), this._streamedContent =
|
3231
|
+
n.innerHTML = e, t.appendChild(n), this._streamedContent = Re.HTML_CONTENT_PLACEHOLDER;
|
3232
3232
|
}
|
3233
3233
|
}
|
3234
3234
|
}, {
|
@@ -3238,18 +3238,23 @@ var Me = /*#__PURE__*/function () {
|
|
3238
3238
|
var e = this._messages.textElementsToText;
|
3239
3239
|
if (!(this._fileAdded && !this._elements)) {
|
3240
3240
|
if (!this._elements) throw Error(A.NO_VALID_STREAM_EVENTS_SENT);
|
3241
|
-
(t = this._elements.bubbleElement) != null && t.classList.contains(
|
3241
|
+
(t = this._elements.bubbleElement) != null && t.classList.contains(Re.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && rt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === Re.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && fe.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._message && this._messages.sendClientUpdate(ot.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
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
|
-
|
3252
|
-
var
|
3256
|
+
Re.MESSAGE_CLASS = "streamed-message", Re.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3257
|
+
var Se = Re;
|
3253
3258
|
var Ue = /*#__PURE__*/function () {
|
3254
3259
|
function Ue() {
|
3255
3260
|
_classCallCheck(this, Ue);
|
@@ -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":
|
@@ -3583,9 +3588,9 @@ var C = /*#__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,
|
@@ -3628,19 +3633,19 @@ var C = /*#__PURE__*/function () {
|
|
3628
3633
|
_context6.next = 17;
|
3629
3634
|
break;
|
3630
3635
|
}
|
3631
|
-
return _context6.abrupt("return",
|
3636
|
+
return _context6.abrupt("return", Ee.stream(e, a, i));
|
3632
3637
|
case 17:
|
3633
|
-
if (!(((S = e.connectSettings) == null ? void 0 : S.url) ===
|
3638
|
+
if (!(((S = e.connectSettings) == null ? void 0 : S.url) === pe.URL)) {
|
3634
3639
|
_context6.next = 19;
|
3635
3640
|
break;
|
3636
3641
|
}
|
3637
|
-
return _context6.abrupt("return",
|
3642
|
+
return _context6.abrupt("return", pe.requestStream(i, e.streamHandlers));
|
3638
3643
|
case 19:
|
3639
|
-
f = new
|
3640
|
-
lo(((
|
3641
|
-
method: ((
|
3644
|
+
f = new Se(i), m = v.fetch.bind(this, e, l, n);
|
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
|
@@ -3722,7 +3727,7 @@ var C = /*#__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 C = /*#__PURE__*/function () {
|
|
3744
3749
|
}, i), !1), i.text) {
|
3745
3750
|
t.onOpen();
|
3746
3751
|
var r = i.text.split("");
|
3747
|
-
C.populateMessages(r, new
|
3752
|
+
C.populateMessages(r, new Se(e), n);
|
3748
3753
|
}
|
3749
3754
|
}
|
3750
3755
|
}, {
|
@@ -3789,7 +3794,7 @@ var C = /*#__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
|
}();
|
@@ -3865,7 +3870,7 @@ var He = /*#__PURE__*/function () {
|
|
3865
3870
|
}]);
|
3866
3871
|
}();
|
3867
3872
|
He.URL = "deep-chat-demo";
|
3868
|
-
var
|
3873
|
+
var pe = He;
|
3869
3874
|
var z = /*#__PURE__*/function () {
|
3870
3875
|
function z() {
|
3871
3876
|
_classCallCheck(this, z);
|
@@ -3873,7 +3878,7 @@ var z = /*#__PURE__*/function () {
|
|
3873
3878
|
return _createClass(z, null, [{
|
3874
3879
|
key: "setup",
|
3875
3880
|
value: function setup(e) {
|
3876
|
-
e.connectSettings.url !==
|
3881
|
+
e.connectSettings.url !== pe.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
3877
3882
|
}
|
3878
3883
|
}, {
|
3879
3884
|
key: "createConnection",
|
@@ -3881,7 +3886,7 @@ var z = /*#__PURE__*/function () {
|
|
3881
3886
|
if (!document.body.contains(e.deepChat)) return;
|
3882
3887
|
var i = e.connectSettings.websocket;
|
3883
3888
|
if (i) {
|
3884
|
-
if (e.connectSettings.handler) return
|
3889
|
+
if (e.connectSettings.handler) return Ee.websocket(e, t);
|
3885
3890
|
try {
|
3886
3891
|
var n = typeof i != "boolean" ? i : void 0,
|
3887
3892
|
r = new WebSocket(e.connectSettings.url || "", n);
|
@@ -4013,11 +4018,11 @@ var z = /*#__PURE__*/function () {
|
|
4013
4018
|
return _context9.abrupt("return", r.newUserMessage.listener(a));
|
4014
4019
|
case 14:
|
4015
4020
|
c = n ? JSON.stringify(a) : a;
|
4016
|
-
if (!(((h = e.connectSettings) == null ? void 0 : h.url) ===
|
4021
|
+
if (!(((h = e.connectSettings) == null ? void 0 : h.url) === pe.URL)) {
|
4017
4022
|
_context9.next = 17;
|
4018
4023
|
break;
|
4019
4024
|
}
|
4020
|
-
return _context9.abrupt("return",
|
4025
|
+
return _context9.abrupt("return", pe.request(e, i));
|
4021
4026
|
case 17:
|
4022
4027
|
r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
|
4023
4028
|
case 18:
|
@@ -4051,16 +4056,16 @@ var z = /*#__PURE__*/function () {
|
|
4051
4056
|
var _i$o;
|
4052
4057
|
var o = n.role || b.AI_ROLE,
|
4053
4058
|
a = i[o];
|
4054
|
-
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
|
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
4060
|
} else C.simulate(t, e.streamHandlers, n);
|
4056
4061
|
}
|
4057
4062
|
}]);
|
4058
4063
|
}();
|
4059
|
-
var
|
4060
|
-
function
|
4061
|
-
_classCallCheck(this,
|
4064
|
+
var Ee = /*#__PURE__*/function () {
|
4065
|
+
function Ee() {
|
4066
|
+
_classCallCheck(this, Ee);
|
4062
4067
|
}
|
4063
|
-
return _createClass(
|
4068
|
+
return _createClass(Ee, null, [{
|
4064
4069
|
key: "request",
|
4065
4070
|
value: function () {
|
4066
4071
|
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, i) {
|
@@ -4103,7 +4108,7 @@ var ye = /*#__PURE__*/function () {
|
|
4103
4108
|
return function r(_x22) {
|
4104
4109
|
return _ref3.apply(this, arguments);
|
4105
4110
|
};
|
4106
|
-
}(), o =
|
4111
|
+
}(), o = Ee.generateOptionalSignals();
|
4107
4112
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
4108
4113
|
onResponse: r
|
4109
4114
|
}));
|
@@ -4134,12 +4139,12 @@ var ye = /*#__PURE__*/function () {
|
|
4134
4139
|
var h, u;
|
4135
4140
|
var n = !0,
|
4136
4141
|
r = !1;
|
4137
|
-
var o = new
|
4142
|
+
var o = new Se(i),
|
4138
4143
|
a = function a() {
|
4139
4144
|
r || !n || (e.streamHandlers.onOpen(), r = !0);
|
4140
4145
|
},
|
4141
4146
|
l = function l() {
|
4142
|
-
n && (
|
4147
|
+
n && (Ee.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1);
|
4143
4148
|
},
|
4144
4149
|
c = /*#__PURE__*/function () {
|
4145
4150
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(f) {
|
@@ -4176,9 +4181,9 @@ var ye = /*#__PURE__*/function () {
|
|
4176
4181
|
};
|
4177
4182
|
}();
|
4178
4183
|
e.streamHandlers.abortStream.abort = function () {
|
4179
|
-
|
4184
|
+
Ee.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1;
|
4180
4185
|
};
|
4181
|
-
var d =
|
4186
|
+
var d = Ee.generateOptionalSignals();
|
4182
4187
|
(u = (h = e.connectSettings).handler) == null || u.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
|
4183
4188
|
onOpen: a,
|
4184
4189
|
onResponse: c,
|
@@ -4243,7 +4248,7 @@ var ye = /*#__PURE__*/function () {
|
|
4243
4248
|
return _ref5.apply(this, arguments);
|
4244
4249
|
};
|
4245
4250
|
}(),
|
4246
|
-
a =
|
4251
|
+
a = Ee.generateOptionalSignals();
|
4247
4252
|
(c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
4248
4253
|
onOpen: n,
|
4249
4254
|
onResponse: o,
|
@@ -4315,13 +4320,13 @@ var T = /*#__PURE__*/function () {
|
|
4315
4320
|
_context15.next = 13;
|
4316
4321
|
break;
|
4317
4322
|
}
|
4318
|
-
return _context15.abrupt("return",
|
4323
|
+
return _context15.abrupt("return", Ee.request(e, o, i));
|
4319
4324
|
case 13:
|
4320
|
-
if (!(((m = e.connectSettings) == null ? void 0 : m.url) ===
|
4325
|
+
if (!(((m = e.connectSettings) == null ? void 0 : m.url) === pe.URL)) {
|
4321
4326
|
_context15.next = 15;
|
4322
4327
|
break;
|
4323
4328
|
}
|
4324
|
-
return _context15.abrupt("return",
|
4329
|
+
return _context15.abrupt("return", pe.request(e, i));
|
4325
4330
|
case 15:
|
4326
4331
|
d = !0;
|
4327
4332
|
h = v.fetch.bind(this, e, a, n);
|
@@ -4331,7 +4336,7 @@ var T = /*#__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 T = /*#__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) {
|
@@ -4665,7 +4670,7 @@ var We = /*#__PURE__*/function () {
|
|
4665
4670
|
var _a$url;
|
4666
4671
|
_classCallCheck(this, We);
|
4667
4672
|
var n, r, o, a, l;
|
4668
|
-
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = We.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (n = e.connect) == null ? void 0 : n.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, I.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url =
|
4673
|
+
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = We.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (n = e.connect) == null ? void 0 : n.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, I.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = pe.URL), this.connectSettings.websocket && z.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || he.checkForStream(this.deepChat);
|
4669
4674
|
}
|
4670
4675
|
return _createClass(We, [{
|
4671
4676
|
key: "verifyKey",
|
@@ -4825,7 +4830,7 @@ var We = /*#__PURE__*/function () {
|
|
4825
4830
|
_context23.next = 4;
|
4826
4831
|
break;
|
4827
4832
|
}
|
4828
|
-
return _context23.abrupt("return",
|
4833
|
+
return _context23.abrupt("return", he.handleResponseProperty(e));
|
4829
4834
|
case 4:
|
4830
4835
|
if (!v.validateResponseFormat(e)) {
|
4831
4836
|
_context23.next = 6;
|
@@ -4941,19 +4946,19 @@ var ei = /*#__PURE__*/function () {
|
|
4941
4946
|
}
|
4942
4947
|
}]);
|
4943
4948
|
}();
|
4944
|
-
var
|
4949
|
+
var be = /*#__PURE__*/function (_HTMLElement) {
|
4945
4950
|
// If this is not working, try using propertyName directly
|
4946
|
-
function
|
4951
|
+
function be() {
|
4947
4952
|
var _this9;
|
4948
|
-
_classCallCheck(this,
|
4949
|
-
_this9 = _callSuper(this,
|
4950
|
-
var t =
|
4953
|
+
_classCallCheck(this, be);
|
4954
|
+
_this9 = _callSuper(this, be), _this9._waitingToRender_ = !1, _this9._propUpdated_ = !1, Object.keys(be._attributeToProperty_).forEach(function (e) {
|
4955
|
+
var t = be._attributeToProperty_[e];
|
4951
4956
|
_this9.constructPropertyAccessors(t), _this9.hasOwnProperty(e) || _this9.constructPropertyAccessors(t, e);
|
4952
4957
|
});
|
4953
4958
|
return _this9;
|
4954
4959
|
}
|
4955
|
-
_inherits(
|
4956
|
-
return _createClass(
|
4960
|
+
_inherits(be, _HTMLElement);
|
4961
|
+
return _createClass(be, [{
|
4957
4962
|
key: "constructPropertyAccessors",
|
4958
4963
|
value:
|
4959
4964
|
// need to be called here as accessors need to be set for the class instance
|
@@ -4972,8 +4977,8 @@ var ge = /*#__PURE__*/function (_HTMLElement) {
|
|
4972
4977
|
key: "attributeChangedCallback",
|
4973
4978
|
value: function attributeChangedCallback(e, t, i) {
|
4974
4979
|
if (t === i) return;
|
4975
|
-
var n =
|
4976
|
-
r =
|
4980
|
+
var n = be._attributes_[e](i),
|
4981
|
+
r = be._attributeToProperty_[e];
|
4977
4982
|
this[r] = n;
|
4978
4983
|
}
|
4979
4984
|
}, {
|
@@ -4982,40 +4987,40 @@ var ge = /*#__PURE__*/function (_HTMLElement) {
|
|
4982
4987
|
}], [{
|
4983
4988
|
key: "observedAttributes",
|
4984
4989
|
get: function get() {
|
4985
|
-
return Object.keys(
|
4990
|
+
return Object.keys(be._attributes_) || [];
|
4986
4991
|
}
|
4987
4992
|
}]);
|
4988
4993
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4989
|
-
|
4990
|
-
var Xi =
|
4994
|
+
be._attributes_ = {}, be._attributeToProperty_ = {};
|
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;
|
5001
5006
|
}
|
5002
5007
|
}]);
|
5003
5008
|
}();
|
5004
|
-
var
|
5005
|
-
function
|
5006
|
-
_classCallCheck(this,
|
5009
|
+
var Ie = /*#__PURE__*/function () {
|
5010
|
+
function Ie() {
|
5011
|
+
_classCallCheck(this, Ie);
|
5007
5012
|
}
|
5008
|
-
return _createClass(
|
5013
|
+
return _createClass(Ie, null, [{
|
5009
5014
|
key: "changeVisibility",
|
5010
5015
|
value:
|
5011
5016
|
// prettier-ignore
|
5012
5017
|
function changeVisibility(e, t, i, n) {
|
5013
|
-
n.target.id ===
|
5018
|
+
n.target.id === Ie.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
|
5014
5019
|
}
|
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
|
@@ -5024,15 +5029,15 @@ var Re = /*#__PURE__*/function () {
|
|
5024
5029
|
value: function create(e) {
|
5025
5030
|
var t = document.createElement("div");
|
5026
5031
|
t.id = "visibility-icon-container";
|
5027
|
-
var i =
|
5032
|
+
var i = Ie.createIconElement(uo, Ie.VISIBLE_ICON_ID);
|
5028
5033
|
i.style.display = "none", t.appendChild(i);
|
5029
|
-
var n =
|
5030
|
-
return t.appendChild(n), t.onclick =
|
5034
|
+
var n = Ie.createIconElement(ho, "not-visible-icon");
|
5035
|
+
return t.appendChild(n), t.onclick = Ie.changeVisibility.bind(this, e, i, n), t;
|
5031
5036
|
}
|
5032
5037
|
}]);
|
5033
5038
|
}();
|
5034
|
-
|
5035
|
-
var Zi =
|
5039
|
+
Ie.VISIBLE_ICON_ID = "visible-icon";
|
5040
|
+
var Zi = Ie;
|
5036
5041
|
var D = /*#__PURE__*/function () {
|
5037
5042
|
function D() {
|
5038
5043
|
_classCallCheck(this, D);
|
@@ -5641,7 +5646,7 @@ var On = {
|
|
5641
5646
|
this.streamHandlers.abortStream.abort = function () {
|
5642
5647
|
i.interruptGenerate();
|
5643
5648
|
}, this.streamHandlers.onOpen();
|
5644
|
-
n = new
|
5649
|
+
n = new Se(e);
|
5645
5650
|
_context30.next = 4;
|
5646
5651
|
return i.generate(t, /*#__PURE__*/function () {
|
5647
5652
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(r, o) {
|
@@ -5968,8 +5973,8 @@ var St = /*#__PURE__*/function (_U) {
|
|
5968
5973
|
}]);
|
5969
5974
|
}(U);
|
5970
5975
|
St.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5971
|
-
var
|
5972
|
-
var Dt = /*#__PURE__*/function (
|
5976
|
+
var we = St;
|
5977
|
+
var Dt = /*#__PURE__*/function (_we) {
|
5973
5978
|
// prettier-ignore
|
5974
5979
|
function Dt(e, t, i, n, r, o) {
|
5975
5980
|
var _this17;
|
@@ -5977,7 +5982,7 @@ var Dt = /*#__PURE__*/function (_Se) {
|
|
5977
5982
|
_this17 = _callSuper(this, Dt, [e, t, i, n, r, o]), _this17.isTextInputDisabled = !0, _this17.canSendMessage = Dt.canSendFile;
|
5978
5983
|
return _this17;
|
5979
5984
|
}
|
5980
|
-
_inherits(Dt,
|
5985
|
+
_inherits(Dt, _we);
|
5981
5986
|
return _createClass(Dt, [{
|
5982
5987
|
key: "preprocessBody",
|
5983
5988
|
value: function preprocessBody(e, t, i) {
|
@@ -6021,7 +6026,7 @@ var Dt = /*#__PURE__*/function (_Se) {
|
|
6021
6026
|
return !!(t != null && t[0]);
|
6022
6027
|
}
|
6023
6028
|
}]);
|
6024
|
-
}(
|
6029
|
+
}(we);
|
6025
6030
|
var fo = /*#__PURE__*/function (_Dt) {
|
6026
6031
|
// prettier-ignore
|
6027
6032
|
function fo(e) {
|
@@ -6122,11 +6127,11 @@ var po = /*#__PURE__*/function (_Dt2) {
|
|
6122
6127
|
}]);
|
6123
6128
|
}(Dt);
|
6124
6129
|
var Ft = "data:image/png;base64,";
|
6125
|
-
var
|
6126
|
-
function
|
6127
|
-
_classCallCheck(this,
|
6130
|
+
var me = /*#__PURE__*/function () {
|
6131
|
+
function me() {
|
6132
|
+
_classCallCheck(this, me);
|
6128
6133
|
}
|
6129
|
-
return _createClass(
|
6134
|
+
return _createClass(me, null, [{
|
6130
6135
|
key: "buildHeaders",
|
6131
6136
|
value: function buildHeaders(e) {
|
6132
6137
|
return {
|
@@ -6146,7 +6151,7 @@ var pe = /*#__PURE__*/function () {
|
|
6146
6151
|
return {
|
6147
6152
|
url: "https://api.stability.ai/v1/engines/list",
|
6148
6153
|
method: "GET",
|
6149
|
-
handleVerificationResult:
|
6154
|
+
handleVerificationResult: me.handleVerificationResult
|
6150
6155
|
};
|
6151
6156
|
}
|
6152
6157
|
}]);
|
@@ -6177,7 +6182,7 @@ var ni = /*#__PURE__*/function (_i10) {
|
|
6177
6182
|
}
|
6178
6183
|
}
|
6179
6184
|
};
|
6180
|
-
_this19 = _callSuper(this, ni, [e,
|
6185
|
+
_this19 = _callSuper(this, ni, [e, me.buildKeyVerificationDetails(), me.buildHeaders, i, n]), _this19.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this19.textInputPlaceholderText = "Describe image changes", _this19.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6181
6186
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6182
6187
|
_typeof(r) == "object" && (r.engine_id && (_this19.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), ni.cleanConfig(r), Object.assign(_this19.rawBody, r)), _this19.canSendMessage = ni.canSendFileMessage;
|
6183
6188
|
return _this19;
|
@@ -6284,7 +6289,7 @@ var si = /*#__PURE__*/function (_i11) {
|
|
6284
6289
|
}
|
6285
6290
|
}
|
6286
6291
|
};
|
6287
|
-
_this20 = _callSuper(this, si, [e,
|
6292
|
+
_this20 = _callSuper(this, si, [e, me.buildKeyVerificationDetails(), me.buildHeaders, i, n]), _this20.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this20._maskSource = "MASK_IMAGE_WHITE", _this20.textInputPlaceholderText = "Describe image changes", _this20.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6288
6293
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6289
6294
|
_typeof(r) == "object" && (r.engine_id && (_this20.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this20._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this20._maskSource = r.mask_source), si.cleanConfig(r), Object.assign(_this20.rawBody, r)), _this20.canSendMessage = si.canSendFileTextMessage;
|
6290
6295
|
return _this20;
|
@@ -6424,7 +6429,7 @@ var mo = /*#__PURE__*/function (_Dt3) {
|
|
6424
6429
|
}()
|
6425
6430
|
}]);
|
6426
6431
|
}(Dt);
|
6427
|
-
var go = /*#__PURE__*/function (
|
6432
|
+
var go = /*#__PURE__*/function (_we2) {
|
6428
6433
|
function go(e) {
|
6429
6434
|
_classCallCheck(this, go);
|
6430
6435
|
var n, r, o;
|
@@ -6432,7 +6437,7 @@ var go = /*#__PURE__*/function (_Se2) {
|
|
6432
6437
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6433
6438
|
return _callSuper(this, go, [e, "Once upon a time", "gpt2", t, i]);
|
6434
6439
|
}
|
6435
|
-
_inherits(go,
|
6440
|
+
_inherits(go, _we2);
|
6436
6441
|
return _createClass(go, [{
|
6437
6442
|
key: "extractResultData",
|
6438
6443
|
value: function () {
|
@@ -6462,8 +6467,8 @@ var go = /*#__PURE__*/function (_Se2) {
|
|
6462
6467
|
return extractResultData;
|
6463
6468
|
}()
|
6464
6469
|
}]);
|
6465
|
-
}(
|
6466
|
-
var bo = /*#__PURE__*/function (
|
6470
|
+
}(we);
|
6471
|
+
var bo = /*#__PURE__*/function (_we3) {
|
6467
6472
|
function bo(e) {
|
6468
6473
|
var _this21;
|
6469
6474
|
_classCallCheck(this, bo);
|
@@ -6473,7 +6478,7 @@ var bo = /*#__PURE__*/function (_Se3) {
|
|
6473
6478
|
_this21 = _callSuper(this, bo, [e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i]), _this21.permittedErrorPrefixes = ["Authorization header", "Error in"], _this21.context = t.context;
|
6474
6479
|
return _this21;
|
6475
6480
|
}
|
6476
|
-
_inherits(bo,
|
6481
|
+
_inherits(bo, _we3);
|
6477
6482
|
return _createClass(bo, [{
|
6478
6483
|
key: "preprocessBody",
|
6479
6484
|
value: function preprocessBody(e, t) {
|
@@ -6516,8 +6521,8 @@ var bo = /*#__PURE__*/function (_Se3) {
|
|
6516
6521
|
return extractResultData;
|
6517
6522
|
}()
|
6518
6523
|
}]);
|
6519
|
-
}(
|
6520
|
-
var vo = /*#__PURE__*/function (
|
6524
|
+
}(we);
|
6525
|
+
var vo = /*#__PURE__*/function (_we4) {
|
6521
6526
|
function vo(e) {
|
6522
6527
|
_classCallCheck(this, vo);
|
6523
6528
|
var n, r, o;
|
@@ -6525,7 +6530,7 @@ var vo = /*#__PURE__*/function (_Se4) {
|
|
6525
6530
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6526
6531
|
return _callSuper(this, vo, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
|
6527
6532
|
}
|
6528
|
-
_inherits(vo,
|
6533
|
+
_inherits(vo, _we4);
|
6529
6534
|
return _createClass(vo, [{
|
6530
6535
|
key: "extractResultData",
|
6531
6536
|
value: function () {
|
@@ -6555,8 +6560,8 @@ var vo = /*#__PURE__*/function (_Se4) {
|
|
6555
6560
|
return extractResultData;
|
6556
6561
|
}()
|
6557
6562
|
}]);
|
6558
|
-
}(
|
6559
|
-
var yo = /*#__PURE__*/function (
|
6563
|
+
}(we);
|
6564
|
+
var yo = /*#__PURE__*/function (_we5) {
|
6560
6565
|
function yo(e) {
|
6561
6566
|
var _this22$maxMessages;
|
6562
6567
|
var _this22;
|
@@ -6568,7 +6573,7 @@ var yo = /*#__PURE__*/function (_Se5) {
|
|
6568
6573
|
return _this22;
|
6569
6574
|
}
|
6570
6575
|
// prettier-ignore
|
6571
|
-
_inherits(yo,
|
6576
|
+
_inherits(yo, _we5);
|
6572
6577
|
return _createClass(yo, [{
|
6573
6578
|
key: "processMessages",
|
6574
6579
|
value: function processMessages(e) {
|
@@ -6637,7 +6642,7 @@ var yo = /*#__PURE__*/function (_Se5) {
|
|
6637
6642
|
return extractResultData;
|
6638
6643
|
}()
|
6639
6644
|
}]);
|
6640
|
-
}(
|
6645
|
+
}(we);
|
6641
6646
|
var ri = /*#__PURE__*/function (_i12) {
|
6642
6647
|
function ri(e) {
|
6643
6648
|
var _this23;
|
@@ -6653,7 +6658,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6653
6658
|
}
|
6654
6659
|
}
|
6655
6660
|
};
|
6656
|
-
_this23 = _callSuper(this, ri, [e,
|
6661
|
+
_this23 = _callSuper(this, ri, [e, me.buildKeyVerificationDetails(), me.buildHeaders, i, n]), _this23.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this23.textInputPlaceholderText = "Describe image changes", _this23.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6657
6662
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
6658
6663
|
_typeof(r) == "object" && (r.engine_id && (_this23.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this23._imageWeight = r.weight), ri.cleanConfig(r), Object.assign(_this23.rawBody, r)), _this23.canSendMessage = ri.canSendFileTextMessage;
|
6659
6664
|
return _this23;
|
@@ -6745,7 +6750,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6745
6750
|
}
|
6746
6751
|
}]);
|
6747
6752
|
}(_i);
|
6748
|
-
var Eo = /*#__PURE__*/function (
|
6753
|
+
var Eo = /*#__PURE__*/function (_we6) {
|
6749
6754
|
function Eo(e) {
|
6750
6755
|
_classCallCheck(this, Eo);
|
6751
6756
|
var n, r, o;
|
@@ -6753,7 +6758,7 @@ var Eo = /*#__PURE__*/function (_Se6) {
|
|
6753
6758
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6754
6759
|
return _callSuper(this, Eo, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
|
6755
6760
|
}
|
6756
|
-
_inherits(Eo,
|
6761
|
+
_inherits(Eo, _we6);
|
6757
6762
|
return _createClass(Eo, [{
|
6758
6763
|
key: "extractResultData",
|
6759
6764
|
value: function () {
|
@@ -6783,7 +6788,7 @@ var Eo = /*#__PURE__*/function (_Se6) {
|
|
6783
6788
|
return extractResultData;
|
6784
6789
|
}()
|
6785
6790
|
}]);
|
6786
|
-
}(
|
6791
|
+
}(we);
|
6787
6792
|
var oi = /*#__PURE__*/function (_i13) {
|
6788
6793
|
function oi(e) {
|
6789
6794
|
var _this24;
|
@@ -6791,7 +6796,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6791
6796
|
var r;
|
6792
6797
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
6793
6798
|
i = t.stabilityAI;
|
6794
|
-
_this24 = _callSuper(this, oi, [e,
|
6799
|
+
_this24 = _callSuper(this, oi, [e, me.buildKeyVerificationDetails(), me.buildHeaders, i]), _this24.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this24.textInputPlaceholderText = "Describe an image", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6795
6800
|
var n = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
6796
6801
|
_typeof(n) == "object" && (n.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(n.engine_id, "/text-to-image")), n.weight !== void 0 && n.weight !== null && (_this24._imageWeight = n.weight), oi.cleanConfig(n), Object.assign(_this24.rawBody, n)), _this24.canSendMessage = oi.canSendTextMessage;
|
6797
6802
|
return _this24;
|
@@ -6877,7 +6882,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6877
6882
|
}
|
6878
6883
|
}]);
|
6879
6884
|
}(_i);
|
6880
|
-
var xo = /*#__PURE__*/function (
|
6885
|
+
var xo = /*#__PURE__*/function (_we7) {
|
6881
6886
|
function xo(e) {
|
6882
6887
|
var _this25;
|
6883
6888
|
_classCallCheck(this, xo);
|
@@ -6887,7 +6892,7 @@ var xo = /*#__PURE__*/function (_Se7) {
|
|
6887
6892
|
_this25 = _callSuper(this, xo, [e, "The goal of life is [MASK].", "bert-base-uncased", t, i]), _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this25.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
|
6888
6893
|
return _this25;
|
6889
6894
|
}
|
6890
|
-
_inherits(xo,
|
6895
|
+
_inherits(xo, _we7);
|
6891
6896
|
return _createClass(xo, [{
|
6892
6897
|
key: "extractResultData",
|
6893
6898
|
value: function () {
|
@@ -6917,7 +6922,7 @@ var xo = /*#__PURE__*/function (_Se7) {
|
|
6917
6922
|
return extractResultData;
|
6918
6923
|
}()
|
6919
6924
|
}]);
|
6920
|
-
}(
|
6925
|
+
}(we);
|
6921
6926
|
var ai = /*#__PURE__*/function () {
|
6922
6927
|
function ai() {
|
6923
6928
|
_classCallCheck(this, ai);
|
@@ -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,7 +7331,7 @@ 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 =
|
7334
|
+
n = this.preprocessBody(this.rawBody, t), r = ae.createFormDataBody(n, i[0]);
|
7330
7335
|
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7331
7336
|
case 7:
|
7332
7337
|
case "end":
|
@@ -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;
|
@@ -7510,7 +7515,7 @@ var To = /*#__PURE__*/function (_wo) {
|
|
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, To, [e,
|
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
7521
|
_inherits(To, _wo);
|
@@ -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);
|
@@ -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;
|
@@ -8036,7 +8041,7 @@ var Co = /*#__PURE__*/function (_U9) {
|
|
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, Co, [e,
|
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;
|
@@ -8107,11 +8112,11 @@ var Co = /*#__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 Ie = /*#__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 Ie = /*#__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 Ie = /*#__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 Ie = /*#__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:
|
@@ -8312,6 +8317,101 @@ var Ie = /*#__PURE__*/function () {
|
|
8312
8317
|
}
|
8313
8318
|
return getFilesAndText;
|
8314
8319
|
}()
|
8320
|
+
}, {
|
8321
|
+
key: "parseResult",
|
8322
|
+
value: function parseResult(e, t) {
|
8323
|
+
var i = [];
|
8324
|
+
if (t) i = e.data;else for (var n = 0; n < e.data.length; n += 1) {
|
8325
|
+
var r = e.data[n];
|
8326
|
+
if (r.role === "assistant") i.push(r);else break;
|
8327
|
+
}
|
8328
|
+
return i;
|
8329
|
+
}
|
8330
|
+
// test this using this prompt and it should give 2 text mesages and a file:
|
8331
|
+
// "give example data for a csv and create a suitable bar chart"
|
8332
|
+
}, {
|
8333
|
+
key: "parseMessages",
|
8334
|
+
value: function parseMessages(e, t) {
|
8335
|
+
var i = [];
|
8336
|
+
return t.forEach( /*#__PURE__*/function () {
|
8337
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(n) {
|
8338
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
8339
|
+
while (1) switch (_context81.prev = _context81.next) {
|
8340
|
+
case 0:
|
8341
|
+
n.content.filter(function (r) {
|
8342
|
+
return !!r.text || !!r.image_file;
|
8343
|
+
}).sort(function (r) {
|
8344
|
+
return r.text ? -1 : r.image_file ? 1 : 0;
|
8345
|
+
}).forEach( /*#__PURE__*/function () {
|
8346
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(r) {
|
8347
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8348
|
+
while (1) switch (_context80.prev = _context80.next) {
|
8349
|
+
case 0:
|
8350
|
+
i.push(J.getFilesAndText(e, n, r));
|
8351
|
+
case 1:
|
8352
|
+
case "end":
|
8353
|
+
return _context80.stop();
|
8354
|
+
}
|
8355
|
+
}, _callee80);
|
8356
|
+
}));
|
8357
|
+
return function (_x151) {
|
8358
|
+
return _ref12.apply(this, arguments);
|
8359
|
+
};
|
8360
|
+
}());
|
8361
|
+
case 1:
|
8362
|
+
case "end":
|
8363
|
+
return _context81.stop();
|
8364
|
+
}
|
8365
|
+
}, _callee81);
|
8366
|
+
}));
|
8367
|
+
return function (_x150) {
|
8368
|
+
return _ref11.apply(this, arguments);
|
8369
|
+
};
|
8370
|
+
}()), Promise.all(i);
|
8371
|
+
}
|
8372
|
+
}, {
|
8373
|
+
key: "processSteamMessages",
|
8374
|
+
value: function () {
|
8375
|
+
var _processSteamMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e, t) {
|
8376
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8377
|
+
while (1) switch (_context82.prev = _context82.next) {
|
8378
|
+
case 0:
|
8379
|
+
return _context82.abrupt("return", J.parseMessages(e, [{
|
8380
|
+
content: t,
|
8381
|
+
role: "assistant"
|
8382
|
+
}]));
|
8383
|
+
case 1:
|
8384
|
+
case "end":
|
8385
|
+
return _context82.stop();
|
8386
|
+
}
|
8387
|
+
}, _callee82);
|
8388
|
+
}));
|
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) {
|
8411
|
+
return _processAPIMessages.apply(this, arguments);
|
8412
|
+
}
|
8413
|
+
return processAPIMessages;
|
8414
|
+
}()
|
8315
8415
|
}]);
|
8316
8416
|
}();
|
8317
8417
|
var F = /*#__PURE__*/function (_U10) {
|
@@ -8333,8 +8433,8 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8333
8433
|
u = _this36$config.thread_id,
|
8334
8434
|
f = _this36$config.load_thread_history;
|
8335
8435
|
Object.assign(_this36.newAssistantDetails, h), u && (_this36.sessionId = u), f && (_this36.shouldFetchHistory = !0);
|
8336
|
-
var
|
8337
|
-
m =
|
8436
|
+
var _ref13 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.assistant,
|
8437
|
+
m = _ref13.function_handler;
|
8338
8438
|
m && (_this36._functionHandler = m);
|
8339
8439
|
} else (l = t.openAI) != null && l.assistant && (t.openAI.assistant = n);
|
8340
8440
|
(_c$headers = (c = _this36.connectSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_d$OpenAIBeta = (d = _this36.connectSettings.headers)["OpenAI-Beta"]) !== null && _d$OpenAIBeta !== void 0 ? _d$OpenAIBeta : d["OpenAI-Beta"] = "assistants=v1", _this36.maxMessages = 1, _this36.isSSEStream = !!(_this36.stream && (_typeof(_this36.stream) != "object" || !_this36.stream.simulation)), _this36.shouldFetchHistory && _this36.sessionId && (_this36.fetchHistory = _this36.fetchHistoryFunc.bind(_this36));
|
@@ -8344,32 +8444,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8344
8444
|
return _createClass(F, [{
|
8345
8445
|
key: "fetchHistoryFunc",
|
8346
8446
|
value: function () {
|
8347
|
-
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8447
|
+
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
|
8348
8448
|
var _this37 = this;
|
8349
8449
|
var e;
|
8350
|
-
return _regeneratorRuntime().wrap(function
|
8351
|
-
while (1) switch (
|
8450
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8451
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8352
8452
|
case 0:
|
8353
8453
|
setTimeout(function () {
|
8354
8454
|
return _this37.deepChat.disableSubmitButton();
|
8355
8455
|
}, 2);
|
8356
|
-
|
8357
|
-
|
8456
|
+
_context84.prev = 1;
|
8457
|
+
_context84.next = 4;
|
8358
8458
|
return this.getThreadMessages(this.sessionId, !0);
|
8359
8459
|
case 4:
|
8360
|
-
e =
|
8361
|
-
return
|
8460
|
+
e = _context84.sent;
|
8461
|
+
return _context84.abrupt("return", (this.deepChat.disableSubmitButton(!1), e.reverse()));
|
8362
8462
|
case 8:
|
8363
|
-
|
8364
|
-
|
8365
|
-
return
|
8463
|
+
_context84.prev = 8;
|
8464
|
+
_context84.t0 = _context84["catch"](1);
|
8465
|
+
return _context84.abrupt("return", [{
|
8366
8466
|
error: "failed to fetch thread history"
|
8367
8467
|
}]);
|
8368
8468
|
case 11:
|
8369
8469
|
case "end":
|
8370
|
-
return
|
8470
|
+
return _context84.stop();
|
8371
8471
|
}
|
8372
|
-
},
|
8472
|
+
}, _callee84, this, [[1, 8]]);
|
8373
8473
|
}));
|
8374
8474
|
function fetchHistoryFunc() {
|
8375
8475
|
return _fetchHistoryFunc.apply(this, arguments);
|
@@ -8411,61 +8511,62 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8411
8511
|
}, {
|
8412
8512
|
key: "callServiceAPI",
|
8413
8513
|
value: function () {
|
8414
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8514
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e, t, i) {
|
8415
8515
|
var _r$assistant_id;
|
8416
8516
|
var r, n;
|
8417
|
-
return _regeneratorRuntime().wrap(function
|
8418
|
-
while (1) switch (
|
8517
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8518
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8419
8519
|
case 0:
|
8420
8520
|
if (!(this.waitingForStreamResponse = !1, !this.connectSettings)) {
|
8421
|
-
|
8521
|
+
_context85.next = 2;
|
8422
8522
|
break;
|
8423
8523
|
}
|
8424
8524
|
throw new Error("Request settings have not been set up");
|
8425
8525
|
case 2:
|
8426
8526
|
if (!((_r$assistant_id = (r = this.rawBody).assistant_id) !== null && _r$assistant_id !== void 0)) {
|
8427
|
-
|
8527
|
+
_context85.next = 6;
|
8428
8528
|
break;
|
8429
8529
|
}
|
8430
8530
|
_r$assistant_id;
|
8431
|
-
|
8531
|
+
_context85.next = 12;
|
8432
8532
|
break;
|
8433
8533
|
case 6:
|
8434
|
-
|
8435
|
-
if (
|
8436
|
-
|
8534
|
+
_context85.t0 = this.config.assistant_id;
|
8535
|
+
if (_context85.t0) {
|
8536
|
+
_context85.next = 11;
|
8437
8537
|
break;
|
8438
8538
|
}
|
8439
|
-
|
8539
|
+
_context85.next = 10;
|
8440
8540
|
return this.createNewAssistant();
|
8441
8541
|
case 10:
|
8442
|
-
|
8542
|
+
_context85.t0 = _context85.sent;
|
8443
8543
|
case 11:
|
8444
|
-
r.assistant_id =
|
8544
|
+
r.assistant_id = _context85.t0;
|
8445
8545
|
case 12:
|
8546
|
+
this.streamedMessageId = void 0;
|
8446
8547
|
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
|
8447
8548
|
if (!i) {
|
8448
|
-
|
8549
|
+
_context85.next = 20;
|
8449
8550
|
break;
|
8450
8551
|
}
|
8451
|
-
|
8452
|
-
return
|
8453
|
-
case
|
8454
|
-
|
8455
|
-
|
8552
|
+
_context85.next = 17;
|
8553
|
+
return J.storeFiles(this, e, i);
|
8554
|
+
case 17:
|
8555
|
+
_context85.t1 = _context85.sent;
|
8556
|
+
_context85.next = 21;
|
8456
8557
|
break;
|
8457
|
-
case 19:
|
8458
|
-
_context81.t1 = void 0;
|
8459
8558
|
case 20:
|
8460
|
-
|
8559
|
+
_context85.t1 = void 0;
|
8560
|
+
case 21:
|
8561
|
+
n = _context85.t1;
|
8461
8562
|
this.connectSettings.method = "POST", this.callService(e, t, n);
|
8462
|
-
case
|
8563
|
+
case 23:
|
8463
8564
|
case "end":
|
8464
|
-
return
|
8565
|
+
return _context85.stop();
|
8465
8566
|
}
|
8466
|
-
},
|
8567
|
+
}, _callee85, this);
|
8467
8568
|
}));
|
8468
|
-
function callServiceAPI(
|
8569
|
+
function callServiceAPI(_x157, _x158, _x159) {
|
8469
8570
|
return _callServiceAPI18.apply(this, arguments);
|
8470
8571
|
}
|
8471
8572
|
return callServiceAPI;
|
@@ -8473,27 +8574,27 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8473
8574
|
}, {
|
8474
8575
|
key: "createNewAssistant",
|
8475
8576
|
value: function () {
|
8476
|
-
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8577
|
+
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
|
8477
8578
|
var e;
|
8478
|
-
return _regeneratorRuntime().wrap(function
|
8479
|
-
while (1) switch (
|
8579
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8580
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8480
8581
|
case 0:
|
8481
|
-
|
8582
|
+
_context86.prev = 0;
|
8482
8583
|
this.url = F.NEW_ASSISTANT_URL;
|
8483
|
-
|
8584
|
+
_context86.next = 4;
|
8484
8585
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
|
8485
8586
|
case 4:
|
8486
|
-
e =
|
8487
|
-
return
|
8587
|
+
e = _context86.sent;
|
8588
|
+
return _context86.abrupt("return", (this.config.assistant_id = e.id, this.config.assistant_id));
|
8488
8589
|
case 8:
|
8489
|
-
|
8490
|
-
|
8491
|
-
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");
|
8492
8593
|
case 11:
|
8493
8594
|
case "end":
|
8494
|
-
return
|
8595
|
+
return _context86.stop();
|
8495
8596
|
}
|
8496
|
-
},
|
8597
|
+
}, _callee86, this, [[0, 8]]);
|
8497
8598
|
}));
|
8498
8599
|
function createNewAssistant() {
|
8499
8600
|
return _createNewAssistant.apply(this, arguments);
|
@@ -8512,43 +8613,43 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8512
8613
|
}, {
|
8513
8614
|
key: "extractResultData",
|
8514
8615
|
value: function () {
|
8515
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8616
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e) {
|
8516
8617
|
var n, t, i;
|
8517
|
-
return _regeneratorRuntime().wrap(function
|
8518
|
-
while (1) switch (
|
8618
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8619
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8519
8620
|
case 0:
|
8520
8621
|
if (!(this.waitingForStreamResponse || this.isSSEStream && this.sessionId)) {
|
8521
|
-
|
8622
|
+
_context87.next = 4;
|
8522
8623
|
break;
|
8523
8624
|
}
|
8524
|
-
|
8625
|
+
_context87.next = 3;
|
8525
8626
|
return this.handleStream(e);
|
8526
8627
|
case 3:
|
8527
|
-
return
|
8628
|
+
return _context87.abrupt("return", _context87.sent);
|
8528
8629
|
case 4:
|
8529
8630
|
if (!e.error) {
|
8530
|
-
|
8631
|
+
_context87.next = 6;
|
8531
8632
|
break;
|
8532
8633
|
}
|
8533
8634
|
throw e.error.message;
|
8534
8635
|
case 6:
|
8535
|
-
|
8636
|
+
_context87.next = 8;
|
8536
8637
|
return this.assignThreadAndRun(e);
|
8537
8638
|
case 8:
|
8538
8639
|
t = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
8539
8640
|
method: "GET",
|
8540
8641
|
headers: (n = this.connectSettings) == null ? void 0 : n.headers
|
8541
8642
|
};
|
8542
|
-
return
|
8643
|
+
return _context87.abrupt("return", (T.executePollRequest(this, t, i, this.messages), {
|
8543
8644
|
makingAnotherRequest: !0
|
8544
8645
|
}));
|
8545
8646
|
case 10:
|
8546
8647
|
case "end":
|
8547
|
-
return
|
8648
|
+
return _context87.stop();
|
8548
8649
|
}
|
8549
|
-
},
|
8650
|
+
}, _callee87, this);
|
8550
8651
|
}));
|
8551
|
-
function extractResultData(
|
8652
|
+
function extractResultData(_x160) {
|
8552
8653
|
return _extractResultData21.apply(this, arguments);
|
8553
8654
|
}
|
8554
8655
|
return extractResultData;
|
@@ -8556,32 +8657,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8556
8657
|
}, {
|
8557
8658
|
key: "assignThreadAndRun",
|
8558
8659
|
value: function () {
|
8559
|
-
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8660
|
+
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e) {
|
8560
8661
|
var t;
|
8561
|
-
return _regeneratorRuntime().wrap(function
|
8562
|
-
while (1) switch (
|
8662
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8663
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8563
8664
|
case 0:
|
8564
8665
|
if (!this.sessionId) {
|
8565
|
-
|
8666
|
+
_context88.next = 8;
|
8566
8667
|
break;
|
8567
8668
|
}
|
8568
8669
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8569
|
-
|
8670
|
+
_context88.next = 4;
|
8570
8671
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8571
8672
|
case 4:
|
8572
|
-
t =
|
8673
|
+
t = _context88.sent;
|
8573
8674
|
this.run_id = t.id;
|
8574
|
-
|
8675
|
+
_context88.next = 9;
|
8575
8676
|
break;
|
8576
8677
|
case 8:
|
8577
8678
|
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
|
8578
8679
|
case 9:
|
8579
8680
|
case "end":
|
8580
|
-
return
|
8681
|
+
return _context88.stop();
|
8581
8682
|
}
|
8582
|
-
},
|
8683
|
+
}, _callee88, this);
|
8583
8684
|
}));
|
8584
|
-
function assignThreadAndRun(
|
8685
|
+
function assignThreadAndRun(_x161) {
|
8585
8686
|
return _assignThreadAndRun.apply(this, arguments);
|
8586
8687
|
}
|
8587
8688
|
return assignThreadAndRun;
|
@@ -8589,64 +8690,39 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8589
8690
|
}, {
|
8590
8691
|
key: "getThreadMessages",
|
8591
8692
|
value: function () {
|
8592
|
-
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8593
|
-
var _this38 = this;
|
8693
|
+
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e) {
|
8594
8694
|
var t,
|
8595
|
-
|
8596
|
-
a,
|
8597
|
-
i,
|
8695
|
+
n,
|
8598
8696
|
r,
|
8599
|
-
|
8600
|
-
|
8601
|
-
|
8697
|
+
i,
|
8698
|
+
_args89 = arguments;
|
8699
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
8700
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8602
8701
|
case 0:
|
8603
|
-
t =
|
8702
|
+
t = _args89.length > 1 && _args89[1] !== undefined ? _args89[1] : !1;
|
8604
8703
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(e, "/messages");
|
8605
|
-
|
8704
|
+
_context89.next = 4;
|
8606
8705
|
return P.directFetch(this, {}, "GET");
|
8607
8706
|
case 4:
|
8608
|
-
i =
|
8609
|
-
|
8610
|
-
if (!
|
8611
|
-
|
8707
|
+
i = _context89.sent;
|
8708
|
+
_context89.t0 = !t && this.deepChat.responseInterceptor;
|
8709
|
+
if (!_context89.t0) {
|
8710
|
+
_context89.next = 10;
|
8612
8711
|
break;
|
8613
8712
|
}
|
8614
|
-
|
8615
|
-
return (
|
8713
|
+
_context89.next = 9;
|
8714
|
+
return (r = (n = this.deepChat).responseInterceptor) == null ? void 0 : r.call(n, i);
|
8616
8715
|
case 9:
|
8617
|
-
i =
|
8716
|
+
i = _context89.sent;
|
8618
8717
|
case 10:
|
8619
|
-
|
8620
|
-
|
8621
|
-
var c;
|
8622
|
-
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8623
|
-
while (1) switch (_context85.prev = _context85.next) {
|
8624
|
-
case 0:
|
8625
|
-
c = l.content.find(function (d) {
|
8626
|
-
return !!d.text || !!d.image_file;
|
8627
|
-
});
|
8628
|
-
_context85.next = 3;
|
8629
|
-
return Ie.getFilesAndText(_this38, l, c);
|
8630
|
-
case 3:
|
8631
|
-
return _context85.abrupt("return", _context85.sent);
|
8632
|
-
case 4:
|
8633
|
-
case "end":
|
8634
|
-
return _context85.stop();
|
8635
|
-
}
|
8636
|
-
}, _callee85);
|
8637
|
-
}));
|
8638
|
-
return function (_x156) {
|
8639
|
-
return _ref12.apply(this, arguments);
|
8640
|
-
};
|
8641
|
-
}());
|
8642
|
-
return _context86.abrupt("return", Promise.all(r));
|
8643
|
-
case 12:
|
8718
|
+
return _context89.abrupt("return", J.processAPIMessages(this, i, t));
|
8719
|
+
case 11:
|
8644
8720
|
case "end":
|
8645
|
-
return
|
8721
|
+
return _context89.stop();
|
8646
8722
|
}
|
8647
|
-
},
|
8723
|
+
}, _callee89, this);
|
8648
8724
|
}));
|
8649
|
-
function getThreadMessages(
|
8725
|
+
function getThreadMessages(_x162) {
|
8650
8726
|
return _getThreadMessages.apply(this, arguments);
|
8651
8727
|
}
|
8652
8728
|
return getThreadMessages;
|
@@ -8654,55 +8730,60 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8654
8730
|
}, {
|
8655
8731
|
key: "extractPollResultData",
|
8656
8732
|
value: function () {
|
8657
|
-
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8658
|
-
var
|
8659
|
-
|
8660
|
-
|
8733
|
+
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
|
8734
|
+
var _this38 = this;
|
8735
|
+
var r, t, i, o, _o$pop, a, l, n;
|
8736
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
8737
|
+
while (1) switch (_context90.prev = _context90.next) {
|
8661
8738
|
case 0:
|
8662
8739
|
t = e.status, i = e.required_action;
|
8663
8740
|
if (!(t === "queued" || t === "in_progress")) {
|
8664
|
-
|
8741
|
+
_context90.next = 3;
|
8665
8742
|
break;
|
8666
8743
|
}
|
8667
|
-
return
|
8744
|
+
return _context90.abrupt("return", {
|
8668
8745
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8669
8746
|
});
|
8670
8747
|
case 3:
|
8671
8748
|
if (!(t === "completed" && this.messages)) {
|
8672
|
-
|
8749
|
+
_context90.next = 11;
|
8673
8750
|
break;
|
8674
8751
|
}
|
8675
|
-
|
8752
|
+
_context90.next = 6;
|
8676
8753
|
return this.getThreadMessages(e.thread_id);
|
8677
8754
|
case 6:
|
8678
|
-
o =
|
8679
|
-
_o$ = o
|
8680
|
-
a = _o
|
8681
|
-
l = _o
|
8682
|
-
return
|
8755
|
+
o = _context90.sent;
|
8756
|
+
_o$pop = o.pop();
|
8757
|
+
a = _o$pop.text;
|
8758
|
+
l = _o$pop.files;
|
8759
|
+
return _context90.abrupt("return", (setTimeout(function () {
|
8760
|
+
o.forEach(function (c) {
|
8761
|
+
return _this38.deepChat.addMessage(c);
|
8762
|
+
});
|
8763
|
+
}), {
|
8683
8764
|
text: a,
|
8684
8765
|
_sessionId: this.sessionId,
|
8685
8766
|
files: l
|
8686
|
-
});
|
8767
|
+
}));
|
8687
8768
|
case 11:
|
8688
8769
|
n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
|
8689
8770
|
if (!(t === "requires_action" && n)) {
|
8690
|
-
|
8771
|
+
_context90.next = 16;
|
8691
8772
|
break;
|
8692
8773
|
}
|
8693
|
-
|
8774
|
+
_context90.next = 15;
|
8694
8775
|
return this.handleTools(n);
|
8695
8776
|
case 15:
|
8696
|
-
return
|
8777
|
+
return _context90.abrupt("return", _context90.sent);
|
8697
8778
|
case 16:
|
8698
8779
|
throw Error("Thread run status: ".concat(t));
|
8699
8780
|
case 17:
|
8700
8781
|
case "end":
|
8701
|
-
return
|
8782
|
+
return _context90.stop();
|
8702
8783
|
}
|
8703
|
-
},
|
8784
|
+
}, _callee90, this);
|
8704
8785
|
}));
|
8705
|
-
function extractPollResultData(
|
8786
|
+
function extractPollResultData(_x163) {
|
8706
8787
|
return _extractPollResultData5.apply(this, arguments);
|
8707
8788
|
}
|
8708
8789
|
return extractPollResultData;
|
@@ -8710,13 +8791,13 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8710
8791
|
}, {
|
8711
8792
|
key: "handleTools",
|
8712
8793
|
value: function () {
|
8713
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8794
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
|
8714
8795
|
var t, i, n;
|
8715
|
-
return _regeneratorRuntime().wrap(function
|
8716
|
-
while (1) switch (
|
8796
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
8797
|
+
while (1) switch (_context91.prev = _context91.next) {
|
8717
8798
|
case 0:
|
8718
8799
|
if (this._functionHandler) {
|
8719
|
-
|
8800
|
+
_context91.next = 2;
|
8720
8801
|
break;
|
8721
8802
|
}
|
8722
8803
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8727,14 +8808,14 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8727
8808
|
arguments: r["function"].arguments
|
8728
8809
|
};
|
8729
8810
|
});
|
8730
|
-
|
8811
|
+
_context91.next = 5;
|
8731
8812
|
return this._functionHandler(t);
|
8732
8813
|
case 5:
|
8733
|
-
i =
|
8814
|
+
i = _context91.sent;
|
8734
8815
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8735
8816
|
return typeof r != "string";
|
8736
8817
|
}) || e.length !== i.length)) {
|
8737
|
-
|
8818
|
+
_context91.next = 8;
|
8738
8819
|
break;
|
8739
8820
|
}
|
8740
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.");
|
@@ -8747,32 +8828,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8747
8828
|
});
|
8748
8829
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8749
8830
|
if (!this.isSSEStream) {
|
8750
|
-
|
8831
|
+
_context91.next = 15;
|
8751
8832
|
break;
|
8752
8833
|
}
|
8753
|
-
|
8834
|
+
_context91.next = 13;
|
8754
8835
|
return this.createStreamRun({
|
8755
8836
|
tool_outputs: n
|
8756
8837
|
});
|
8757
8838
|
case 13:
|
8758
|
-
|
8839
|
+
_context91.next = 17;
|
8759
8840
|
break;
|
8760
8841
|
case 15:
|
8761
|
-
|
8842
|
+
_context91.next = 17;
|
8762
8843
|
return P.directFetch(this, {
|
8763
8844
|
tool_outputs: n
|
8764
8845
|
}, "POST");
|
8765
8846
|
case 17:
|
8766
|
-
return
|
8847
|
+
return _context91.abrupt("return", {
|
8767
8848
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8768
8849
|
});
|
8769
8850
|
case 18:
|
8770
8851
|
case "end":
|
8771
|
-
return
|
8852
|
+
return _context91.stop();
|
8772
8853
|
}
|
8773
|
-
},
|
8854
|
+
}, _callee91, this);
|
8774
8855
|
}));
|
8775
|
-
function handleTools(
|
8856
|
+
function handleTools(_x164) {
|
8776
8857
|
return _handleTools.apply(this, arguments);
|
8777
8858
|
}
|
8778
8859
|
return handleTools;
|
@@ -8780,77 +8861,111 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8780
8861
|
}, {
|
8781
8862
|
key: "handleStream",
|
8782
8863
|
value: function () {
|
8783
|
-
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8864
|
+
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e) {
|
8784
8865
|
var i, n, t, r;
|
8785
|
-
return _regeneratorRuntime().wrap(function
|
8786
|
-
while (1) switch (
|
8866
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
8867
|
+
while (1) switch (_context92.prev = _context92.next) {
|
8787
8868
|
case 0:
|
8788
8869
|
t = (n = (i = e.required_action) == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : n.tool_calls;
|
8789
8870
|
if (!(e.status === "requires_action" && t)) {
|
8790
|
-
|
8871
|
+
_context92.next = 6;
|
8791
8872
|
break;
|
8792
8873
|
}
|
8793
8874
|
this.run_id = e.id;
|
8794
|
-
|
8875
|
+
_context92.next = 5;
|
8795
8876
|
return this.handleTools(t);
|
8796
8877
|
case 5:
|
8797
|
-
return
|
8878
|
+
return _context92.abrupt("return", _context92.sent);
|
8798
8879
|
case 6:
|
8799
8880
|
if (!this.waitingForStreamResponse) {
|
8800
|
-
|
8881
|
+
_context92.next = 8;
|
8801
8882
|
break;
|
8802
8883
|
}
|
8803
|
-
return
|
8884
|
+
return _context92.abrupt("return", this.parseStreamResult(e));
|
8804
8885
|
case 8:
|
8805
8886
|
if (this.isSSEStream && this.sessionId) {
|
8806
8887
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8807
8888
|
r = JSON.parse(JSON.stringify(this.rawBody));
|
8808
8889
|
this.createStreamRun(r);
|
8809
8890
|
}
|
8810
|
-
return
|
8891
|
+
return _context92.abrupt("return", {
|
8811
8892
|
makingAnotherRequest: !0
|
8812
8893
|
});
|
8813
8894
|
case 10:
|
8814
8895
|
case "end":
|
8815
|
-
return
|
8896
|
+
return _context92.stop();
|
8816
8897
|
}
|
8817
|
-
},
|
8898
|
+
}, _callee92, this);
|
8818
8899
|
}));
|
8819
|
-
function handleStream(
|
8900
|
+
function handleStream(_x165) {
|
8820
8901
|
return _handleStream.apply(this, arguments);
|
8821
8902
|
}
|
8822
8903
|
return handleStream;
|
8823
8904
|
}()
|
8824
8905
|
}, {
|
8825
8906
|
key: "parseStreamResult",
|
8826
|
-
value: function
|
8827
|
-
var
|
8828
|
-
|
8829
|
-
|
8830
|
-
|
8831
|
-
|
8832
|
-
|
8833
|
-
|
8834
|
-
|
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
|
8835
8948
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8836
8949
|
}, {
|
8837
8950
|
key: "createStreamRun",
|
8838
8951
|
value: function () {
|
8839
|
-
var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8840
|
-
return _regeneratorRuntime().wrap(function
|
8841
|
-
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) {
|
8842
8955
|
case 0:
|
8843
8956
|
e.stream = !0;
|
8844
8957
|
this.waitingForStreamResponse = !0;
|
8845
|
-
|
8958
|
+
_context94.next = 4;
|
8846
8959
|
return C.request(this, e, this.messages, !0, !0);
|
8847
8960
|
case 4:
|
8961
|
+
this.messageStream = _context94.sent;
|
8962
|
+
case 5:
|
8848
8963
|
case "end":
|
8849
|
-
return
|
8964
|
+
return _context94.stop();
|
8850
8965
|
}
|
8851
|
-
},
|
8966
|
+
}, _callee94, this);
|
8852
8967
|
}));
|
8853
|
-
function createStreamRun(
|
8968
|
+
function createStreamRun(_x167) {
|
8854
8969
|
return _createStreamRun.apply(this, arguments);
|
8855
8970
|
}
|
8856
8971
|
return createStreamRun;
|
@@ -8859,10 +8974,10 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8859
8974
|
}(U);
|
8860
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;
|
8861
8976
|
var nn = F;
|
8862
|
-
var
|
8863
|
-
function
|
8977
|
+
var le = /*#__PURE__*/function (_U11) {
|
8978
|
+
function le(e) {
|
8864
8979
|
var _this39;
|
8865
|
-
_classCallCheck(this,
|
8980
|
+
_classCallCheck(this, le);
|
8866
8981
|
var o;
|
8867
8982
|
var t = e.directConnection,
|
8868
8983
|
i = t == null ? void 0 : t.openAI,
|
@@ -8874,7 +8989,7 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8874
8989
|
}
|
8875
8990
|
}
|
8876
8991
|
};
|
8877
|
-
_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"];
|
8878
8993
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
8879
8994
|
if (_this39.camera) {
|
8880
8995
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -8885,11 +9000,11 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8885
9000
|
}
|
8886
9001
|
};
|
8887
9002
|
}
|
8888
|
-
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage =
|
9003
|
+
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage = le.canFileSendMessage;
|
8889
9004
|
return _this39;
|
8890
9005
|
}
|
8891
|
-
_inherits(
|
8892
|
-
return _createClass(
|
9006
|
+
_inherits(le, _U11);
|
9007
|
+
return _createClass(le, [{
|
8893
9008
|
key: "preprocessBody",
|
8894
9009
|
value: function preprocessBody(e, t) {
|
8895
9010
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -8903,50 +9018,50 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8903
9018
|
var n;
|
8904
9019
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
8905
9020
|
if (i[1] || r && r !== "") {
|
8906
|
-
this.url =
|
9021
|
+
this.url = le.IMAGE_EDIT_URL;
|
8907
9022
|
var l = this.preprocessBody(this.rawBody, r);
|
8908
|
-
n =
|
8909
|
-
} else this.url =
|
9023
|
+
n = le.createFormDataBody(l, i[0], i[1]);
|
9024
|
+
} else this.url = le.IMAGE_VARIATIONS_URL, n = le.createFormDataBody(this.rawBody, i[0]);
|
8910
9025
|
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, n, e), !1);
|
8911
9026
|
}
|
8912
9027
|
}, {
|
8913
9028
|
key: "callServiceAPI",
|
8914
9029
|
value: function () {
|
8915
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9030
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i) {
|
8916
9031
|
var n, r;
|
8917
|
-
return _regeneratorRuntime().wrap(function
|
8918
|
-
while (1) switch (
|
9032
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
9033
|
+
while (1) switch (_context95.prev = _context95.next) {
|
8919
9034
|
case 0:
|
8920
9035
|
if ((n = this.connectSettings) != null && n.headers) {
|
8921
|
-
|
9036
|
+
_context95.next = 2;
|
8922
9037
|
break;
|
8923
9038
|
}
|
8924
9039
|
throw new Error("Request settings have not been set up");
|
8925
9040
|
case 2:
|
8926
9041
|
if (!(i != null && i[0])) {
|
8927
|
-
|
9042
|
+
_context95.next = 6;
|
8928
9043
|
break;
|
8929
9044
|
}
|
8930
9045
|
this.callApiWithImage(e, t, i);
|
8931
|
-
|
9046
|
+
_context95.next = 11;
|
8932
9047
|
break;
|
8933
9048
|
case 6:
|
8934
9049
|
if (this.connectSettings) {
|
8935
|
-
|
9050
|
+
_context95.next = 8;
|
8936
9051
|
break;
|
8937
9052
|
}
|
8938
9053
|
throw new Error("Request settings have not been set up");
|
8939
9054
|
case 8:
|
8940
|
-
this.url =
|
9055
|
+
this.url = le.IMAGE_GENERATION_URL;
|
8941
9056
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
8942
9057
|
T.request(this, r, e);
|
8943
9058
|
case 11:
|
8944
9059
|
case "end":
|
8945
|
-
return
|
9060
|
+
return _context95.stop();
|
8946
9061
|
}
|
8947
|
-
},
|
9062
|
+
}, _callee95, this);
|
8948
9063
|
}));
|
8949
|
-
function callServiceAPI(
|
9064
|
+
function callServiceAPI(_x168, _x169, _x170) {
|
8950
9065
|
return _callServiceAPI19.apply(this, arguments);
|
8951
9066
|
}
|
8952
9067
|
return callServiceAPI;
|
@@ -8954,17 +9069,17 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8954
9069
|
}, {
|
8955
9070
|
key: "extractResultData",
|
8956
9071
|
value: function () {
|
8957
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8958
|
-
return _regeneratorRuntime().wrap(function
|
8959
|
-
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) {
|
8960
9075
|
case 0:
|
8961
9076
|
if (!e.error) {
|
8962
|
-
|
9077
|
+
_context96.next = 2;
|
8963
9078
|
break;
|
8964
9079
|
}
|
8965
9080
|
throw e.error.message;
|
8966
9081
|
case 2:
|
8967
|
-
return
|
9082
|
+
return _context96.abrupt("return", {
|
8968
9083
|
files: e.data.map(function (i) {
|
8969
9084
|
return i.url ? {
|
8970
9085
|
src: i.url,
|
@@ -8977,11 +9092,11 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8977
9092
|
});
|
8978
9093
|
case 3:
|
8979
9094
|
case "end":
|
8980
|
-
return
|
9095
|
+
return _context96.stop();
|
8981
9096
|
}
|
8982
|
-
},
|
9097
|
+
}, _callee96);
|
8983
9098
|
}));
|
8984
|
-
function extractResultData(
|
9099
|
+
function extractResultData(_x171) {
|
8985
9100
|
return _extractResultData22.apply(this, arguments);
|
8986
9101
|
}
|
8987
9102
|
return extractResultData;
|
@@ -9009,8 +9124,8 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
9009
9124
|
}
|
9010
9125
|
}]);
|
9011
9126
|
}(U);
|
9012
|
-
|
9013
|
-
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;
|
9014
9129
|
var yt = /*#__PURE__*/function (_U12) {
|
9015
9130
|
function yt(e) {
|
9016
9131
|
var _this40$maxMessages, _l$model;
|
@@ -9023,8 +9138,8 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9023
9138
|
var n = (r = t.openAI) == null ? void 0 : r.chat;
|
9024
9139
|
if (_typeof(n) == "object") {
|
9025
9140
|
n.system_prompt && (_this40._systemMessage = yt.generateSystemMessage(n.system_prompt));
|
9026
|
-
var
|
9027
|
-
c =
|
9141
|
+
var _ref14 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.chat,
|
9142
|
+
c = _ref14.function_handler;
|
9028
9143
|
c && (_this40._functionHandler = c), _this40.cleanConfig(n), Object.assign(_this40.rawBody, n);
|
9029
9144
|
}
|
9030
9145
|
(_this40$maxMessages = _this40.maxMessages) !== null && _this40$maxMessages !== void 0 ? _this40$maxMessages : _this40.maxMessages = -1, (_l$model = (l = _this40.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-3.5-turbo";
|
@@ -9056,13 +9171,13 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9056
9171
|
}, {
|
9057
9172
|
key: "callServiceAPI",
|
9058
9173
|
value: function () {
|
9059
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9174
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t) {
|
9060
9175
|
var i, n;
|
9061
|
-
return _regeneratorRuntime().wrap(function
|
9062
|
-
while (1) switch (
|
9176
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
9177
|
+
while (1) switch (_context97.prev = _context97.next) {
|
9063
9178
|
case 0:
|
9064
9179
|
if (this.connectSettings) {
|
9065
|
-
|
9180
|
+
_context97.next = 2;
|
9066
9181
|
break;
|
9067
9182
|
}
|
9068
9183
|
throw new Error("Request settings have not been set up");
|
@@ -9071,11 +9186,11 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9071
9186
|
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, C.request(this, i, e)) : T.request(this, i, e);
|
9072
9187
|
case 4:
|
9073
9188
|
case "end":
|
9074
|
-
return
|
9189
|
+
return _context97.stop();
|
9075
9190
|
}
|
9076
|
-
},
|
9191
|
+
}, _callee97, this);
|
9077
9192
|
}));
|
9078
|
-
function callServiceAPI(
|
9193
|
+
function callServiceAPI(_x172, _x173) {
|
9079
9194
|
return _callServiceAPI20.apply(this, arguments);
|
9080
9195
|
}
|
9081
9196
|
return callServiceAPI;
|
@@ -9083,29 +9198,29 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9083
9198
|
}, {
|
9084
9199
|
key: "extractResultData",
|
9085
9200
|
value: function () {
|
9086
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9201
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e, t, i) {
|
9087
9202
|
var n, r, o, a;
|
9088
|
-
return _regeneratorRuntime().wrap(function
|
9089
|
-
while (1) switch (
|
9203
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
9204
|
+
while (1) switch (_context98.prev = _context98.next) {
|
9090
9205
|
case 0:
|
9091
9206
|
if (!e.error) {
|
9092
|
-
|
9207
|
+
_context98.next = 2;
|
9093
9208
|
break;
|
9094
9209
|
}
|
9095
9210
|
throw e.error.message;
|
9096
9211
|
case 2:
|
9097
|
-
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) : {
|
9098
9213
|
text: e.choices[0].message.content
|
9099
9214
|
} : {
|
9100
9215
|
text: ""
|
9101
9216
|
});
|
9102
9217
|
case 3:
|
9103
9218
|
case "end":
|
9104
|
-
return
|
9219
|
+
return _context98.stop();
|
9105
9220
|
}
|
9106
|
-
},
|
9221
|
+
}, _callee98, this);
|
9107
9222
|
}));
|
9108
|
-
function extractResultData(
|
9223
|
+
function extractResultData(_x174, _x175, _x176) {
|
9109
9224
|
return _extractResultData23.apply(this, arguments);
|
9110
9225
|
}
|
9111
9226
|
return extractResultData;
|
@@ -9113,37 +9228,37 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9113
9228
|
}, {
|
9114
9229
|
key: "extractStreamResult",
|
9115
9230
|
value: function () {
|
9116
|
-
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9231
|
+
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t, i) {
|
9117
9232
|
var _this41 = this;
|
9118
9233
|
var n, r, o;
|
9119
|
-
return _regeneratorRuntime().wrap(function
|
9120
|
-
while (1) switch (
|
9234
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
9235
|
+
while (1) switch (_context99.prev = _context99.next) {
|
9121
9236
|
case 0:
|
9122
9237
|
n = e.delta, r = e.finish_reason;
|
9123
9238
|
if (!(r === "tool_calls")) {
|
9124
|
-
|
9239
|
+
_context99.next = 7;
|
9125
9240
|
break;
|
9126
9241
|
}
|
9127
9242
|
this.asyncCallInProgress = !0;
|
9128
9243
|
o = {
|
9129
9244
|
tool_calls: this._streamToolCalls
|
9130
9245
|
};
|
9131
|
-
return
|
9246
|
+
return _context99.abrupt("return", (this._streamToolCalls = void 0, this.handleTools(o, t, i)));
|
9132
9247
|
case 7:
|
9133
9248
|
n != null && n.tool_calls && (this._streamToolCalls ? n.tool_calls.forEach(function (o, a) {
|
9134
9249
|
_this41._streamToolCalls && (_this41._streamToolCalls[a]["function"].arguments += o["function"].arguments);
|
9135
9250
|
}) : this._streamToolCalls = n.tool_calls);
|
9136
9251
|
case 8:
|
9137
|
-
return
|
9252
|
+
return _context99.abrupt("return", {
|
9138
9253
|
text: (n == null ? void 0 : n.content) || ""
|
9139
9254
|
});
|
9140
9255
|
case 9:
|
9141
9256
|
case "end":
|
9142
|
-
return
|
9257
|
+
return _context99.stop();
|
9143
9258
|
}
|
9144
|
-
},
|
9259
|
+
}, _callee99, this);
|
9145
9260
|
}));
|
9146
|
-
function extractStreamResult(
|
9261
|
+
function extractStreamResult(_x177, _x178, _x179) {
|
9147
9262
|
return _extractStreamResult.apply(this, arguments);
|
9148
9263
|
}
|
9149
9264
|
return extractStreamResult;
|
@@ -9151,13 +9266,13 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9151
9266
|
}, {
|
9152
9267
|
key: "handleTools",
|
9153
9268
|
value: function () {
|
9154
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9269
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e, t, i) {
|
9155
9270
|
var a, l, c, d, h, n, r, o, u, _u;
|
9156
|
-
return _regeneratorRuntime().wrap(function
|
9157
|
-
while (1) switch (
|
9271
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
9272
|
+
while (1) switch (_context100.prev = _context100.next) {
|
9158
9273
|
case 0:
|
9159
9274
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
9160
|
-
|
9275
|
+
_context100.next = 2;
|
9161
9276
|
break;
|
9162
9277
|
}
|
9163
9278
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -9169,28 +9284,28 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9169
9284
|
arguments: u["function"].arguments
|
9170
9285
|
};
|
9171
9286
|
});
|
9172
|
-
|
9287
|
+
_context100.next = 6;
|
9173
9288
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
9174
9289
|
case 6:
|
9175
|
-
o =
|
9290
|
+
o = _context100.sent;
|
9176
9291
|
if (!o.text) {
|
9177
|
-
|
9292
|
+
_context100.next = 15;
|
9178
9293
|
break;
|
9179
9294
|
}
|
9180
9295
|
u = {
|
9181
9296
|
text: o.text
|
9182
9297
|
};
|
9183
|
-
|
9298
|
+
_context100.next = 11;
|
9184
9299
|
return (c = (l = this.deepChat).responseInterceptor) == null ? void 0 : c.call(l, u);
|
9185
9300
|
case 11:
|
9186
|
-
|
9187
|
-
if (
|
9188
|
-
|
9301
|
+
_context100.t0 = _context100.sent;
|
9302
|
+
if (_context100.t0) {
|
9303
|
+
_context100.next = 14;
|
9189
9304
|
break;
|
9190
9305
|
}
|
9191
|
-
|
9306
|
+
_context100.t0 = u;
|
9192
9307
|
case 14:
|
9193
|
-
return
|
9308
|
+
return _context100.abrupt("return", _context100.t0);
|
9194
9309
|
case 15:
|
9195
9310
|
if (!(n.messages.push({
|
9196
9311
|
tool_calls: e.tool_calls,
|
@@ -9199,7 +9314,7 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9199
9314
|
}), Array.isArray(o) && !o.find(function (u) {
|
9200
9315
|
return typeof u != "string";
|
9201
9316
|
}) || r.length === o.length)) {
|
9202
|
-
|
9317
|
+
_context100.next = 35;
|
9203
9318
|
break;
|
9204
9319
|
}
|
9205
9320
|
o.forEach(function (u, f) {
|
@@ -9212,46 +9327,46 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9212
9327
|
content: u.response
|
9213
9328
|
});
|
9214
9329
|
}), delete n.tools, delete n.tool_choice, delete n.stream;
|
9215
|
-
|
9216
|
-
|
9330
|
+
_context100.prev = 17;
|
9331
|
+
_context100.next = 20;
|
9217
9332
|
return t == null ? void 0 : t(n).then(function (f) {
|
9218
9333
|
return v.processResponseByType(f);
|
9219
9334
|
});
|
9220
9335
|
case 20:
|
9221
|
-
_u =
|
9222
|
-
|
9336
|
+
_u = _context100.sent;
|
9337
|
+
_context100.next = 23;
|
9223
9338
|
return (h = (d = this.deepChat).responseInterceptor) == null ? void 0 : h.call(d, _u);
|
9224
9339
|
case 23:
|
9225
|
-
|
9226
|
-
if (
|
9227
|
-
|
9340
|
+
_context100.t1 = _context100.sent;
|
9341
|
+
if (_context100.t1) {
|
9342
|
+
_context100.next = 26;
|
9228
9343
|
break;
|
9229
9344
|
}
|
9230
|
-
|
9345
|
+
_context100.t1 = _u;
|
9231
9346
|
case 26:
|
9232
|
-
_u =
|
9347
|
+
_u = _context100.t1;
|
9233
9348
|
if (!_u.error) {
|
9234
|
-
|
9349
|
+
_context100.next = 29;
|
9235
9350
|
break;
|
9236
9351
|
}
|
9237
9352
|
throw _u.error.message;
|
9238
9353
|
case 29:
|
9239
|
-
return
|
9354
|
+
return _context100.abrupt("return", {
|
9240
9355
|
text: _u.choices[0].message.content || ""
|
9241
9356
|
});
|
9242
9357
|
case 32:
|
9243
|
-
|
9244
|
-
|
9245
|
-
throw this.asyncCallInProgress = !1,
|
9358
|
+
_context100.prev = 32;
|
9359
|
+
_context100.t2 = _context100["catch"](17);
|
9360
|
+
throw this.asyncCallInProgress = !1, _context100.t2;
|
9246
9361
|
case 35:
|
9247
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.");
|
9248
9363
|
case 36:
|
9249
9364
|
case "end":
|
9250
|
-
return
|
9365
|
+
return _context100.stop();
|
9251
9366
|
}
|
9252
|
-
},
|
9367
|
+
}, _callee100, this, [[17, 32]]);
|
9253
9368
|
}));
|
9254
|
-
function handleTools(
|
9369
|
+
function handleTools(_x180, _x181, _x182) {
|
9255
9370
|
return _handleTools2.apply(this, arguments);
|
9256
9371
|
}
|
9257
9372
|
return handleTools;
|
@@ -9315,13 +9430,13 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9315
9430
|
}, {
|
9316
9431
|
key: "callServiceAPI",
|
9317
9432
|
value: function () {
|
9318
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9433
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e, t) {
|
9319
9434
|
var i;
|
9320
|
-
return _regeneratorRuntime().wrap(function
|
9321
|
-
while (1) switch (
|
9435
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
9436
|
+
while (1) switch (_context101.prev = _context101.next) {
|
9322
9437
|
case 0:
|
9323
9438
|
if (this.connectSettings) {
|
9324
|
-
|
9439
|
+
_context101.next = 2;
|
9325
9440
|
break;
|
9326
9441
|
}
|
9327
9442
|
throw new Error("Request settings have not been set up");
|
@@ -9330,11 +9445,11 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9330
9445
|
T.request(this, i, e);
|
9331
9446
|
case 4:
|
9332
9447
|
case "end":
|
9333
|
-
return
|
9448
|
+
return _context101.stop();
|
9334
9449
|
}
|
9335
|
-
},
|
9450
|
+
}, _callee101, this);
|
9336
9451
|
}));
|
9337
|
-
function callServiceAPI(
|
9452
|
+
function callServiceAPI(_x183, _x184) {
|
9338
9453
|
return _callServiceAPI21.apply(this, arguments);
|
9339
9454
|
}
|
9340
9455
|
return callServiceAPI;
|
@@ -9342,26 +9457,26 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9342
9457
|
}, {
|
9343
9458
|
key: "extractResultData",
|
9344
9459
|
value: function () {
|
9345
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9346
|
-
return _regeneratorRuntime().wrap(function
|
9347
|
-
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) {
|
9348
9463
|
case 0:
|
9349
9464
|
if (!e.message) {
|
9350
|
-
|
9465
|
+
_context102.next = 2;
|
9351
9466
|
break;
|
9352
9467
|
}
|
9353
9468
|
throw e.message;
|
9354
9469
|
case 2:
|
9355
|
-
return
|
9470
|
+
return _context102.abrupt("return", {
|
9356
9471
|
text: e.text
|
9357
9472
|
});
|
9358
9473
|
case 3:
|
9359
9474
|
case "end":
|
9360
|
-
return
|
9475
|
+
return _context102.stop();
|
9361
9476
|
}
|
9362
|
-
},
|
9477
|
+
}, _callee102);
|
9363
9478
|
}));
|
9364
|
-
function extractResultData(
|
9479
|
+
function extractResultData(_x185) {
|
9365
9480
|
return _extractResultData24.apply(this, arguments);
|
9366
9481
|
}
|
9367
9482
|
return extractResultData;
|
@@ -9433,13 +9548,13 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9433
9548
|
}, {
|
9434
9549
|
key: "callServiceAPI",
|
9435
9550
|
value: function () {
|
9436
|
-
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9551
|
+
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e, t) {
|
9437
9552
|
var i;
|
9438
|
-
return _regeneratorRuntime().wrap(function
|
9439
|
-
while (1) switch (
|
9553
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
9554
|
+
while (1) switch (_context103.prev = _context103.next) {
|
9440
9555
|
case 0:
|
9441
9556
|
if (this.connectSettings) {
|
9442
|
-
|
9557
|
+
_context103.next = 2;
|
9443
9558
|
break;
|
9444
9559
|
}
|
9445
9560
|
throw new Error("Request settings have not been set up");
|
@@ -9448,11 +9563,11 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9448
9563
|
T.request(this, i, e);
|
9449
9564
|
case 4:
|
9450
9565
|
case "end":
|
9451
|
-
return
|
9566
|
+
return _context103.stop();
|
9452
9567
|
}
|
9453
|
-
},
|
9568
|
+
}, _callee103, this);
|
9454
9569
|
}));
|
9455
|
-
function callServiceAPI(
|
9570
|
+
function callServiceAPI(_x186, _x187) {
|
9456
9571
|
return _callServiceAPI22.apply(this, arguments);
|
9457
9572
|
}
|
9458
9573
|
return callServiceAPI;
|
@@ -9460,26 +9575,26 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9460
9575
|
}, {
|
9461
9576
|
key: "extractResultData",
|
9462
9577
|
value: function () {
|
9463
|
-
var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9464
|
-
return _regeneratorRuntime().wrap(function
|
9465
|
-
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) {
|
9466
9581
|
case 0:
|
9467
9582
|
if (!e.message) {
|
9468
|
-
|
9583
|
+
_context104.next = 2;
|
9469
9584
|
break;
|
9470
9585
|
}
|
9471
9586
|
throw e.message;
|
9472
9587
|
case 2:
|
9473
|
-
return
|
9588
|
+
return _context104.abrupt("return", {
|
9474
9589
|
text: e.text
|
9475
9590
|
});
|
9476
9591
|
case 3:
|
9477
9592
|
case "end":
|
9478
|
-
return
|
9593
|
+
return _context104.stop();
|
9479
9594
|
}
|
9480
|
-
},
|
9595
|
+
}, _callee104);
|
9481
9596
|
}));
|
9482
|
-
function extractResultData(
|
9597
|
+
function extractResultData(_x188) {
|
9483
9598
|
return _extractResultData25.apply(this, arguments);
|
9484
9599
|
}
|
9485
9600
|
return extractResultData;
|
@@ -9627,11 +9742,11 @@ var Ro = /*#__PURE__*/function () {
|
|
9627
9742
|
}]);
|
9628
9743
|
}();
|
9629
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>";
|
9630
|
-
var
|
9631
|
-
function
|
9632
|
-
_classCallCheck(this,
|
9745
|
+
var Ce = /*#__PURE__*/function () {
|
9746
|
+
function Ce() {
|
9747
|
+
_classCallCheck(this, Ce);
|
9633
9748
|
}
|
9634
|
-
return _createClass(
|
9749
|
+
return _createClass(Ce, null, [{
|
9635
9750
|
key: "createImage",
|
9636
9751
|
value: function createImage(e, t) {
|
9637
9752
|
var i = new Image();
|
@@ -9641,20 +9756,20 @@ var Te = /*#__PURE__*/function () {
|
|
9641
9756
|
}, {
|
9642
9757
|
key: "addNewImageMessage",
|
9643
9758
|
value: function () {
|
9644
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9759
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e, t, i) {
|
9645
9760
|
var n, r;
|
9646
|
-
return _regeneratorRuntime().wrap(function
|
9647
|
-
while (1) switch (
|
9761
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
9762
|
+
while (1) switch (_context105.prev = _context105.next) {
|
9648
9763
|
case 0:
|
9649
|
-
n =
|
9764
|
+
n = Ce.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
9650
9765
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), q.addMessage(e, r, "image", i);
|
9651
9766
|
case 2:
|
9652
9767
|
case "end":
|
9653
|
-
return
|
9768
|
+
return _context105.stop();
|
9654
9769
|
}
|
9655
|
-
},
|
9770
|
+
}, _callee105);
|
9656
9771
|
}));
|
9657
|
-
function addNewImageMessage(
|
9772
|
+
function addNewImageMessage(_x189, _x190, _x191) {
|
9658
9773
|
return _addNewImageMessage.apply(this, arguments);
|
9659
9774
|
}
|
9660
9775
|
return addNewImageMessage;
|
@@ -9668,7 +9783,7 @@ var Te = /*#__PURE__*/function () {
|
|
9668
9783
|
}, {
|
9669
9784
|
key: "addNewAudioMessage",
|
9670
9785
|
value: function addNewAudioMessage(e, t, i) {
|
9671
|
-
var n =
|
9786
|
+
var n = Ce.createAudioElement(t, i),
|
9672
9787
|
r = e.createNewMessageElement("", i);
|
9673
9788
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"), q.addMessage(e, r, "audio", i);
|
9674
9789
|
}
|
@@ -9679,7 +9794,7 @@ var Te = /*#__PURE__*/function () {
|
|
9679
9794
|
t.classList.add("any-file-message-contents");
|
9680
9795
|
var i = document.createElement("div");
|
9681
9796
|
i.classList.add("any-file-message-icon-container");
|
9682
|
-
var n =
|
9797
|
+
var n = Z.createSVGElement(Io);
|
9683
9798
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9684
9799
|
var r = document.createElement("div");
|
9685
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);
|
@@ -9688,7 +9803,7 @@ var Te = /*#__PURE__*/function () {
|
|
9688
9803
|
key: "addNewAnyFileMessage",
|
9689
9804
|
value: function addNewAnyFileMessage(e, t, i) {
|
9690
9805
|
var n = e.createNewMessageElement("", i),
|
9691
|
-
r =
|
9806
|
+
r = Ce.createAnyFile(t);
|
9692
9807
|
n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r), q.addMessage(e, n, "file", i);
|
9693
9808
|
}
|
9694
9809
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
@@ -9696,21 +9811,21 @@ var Te = /*#__PURE__*/function () {
|
|
9696
9811
|
key: "addMessages",
|
9697
9812
|
value: function addMessages(e, t, i) {
|
9698
9813
|
t.forEach(function (n) {
|
9699
|
-
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);
|
9700
9815
|
});
|
9701
9816
|
}
|
9702
9817
|
}]);
|
9703
9818
|
}();
|
9704
|
-
var
|
9705
|
-
function
|
9819
|
+
var ke = /*#__PURE__*/function (_ot) {
|
9820
|
+
function ke(e, t, i) {
|
9706
9821
|
var _this44;
|
9707
|
-
_classCallCheck(this,
|
9822
|
+
_classCallCheck(this, ke);
|
9708
9823
|
var a, l;
|
9709
|
-
_this44 = _callSuper(this,
|
9824
|
+
_this44 = _callSuper(this, ke, [e]);
|
9710
9825
|
var n = t.permittedErrorPrefixes,
|
9711
9826
|
r = t.introPanelMarkUp,
|
9712
9827
|
o = t.demo;
|
9713
|
-
_this44._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this44._onClearMessages = Qt.onClearMessages.bind(_this44, e), _this44._onError = Qt.onError.bind(_this44, e), _this44._displayLoadingMessage =
|
9828
|
+
_this44._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this44._onClearMessages = Qt.onClearMessages.bind(_this44, e), _this44._onError = Qt.onError.bind(_this44, e), _this44._displayLoadingMessage = ke.getDisplayLoadingMessage(e, t), _this44._permittedErrorPrefixes = n, _this44.addSetupMessageIfNeeded(e, t) || _this44.populateIntroPanel(i, r, e.introPanelStyle), _this44.addIntroductoryMessage(e, t), _this44.populateHistory(e), _this44._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
9714
9829
|
return JSON.parse(JSON.stringify(_this44.messages));
|
9715
9830
|
}, e.clearMessages = _this44.clearMessages.bind(_this44, t), e.refreshMessages = _this44.refreshTextMessages.bind(_this44), e.scrollToBottom = j.scrollToBottom.bind(_this44, _this44.elementRef), e.addMessage = function (c, d) {
|
9716
9831
|
_this44.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
@@ -9721,8 +9836,8 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9721
9836
|
}), t.fetchHistory && _this44.fetchHistory(t.fetchHistory);
|
9722
9837
|
return _this44;
|
9723
9838
|
}
|
9724
|
-
_inherits(
|
9725
|
-
return _createClass(
|
9839
|
+
_inherits(ke, _ot);
|
9840
|
+
return _createClass(ke, [{
|
9726
9841
|
key: "prepareDemo",
|
9727
9842
|
value: function prepareDemo(e) {
|
9728
9843
|
_typeof(e) == "object" && (e.response && (this.customDemoResponse = e.response), e.displayErrors && (e.displayErrors["default"] && this.addNewErrorMessage("", ""), e.displayErrors.service && this.addNewErrorMessage("service", ""), e.displayErrors.speechToText && this.addNewErrorMessage("speechToText", "")), e.displayLoadingBubble && this.addLoadingMessage());
|
@@ -9760,9 +9875,9 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9760
9875
|
key: "populateHistory",
|
9761
9876
|
value: function populateHistory(e) {
|
9762
9877
|
var _this45 = this;
|
9763
|
-
var t = e.history ||
|
9878
|
+
var t = e.history || he.processHistory(e);
|
9764
9879
|
t && (t.forEach(function (i) {
|
9765
|
-
|
9880
|
+
he.processHistoryFile(i), _this45.addNewMessage(i, !0);
|
9766
9881
|
}), setTimeout(function () {
|
9767
9882
|
return j.scrollToBottom(_this45.elementRef);
|
9768
9883
|
}, 0));
|
@@ -9770,15 +9885,15 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9770
9885
|
}, {
|
9771
9886
|
key: "fetchHistory",
|
9772
9887
|
value: function () {
|
9773
|
-
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9888
|
+
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(e) {
|
9774
9889
|
var _this46 = this;
|
9775
|
-
return _regeneratorRuntime().wrap(function
|
9776
|
-
while (1) switch (
|
9890
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
9891
|
+
while (1) switch (_context106.prev = _context106.next) {
|
9777
9892
|
case 0:
|
9778
|
-
|
9893
|
+
_context106.next = 2;
|
9779
9894
|
return e();
|
9780
9895
|
case 2:
|
9781
|
-
|
9896
|
+
_context106.sent.forEach(function (i) {
|
9782
9897
|
return _this46.addAnyMessage(i, !0);
|
9783
9898
|
});
|
9784
9899
|
setTimeout(function () {
|
@@ -9786,11 +9901,11 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9786
9901
|
}, 0);
|
9787
9902
|
case 4:
|
9788
9903
|
case "end":
|
9789
|
-
return
|
9904
|
+
return _context106.stop();
|
9790
9905
|
}
|
9791
|
-
},
|
9906
|
+
}, _callee106);
|
9792
9907
|
}));
|
9793
|
-
function fetchHistory(
|
9908
|
+
function fetchHistory(_x192) {
|
9794
9909
|
return _fetchHistory.apply(this, arguments);
|
9795
9910
|
}
|
9796
9911
|
return fetchHistory;
|
@@ -9806,11 +9921,11 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9806
9921
|
key: "addNewMessage",
|
9807
9922
|
value: function addNewMessage(e) {
|
9808
9923
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
9809
|
-
var i =
|
9924
|
+
var i = ke.createMessageContent(e),
|
9810
9925
|
n = {
|
9811
9926
|
status: e.overwrite
|
9812
9927
|
};
|
9813
|
-
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) {
|
9814
9929
|
var r = ct.add(this, i.html, i.role, this.messageElementRefs, n);
|
9815
9930
|
Le.isElementTemporary(r) && delete i.html;
|
9816
9931
|
}
|
@@ -9834,7 +9949,7 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9834
9949
|
value: function removeMessageOnError() {
|
9835
9950
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
9836
9951
|
t = e == null ? void 0 : e.bubbleElement;
|
9837
|
-
(t != null && t.classList.contains(
|
9952
|
+
(t != null && t.classList.contains(Se.MESSAGE_CLASS) && t.textContent === "" || ke.isTemporaryElement(e)) && this.removeLastMessage();
|
9838
9953
|
}
|
9839
9954
|
// prettier-ignore
|
9840
9955
|
}, {
|
@@ -9842,7 +9957,7 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9842
9957
|
value: function addNewErrorMessage(e, t) {
|
9843
9958
|
var l, c, d, h, u;
|
9844
9959
|
this.removeMessageOnError();
|
9845
|
-
var i =
|
9960
|
+
var i = ke.createBaseElements(),
|
9846
9961
|
n = i.outerContainer,
|
9847
9962
|
r = i.bubbleElement;
|
9848
9963
|
r.classList.add("error-message-text");
|
@@ -9857,10 +9972,10 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9857
9972
|
if (e) {
|
9858
9973
|
if (this._displayServiceErrorMessages) return e;
|
9859
9974
|
if (typeof e == "string" && this._permittedErrorPrefixes) {
|
9860
|
-
var t =
|
9975
|
+
var t = ke.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, e);
|
9861
9976
|
if (t) return t;
|
9862
9977
|
} else if (Array.isArray(e) && this._permittedErrorPrefixes) for (var _t3 = 0; _t3 < e.length; _t3 += 1) {
|
9863
|
-
var _i17 =
|
9978
|
+
var _i17 = ke.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, e[_t3]);
|
9864
9979
|
if (_i17) return _i17;
|
9865
9980
|
}
|
9866
9981
|
}
|
@@ -9885,16 +10000,16 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9885
10000
|
}, {
|
9886
10001
|
key: "populateIntroPanel",
|
9887
10002
|
value: function populateIntroPanel(e, t, i) {
|
9888
|
-
(e || t) && (this._introPanel = new ci(e, t, i), this._introPanel._elementRef && (
|
10003
|
+
(e || t) && (this._introPanel = new ci(e, t, i), this._introPanel._elementRef && (fe.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
9889
10004
|
}
|
9890
10005
|
}, {
|
9891
10006
|
key: "addMultipleFiles",
|
9892
10007
|
value: function () {
|
9893
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9894
|
-
return _regeneratorRuntime().wrap(function
|
9895
|
-
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) {
|
9896
10011
|
case 0:
|
9897
|
-
return
|
10012
|
+
return _context107.abrupt("return", Promise.all((e || []).map(function (t) {
|
9898
10013
|
return new Promise(function (i) {
|
9899
10014
|
if (!t.type || t.type === "any") {
|
9900
10015
|
var n = t.file.name || q.DEFAULT_FILE_NAME;
|
@@ -9917,11 +10032,11 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9917
10032
|
})));
|
9918
10033
|
case 1:
|
9919
10034
|
case "end":
|
9920
|
-
return
|
10035
|
+
return _context107.stop();
|
9921
10036
|
}
|
9922
|
-
},
|
10037
|
+
}, _callee107);
|
9923
10038
|
}));
|
9924
|
-
function addMultipleFiles(
|
10039
|
+
function addMultipleFiles(_x193) {
|
9925
10040
|
return _addMultipleFiles.apply(this, arguments);
|
9926
10041
|
}
|
9927
10042
|
return addMultipleFiles;
|
@@ -9933,7 +10048,7 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9933
10048
|
var i = [];
|
9934
10049
|
this.messageElementRefs.forEach(function (o) {
|
9935
10050
|
var a = o.bubbleElement.classList;
|
9936
|
-
a.contains("loading-message-text") || a.contains(
|
10051
|
+
a.contains("loading-message-text") || a.contains(Se.MESSAGE_CLASS) ? i.push(o) : o.outerContainer.remove();
|
9937
10052
|
}), Array.from(this.elementRef.children).forEach(function (o) {
|
9938
10053
|
var l;
|
9939
10054
|
var a = (l = o.children[0]) == null ? void 0 : l.children[0];
|
@@ -10024,11 +10139,11 @@ var ht = /*#__PURE__*/function () {
|
|
10024
10139
|
}]);
|
10025
10140
|
}();
|
10026
10141
|
var Nn = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
10027
|
-
var
|
10028
|
-
function
|
10029
|
-
_classCallCheck(this,
|
10142
|
+
var X = /*#__PURE__*/function () {
|
10143
|
+
function X() {
|
10144
|
+
_classCallCheck(this, X);
|
10030
10145
|
}
|
10031
|
-
return _createClass(
|
10146
|
+
return _createClass(X, null, [{
|
10032
10147
|
key: "createTextElement",
|
10033
10148
|
value: function createTextElement(e) {
|
10034
10149
|
var t = document.createElement("div");
|
@@ -10037,15 +10152,15 @@ var J = /*#__PURE__*/function () {
|
|
10037
10152
|
}, {
|
10038
10153
|
key: "createElement",
|
10039
10154
|
value: function createElement(e, t) {
|
10040
|
-
return t ?
|
10155
|
+
return t ? X.createTextElement(e) : Z.createSVGElement(e);
|
10041
10156
|
}
|
10042
10157
|
}, {
|
10043
10158
|
key: "createCustomElement",
|
10044
10159
|
value: function createCustomElement(e, t) {
|
10045
10160
|
var n, r, o, a;
|
10046
10161
|
var i = t == null ? void 0 : t[e];
|
10047
|
-
if ((n = i == null ? void 0 : i.text) != null && n.content) return
|
10048
|
-
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);
|
10049
10164
|
}
|
10050
10165
|
}, {
|
10051
10166
|
key: "processElement",
|
@@ -10058,16 +10173,16 @@ var J = /*#__PURE__*/function () {
|
|
10058
10173
|
key: "createSpecificStateElement",
|
10059
10174
|
value: function createSpecificStateElement(e, t, i) {
|
10060
10175
|
var n;
|
10061
|
-
return i && (n =
|
10176
|
+
return i && (n = X.createCustomElement(t, i)), X.processElement(e, n), n;
|
10062
10177
|
}
|
10063
10178
|
}]);
|
10064
10179
|
}();
|
10065
10180
|
var Lo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z\"></path>\n</svg>";
|
10066
|
-
var
|
10067
|
-
function
|
10068
|
-
_classCallCheck(this,
|
10181
|
+
var de = /*#__PURE__*/function () {
|
10182
|
+
function de() {
|
10183
|
+
_classCallCheck(this, de);
|
10069
10184
|
}
|
10070
|
-
return _createClass(
|
10185
|
+
return _createClass(de, null, [{
|
10071
10186
|
key: "unsetAllCSS",
|
10072
10187
|
value: function unsetAllCSS(e, t) {
|
10073
10188
|
var i, n;
|
@@ -10088,7 +10203,7 @@ var ce = /*#__PURE__*/function () {
|
|
10088
10203
|
}, {
|
10089
10204
|
key: "setElementCssUpToState",
|
10090
10205
|
value: function setElementCssUpToState(e, t, i) {
|
10091
|
-
|
10206
|
+
de.setElementsCSS(e, t, "default"), i !== "default" && (de.setElementsCSS(e, t, "hover"), i !== "hover" && de.setElementsCSS(e, t, "click"));
|
10092
10207
|
}
|
10093
10208
|
}]);
|
10094
10209
|
}();
|
@@ -10102,22 +10217,22 @@ var Bt = /*#__PURE__*/function () {
|
|
10102
10217
|
return _createClass(Bt, [{
|
10103
10218
|
key: "buttonMouseLeave",
|
10104
10219
|
value: function buttonMouseLeave(e) {
|
10105
|
-
this._mouseState.state = "default", e && (
|
10220
|
+
this._mouseState.state = "default", e && (de.unsetAllCSS(this.elementRef, e), de.setElementsCSS(this.elementRef, e, "default"));
|
10106
10221
|
}
|
10107
10222
|
}, {
|
10108
10223
|
key: "buttonMouseEnter",
|
10109
10224
|
value: function buttonMouseEnter(e) {
|
10110
|
-
this._mouseState.state = "hover", e &&
|
10225
|
+
this._mouseState.state = "hover", e && de.setElementsCSS(this.elementRef, e, "hover");
|
10111
10226
|
}
|
10112
10227
|
}, {
|
10113
10228
|
key: "buttonMouseUp",
|
10114
10229
|
value: function buttonMouseUp(e) {
|
10115
|
-
e &&
|
10230
|
+
e && de.unsetActionCSS(this.elementRef, e), this.buttonMouseEnter(e);
|
10116
10231
|
}
|
10117
10232
|
}, {
|
10118
10233
|
key: "buttonMouseDown",
|
10119
10234
|
value: function buttonMouseDown(e) {
|
10120
|
-
this._mouseState.state = "click", e &&
|
10235
|
+
this._mouseState.state = "click", e && de.setElementsCSS(this.elementRef, e, "click");
|
10121
10236
|
}
|
10122
10237
|
// be careful not to use onclick as that is used for button functionality
|
10123
10238
|
}, {
|
@@ -10131,7 +10246,7 @@ var Bt = /*#__PURE__*/function () {
|
|
10131
10246
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
10132
10247
|
var _i19 = e[t],
|
10133
10248
|
n = _i19 && this._customStyles[_i19];
|
10134
|
-
n &&
|
10249
|
+
n && de.unsetActionCSS(this.elementRef, n);
|
10135
10250
|
}
|
10136
10251
|
}
|
10137
10252
|
}, {
|
@@ -10140,7 +10255,7 @@ var Bt = /*#__PURE__*/function () {
|
|
10140
10255
|
if (!this._customStyles) return;
|
10141
10256
|
t && this.unsetCustomStateStyles(t);
|
10142
10257
|
var i = this._customStyles[e];
|
10143
|
-
i &&
|
10258
|
+
i && de.setElementCssUpToState(this.elementRef, i, this._mouseState.state), this.setEvents(i);
|
10144
10259
|
}
|
10145
10260
|
}]);
|
10146
10261
|
}();
|
@@ -10296,7 +10411,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10296
10411
|
}, {
|
10297
10412
|
key: "createInnerElement",
|
10298
10413
|
value: function createInnerElement(e, t, i) {
|
10299
|
-
return
|
10414
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
10300
10415
|
}
|
10301
10416
|
}, {
|
10302
10417
|
key: "addClickEvent",
|
@@ -10325,7 +10440,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10325
10440
|
}, {
|
10326
10441
|
key: "createSVGIconElement",
|
10327
10442
|
value: function createSVGIconElement() {
|
10328
|
-
return
|
10443
|
+
return Z.createSVGElement(Lo);
|
10329
10444
|
}
|
10330
10445
|
}, {
|
10331
10446
|
key: "createButtonContainer",
|
@@ -10466,7 +10581,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10466
10581
|
}, {
|
10467
10582
|
key: "createInnerElement",
|
10468
10583
|
value: function createInnerElement(e, t, i) {
|
10469
|
-
return
|
10584
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
10470
10585
|
}
|
10471
10586
|
}, {
|
10472
10587
|
key: "changeToActive",
|
@@ -10513,7 +10628,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10513
10628
|
}, {
|
10514
10629
|
key: "createSVGIconElement",
|
10515
10630
|
value: function createSVGIconElement() {
|
10516
|
-
var e =
|
10631
|
+
var e = Z.createSVGElement(Bo);
|
10517
10632
|
return e.id = "microphone-icon", e;
|
10518
10633
|
}
|
10519
10634
|
}]);
|
@@ -10638,11 +10753,11 @@ Object.defineProperty(Ti, "__esModule", {
|
|
10638
10753
|
value: !0
|
10639
10754
|
});
|
10640
10755
|
Ti.EventListeners = void 0;
|
10641
|
-
var
|
10642
|
-
function
|
10643
|
-
_classCallCheck(this,
|
10756
|
+
var ie = /*#__PURE__*/function () {
|
10757
|
+
function ie() {
|
10758
|
+
_classCallCheck(this, ie);
|
10644
10759
|
}
|
10645
|
-
return _createClass(
|
10760
|
+
return _createClass(ie, null, [{
|
10646
10761
|
key: "getElementIfFocusedOnAvailable",
|
10647
10762
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
10648
10763
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -10653,14 +10768,14 @@ var te = /*#__PURE__*/function () {
|
|
10653
10768
|
key: "keyDownWindow",
|
10654
10769
|
value: function keyDownWindow(e) {
|
10655
10770
|
var _this51 = this;
|
10656
|
-
e.element &&
|
10657
|
-
|
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);
|
10658
10773
|
}, 500));
|
10659
10774
|
}
|
10660
10775
|
}, {
|
10661
10776
|
key: "mouseDownWindow",
|
10662
10777
|
value: function mouseDownWindow(e, t) {
|
10663
|
-
this.mouseDownElement =
|
10778
|
+
this.mouseDownElement = ie.getElementIfFocusedOnAvailable(e, t.target);
|
10664
10779
|
}
|
10665
10780
|
}, {
|
10666
10781
|
key: "mouseUpWindow",
|
@@ -10671,7 +10786,7 @@ var te = /*#__PURE__*/function () {
|
|
10671
10786
|
key: "add",
|
10672
10787
|
value: function add(e, t) {
|
10673
10788
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
10674
|
-
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));
|
10675
10790
|
}
|
10676
10791
|
}, {
|
10677
10792
|
key: "remove",
|
@@ -10680,8 +10795,8 @@ var te = /*#__PURE__*/function () {
|
|
10680
10795
|
}
|
10681
10796
|
}]);
|
10682
10797
|
}();
|
10683
|
-
Ti.EventListeners =
|
10684
|
-
|
10798
|
+
Ti.EventListeners = ie;
|
10799
|
+
ie.KEY_DOWN_TIMEOUT = null;
|
10685
10800
|
var Ci = {};
|
10686
10801
|
Object.defineProperty(Ci, "__esModule", {
|
10687
10802
|
value: !0
|
@@ -10891,11 +11006,11 @@ var Fn = qt,
|
|
10891
11006
|
Go = ft,
|
10892
11007
|
Bn = Ye,
|
10893
11008
|
jn = Xe;
|
10894
|
-
var
|
10895
|
-
function
|
10896
|
-
_classCallCheck(this,
|
11009
|
+
var ee = /*#__PURE__*/function () {
|
11010
|
+
function ee() {
|
11011
|
+
_classCallCheck(this, ee);
|
10897
11012
|
}
|
10898
|
-
return _createClass(
|
11013
|
+
return _createClass(ee, null, [{
|
10899
11014
|
key: "processCommand",
|
10900
11015
|
value: function processCommand(e, t) {
|
10901
11016
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? jn.Text.breakupIntoWordsArr(e) : e;
|
@@ -10906,7 +11021,7 @@ var Q = /*#__PURE__*/function () {
|
|
10906
11021
|
var t;
|
10907
11022
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (n, r) {
|
10908
11023
|
var o = e[r];
|
10909
|
-
return n[r] = typeof o == "string" ?
|
11024
|
+
return n[r] = typeof o == "string" ? ee.processCommand(o, e.settings) : o, n;
|
10910
11025
|
}, {});
|
10911
11026
|
}
|
10912
11027
|
}, {
|
@@ -10924,7 +11039,7 @@ var Q = /*#__PURE__*/function () {
|
|
10924
11039
|
}, {
|
10925
11040
|
key: "setText",
|
10926
11041
|
value: function setText(e, t, i, n) {
|
10927
|
-
|
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 () {
|
10928
11043
|
return Fn.AutoScroll.scrollGeneric(e, n);
|
10929
11044
|
})), e.resetRecording(t);
|
10930
11045
|
}
|
@@ -10954,38 +11069,38 @@ var Q = /*#__PURE__*/function () {
|
|
10954
11069
|
if (!c || !n || !i) return;
|
10955
11070
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
10956
11071
|
h = jn.Text.breakupIntoWordsArr(d),
|
10957
|
-
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;
|
10958
11073
|
if (c.commandMode && u(c.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
10959
|
-
return
|
11074
|
+
return ee.toggleCommandModeOn(e);
|
10960
11075
|
}), {
|
10961
11076
|
doNotProcessTranscription: !1
|
10962
11077
|
};
|
10963
11078
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
10964
|
-
if (c.stop && u(c.stop, d, h)) return
|
11079
|
+
if (c.stop && u(c.stop, d, h)) return ee.toggleCommandModeOff(e), setTimeout(function () {
|
10965
11080
|
return e.stop();
|
10966
11081
|
}), {
|
10967
11082
|
doNotProcessTranscription: !1
|
10968
11083
|
};
|
10969
|
-
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 () {
|
10970
11085
|
var f;
|
10971
11086
|
e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
|
10972
11087
|
}), {
|
10973
11088
|
doNotProcessTranscription: !1
|
10974
11089
|
};
|
10975
|
-
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), {
|
10976
11091
|
doNotProcessTranscription: !0
|
10977
11092
|
};
|
10978
|
-
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), {
|
10979
11094
|
doNotProcessTranscription: !0
|
10980
11095
|
};
|
10981
|
-
if (c.removeAllText && u(c.removeAllText, d, h)) return
|
11096
|
+
if (c.removeAllText && u(c.removeAllText, d, h)) return ee.setText(e, i, "", n), {
|
10982
11097
|
doNotProcessTranscription: !0
|
10983
11098
|
};
|
10984
11099
|
}
|
10985
11100
|
}
|
10986
11101
|
}]);
|
10987
11102
|
}();
|
10988
|
-
Ht.CommandUtils =
|
11103
|
+
Ht.CommandUtils = ee;
|
10989
11104
|
var ki = {};
|
10990
11105
|
Object.defineProperty(ki, "__esModule", {
|
10991
11106
|
value: !0
|
@@ -11117,7 +11232,7 @@ var Hn = Ti,
|
|
11117
11232
|
qn = Ht,
|
11118
11233
|
$t = qt,
|
11119
11234
|
Ui = ki,
|
11120
|
-
|
11235
|
+
ue = Ze,
|
11121
11236
|
Hi = Ai,
|
11122
11237
|
zn = ft,
|
11123
11238
|
Vn = Ye,
|
@@ -11125,7 +11240,7 @@ var Hn = Ti,
|
|
11125
11240
|
var Jo = /*#__PURE__*/function () {
|
11126
11241
|
function Jo() {
|
11127
11242
|
_classCallCheck(this, Jo);
|
11128
|
-
this.finalTranscript = "", this.interimSpan =
|
11243
|
+
this.finalTranscript = "", this.interimSpan = ue.Elements.createInterimSpan(), this.finalSpan = ue.Elements.createGenericSpan(), this.scrollingSpan = ue.Elements.createGenericSpan(), this.isCursorAtEnd = !1, this.spansPopulated = !1, this.startPadding = "", this.endPadding = "", this.numberOfSpacesBeforeNewText = 0, this.numberOfSpacesAfterNewText = 0, this.isHighlighted = !1, this.primitiveTextRecorded = !1, this.recognizing = !1, this._displayInterimResults = !0, this.insertInCursorLocation = !0, this.autoScroll = !0, this.isRestarting = !1, this.isPaused = !1, this.isWaitingForCommand = !1, this.isTargetInShadow = !1, this.cannotBeStopped = !1, this.resetState();
|
11129
11244
|
}
|
11130
11245
|
return _createClass(Jo, [{
|
11131
11246
|
key: "prepareBeforeStart",
|
@@ -11138,12 +11253,12 @@ var Jo = /*#__PURE__*/function () {
|
|
11138
11253
|
if (!r) return;
|
11139
11254
|
this.prepare(r);
|
11140
11255
|
} else this.prepare(e.element);
|
11141
|
-
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"],
|
11256
|
+
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], ue.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((i = this._options) === null || i === void 0) && i.commands && (this.commands = qn.CommandUtils.process(this._options.commands));
|
11142
11257
|
}
|
11143
11258
|
}, {
|
11144
11259
|
key: "prepare",
|
11145
11260
|
value: function prepare(e) {
|
11146
|
-
Hi.Padding.setState(this, e), Ui.Highlight.setState(this, e), this.isTargetInShadow =
|
11261
|
+
Hi.Padding.setState(this, e), Ui.Highlight.setState(this, e), this.isTargetInShadow = ue.Elements.isInsideShadowDOM(e), ue.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
|
11147
11262
|
}
|
11148
11263
|
// there was an attempt to optimize this by not having to restart the service and just reset state:
|
11149
11264
|
// unfortunately it did not work because the service would still continue firing the intermediate and final results
|
@@ -11187,7 +11302,7 @@ var Jo = /*#__PURE__*/function () {
|
|
11187
11302
|
}, {
|
11188
11303
|
key: "updateGenericElement",
|
11189
11304
|
value: function updateGenericElement(e, t, i) {
|
11190
|
-
this.isHighlighted && Ui.Highlight.removeForGeneric(this, e), this.spansPopulated ||
|
11305
|
+
this.isHighlighted && Ui.Highlight.removeForGeneric(this, e), this.spansPopulated || ue.Elements.appendSpans(this, e);
|
11191
11306
|
var n = (i ? "" : this.startPadding) + qi.Text.lineBreak(this.finalTranscript);
|
11192
11307
|
this.finalSpan.innerHTML = n;
|
11193
11308
|
var r = $t.AutoScroll.isRequired(this.autoScroll, e);
|
@@ -11198,7 +11313,7 @@ var Jo = /*#__PURE__*/function () {
|
|
11198
11313
|
}, {
|
11199
11314
|
key: "finalise",
|
11200
11315
|
value: function finalise(e) {
|
11201
|
-
this._genericElement && (e ? (this.finalSpan =
|
11316
|
+
this._genericElement && (e ? (this.finalSpan = ue.Elements.createGenericSpan(), this.setInterimColorToFinal(), this.interimSpan = ue.Elements.createInterimSpan(), this.scrollingSpan = ue.Elements.createGenericSpan()) : this._genericElement.textContent = this._genericElement.textContent, this.spansPopulated = !1), Hn.EventListeners.remove(this);
|
11202
11317
|
}
|
11203
11318
|
}, {
|
11204
11319
|
key: "setInterimColorToFinal",
|
@@ -11372,26 +11487,26 @@ var fi = /*#__PURE__*/function () {
|
|
11372
11487
|
}, {
|
11373
11488
|
key: "getNewSpeechConfig",
|
11374
11489
|
value: function () {
|
11375
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11376
|
-
return _regeneratorRuntime().wrap(function
|
11377
|
-
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) {
|
11378
11493
|
case 0:
|
11379
11494
|
if (!t.region) {
|
11380
|
-
|
11495
|
+
_context108.next = 2;
|
11381
11496
|
break;
|
11382
11497
|
}
|
11383
|
-
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) {
|
11384
11499
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11385
11500
|
})["catch"](function (i) {
|
11386
11501
|
return console.error(i), null;
|
11387
11502
|
}) : null);
|
11388
11503
|
case 2:
|
11389
11504
|
case "end":
|
11390
|
-
return
|
11505
|
+
return _context108.stop();
|
11391
11506
|
}
|
11392
|
-
},
|
11507
|
+
}, _callee108);
|
11393
11508
|
}));
|
11394
|
-
function getNewSpeechConfig(
|
11509
|
+
function getNewSpeechConfig(_x194, _x195) {
|
11395
11510
|
return _getNewSpeechConfig.apply(this, arguments);
|
11396
11511
|
}
|
11397
11512
|
return getNewSpeechConfig;
|
@@ -11404,23 +11519,23 @@ var fi = /*#__PURE__*/function () {
|
|
11404
11519
|
}, {
|
11405
11520
|
key: "get",
|
11406
11521
|
value: function () {
|
11407
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11522
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee109(e, t) {
|
11408
11523
|
var i;
|
11409
|
-
return _regeneratorRuntime().wrap(function
|
11410
|
-
while (1) switch (
|
11524
|
+
return _regeneratorRuntime().wrap(function _callee109$(_context109) {
|
11525
|
+
while (1) switch (_context109.prev = _context109.next) {
|
11411
11526
|
case 0:
|
11412
|
-
|
11527
|
+
_context109.next = 2;
|
11413
11528
|
return fi.getNewSpeechConfig(e, t);
|
11414
11529
|
case 2:
|
11415
|
-
i =
|
11416
|
-
return
|
11530
|
+
i = _context109.sent;
|
11531
|
+
return _context109.abrupt("return", (i && fi.process(i, t), i));
|
11417
11532
|
case 4:
|
11418
11533
|
case "end":
|
11419
|
-
return
|
11534
|
+
return _context109.stop();
|
11420
11535
|
}
|
11421
|
-
},
|
11536
|
+
}, _callee109);
|
11422
11537
|
}));
|
11423
|
-
function get(
|
11538
|
+
function get(_x196, _x197) {
|
11424
11539
|
return _get.apply(this, arguments);
|
11425
11540
|
}
|
11426
11541
|
return get;
|
@@ -11506,28 +11621,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11506
11621
|
}, {
|
11507
11622
|
key: "startAsync",
|
11508
11623
|
value: function () {
|
11509
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11624
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee110(e) {
|
11510
11625
|
var t;
|
11511
|
-
return _regeneratorRuntime().wrap(function
|
11512
|
-
while (1) switch (
|
11626
|
+
return _regeneratorRuntime().wrap(function _callee110$(_context110) {
|
11627
|
+
while (1) switch (_context110.prev = _context110.next) {
|
11513
11628
|
case 0:
|
11514
|
-
|
11515
|
-
if (!
|
11516
|
-
|
11629
|
+
_context110.t0 = this.validate(e);
|
11630
|
+
if (!_context110.t0) {
|
11631
|
+
_context110.next = 6;
|
11517
11632
|
break;
|
11518
11633
|
}
|
11519
|
-
|
11634
|
+
_context110.next = 4;
|
11520
11635
|
return this.instantiateService(e);
|
11521
11636
|
case 4:
|
11522
11637
|
this._translations = e == null ? void 0 : e.translations;
|
11523
11638
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11524
11639
|
case 6:
|
11525
11640
|
case "end":
|
11526
|
-
return
|
11641
|
+
return _context110.stop();
|
11527
11642
|
}
|
11528
|
-
},
|
11643
|
+
}, _callee110, this);
|
11529
11644
|
}));
|
11530
|
-
function startAsync(
|
11645
|
+
function startAsync(_x198) {
|
11531
11646
|
return _startAsync.apply(this, arguments);
|
11532
11647
|
}
|
11533
11648
|
return startAsync;
|
@@ -11540,28 +11655,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11540
11655
|
}, {
|
11541
11656
|
key: "instantiateService",
|
11542
11657
|
value: function () {
|
11543
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11658
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee111(e) {
|
11544
11659
|
var t, i, n, r;
|
11545
|
-
return _regeneratorRuntime().wrap(function
|
11546
|
-
while (1) switch (
|
11660
|
+
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
11661
|
+
while (1) switch (_context111.prev = _context111.next) {
|
11547
11662
|
case 0:
|
11548
11663
|
t = pi.getAPI();
|
11549
11664
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11550
|
-
|
11665
|
+
_context111.next = 4;
|
11551
11666
|
return Kn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11552
11667
|
case 4:
|
11553
|
-
n =
|
11668
|
+
n = _context111.sent;
|
11554
11669
|
if (n) {
|
11555
11670
|
r = new t.SpeechRecognizer(n, i);
|
11556
11671
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11557
11672
|
} else this.error("Unable to contact Azure server");
|
11558
11673
|
case 6:
|
11559
11674
|
case "end":
|
11560
|
-
return
|
11675
|
+
return _context111.stop();
|
11561
11676
|
}
|
11562
|
-
},
|
11677
|
+
}, _callee111, this);
|
11563
11678
|
}));
|
11564
|
-
function instantiateService(
|
11679
|
+
function instantiateService(_x199) {
|
11565
11680
|
return _instantiateService.apply(this, arguments);
|
11566
11681
|
}
|
11567
11682
|
return instantiateService;
|
@@ -11662,7 +11777,7 @@ Object.defineProperty(cs, "__esModule", {
|
|
11662
11777
|
});
|
11663
11778
|
var Xn = Si,
|
11664
11779
|
ta = Ht,
|
11665
|
-
|
11780
|
+
re = Mi,
|
11666
11781
|
ia = Ri;
|
11667
11782
|
var tt = /*#__PURE__*/function () {
|
11668
11783
|
function tt() {
|
@@ -11673,12 +11788,12 @@ var tt = /*#__PURE__*/function () {
|
|
11673
11788
|
value: function toggle(e, t) {
|
11674
11789
|
var i, n;
|
11675
11790
|
var r = e.toLocaleLowerCase().trim();
|
11676
|
-
!((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'"));
|
11677
11792
|
}
|
11678
11793
|
}, {
|
11679
11794
|
key: "startWebSpeech",
|
11680
11795
|
value: function startWebSpeech(e) {
|
11681
|
-
tt.stop() || (
|
11796
|
+
tt.stop() || (re.GlobalState.service = new Xn.WebSpeech(), re.GlobalState.service.start(e));
|
11682
11797
|
}
|
11683
11798
|
}, {
|
11684
11799
|
key: "isWebSpeechSupported",
|
@@ -11689,18 +11804,18 @@ var tt = /*#__PURE__*/function () {
|
|
11689
11804
|
key: "startAzure",
|
11690
11805
|
value: function startAzure(e) {
|
11691
11806
|
var t;
|
11692
|
-
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));
|
11693
11808
|
}
|
11694
11809
|
}, {
|
11695
11810
|
key: "stop",
|
11696
11811
|
value: function stop() {
|
11697
11812
|
var e;
|
11698
|
-
return
|
11813
|
+
return re.GlobalState.doubleClickDetector() ? !0 : (!((e = re.GlobalState.service) === null || e === void 0) && e.recognizing && re.GlobalState.service.stop(), !1);
|
11699
11814
|
}
|
11700
11815
|
}, {
|
11701
11816
|
key: "endCommandMode",
|
11702
11817
|
value: function endCommandMode() {
|
11703
|
-
|
11818
|
+
re.GlobalState.service && ta.CommandUtils.toggleCommandModeOff(re.GlobalState.service);
|
11704
11819
|
}
|
11705
11820
|
}]);
|
11706
11821
|
}();
|
@@ -11838,32 +11953,32 @@ var Tt = /*#__PURE__*/function (_Lt) {
|
|
11838
11953
|
}(Lt);
|
11839
11954
|
Tt.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
11840
11955
|
var Ot = Tt;
|
11841
|
-
var
|
11956
|
+
var xe = /*#__PURE__*/function () {
|
11842
11957
|
// prettier-ignore
|
11843
|
-
function
|
11958
|
+
function xe(e, t, i, n) {
|
11844
11959
|
var _this58 = this;
|
11845
|
-
_classCallCheck(this,
|
11960
|
+
_classCallCheck(this, xe);
|
11846
11961
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = n, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
11847
11962
|
_this58._validationHandler = e._validationHandler;
|
11848
11963
|
});
|
11849
11964
|
}
|
11850
|
-
return _createClass(
|
11965
|
+
return _createClass(xe, [{
|
11851
11966
|
key: "attemptAddFile",
|
11852
11967
|
value: function attemptAddFile(e, t) {
|
11853
|
-
return
|
11968
|
+
return xe.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
11854
11969
|
}
|
11855
11970
|
}, {
|
11856
11971
|
key: "addAttachmentBasedOnType",
|
11857
11972
|
value: function addAttachmentBasedOnType(e, t, i) {
|
11858
|
-
var n =
|
11973
|
+
var n = xe.getTypeFromBlob(e);
|
11859
11974
|
if (n === "image") {
|
11860
|
-
var r =
|
11975
|
+
var r = xe.createImageAttachment(t);
|
11861
11976
|
this.addFileAttachment(e, "image", r, i);
|
11862
11977
|
} else if (n === "audio") {
|
11863
11978
|
var _r2 = Nt.createAudioAttachment(t);
|
11864
11979
|
this.addFileAttachment(e, "audio", _r2, i);
|
11865
11980
|
} else {
|
11866
|
-
var _r3 =
|
11981
|
+
var _r3 = xe.createAnyFileAttachment(e.name);
|
11867
11982
|
this.addFileAttachment(e, "any", _r3, i);
|
11868
11983
|
}
|
11869
11984
|
}
|
@@ -11871,7 +11986,7 @@ var Ee = /*#__PURE__*/function () {
|
|
11871
11986
|
key: "addFileAttachment",
|
11872
11987
|
value: function addFileAttachment(e, t, i, n) {
|
11873
11988
|
var a;
|
11874
|
-
var r =
|
11989
|
+
var r = xe.createContainer(i);
|
11875
11990
|
if (this._attachments.length >= this._fileCountLimit) {
|
11876
11991
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
11877
11992
|
l == null || l.click();
|
@@ -11973,19 +12088,19 @@ var Ee = /*#__PURE__*/function () {
|
|
11973
12088
|
}();
|
11974
12089
|
var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
11975
12090
|
Zn = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
11976
|
-
|
12091
|
+
ve = /*#__PURE__*/function (_xe) {
|
11977
12092
|
// prettier-ignore
|
11978
|
-
function
|
11979
|
-
_classCallCheck(this,
|
11980
|
-
return _callSuper(this,
|
12093
|
+
function ve(e, t, i, n) {
|
12094
|
+
_classCallCheck(this, ve);
|
12095
|
+
return _callSuper(this, ve, [e, t, i, n]);
|
11981
12096
|
}
|
11982
|
-
_inherits(
|
11983
|
-
return _createClass(
|
12097
|
+
_inherits(ve, _xe);
|
12098
|
+
return _createClass(ve, [{
|
11984
12099
|
key: "createTimer",
|
11985
12100
|
value: function createTimer(e, t) {
|
11986
12101
|
var _this59 = this;
|
11987
12102
|
var i = 0;
|
11988
|
-
var n = t !== void 0 && t <
|
12103
|
+
var n = t !== void 0 && t < ve.TIMER_LIMIT_S ? t : ve.TIMER_LIMIT_S;
|
11989
12104
|
return setInterval(function () {
|
11990
12105
|
var a;
|
11991
12106
|
i += 1, i === n && ((a = _this59.stopPlaceholderCallback) == null || a.call(_this59), _this59.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -11997,12 +12112,12 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
11997
12112
|
}, {
|
11998
12113
|
key: "createPlaceholderAudioAttachment",
|
11999
12114
|
value: function createPlaceholderAudioAttachment(e) {
|
12000
|
-
var t =
|
12115
|
+
var t = ve.createAudioContainer(),
|
12001
12116
|
i = document.createElement("div");
|
12002
12117
|
i.classList.add("audio-placeholder-text-3-digits");
|
12003
12118
|
var n = document.createElement("div");
|
12004
12119
|
n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
|
12005
|
-
var r =
|
12120
|
+
var r = Z.createSVGElement(Zn);
|
12006
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;
|
12007
12122
|
}
|
12008
12123
|
}, {
|
@@ -12034,7 +12149,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12034
12149
|
key: "completePlaceholderAttachment",
|
12035
12150
|
value: function completePlaceholderAttachment(e, t) {
|
12036
12151
|
var i = this._activePlaceholderAttachment;
|
12037
|
-
i && (i.file = e,
|
12152
|
+
i && (i.file = e, ve.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
12038
12153
|
}
|
12039
12154
|
}, {
|
12040
12155
|
key: "removePlaceholderAttachment",
|
@@ -12058,9 +12173,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12058
12173
|
var i = e.parentElement ? j.cloneElement(e) : e,
|
12059
12174
|
n = document.createElement("audio");
|
12060
12175
|
n.src = t;
|
12061
|
-
var r =
|
12176
|
+
var r = Z.createSVGElement(sa);
|
12062
12177
|
r.classList.add("attachment-icon", "play-icon");
|
12063
|
-
var o =
|
12178
|
+
var o = Z.createSVGElement(Zn);
|
12064
12179
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
|
12065
12180
|
i.replaceChildren(o);
|
12066
12181
|
}, n.onpause = function () {
|
@@ -12074,8 +12189,8 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12074
12189
|
}, {
|
12075
12190
|
key: "createAudioAttachment",
|
12076
12191
|
value: function createAudioAttachment(e) {
|
12077
|
-
var t =
|
12078
|
-
return
|
12192
|
+
var t = ve.createAudioContainer();
|
12193
|
+
return ve.addAudioElements(t, e), t;
|
12079
12194
|
}
|
12080
12195
|
}, {
|
12081
12196
|
key: "stopAttachmentPlayback",
|
@@ -12084,9 +12199,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12084
12199
|
(n = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && n.classList.contains("stop-icon") && e.children[0].click();
|
12085
12200
|
}
|
12086
12201
|
}]);
|
12087
|
-
}(
|
12088
|
-
|
12089
|
-
var Nt =
|
12202
|
+
}(xe);
|
12203
|
+
ve.TIMER_LIMIT_S = 5999;
|
12204
|
+
var Nt = ve;
|
12090
12205
|
var ra = /*#__PURE__*/function () {
|
12091
12206
|
function ra() {
|
12092
12207
|
_classCallCheck(this, ra);
|
@@ -12096,7 +12211,7 @@ var ra = /*#__PURE__*/function () {
|
|
12096
12211
|
value:
|
12097
12212
|
// prettier-ignore
|
12098
12213
|
function create(e, t, i, n, r) {
|
12099
|
-
return r === "audio" ? new Nt(e, t, i, n) : new
|
12214
|
+
return r === "audio" ? new Nt(e, t, i, n) : new xe(e, t, i, n);
|
12100
12215
|
}
|
12101
12216
|
}]);
|
12102
12217
|
}();
|
@@ -12136,33 +12251,33 @@ var zt = /*#__PURE__*/function () {
|
|
12136
12251
|
}, {
|
12137
12252
|
key: "completePlaceholders",
|
12138
12253
|
value: function () {
|
12139
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12140
|
-
return _regeneratorRuntime().wrap(function
|
12141
|
-
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) {
|
12142
12257
|
case 0:
|
12143
|
-
|
12258
|
+
_context113.next = 2;
|
12144
12259
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
12145
|
-
var
|
12260
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee112(e) {
|
12146
12261
|
var t;
|
12147
|
-
return _regeneratorRuntime().wrap(function
|
12148
|
-
while (1) switch (
|
12262
|
+
return _regeneratorRuntime().wrap(function _callee112$(_context112) {
|
12263
|
+
while (1) switch (_context112.prev = _context112.next) {
|
12149
12264
|
case 0:
|
12150
|
-
return
|
12265
|
+
return _context112.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
12151
12266
|
case 1:
|
12152
12267
|
case "end":
|
12153
|
-
return
|
12268
|
+
return _context112.stop();
|
12154
12269
|
}
|
12155
|
-
},
|
12270
|
+
}, _callee112);
|
12156
12271
|
}));
|
12157
|
-
return function (
|
12158
|
-
return
|
12272
|
+
return function (_x200) {
|
12273
|
+
return _ref15.apply(this, arguments);
|
12159
12274
|
};
|
12160
12275
|
}()));
|
12161
12276
|
case 2:
|
12162
12277
|
case "end":
|
12163
|
-
return
|
12278
|
+
return _context113.stop();
|
12164
12279
|
}
|
12165
|
-
},
|
12280
|
+
}, _callee113, this);
|
12166
12281
|
}));
|
12167
12282
|
function completePlaceholders() {
|
12168
12283
|
return _completePlaceholders.apply(this, arguments);
|
@@ -12198,12 +12313,12 @@ var zt = /*#__PURE__*/function () {
|
|
12198
12313
|
}
|
12199
12314
|
}]);
|
12200
12315
|
}();
|
12201
|
-
var
|
12202
|
-
function
|
12203
|
-
_classCallCheck(this,
|
12204
|
-
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);
|
12205
12320
|
}
|
12206
|
-
return _createClass(
|
12321
|
+
return _createClass(ce, [{
|
12207
12322
|
key: "isOpen",
|
12208
12323
|
value: function isOpen() {
|
12209
12324
|
return this._isOpen;
|
@@ -12225,7 +12340,7 @@ var le = /*#__PURE__*/function () {
|
|
12225
12340
|
var _this62 = this;
|
12226
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 () {
|
12227
12342
|
_this62._elementRef.style.display = "none", _this62._backgroundPanelRef.style.display = "none";
|
12228
|
-
},
|
12343
|
+
}, ce.MODAL_CLOSE_TIMEOUT_MS);
|
12229
12344
|
}
|
12230
12345
|
}, {
|
12231
12346
|
key: "displayModalElements",
|
@@ -12241,7 +12356,7 @@ var le = /*#__PURE__*/function () {
|
|
12241
12356
|
key: "addCloseButton",
|
12242
12357
|
value: function addCloseButton(e, t, i) {
|
12243
12358
|
var _this63 = this;
|
12244
|
-
var n = t ?
|
12359
|
+
var n = t ? ce.createSVGButton(e) : ce.createTextButton(e);
|
12245
12360
|
return this.addButtons(n), n.onclick = function () {
|
12246
12361
|
_this63.close(), setTimeout(function () {
|
12247
12362
|
i == null || i();
|
@@ -12295,7 +12410,7 @@ var le = /*#__PURE__*/function () {
|
|
12295
12410
|
value: function createSVGButton(e) {
|
12296
12411
|
var t = document.createElement("div");
|
12297
12412
|
t.classList.add("modal-button", "modal-svg-button");
|
12298
|
-
var i =
|
12413
|
+
var i = Z.createSVGElement(e);
|
12299
12414
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
12300
12415
|
}
|
12301
12416
|
}, {
|
@@ -12303,14 +12418,14 @@ var le = /*#__PURE__*/function () {
|
|
12303
12418
|
value: function createTextModalFunc(e, t, i) {
|
12304
12419
|
var n;
|
12305
12420
|
if (_typeof(t) == "object" && (n = t.files) != null && n.infoModal) {
|
12306
|
-
var r = new
|
12421
|
+
var r = new ce(e, ["modal-content"], t.files.infoModal.containerStyle);
|
12307
12422
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
12308
12423
|
}
|
12309
12424
|
}
|
12310
12425
|
}]);
|
12311
12426
|
}();
|
12312
|
-
|
12313
|
-
var ze =
|
12427
|
+
ce.MODAL_CLOSE_TIMEOUT_MS = 190;
|
12428
|
+
var ze = ce;
|
12314
12429
|
var xt = /*#__PURE__*/function (_Bt3) {
|
12315
12430
|
// prettier-ignore
|
12316
12431
|
function xt(e, t, i, n, r, o) {
|
@@ -12344,7 +12459,7 @@ var xt = /*#__PURE__*/function (_Bt3) {
|
|
12344
12459
|
}, {
|
12345
12460
|
key: "createInnerElement",
|
12346
12461
|
value: function createInnerElement(e, t, i) {
|
12347
|
-
return
|
12462
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
12348
12463
|
}
|
12349
12464
|
}, {
|
12350
12465
|
key: "addClickEvent",
|
@@ -12373,20 +12488,20 @@ var xt = /*#__PURE__*/function (_Bt3) {
|
|
12373
12488
|
}, {
|
12374
12489
|
key: "createSVGIconElement",
|
12375
12490
|
value: function createSVGIconElement(e, t) {
|
12376
|
-
var i =
|
12491
|
+
var i = Z.createSVGElement(t);
|
12377
12492
|
return i.id = e, i;
|
12378
12493
|
}
|
12379
12494
|
}]);
|
12380
12495
|
}(Bt);
|
12381
|
-
var
|
12382
|
-
function
|
12383
|
-
_classCallCheck(this,
|
12496
|
+
var ye = /*#__PURE__*/function () {
|
12497
|
+
function ye() {
|
12498
|
+
_classCallCheck(this, ye);
|
12384
12499
|
}
|
12385
|
-
return _createClass(
|
12500
|
+
return _createClass(ye, null, [{
|
12386
12501
|
key: "create",
|
12387
12502
|
value: function create(e, t, i) {
|
12388
|
-
var n =
|
12389
|
-
|
12503
|
+
var n = ye.createElement(i);
|
12504
|
+
ye.addEvents(n, e, t), e.appendChild(n);
|
12390
12505
|
}
|
12391
12506
|
}, {
|
12392
12507
|
key: "createElement",
|
@@ -12398,13 +12513,13 @@ var ve = /*#__PURE__*/function () {
|
|
12398
12513
|
key: "addEvents",
|
12399
12514
|
value: function addEvents(e, t, i) {
|
12400
12515
|
t.ondragenter = function (n) {
|
12401
|
-
n.preventDefault(),
|
12516
|
+
n.preventDefault(), ye.display(e);
|
12402
12517
|
}, e.ondragleave = function (n) {
|
12403
|
-
n.preventDefault(),
|
12518
|
+
n.preventDefault(), ye.hide(e);
|
12404
12519
|
}, e.ondragover = function (n) {
|
12405
12520
|
n.preventDefault();
|
12406
12521
|
}, e.ondrop = function (n) {
|
12407
|
-
n.preventDefault(),
|
12522
|
+
n.preventDefault(), ye.uploadFile(i, n), ye.hide(e);
|
12408
12523
|
};
|
12409
12524
|
}
|
12410
12525
|
}, {
|
@@ -12447,26 +12562,26 @@ var Fe = /*#__PURE__*/function () {
|
|
12447
12562
|
}, {
|
12448
12563
|
key: "useValidationFunc",
|
12449
12564
|
value: function () {
|
12450
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12565
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee114(e, t, i, n) {
|
12451
12566
|
var r, o, a, l;
|
12452
|
-
return _regeneratorRuntime().wrap(function
|
12453
|
-
while (1) switch (
|
12567
|
+
return _regeneratorRuntime().wrap(function _callee114$(_context114) {
|
12568
|
+
while (1) switch (_context114.prev = _context114.next) {
|
12454
12569
|
case 0:
|
12455
12570
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
12456
|
-
|
12571
|
+
_context114.next = 3;
|
12457
12572
|
return i.completePlaceholders();
|
12458
12573
|
case 3:
|
12459
12574
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
12460
12575
|
return c.file;
|
12461
12576
|
});
|
12462
|
-
return
|
12577
|
+
return _context114.abrupt("return", Fe.validate(e, n, o, l));
|
12463
12578
|
case 5:
|
12464
12579
|
case "end":
|
12465
|
-
return
|
12580
|
+
return _context114.stop();
|
12466
12581
|
}
|
12467
|
-
},
|
12582
|
+
}, _callee114);
|
12468
12583
|
}));
|
12469
|
-
function useValidationFunc(
|
12584
|
+
function useValidationFunc(_x201, _x202, _x203, _x204) {
|
12470
12585
|
return _useValidationFunc.apply(this, arguments);
|
12471
12586
|
}
|
12472
12587
|
return useValidationFunc;
|
@@ -12474,22 +12589,22 @@ var Fe = /*#__PURE__*/function () {
|
|
12474
12589
|
}, {
|
12475
12590
|
key: "useValidationFuncProgrammatic",
|
12476
12591
|
value: function () {
|
12477
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12592
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee115(e, t, i) {
|
12478
12593
|
var r, n;
|
12479
|
-
return _regeneratorRuntime().wrap(function
|
12480
|
-
while (1) switch (
|
12594
|
+
return _regeneratorRuntime().wrap(function _callee115$(_context115) {
|
12595
|
+
while (1) switch (_context115.prev = _context115.next) {
|
12481
12596
|
case 0:
|
12482
12597
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
12483
12598
|
return o.file;
|
12484
12599
|
});
|
12485
|
-
return
|
12600
|
+
return _context115.abrupt("return", Fe.validate(e, i, t.text, n, !0));
|
12486
12601
|
case 2:
|
12487
12602
|
case "end":
|
12488
|
-
return
|
12603
|
+
return _context115.stop();
|
12489
12604
|
}
|
12490
|
-
},
|
12605
|
+
}, _callee115);
|
12491
12606
|
}));
|
12492
|
-
function useValidationFuncProgrammatic(
|
12607
|
+
function useValidationFuncProgrammatic(_x205, _x206, _x207) {
|
12493
12608
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
12494
12609
|
}
|
12495
12610
|
return useValidationFuncProgrammatic;
|
@@ -12503,29 +12618,29 @@ var Fe = /*#__PURE__*/function () {
|
|
12503
12618
|
}, {
|
12504
12619
|
key: "attach",
|
12505
12620
|
value: function attach(e, t, i, n, r) {
|
12506
|
-
var o = e.validateInput ||
|
12621
|
+
var o = e.validateInput || he.processValidateInput(e);
|
12507
12622
|
e._validationHandler = /*#__PURE__*/function () {
|
12508
|
-
var
|
12623
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee116(a) {
|
12509
12624
|
var l;
|
12510
|
-
return _regeneratorRuntime().wrap(function
|
12511
|
-
while (1) switch (
|
12625
|
+
return _regeneratorRuntime().wrap(function _callee116$(_context116) {
|
12626
|
+
while (1) switch (_context116.prev = _context116.next) {
|
12512
12627
|
case 0:
|
12513
12628
|
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Fe.validateWebsocket(t, r))) {
|
12514
|
-
|
12629
|
+
_context116.next = 2;
|
12515
12630
|
break;
|
12516
12631
|
}
|
12517
|
-
return
|
12632
|
+
return _context116.abrupt("return", !1);
|
12518
12633
|
case 2:
|
12519
12634
|
l = o || t.canSendMessage;
|
12520
|
-
return
|
12635
|
+
return _context116.abrupt("return", l ? a ? Fe.useValidationFuncProgrammatic(l, a, r) : Fe.useValidationFunc(l, i, n, r) : null);
|
12521
12636
|
case 4:
|
12522
12637
|
case "end":
|
12523
|
-
return
|
12638
|
+
return _context116.stop();
|
12524
12639
|
}
|
12525
|
-
},
|
12640
|
+
}, _callee116);
|
12526
12641
|
}));
|
12527
|
-
return function (
|
12528
|
-
return
|
12642
|
+
return function (_x208) {
|
12643
|
+
return _ref16.apply(this, arguments);
|
12529
12644
|
};
|
12530
12645
|
}();
|
12531
12646
|
}
|
@@ -12711,21 +12826,21 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12711
12826
|
key: "createCustomElements",
|
12712
12827
|
value: function createCustomElements() {
|
12713
12828
|
var _this70 = this;
|
12714
|
-
var e =
|
12829
|
+
var e = X.createSpecificStateElement(this.elementRef, "submit", this._customStyles),
|
12715
12830
|
t = {
|
12716
12831
|
loading: void 0,
|
12717
12832
|
stop: void 0
|
12718
12833
|
};
|
12719
12834
|
return Object.keys(t).forEach(function (i) {
|
12720
12835
|
var n = i,
|
12721
|
-
r =
|
12836
|
+
r = X.createCustomElement(n, _this70._customStyles);
|
12722
12837
|
r && (t[n] = r);
|
12723
12838
|
}), t.submit = e, t;
|
12724
12839
|
}
|
12725
12840
|
}, {
|
12726
12841
|
key: "createDisabledIconElement",
|
12727
12842
|
value: function createDisabledIconElement(e) {
|
12728
|
-
return
|
12843
|
+
return X.createCustomElement("disabled", this._customStyles) || e.cloneNode(!0);
|
12729
12844
|
}
|
12730
12845
|
// prettier-ignore
|
12731
12846
|
}, {
|
@@ -12764,12 +12879,12 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12764
12879
|
}, {
|
12765
12880
|
key: "submitFromInput",
|
12766
12881
|
value: function () {
|
12767
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12882
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee117() {
|
12768
12883
|
var t, e, _i22;
|
12769
|
-
return _regeneratorRuntime().wrap(function
|
12770
|
-
while (1) switch (
|
12884
|
+
return _regeneratorRuntime().wrap(function _callee117$(_context117) {
|
12885
|
+
while (1) switch (_context117.prev = _context117.next) {
|
12771
12886
|
case 0:
|
12772
|
-
|
12887
|
+
_context117.next = 2;
|
12773
12888
|
return this._fileAttachments.completePlaceholders();
|
12774
12889
|
case 2:
|
12775
12890
|
e = this._fileAttachments.getAllFileData();
|
@@ -12785,9 +12900,9 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12785
12900
|
}
|
12786
12901
|
case 4:
|
12787
12902
|
case "end":
|
12788
|
-
return
|
12903
|
+
return _context117.stop();
|
12789
12904
|
}
|
12790
|
-
},
|
12905
|
+
}, _callee117, this);
|
12791
12906
|
}));
|
12792
12907
|
function submitFromInput() {
|
12793
12908
|
return _submitFromInput.apply(this, arguments);
|
@@ -12797,31 +12912,31 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12797
12912
|
}, {
|
12798
12913
|
key: "programmaticSubmit",
|
12799
12914
|
value: function () {
|
12800
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12915
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee118(e) {
|
12801
12916
|
var _this71 = this;
|
12802
12917
|
var t;
|
12803
|
-
return _regeneratorRuntime().wrap(function
|
12804
|
-
while (1) switch (
|
12918
|
+
return _regeneratorRuntime().wrap(function _callee118$(_context118) {
|
12919
|
+
while (1) switch (_context118.prev = _context118.next) {
|
12805
12920
|
case 0:
|
12806
|
-
typeof e == "string" && (e =
|
12921
|
+
typeof e == "string" && (e = he.processSubmitUserMessage(e));
|
12807
12922
|
t = {
|
12808
12923
|
text: e.text
|
12809
12924
|
};
|
12810
12925
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
12811
12926
|
return {
|
12812
12927
|
file: i,
|
12813
|
-
type:
|
12928
|
+
type: xe.getTypeFromBlob(i)
|
12814
12929
|
};
|
12815
12930
|
})), setTimeout(function () {
|
12816
12931
|
return _this71.attemptSubmit(t, !0);
|
12817
12932
|
});
|
12818
12933
|
case 3:
|
12819
12934
|
case "end":
|
12820
|
-
return
|
12935
|
+
return _context118.stop();
|
12821
12936
|
}
|
12822
|
-
},
|
12937
|
+
}, _callee118);
|
12823
12938
|
}));
|
12824
|
-
function programmaticSubmit(
|
12939
|
+
function programmaticSubmit(_x209) {
|
12825
12940
|
return _programmaticSubmit.apply(this, arguments);
|
12826
12941
|
}
|
12827
12942
|
return programmaticSubmit;
|
@@ -12829,31 +12944,31 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12829
12944
|
}, {
|
12830
12945
|
key: "attemptSubmit",
|
12831
12946
|
value: function () {
|
12832
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12947
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee119(e) {
|
12833
12948
|
var t,
|
12834
12949
|
r,
|
12835
12950
|
o,
|
12836
12951
|
a,
|
12837
12952
|
i,
|
12838
12953
|
n,
|
12839
|
-
|
12840
|
-
return _regeneratorRuntime().wrap(function
|
12841
|
-
while (1) switch (
|
12954
|
+
_args119 = arguments;
|
12955
|
+
return _regeneratorRuntime().wrap(function _callee119$(_context119) {
|
12956
|
+
while (1) switch (_context119.prev = _context119.next) {
|
12842
12957
|
case 0:
|
12843
|
-
t =
|
12844
|
-
|
12958
|
+
t = _args119.length > 1 && _args119[1] !== undefined ? _args119[1] : !1;
|
12959
|
+
_context119.next = 3;
|
12845
12960
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12846
12961
|
case 3:
|
12847
|
-
|
12848
|
-
|
12849
|
-
if (!(
|
12850
|
-
|
12962
|
+
_context119.t0 = _context119.sent;
|
12963
|
+
_context119.t1 = !1;
|
12964
|
+
if (!(_context119.t0 === _context119.t1)) {
|
12965
|
+
_context119.next = 7;
|
12851
12966
|
break;
|
12852
12967
|
}
|
12853
|
-
return
|
12968
|
+
return _context119.abrupt("return");
|
12854
12969
|
case 7:
|
12855
12970
|
this.changeToLoadingIcon();
|
12856
|
-
|
12971
|
+
_context119.next = 10;
|
12857
12972
|
return this.addNewMessage(e);
|
12858
12973
|
case 10:
|
12859
12974
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
@@ -12864,17 +12979,17 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12864
12979
|
text: e.text === "" ? void 0 : e.text,
|
12865
12980
|
files: i
|
12866
12981
|
};
|
12867
|
-
|
12982
|
+
_context119.next = 15;
|
12868
12983
|
return this._serviceIO.callAPI(n, this._messages);
|
12869
12984
|
case 15:
|
12870
12985
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12871
12986
|
case 16:
|
12872
12987
|
case "end":
|
12873
|
-
return
|
12988
|
+
return _context119.stop();
|
12874
12989
|
}
|
12875
|
-
},
|
12990
|
+
}, _callee119, this);
|
12876
12991
|
}));
|
12877
|
-
function attemptSubmit(
|
12992
|
+
function attemptSubmit(_x210) {
|
12878
12993
|
return _attemptSubmit.apply(this, arguments);
|
12879
12994
|
}
|
12880
12995
|
return attemptSubmit;
|
@@ -12882,35 +12997,35 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12882
12997
|
}, {
|
12883
12998
|
key: "addNewMessage",
|
12884
12999
|
value: function () {
|
12885
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
13000
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee120(_ref17) {
|
12886
13001
|
var e, t, i;
|
12887
|
-
return _regeneratorRuntime().wrap(function
|
12888
|
-
while (1) switch (
|
13002
|
+
return _regeneratorRuntime().wrap(function _callee120$(_context120) {
|
13003
|
+
while (1) switch (_context120.prev = _context120.next) {
|
12889
13004
|
case 0:
|
12890
|
-
e =
|
13005
|
+
e = _ref17.text, t = _ref17.files;
|
12891
13006
|
i = {
|
12892
13007
|
role: b.USER_ROLE
|
12893
13008
|
};
|
12894
13009
|
e && (i.text = e);
|
12895
|
-
|
12896
|
-
if (!
|
12897
|
-
|
13010
|
+
_context120.t0 = t;
|
13011
|
+
if (!_context120.t0) {
|
13012
|
+
_context120.next = 8;
|
12898
13013
|
break;
|
12899
13014
|
}
|
12900
|
-
|
13015
|
+
_context120.next = 7;
|
12901
13016
|
return this._messages.addMultipleFiles(t);
|
12902
13017
|
case 7:
|
12903
|
-
i.files =
|
13018
|
+
i.files = _context120.sent;
|
12904
13019
|
case 8:
|
12905
13020
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12906
13021
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12907
13022
|
case 10:
|
12908
13023
|
case "end":
|
12909
|
-
return
|
13024
|
+
return _context120.stop();
|
12910
13025
|
}
|
12911
|
-
},
|
13026
|
+
}, _callee120, this);
|
12912
13027
|
}));
|
12913
|
-
function addNewMessage(
|
13028
|
+
function addNewMessage(_x211) {
|
12914
13029
|
return _addNewMessage.apply(this, arguments);
|
12915
13030
|
}
|
12916
13031
|
return addNewMessage;
|
@@ -12963,7 +13078,7 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12963
13078
|
}, {
|
12964
13079
|
key: "createSubmitIconElement",
|
12965
13080
|
value: function createSubmitIconElement() {
|
12966
|
-
var e =
|
13081
|
+
var e = Z.createSVGElement(aa);
|
12967
13082
|
return e.id = "submit-icon", e;
|
12968
13083
|
}
|
12969
13084
|
}, {
|
@@ -12995,7 +13110,7 @@ var bn = /*#__PURE__*/function (_ze) {
|
|
12995
13110
|
var _this73$addButtonsAnd = _this73.addButtonsAndTheirEvents(t),
|
12996
13111
|
r = _this73$addButtonsAnd.captureButton,
|
12997
13112
|
o = _this73$addButtonsAnd.submitButton;
|
12998
|
-
_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;
|
12999
13114
|
return _this73;
|
13000
13115
|
}
|
13001
13116
|
_inherits(bn, _ze);
|
@@ -13121,7 +13236,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13121
13236
|
}, {
|
13122
13237
|
key: "createInnerElement",
|
13123
13238
|
value: function createInnerElement(e, t, i) {
|
13124
|
-
return
|
13239
|
+
return X.createSpecificStateElement(this.elementRef, t, i) || e;
|
13125
13240
|
}
|
13126
13241
|
}, {
|
13127
13242
|
key: "addClickEvent",
|
@@ -13140,7 +13255,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13140
13255
|
}, {
|
13141
13256
|
key: "createSVGIconElement",
|
13142
13257
|
value: function createSVGIconElement() {
|
13143
|
-
var e =
|
13258
|
+
var e = Z.createSVGElement(ua);
|
13144
13259
|
return e.id = "camera-icon", e;
|
13145
13260
|
}
|
13146
13261
|
}]);
|
@@ -13179,7 +13294,7 @@ var _t = /*#__PURE__*/function () {
|
|
13179
13294
|
button: new oa(_d, t.recordAudio)
|
13180
13295
|
};
|
13181
13296
|
}
|
13182
|
-
return
|
13297
|
+
return ye.isEnabled(r, e.dragAndDrop) && ye.create(i, r, e.dragAndDrop), r;
|
13183
13298
|
}
|
13184
13299
|
// prettier-ignore
|
13185
13300
|
}], [{
|
@@ -13228,7 +13343,7 @@ var vn = /*#__PURE__*/function () {
|
|
13228
13343
|
value: function createElements(e, t, i) {
|
13229
13344
|
var n = document.createElement("div");
|
13230
13345
|
n.id = "chat-view";
|
13231
|
-
var r = new
|
13346
|
+
var r = new ke(e, t, i);
|
13232
13347
|
t.websocket && z.createConnection(t, r);
|
13233
13348
|
var o = new _t(e, r, t, n);
|
13234
13349
|
return j.addElements(n, r.elementRef, o.elementRef), n;
|
@@ -13278,7 +13393,7 @@ var y = /*#__PURE__*/function (_Xi) {
|
|
13278
13393
|
key: "onRender",
|
13279
13394
|
value: function onRender() {
|
13280
13395
|
var _this$_childElement;
|
13281
|
-
Xt.attemptAppendStyleSheetToHead(this.style),
|
13396
|
+
Xt.attemptAppendStyleSheetToHead(this.style), he.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = Mo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (bt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), bt.applyDefaultStyleToComponent(this.style, this.chatStyle), he.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? Jt.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof U) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], vn.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof U && D.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Qt.onRender(this);
|
13282
13397
|
}
|
13283
13398
|
}, {
|
13284
13399
|
key: "disconnectedCallback",
|