deep-chat-dev 9.0.158 → 9.0.159
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 +4060 -3992
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +814 -752
- package/dist/services/openAI/openAIAssistantIO.d.ts +1 -2
- package/dist/services/openAI/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/utils/openAIAssistantFiles.d.ts +8 -1
- package/dist/services/openAI/utils/openAIAssistantFiles.d.ts.map +1 -1
- package/package.json +1 -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
|
351
|
+
Ae.TEXT_INPUT_ID = "text-input";
|
352
|
+
var Tt = Ae;
|
353
353
|
var yi = /*#__PURE__*/function () {
|
354
354
|
function yi() {
|
355
355
|
_classCallCheck(this, yi);
|
@@ -365,7 +365,7 @@ var yi = /*#__PURE__*/function () {
|
|
365
365
|
}, {
|
366
366
|
key: "focusFromParentElement",
|
367
367
|
value: function focusFromParentElement(e) {
|
368
|
-
var t = e.querySelector("#".concat(
|
368
|
+
var t = e.querySelector("#".concat(Tt.TEXT_INPUT_ID));
|
369
369
|
t && yi.focusEndOfInput(t);
|
370
370
|
}
|
371
371
|
}]);
|
@@ -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;
|
@@ -603,15 +603,15 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
603
603
|
}();
|
604
604
|
ee.CONTAINER_CLASS = "avatar-container";
|
605
605
|
var Zt = ee;
|
606
|
-
var
|
607
|
-
function
|
608
|
-
_classCallCheck(this,
|
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,20 +637,20 @@ 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 =
|
652
|
+
ge.NAME_CLASS = "name";
|
653
|
+
var Yt = ge;
|
654
654
|
var re = /*#__PURE__*/function () {
|
655
655
|
function re() {
|
656
656
|
_classCallCheck(this, re);
|
@@ -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
|
}();
|
@@ -984,14 +984,14 @@ function $i(s) {
|
|
984
984
|
return String.fromCharCode(s);
|
985
985
|
}
|
986
986
|
var ws = /&([a-z#][a-z0-9]{1,31});/gi,
|
987
|
-
|
988
|
-
function
|
987
|
+
Cs = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
|
988
|
+
function Ts(s, e) {
|
989
989
|
var t = 0,
|
990
990
|
i = Yn(e);
|
991
|
-
return e !== i ? i : e.charCodeAt(0) === 35 &&
|
991
|
+
return e !== i ? i : e.charCodeAt(0) === 35 && Cs.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), es(t)) ? $i(t) : s;
|
992
992
|
}
|
993
993
|
function Ge(s) {
|
994
|
-
return s.indexOf("&") < 0 ? s : s.replace(ws,
|
994
|
+
return s.indexOf("&") < 0 ? s : s.replace(ws, Ts);
|
995
995
|
}
|
996
996
|
var ks = /[&<>"]/,
|
997
997
|
As = /[&<>"]/g,
|
@@ -1592,8 +1592,8 @@ function zs(s) {
|
|
1592
1592
|
var Vs = /['"]/,
|
1593
1593
|
wn = /['"]/g,
|
1594
1594
|
Gs = /[-\s()\[\]]/,
|
1595
|
-
|
1596
|
-
function
|
1595
|
+
Cn = "’";
|
1596
|
+
function Tn(s, e) {
|
1597
1597
|
return e < 0 || e >= s.length ? !1 : !Gs.test(s[e]);
|
1598
1598
|
}
|
1599
1599
|
function Qe(s, e, t) {
|
@@ -1607,8 +1607,8 @@ function Ws(s) {
|
|
1607
1607
|
for (a = E[e].level, f = S.length - 1; f >= 0 && !(S[f].level <= a); f--);
|
1608
1608
|
S.length = f + 1, i = t.content, r = 0, o = i.length;
|
1609
1609
|
e: for (; r < o && (wn.lastIndex = r, n = wn.exec(i), !!n);) {
|
1610
|
-
if (l = !
|
1611
|
-
m && (t.content = Qe(t.content, n.index,
|
1610
|
+
if (l = !Tn(i, n.index - 1), r = n.index + 1, m = n[0] === "'", c = !Tn(i, r), !c && !l) {
|
1611
|
+
m && (t.content = Qe(t.content, n.index, Cn));
|
1612
1612
|
continue;
|
1613
1613
|
}
|
1614
1614
|
if (h = !c, u = !l, u) {
|
@@ -1622,7 +1622,7 @@ function Ws(s) {
|
|
1622
1622
|
pos: n.index,
|
1623
1623
|
single: m,
|
1624
1624
|
level: a
|
1625
|
-
}) : u && m && (t.content = Qe(t.content, n.index,
|
1625
|
+
}) : u && m && (t.content = Qe(t.content, n.index, Cn));
|
1626
1626
|
}
|
1627
1627
|
}
|
1628
1628
|
}
|
@@ -1822,7 +1822,7 @@ function Ys(s, e, t, i) {
|
|
1822
1822
|
S,
|
1823
1823
|
Y,
|
1824
1824
|
ne,
|
1825
|
-
|
1825
|
+
Ce,
|
1826
1826
|
R,
|
1827
1827
|
W = !0,
|
1828
1828
|
$,
|
@@ -1835,11 +1835,11 @@ function Ys(s, e, t, i) {
|
|
1835
1835
|
for (Y = 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: Ce = [e, 0],
|
1839
1839
|
level: s.level++
|
1840
1840
|
})) : s.tokens.push({
|
1841
1841
|
type: "bullet_list_open",
|
1842
|
-
lines:
|
1842
|
+
lines: Ce = [e, 0],
|
1843
1843
|
level: s.level++
|
1844
1844
|
}), n = e, ne = !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",
|
@@ -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
|
+
}), Ce[1] = n, s.line = n, W && Zs(s, Y), !0;
|
1866
1866
|
}
|
1867
1867
|
function Qs(s, e, t, i) {
|
1868
1868
|
var n,
|
@@ -2441,7 +2441,7 @@ function Sr(s, e) {
|
|
2441
2441
|
}), s.pos = s.posMax + 1, s.posMax = n, !0);
|
2442
2442
|
}
|
2443
2443
|
var wr = /\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;
|
2444
|
-
function
|
2444
|
+
function Cr(s, e) {
|
2445
2445
|
var t,
|
2446
2446
|
i,
|
2447
2447
|
n = s.posMax,
|
@@ -2460,7 +2460,7 @@ function Tr(s, e) {
|
|
2460
2460
|
content: i.replace(wr, "$1")
|
2461
2461
|
}), s.pos = s.posMax + 1, s.posMax = n, !0);
|
2462
2462
|
}
|
2463
|
-
function
|
2463
|
+
function Tr(s, e) {
|
2464
2464
|
var t,
|
2465
2465
|
i,
|
2466
2466
|
n,
|
@@ -2627,7 +2627,7 @@ function Xr(s, e) {
|
|
2627
2627
|
}
|
2628
2628
|
return e || (s.pending += "&"), s.pos++, !0;
|
2629
2629
|
}
|
2630
|
-
var ji = [["text", pr], ["newline", mr], ["escape", gr], ["backticks", br], ["del", vr], ["ins", yr], ["mark", Er], ["emphasis", xr], ["sub", Sr], ["sup",
|
2630
|
+
var ji = [["text", pr], ["newline", mr], ["escape", gr], ["backticks", br], ["del", vr], ["ins", yr], ["mark", Er], ["emphasis", xr], ["sub", Sr], ["sup", Cr], ["links", Tr], ["footnote_inline", kr], ["footnote_ref", Ar], ["autolink", Lr], ["htmltag", $r], ["entity", Xr]];
|
2631
2631
|
function xi() {
|
2632
2632
|
this.ruler = new Z();
|
2633
2633
|
for (var s = 0; s < ji.length; s++) this.ruler.push(ji[s][0], ji[s][1]);
|
@@ -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
|
2789
|
+
function _e(s, e) {
|
2790
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 Z(), 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,7 +3238,7 @@ 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
|
}, {
|
@@ -3248,8 +3248,8 @@ var Me = /*#__PURE__*/function () {
|
|
3248
3248
|
}
|
3249
3249
|
}]);
|
3250
3250
|
}();
|
3251
|
-
|
3252
|
-
var
|
3251
|
+
Re.MESSAGE_CLASS = "streamed-message", Re.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3252
|
+
var Se = Re;
|
3253
3253
|
var Ue = /*#__PURE__*/function () {
|
3254
3254
|
function Ue() {
|
3255
3255
|
_classCallCheck(this, Ue);
|
@@ -3383,29 +3383,29 @@ function io(_x10, _x11) {
|
|
3383
3383
|
return _io.apply(this, arguments);
|
3384
3384
|
}
|
3385
3385
|
function _io() {
|
3386
|
-
_io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3386
|
+
_io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee119(s, e) {
|
3387
3387
|
var t, i;
|
3388
|
-
return _regeneratorRuntime().wrap(function
|
3389
|
-
while (1) switch (
|
3388
|
+
return _regeneratorRuntime().wrap(function _callee119$(_context119) {
|
3389
|
+
while (1) switch (_context119.prev = _context119.next) {
|
3390
3390
|
case 0:
|
3391
3391
|
t = s.getReader();
|
3392
3392
|
case 1:
|
3393
|
-
|
3393
|
+
_context119.next = 3;
|
3394
3394
|
return t.read();
|
3395
3395
|
case 3:
|
3396
|
-
if ((i =
|
3397
|
-
|
3396
|
+
if ((i = _context119.sent).done) {
|
3397
|
+
_context119.next = 7;
|
3398
3398
|
break;
|
3399
3399
|
}
|
3400
3400
|
e(i.value);
|
3401
3401
|
case 5:
|
3402
|
-
|
3402
|
+
_context119.next = 1;
|
3403
3403
|
break;
|
3404
3404
|
case 7:
|
3405
3405
|
case "end":
|
3406
|
-
return
|
3406
|
+
return _context119.stop();
|
3407
3407
|
}
|
3408
|
-
},
|
3408
|
+
}, _callee119);
|
3409
3409
|
}));
|
3410
3410
|
return _io.apply(this, arguments);
|
3411
3411
|
}
|
@@ -3511,7 +3511,7 @@ function lo(s, e) {
|
|
3511
3511
|
Y(), h();
|
3512
3512
|
});
|
3513
3513
|
var ne = c !== null && c !== void 0 ? c : window.fetch,
|
3514
|
-
|
3514
|
+
Ce = n !== null && n !== void 0 ? n : co;
|
3515
3515
|
function R() {
|
3516
3516
|
return _R.apply(this, arguments);
|
3517
3517
|
}
|
@@ -3531,7 +3531,7 @@ function lo(s, e) {
|
|
3531
3531
|
case 4:
|
3532
3532
|
$ = _context3.sent;
|
3533
3533
|
_context3.next = 7;
|
3534
|
-
return
|
3534
|
+
return Ce($);
|
3535
3535
|
case 7:
|
3536
3536
|
_context3.next = 9;
|
3537
3537
|
return io($.body, no(so(function (N) {
|
@@ -3569,11 +3569,11 @@ function co(s) {
|
|
3569
3569
|
var e = s.headers.get("content-type");
|
3570
3570
|
if (!(e != null && e.startsWith(Ji))) throw new Error("Expected content-type to be ".concat(Ji, ", Actual: ").concat(e));
|
3571
3571
|
}
|
3572
|
-
var
|
3573
|
-
function
|
3574
|
-
_classCallCheck(this,
|
3572
|
+
var T = /*#__PURE__*/function () {
|
3573
|
+
function T() {
|
3574
|
+
_classCallCheck(this, T);
|
3575
3575
|
}
|
3576
|
-
return _createClass(
|
3576
|
+
return _createClass(T, null, [{
|
3577
3577
|
key: "request",
|
3578
3578
|
value: // prettier-ignore
|
3579
3579
|
function () {
|
@@ -3585,7 +3585,7 @@ var C = /*#__PURE__*/function () {
|
|
3585
3585
|
S,
|
3586
3586
|
Y,
|
3587
3587
|
ne,
|
3588
|
-
|
3588
|
+
Ce,
|
3589
3589
|
o,
|
3590
3590
|
_yield$v$processReque,
|
3591
3591
|
a,
|
@@ -3628,19 +3628,19 @@ var C = /*#__PURE__*/function () {
|
|
3628
3628
|
_context6.next = 17;
|
3629
3629
|
break;
|
3630
3630
|
}
|
3631
|
-
return _context6.abrupt("return",
|
3631
|
+
return _context6.abrupt("return", Ee.stream(e, a, i));
|
3632
3632
|
case 17:
|
3633
|
-
if (!(((S = e.connectSettings) == null ? void 0 : S.url) ===
|
3633
|
+
if (!(((S = e.connectSettings) == null ? void 0 : S.url) === pe.URL)) {
|
3634
3634
|
_context6.next = 19;
|
3635
3635
|
break;
|
3636
3636
|
}
|
3637
|
-
return _context6.abrupt("return",
|
3637
|
+
return _context6.abrupt("return", pe.requestStream(i, e.streamHandlers));
|
3638
3638
|
case 19:
|
3639
|
-
f = new
|
3639
|
+
f = new Se(i), m = v.fetch.bind(this, e, l, n);
|
3640
3640
|
lo(((Y = e.connectSettings) == null ? void 0 : Y.url) || e.url || "", {
|
3641
3641
|
method: ((ne = e.connectSettings) == null ? void 0 : ne.method) || "POST",
|
3642
3642
|
headers: l,
|
3643
|
-
credentials: (
|
3643
|
+
credentials: (Ce = e.connectSettings) == null ? void 0 : Ce.credentials,
|
3644
3644
|
body: n ? JSON.stringify(a) : a,
|
3645
3645
|
openWhenHidden: !0,
|
3646
3646
|
// keep stream open when browser tab not open
|
@@ -3693,7 +3693,7 @@ var C = /*#__PURE__*/function () {
|
|
3693
3693
|
case 7:
|
3694
3694
|
pt = _context5.t0;
|
3695
3695
|
(N = e.extractResultData) == null || N.call(e, pt, m, a).then(function (Ne) {
|
3696
|
-
e.asyncCallInProgress && Ne && Ne.text !== "" ? (
|
3696
|
+
e.asyncCallInProgress && Ne && Ne.text !== "" ? (T.simulate(i, e.streamHandlers, Ne), h(), e.asyncCallInProgress = !1) : T.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, Ne);
|
3697
3697
|
})["catch"](function (Ne) {
|
3698
3698
|
return v.displayError(i, Ne);
|
3699
3699
|
});
|
@@ -3744,7 +3744,7 @@ var C = /*#__PURE__*/function () {
|
|
3744
3744
|
}, i), !1), i.text) {
|
3745
3745
|
t.onOpen();
|
3746
3746
|
var r = i.text.split("");
|
3747
|
-
|
3747
|
+
T.populateMessages(r, new Se(e), n);
|
3748
3748
|
}
|
3749
3749
|
}
|
3750
3750
|
}, {
|
@@ -3757,10 +3757,10 @@ var C = /*#__PURE__*/function () {
|
|
3757
3757
|
text: r
|
3758
3758
|
});
|
3759
3759
|
var o = setTimeout(function () {
|
3760
|
-
|
3760
|
+
T.populateMessages(e, t, i, n + 1);
|
3761
3761
|
}, i.simulationInterim || 6);
|
3762
3762
|
i.abortStream.abort = function () {
|
3763
|
-
|
3763
|
+
T.abort(o, t, i.onClose);
|
3764
3764
|
};
|
3765
3765
|
} else t.finaliseStreamedMessage(), i.onClose();
|
3766
3766
|
}
|
@@ -3772,7 +3772,7 @@ var C = /*#__PURE__*/function () {
|
|
3772
3772
|
}, {
|
3773
3773
|
key: "isSimulatable",
|
3774
3774
|
value: function isSimulatable(e, t) {
|
3775
|
-
return
|
3775
|
+
return T.isSimulation(e) && t && (t.text || t.html);
|
3776
3776
|
}
|
3777
3777
|
}, {
|
3778
3778
|
key: "abort",
|
@@ -3845,7 +3845,7 @@ var He = /*#__PURE__*/function () {
|
|
3845
3845
|
_context7.t0 = i;
|
3846
3846
|
case 5:
|
3847
3847
|
n = _context7.t0;
|
3848
|
-
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) :
|
3848
|
+
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) : T.isSimulatable(e.stream, n) ? T.simulate(t, e.streamHandlers, n) : (t.addNewMessage(n), e.completionsHandlers.onFinish());
|
3849
3849
|
case 7:
|
3850
3850
|
case "end":
|
3851
3851
|
return _context7.stop();
|
@@ -3859,13 +3859,13 @@ var He = /*#__PURE__*/function () {
|
|
3859
3859
|
value: function requestStream(e, t) {
|
3860
3860
|
setTimeout(function () {
|
3861
3861
|
var i = He.getResponse(e);
|
3862
|
-
|
3862
|
+
T.simulate(e, t, i);
|
3863
3863
|
}, 400);
|
3864
3864
|
}
|
3865
3865
|
}]);
|
3866
3866
|
}();
|
3867
3867
|
He.URL = "deep-chat-demo";
|
3868
|
-
var
|
3868
|
+
var pe = He;
|
3869
3869
|
var z = /*#__PURE__*/function () {
|
3870
3870
|
function z() {
|
3871
3871
|
_classCallCheck(this, z);
|
@@ -3873,7 +3873,7 @@ var z = /*#__PURE__*/function () {
|
|
3873
3873
|
return _createClass(z, null, [{
|
3874
3874
|
key: "setup",
|
3875
3875
|
value: function setup(e) {
|
3876
|
-
e.connectSettings.url !==
|
3876
|
+
e.connectSettings.url !== pe.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
3877
3877
|
}
|
3878
3878
|
}, {
|
3879
3879
|
key: "createConnection",
|
@@ -3881,7 +3881,7 @@ var z = /*#__PURE__*/function () {
|
|
3881
3881
|
if (!document.body.contains(e.deepChat)) return;
|
3882
3882
|
var i = e.connectSettings.websocket;
|
3883
3883
|
if (i) {
|
3884
|
-
if (e.connectSettings.handler) return
|
3884
|
+
if (e.connectSettings.handler) return Ee.websocket(e, t);
|
3885
3885
|
try {
|
3886
3886
|
var n = typeof i != "boolean" ? i : void 0,
|
3887
3887
|
r = new WebSocket(e.connectSettings.url || "", n);
|
@@ -3942,9 +3942,9 @@ var z = /*#__PURE__*/function () {
|
|
3942
3942
|
}
|
3943
3943
|
throw Error(A.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
3944
3944
|
case 14:
|
3945
|
-
if (
|
3945
|
+
if (T.isSimulation(e.stream)) {
|
3946
3946
|
h = z.stream.bind(_this6, e, i, n), u = n[l.role || b.AI_ROLE];
|
3947
|
-
|
3947
|
+
T.upsertWFiles(i, h, u, d);
|
3948
3948
|
} else i.addNewMessage(d);
|
3949
3949
|
_context8.next = 20;
|
3950
3950
|
break;
|
@@ -4013,11 +4013,11 @@ var z = /*#__PURE__*/function () {
|
|
4013
4013
|
return _context9.abrupt("return", r.newUserMessage.listener(a));
|
4014
4014
|
case 14:
|
4015
4015
|
c = n ? JSON.stringify(a) : a;
|
4016
|
-
if (!(((h = e.connectSettings) == null ? void 0 : h.url) ===
|
4016
|
+
if (!(((h = e.connectSettings) == null ? void 0 : h.url) === pe.URL)) {
|
4017
4017
|
_context9.next = 17;
|
4018
4018
|
break;
|
4019
4019
|
}
|
4020
|
-
return _context9.abrupt("return",
|
4020
|
+
return _context9.abrupt("return", pe.request(e, i));
|
4021
4021
|
case 17:
|
4022
4022
|
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
4023
|
case 18:
|
@@ -4051,16 +4051,16 @@ var z = /*#__PURE__*/function () {
|
|
4051
4051
|
var _i$o;
|
4052
4052
|
var o = n.role || b.AI_ROLE,
|
4053
4053
|
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
|
4055
|
-
} else
|
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 Se(t), i[o].upsertStreamedMessage(n));
|
4055
|
+
} else T.simulate(t, e.streamHandlers, n);
|
4056
4056
|
}
|
4057
4057
|
}]);
|
4058
4058
|
}();
|
4059
|
-
var
|
4060
|
-
function
|
4061
|
-
_classCallCheck(this,
|
4059
|
+
var Ee = /*#__PURE__*/function () {
|
4060
|
+
function Ee() {
|
4061
|
+
_classCallCheck(this, Ee);
|
4062
4062
|
}
|
4063
|
-
return _createClass(
|
4063
|
+
return _createClass(Ee, null, [{
|
4064
4064
|
key: "request",
|
4065
4065
|
value: function () {
|
4066
4066
|
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, i) {
|
@@ -4093,7 +4093,7 @@ var ye = /*#__PURE__*/function () {
|
|
4093
4093
|
_context10.t0 = c;
|
4094
4094
|
case 8:
|
4095
4095
|
d = _context10.t0;
|
4096
|
-
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) :
|
4096
|
+
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : T.isSimulatable(e.stream, d) ? T.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(A.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
4097
4097
|
case 10:
|
4098
4098
|
case "end":
|
4099
4099
|
return _context10.stop();
|
@@ -4103,7 +4103,7 @@ var ye = /*#__PURE__*/function () {
|
|
4103
4103
|
return function r(_x22) {
|
4104
4104
|
return _ref3.apply(this, arguments);
|
4105
4105
|
};
|
4106
|
-
}(), o =
|
4106
|
+
}(), o = Ee.generateOptionalSignals();
|
4107
4107
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
4108
4108
|
onResponse: r
|
4109
4109
|
}));
|
@@ -4134,12 +4134,12 @@ var ye = /*#__PURE__*/function () {
|
|
4134
4134
|
var h, u;
|
4135
4135
|
var n = !0,
|
4136
4136
|
r = !1;
|
4137
|
-
var o = new
|
4137
|
+
var o = new Se(i),
|
4138
4138
|
a = function a() {
|
4139
4139
|
r || !n || (e.streamHandlers.onOpen(), r = !0);
|
4140
4140
|
},
|
4141
4141
|
l = function l() {
|
4142
|
-
n && (
|
4142
|
+
n && (Ee.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1);
|
4143
4143
|
},
|
4144
4144
|
c = /*#__PURE__*/function () {
|
4145
4145
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(f) {
|
@@ -4164,7 +4164,7 @@ var ye = /*#__PURE__*/function () {
|
|
4164
4164
|
_context12.t0 = f;
|
4165
4165
|
case 7:
|
4166
4166
|
m = _context12.t0;
|
4167
|
-
v.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), n = !1) :
|
4167
|
+
v.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), n = !1) : T.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(A.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
|
4168
4168
|
case 9:
|
4169
4169
|
case "end":
|
4170
4170
|
return _context12.stop();
|
@@ -4176,9 +4176,9 @@ var ye = /*#__PURE__*/function () {
|
|
4176
4176
|
};
|
4177
4177
|
}();
|
4178
4178
|
e.streamHandlers.abortStream.abort = function () {
|
4179
|
-
|
4179
|
+
Ee.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1;
|
4180
4180
|
};
|
4181
|
-
var d =
|
4181
|
+
var d = Ee.generateOptionalSignals();
|
4182
4182
|
(u = (h = e.connectSettings).handler) == null || u.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
|
4183
4183
|
onOpen: a,
|
4184
4184
|
onResponse: c,
|
@@ -4229,9 +4229,9 @@ var ye = /*#__PURE__*/function () {
|
|
4229
4229
|
_context13.t0 = d;
|
4230
4230
|
case 7:
|
4231
4231
|
h = _context13.t0;
|
4232
|
-
if (!v.validateResponseFormat(h)) console.error(A.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (
|
4232
|
+
if (!v.validateResponseFormat(h)) console.error(A.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (T.isSimulation(e.stream)) {
|
4233
4233
|
m = z.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
|
4234
|
-
|
4234
|
+
T.upsertWFiles(t, m, p, d);
|
4235
4235
|
} else t.addNewMessage(h);
|
4236
4236
|
case 9:
|
4237
4237
|
case "end":
|
@@ -4243,7 +4243,7 @@ var ye = /*#__PURE__*/function () {
|
|
4243
4243
|
return _ref5.apply(this, arguments);
|
4244
4244
|
};
|
4245
4245
|
}(),
|
4246
|
-
a =
|
4246
|
+
a = Ee.generateOptionalSignals();
|
4247
4247
|
(c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
4248
4248
|
onOpen: n,
|
4249
4249
|
onResponse: o,
|
@@ -4267,11 +4267,11 @@ var ye = /*#__PURE__*/function () {
|
|
4267
4267
|
}
|
4268
4268
|
}]);
|
4269
4269
|
}();
|
4270
|
-
var
|
4271
|
-
function
|
4272
|
-
_classCallCheck(this,
|
4270
|
+
var C = /*#__PURE__*/function () {
|
4271
|
+
function C() {
|
4272
|
+
_classCallCheck(this, C);
|
4273
4273
|
}
|
4274
|
-
return _createClass(
|
4274
|
+
return _createClass(C, null, [{
|
4275
4275
|
key: "request",
|
4276
4276
|
value: // prettier-ignore
|
4277
4277
|
function () {
|
@@ -4315,13 +4315,13 @@ var T = /*#__PURE__*/function () {
|
|
4315
4315
|
_context15.next = 13;
|
4316
4316
|
break;
|
4317
4317
|
}
|
4318
|
-
return _context15.abrupt("return",
|
4318
|
+
return _context15.abrupt("return", Ee.request(e, o, i));
|
4319
4319
|
case 13:
|
4320
|
-
if (!(((m = e.connectSettings) == null ? void 0 : m.url) ===
|
4320
|
+
if (!(((m = e.connectSettings) == null ? void 0 : m.url) === pe.URL)) {
|
4321
4321
|
_context15.next = 15;
|
4322
4322
|
break;
|
4323
4323
|
}
|
4324
|
-
return _context15.abrupt("return",
|
4324
|
+
return _context15.abrupt("return", pe.request(e, i));
|
4325
4325
|
case 15:
|
4326
4326
|
d = !0;
|
4327
4327
|
h = v.fetch.bind(this, e, a, n);
|
@@ -4368,7 +4368,7 @@ var T = /*#__PURE__*/function () {
|
|
4368
4368
|
}
|
4369
4369
|
throw Error(A.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, E));
|
4370
4370
|
case 15:
|
4371
|
-
S.makingAnotherRequest || (
|
4371
|
+
S.makingAnotherRequest || (T.isSimulatable(e.stream, S) ? T.simulate(i, e.streamHandlers, S) : (i.addNewMessage(S), c()));
|
4372
4372
|
case 16:
|
4373
4373
|
case "end":
|
4374
4374
|
return _context14.stop();
|
@@ -4427,8 +4427,8 @@ var T = /*#__PURE__*/function () {
|
|
4427
4427
|
case 11:
|
4428
4428
|
a = _context16.sent;
|
4429
4429
|
a.timeoutMS ? setTimeout(function () {
|
4430
|
-
|
4431
|
-
}, a.timeoutMS) :
|
4430
|
+
C.executePollRequest(e, t, i, n);
|
4431
|
+
}, a.timeoutMS) : T.isSimulatable(e.stream, a) ? T.simulate(n, e.streamHandlers, a) : (n.addNewMessage(a), r());
|
4432
4432
|
case 13:
|
4433
4433
|
case "end":
|
4434
4434
|
return _context16.stop();
|
@@ -4487,7 +4487,7 @@ var T = /*#__PURE__*/function () {
|
|
4487
4487
|
body: h,
|
4488
4488
|
headers: a
|
4489
4489
|
};
|
4490
|
-
e.connectSettings.credentials && (u.credentials = e.connectSettings.credentials),
|
4490
|
+
e.connectSettings.credentials && (u.credentials = e.connectSettings.credentials), C.executePollRequest(e, c, u, i);
|
4491
4491
|
case 12:
|
4492
4492
|
case "end":
|
4493
4493
|
return _context17.stop();
|
@@ -4665,7 +4665,7 @@ var We = /*#__PURE__*/function () {
|
|
4665
4665
|
var _a$url;
|
4666
4666
|
_classCallCheck(this, We);
|
4667
4667
|
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 =
|
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 = pe.URL), this.connectSettings.websocket && z.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || he.checkForStream(this.deepChat);
|
4669
4669
|
}
|
4670
4670
|
return _createClass(We, [{
|
4671
4671
|
key: "verifyKey",
|
@@ -4691,7 +4691,7 @@ var We = /*#__PURE__*/function () {
|
|
4691
4691
|
while (1) switch (_context18.prev = _context18.next) {
|
4692
4692
|
case 0:
|
4693
4693
|
i = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : !0;
|
4694
|
-
return _context18.abrupt("return", this.stream && !
|
4694
|
+
return _context18.abrupt("return", this.stream && !T.isSimulation(this.stream) ? T.request(this, e, t, i) : C.request(this, e, t, i));
|
4695
4695
|
case 2:
|
4696
4696
|
case "end":
|
4697
4697
|
return _context18.stop();
|
@@ -4825,7 +4825,7 @@ var We = /*#__PURE__*/function () {
|
|
4825
4825
|
_context23.next = 4;
|
4826
4826
|
break;
|
4827
4827
|
}
|
4828
|
-
return _context23.abrupt("return",
|
4828
|
+
return _context23.abrupt("return", he.handleResponseProperty(e));
|
4829
4829
|
case 4:
|
4830
4830
|
if (!v.validateResponseFormat(e)) {
|
4831
4831
|
_context23.next = 6;
|
@@ -4914,7 +4914,7 @@ var U = /*#__PURE__*/function (_We) {
|
|
4914
4914
|
o = _this$keyVerification.createHeaders,
|
4915
4915
|
a = _this$keyVerification.body,
|
4916
4916
|
l = (o == null ? void 0 : o(e)) || this.buildHeadersFunc(e);
|
4917
|
-
|
4917
|
+
C.verifyKey(e, i, l, n, this.keyAuthenticated.bind(this, t.onSuccess), t.onFail, t.onLoad, r, a);
|
4918
4918
|
}
|
4919
4919
|
}, {
|
4920
4920
|
key: "isDirectConnection",
|
@@ -4941,19 +4941,19 @@ var ei = /*#__PURE__*/function () {
|
|
4941
4941
|
}
|
4942
4942
|
}]);
|
4943
4943
|
}();
|
4944
|
-
var
|
4944
|
+
var be = /*#__PURE__*/function (_HTMLElement) {
|
4945
4945
|
// If this is not working, try using propertyName directly
|
4946
|
-
function
|
4946
|
+
function be() {
|
4947
4947
|
var _this9;
|
4948
|
-
_classCallCheck(this,
|
4949
|
-
_this9 = _callSuper(this,
|
4950
|
-
var t =
|
4948
|
+
_classCallCheck(this, be);
|
4949
|
+
_this9 = _callSuper(this, be), _this9._waitingToRender_ = !1, _this9._propUpdated_ = !1, Object.keys(be._attributeToProperty_).forEach(function (e) {
|
4950
|
+
var t = be._attributeToProperty_[e];
|
4951
4951
|
_this9.constructPropertyAccessors(t), _this9.hasOwnProperty(e) || _this9.constructPropertyAccessors(t, e);
|
4952
4952
|
});
|
4953
4953
|
return _this9;
|
4954
4954
|
}
|
4955
|
-
_inherits(
|
4956
|
-
return _createClass(
|
4955
|
+
_inherits(be, _HTMLElement);
|
4956
|
+
return _createClass(be, [{
|
4957
4957
|
key: "constructPropertyAccessors",
|
4958
4958
|
value:
|
4959
4959
|
// need to be called here as accessors need to be set for the class instance
|
@@ -4972,8 +4972,8 @@ var ge = /*#__PURE__*/function (_HTMLElement) {
|
|
4972
4972
|
key: "attributeChangedCallback",
|
4973
4973
|
value: function attributeChangedCallback(e, t, i) {
|
4974
4974
|
if (t === i) return;
|
4975
|
-
var n =
|
4976
|
-
r =
|
4975
|
+
var n = be._attributes_[e](i),
|
4976
|
+
r = be._attributeToProperty_[e];
|
4977
4977
|
this[r] = n;
|
4978
4978
|
}
|
4979
4979
|
}, {
|
@@ -4982,12 +4982,12 @@ var ge = /*#__PURE__*/function (_HTMLElement) {
|
|
4982
4982
|
}], [{
|
4983
4983
|
key: "observedAttributes",
|
4984
4984
|
get: function get() {
|
4985
|
-
return Object.keys(
|
4985
|
+
return Object.keys(be._attributes_) || [];
|
4986
4986
|
}
|
4987
4987
|
}]);
|
4988
4988
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4989
|
-
|
4990
|
-
var Xi =
|
4989
|
+
be._attributes_ = {}, be._attributeToProperty_ = {};
|
4990
|
+
var Xi = be;
|
4991
4991
|
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
4992
|
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
4993
|
var X = /*#__PURE__*/function () {
|
@@ -5001,16 +5001,16 @@ var X = /*#__PURE__*/function () {
|
|
5001
5001
|
}
|
5002
5002
|
}]);
|
5003
5003
|
}();
|
5004
|
-
var
|
5005
|
-
function
|
5006
|
-
_classCallCheck(this,
|
5004
|
+
var Ie = /*#__PURE__*/function () {
|
5005
|
+
function Ie() {
|
5006
|
+
_classCallCheck(this, Ie);
|
5007
5007
|
}
|
5008
|
-
return _createClass(
|
5008
|
+
return _createClass(Ie, null, [{
|
5009
5009
|
key: "changeVisibility",
|
5010
5010
|
value:
|
5011
5011
|
// prettier-ignore
|
5012
5012
|
function changeVisibility(e, t, i, n) {
|
5013
|
-
n.target.id ===
|
5013
|
+
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
5014
|
}
|
5015
5015
|
}, {
|
5016
5016
|
key: "createIconElement",
|
@@ -5024,15 +5024,15 @@ var Re = /*#__PURE__*/function () {
|
|
5024
5024
|
value: function create(e) {
|
5025
5025
|
var t = document.createElement("div");
|
5026
5026
|
t.id = "visibility-icon-container";
|
5027
|
-
var i =
|
5027
|
+
var i = Ie.createIconElement(uo, Ie.VISIBLE_ICON_ID);
|
5028
5028
|
i.style.display = "none", t.appendChild(i);
|
5029
|
-
var n =
|
5030
|
-
return t.appendChild(n), t.onclick =
|
5029
|
+
var n = Ie.createIconElement(ho, "not-visible-icon");
|
5030
|
+
return t.appendChild(n), t.onclick = Ie.changeVisibility.bind(this, e, i, n), t;
|
5031
5031
|
}
|
5032
5032
|
}]);
|
5033
5033
|
}();
|
5034
|
-
|
5035
|
-
var Zi =
|
5034
|
+
Ie.VISIBLE_ICON_ID = "visible-icon";
|
5035
|
+
var Zi = Ie;
|
5036
5036
|
var D = /*#__PURE__*/function () {
|
5037
5037
|
function D() {
|
5038
5038
|
_classCallCheck(this, D);
|
@@ -5641,7 +5641,7 @@ var On = {
|
|
5641
5641
|
this.streamHandlers.abortStream.abort = function () {
|
5642
5642
|
i.interruptGenerate();
|
5643
5643
|
}, this.streamHandlers.onOpen();
|
5644
|
-
n = new
|
5644
|
+
n = new Se(e);
|
5645
5645
|
_context30.next = 4;
|
5646
5646
|
return i.generate(t, /*#__PURE__*/function () {
|
5647
5647
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(r, o) {
|
@@ -5953,7 +5953,7 @@ var St = /*#__PURE__*/function (_U) {
|
|
5953
5953
|
throw new Error("Request settings have not been set up");
|
5954
5954
|
case 2:
|
5955
5955
|
n = this.preprocessBody(this.rawBody, t, i);
|
5956
|
-
|
5956
|
+
C.request(this, n, e);
|
5957
5957
|
case 4:
|
5958
5958
|
case "end":
|
5959
5959
|
return _context35.stop();
|
@@ -5968,8 +5968,8 @@ var St = /*#__PURE__*/function (_U) {
|
|
5968
5968
|
}]);
|
5969
5969
|
}(U);
|
5970
5970
|
St.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5971
|
-
var
|
5972
|
-
var Dt = /*#__PURE__*/function (
|
5971
|
+
var we = St;
|
5972
|
+
var Dt = /*#__PURE__*/function (_we) {
|
5973
5973
|
// prettier-ignore
|
5974
5974
|
function Dt(e, t, i, n, r, o) {
|
5975
5975
|
var _this17;
|
@@ -5977,7 +5977,7 @@ var Dt = /*#__PURE__*/function (_Se) {
|
|
5977
5977
|
_this17 = _callSuper(this, Dt, [e, t, i, n, r, o]), _this17.isTextInputDisabled = !0, _this17.canSendMessage = Dt.canSendFile;
|
5978
5978
|
return _this17;
|
5979
5979
|
}
|
5980
|
-
_inherits(Dt,
|
5980
|
+
_inherits(Dt, _we);
|
5981
5981
|
return _createClass(Dt, [{
|
5982
5982
|
key: "preprocessBody",
|
5983
5983
|
value: function preprocessBody(e, t, i) {
|
@@ -6003,7 +6003,7 @@ var Dt = /*#__PURE__*/function (_Se) {
|
|
6003
6003
|
}
|
6004
6004
|
throw new Error("No file was added");
|
6005
6005
|
case 4:
|
6006
|
-
|
6006
|
+
C.poll(this, i[0], e, !1);
|
6007
6007
|
case 5:
|
6008
6008
|
case "end":
|
6009
6009
|
return _context36.stop();
|
@@ -6021,7 +6021,7 @@ var Dt = /*#__PURE__*/function (_Se) {
|
|
6021
6021
|
return !!(t != null && t[0]);
|
6022
6022
|
}
|
6023
6023
|
}]);
|
6024
|
-
}(
|
6024
|
+
}(we);
|
6025
6025
|
var fo = /*#__PURE__*/function (_Dt) {
|
6026
6026
|
// prettier-ignore
|
6027
6027
|
function fo(e) {
|
@@ -6122,11 +6122,11 @@ var po = /*#__PURE__*/function (_Dt2) {
|
|
6122
6122
|
}]);
|
6123
6123
|
}(Dt);
|
6124
6124
|
var Ft = "data:image/png;base64,";
|
6125
|
-
var
|
6126
|
-
function
|
6127
|
-
_classCallCheck(this,
|
6125
|
+
var me = /*#__PURE__*/function () {
|
6126
|
+
function me() {
|
6127
|
+
_classCallCheck(this, me);
|
6128
6128
|
}
|
6129
|
-
return _createClass(
|
6129
|
+
return _createClass(me, null, [{
|
6130
6130
|
key: "buildHeaders",
|
6131
6131
|
value: function buildHeaders(e) {
|
6132
6132
|
return {
|
@@ -6146,7 +6146,7 @@ var pe = /*#__PURE__*/function () {
|
|
6146
6146
|
return {
|
6147
6147
|
url: "https://api.stability.ai/v1/engines/list",
|
6148
6148
|
method: "GET",
|
6149
|
-
handleVerificationResult:
|
6149
|
+
handleVerificationResult: me.handleVerificationResult
|
6150
6150
|
};
|
6151
6151
|
}
|
6152
6152
|
}]);
|
@@ -6177,7 +6177,7 @@ var ni = /*#__PURE__*/function (_i10) {
|
|
6177
6177
|
}
|
6178
6178
|
}
|
6179
6179
|
};
|
6180
|
-
_this19 = _callSuper(this, ni, [e,
|
6180
|
+
_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
6181
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6182
6182
|
_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
6183
|
return _this19;
|
@@ -6213,7 +6213,7 @@ var ni = /*#__PURE__*/function (_i10) {
|
|
6213
6213
|
throw new Error("Image was not found");
|
6214
6214
|
case 4:
|
6215
6215
|
n = this.createFormDataBody(this.rawBody, i[0]);
|
6216
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
6216
|
+
v.tempRemoveContentHeader(this.connectSettings, C.request.bind(this, this, n, e), !1);
|
6217
6217
|
case 6:
|
6218
6218
|
case "end":
|
6219
6219
|
return _context39.stop();
|
@@ -6284,7 +6284,7 @@ var si = /*#__PURE__*/function (_i11) {
|
|
6284
6284
|
}
|
6285
6285
|
}
|
6286
6286
|
};
|
6287
|
-
_this20 = _callSuper(this, si, [e,
|
6287
|
+
_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
6288
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6289
6289
|
_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
6290
|
return _this20;
|
@@ -6320,7 +6320,7 @@ var si = /*#__PURE__*/function (_i11) {
|
|
6320
6320
|
throw new Error("Image was not found");
|
6321
6321
|
case 4:
|
6322
6322
|
n = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], i[1], n);
|
6323
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
6323
|
+
v.tempRemoveContentHeader(this.connectSettings, C.request.bind(this, this, r, e), !1);
|
6324
6324
|
case 6:
|
6325
6325
|
case "end":
|
6326
6326
|
return _context41.stop();
|
@@ -6424,7 +6424,7 @@ var mo = /*#__PURE__*/function (_Dt3) {
|
|
6424
6424
|
}()
|
6425
6425
|
}]);
|
6426
6426
|
}(Dt);
|
6427
|
-
var go = /*#__PURE__*/function (
|
6427
|
+
var go = /*#__PURE__*/function (_we2) {
|
6428
6428
|
function go(e) {
|
6429
6429
|
_classCallCheck(this, go);
|
6430
6430
|
var n, r, o;
|
@@ -6432,7 +6432,7 @@ var go = /*#__PURE__*/function (_Se2) {
|
|
6432
6432
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6433
6433
|
return _callSuper(this, go, [e, "Once upon a time", "gpt2", t, i]);
|
6434
6434
|
}
|
6435
|
-
_inherits(go,
|
6435
|
+
_inherits(go, _we2);
|
6436
6436
|
return _createClass(go, [{
|
6437
6437
|
key: "extractResultData",
|
6438
6438
|
value: function () {
|
@@ -6462,8 +6462,8 @@ var go = /*#__PURE__*/function (_Se2) {
|
|
6462
6462
|
return extractResultData;
|
6463
6463
|
}()
|
6464
6464
|
}]);
|
6465
|
-
}(
|
6466
|
-
var bo = /*#__PURE__*/function (
|
6465
|
+
}(we);
|
6466
|
+
var bo = /*#__PURE__*/function (_we3) {
|
6467
6467
|
function bo(e) {
|
6468
6468
|
var _this21;
|
6469
6469
|
_classCallCheck(this, bo);
|
@@ -6473,7 +6473,7 @@ var bo = /*#__PURE__*/function (_Se3) {
|
|
6473
6473
|
_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
6474
|
return _this21;
|
6475
6475
|
}
|
6476
|
-
_inherits(bo,
|
6476
|
+
_inherits(bo, _we3);
|
6477
6477
|
return _createClass(bo, [{
|
6478
6478
|
key: "preprocessBody",
|
6479
6479
|
value: function preprocessBody(e, t) {
|
@@ -6516,8 +6516,8 @@ var bo = /*#__PURE__*/function (_Se3) {
|
|
6516
6516
|
return extractResultData;
|
6517
6517
|
}()
|
6518
6518
|
}]);
|
6519
|
-
}(
|
6520
|
-
var vo = /*#__PURE__*/function (
|
6519
|
+
}(we);
|
6520
|
+
var vo = /*#__PURE__*/function (_we4) {
|
6521
6521
|
function vo(e) {
|
6522
6522
|
_classCallCheck(this, vo);
|
6523
6523
|
var n, r, o;
|
@@ -6525,7 +6525,7 @@ var vo = /*#__PURE__*/function (_Se4) {
|
|
6525
6525
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6526
6526
|
return _callSuper(this, vo, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
|
6527
6527
|
}
|
6528
|
-
_inherits(vo,
|
6528
|
+
_inherits(vo, _we4);
|
6529
6529
|
return _createClass(vo, [{
|
6530
6530
|
key: "extractResultData",
|
6531
6531
|
value: function () {
|
@@ -6555,8 +6555,8 @@ var vo = /*#__PURE__*/function (_Se4) {
|
|
6555
6555
|
return extractResultData;
|
6556
6556
|
}()
|
6557
6557
|
}]);
|
6558
|
-
}(
|
6559
|
-
var yo = /*#__PURE__*/function (
|
6558
|
+
}(we);
|
6559
|
+
var yo = /*#__PURE__*/function (_we5) {
|
6560
6560
|
function yo(e) {
|
6561
6561
|
var _this22$maxMessages;
|
6562
6562
|
var _this22;
|
@@ -6568,7 +6568,7 @@ var yo = /*#__PURE__*/function (_Se5) {
|
|
6568
6568
|
return _this22;
|
6569
6569
|
}
|
6570
6570
|
// prettier-ignore
|
6571
|
-
_inherits(yo,
|
6571
|
+
_inherits(yo, _we5);
|
6572
6572
|
return _createClass(yo, [{
|
6573
6573
|
key: "processMessages",
|
6574
6574
|
value: function processMessages(e) {
|
@@ -6637,7 +6637,7 @@ var yo = /*#__PURE__*/function (_Se5) {
|
|
6637
6637
|
return extractResultData;
|
6638
6638
|
}()
|
6639
6639
|
}]);
|
6640
|
-
}(
|
6640
|
+
}(we);
|
6641
6641
|
var ri = /*#__PURE__*/function (_i12) {
|
6642
6642
|
function ri(e) {
|
6643
6643
|
var _this23;
|
@@ -6653,7 +6653,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6653
6653
|
}
|
6654
6654
|
}
|
6655
6655
|
};
|
6656
|
-
_this23 = _callSuper(this, ri, [e,
|
6656
|
+
_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
6657
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
6658
6658
|
_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
6659
|
return _this23;
|
@@ -6689,7 +6689,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6689
6689
|
throw new Error("Image was not found");
|
6690
6690
|
case 4:
|
6691
6691
|
n = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], n);
|
6692
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
6692
|
+
v.tempRemoveContentHeader(this.connectSettings, C.request.bind(this, this, r, e), !1);
|
6693
6693
|
case 6:
|
6694
6694
|
case "end":
|
6695
6695
|
return _context48.stop();
|
@@ -6745,7 +6745,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6745
6745
|
}
|
6746
6746
|
}]);
|
6747
6747
|
}(_i);
|
6748
|
-
var Eo = /*#__PURE__*/function (
|
6748
|
+
var Eo = /*#__PURE__*/function (_we6) {
|
6749
6749
|
function Eo(e) {
|
6750
6750
|
_classCallCheck(this, Eo);
|
6751
6751
|
var n, r, o;
|
@@ -6753,7 +6753,7 @@ var Eo = /*#__PURE__*/function (_Se6) {
|
|
6753
6753
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6754
6754
|
return _callSuper(this, Eo, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
|
6755
6755
|
}
|
6756
|
-
_inherits(Eo,
|
6756
|
+
_inherits(Eo, _we6);
|
6757
6757
|
return _createClass(Eo, [{
|
6758
6758
|
key: "extractResultData",
|
6759
6759
|
value: function () {
|
@@ -6783,7 +6783,7 @@ var Eo = /*#__PURE__*/function (_Se6) {
|
|
6783
6783
|
return extractResultData;
|
6784
6784
|
}()
|
6785
6785
|
}]);
|
6786
|
-
}(
|
6786
|
+
}(we);
|
6787
6787
|
var oi = /*#__PURE__*/function (_i13) {
|
6788
6788
|
function oi(e) {
|
6789
6789
|
var _this24;
|
@@ -6791,7 +6791,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6791
6791
|
var r;
|
6792
6792
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
6793
6793
|
i = t.stabilityAI;
|
6794
|
-
_this24 = _callSuper(this, oi, [e,
|
6794
|
+
_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
6795
|
var n = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
6796
6796
|
_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
6797
|
return _this24;
|
@@ -6821,7 +6821,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6821
6821
|
throw new Error("Request settings have not been set up");
|
6822
6822
|
case 2:
|
6823
6823
|
i = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
6824
|
-
|
6824
|
+
C.request(this, i, e);
|
6825
6825
|
case 4:
|
6826
6826
|
case "end":
|
6827
6827
|
return _context51.stop();
|
@@ -6877,7 +6877,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6877
6877
|
}
|
6878
6878
|
}]);
|
6879
6879
|
}(_i);
|
6880
|
-
var xo = /*#__PURE__*/function (
|
6880
|
+
var xo = /*#__PURE__*/function (_we7) {
|
6881
6881
|
function xo(e) {
|
6882
6882
|
var _this25;
|
6883
6883
|
_classCallCheck(this, xo);
|
@@ -6887,7 +6887,7 @@ var xo = /*#__PURE__*/function (_Se7) {
|
|
6887
6887
|
_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
6888
|
return _this25;
|
6889
6889
|
}
|
6890
|
-
_inherits(xo,
|
6890
|
+
_inherits(xo, _we7);
|
6891
6891
|
return _createClass(xo, [{
|
6892
6892
|
key: "extractResultData",
|
6893
6893
|
value: function () {
|
@@ -6917,7 +6917,7 @@ var xo = /*#__PURE__*/function (_Se7) {
|
|
6917
6917
|
return extractResultData;
|
6918
6918
|
}()
|
6919
6919
|
}]);
|
6920
|
-
}(
|
6920
|
+
}(we);
|
6921
6921
|
var ai = /*#__PURE__*/function () {
|
6922
6922
|
function ai() {
|
6923
6923
|
_classCallCheck(this, ai);
|
@@ -6995,7 +6995,7 @@ var _o = /*#__PURE__*/function (_un) {
|
|
6995
6995
|
throw new Error("Request settings have not been set up");
|
6996
6996
|
case 2:
|
6997
6997
|
i = this.preprocessBody(this.rawBody, t);
|
6998
|
-
|
6998
|
+
C.request(this, i, e);
|
6999
6999
|
case 4:
|
7000
7000
|
case "end":
|
7001
7001
|
return _context54.stop();
|
@@ -7070,7 +7070,7 @@ var So = /*#__PURE__*/function (_un2) {
|
|
7070
7070
|
throw new Error("Request settings have not been set up");
|
7071
7071
|
case 2:
|
7072
7072
|
i = this.preprocessBody(this.rawBody, t);
|
7073
|
-
|
7073
|
+
C.request(this, i, e);
|
7074
7074
|
case 4:
|
7075
7075
|
case "end":
|
7076
7076
|
return _context56.stop();
|
@@ -7216,7 +7216,7 @@ var nt = /*#__PURE__*/function (_U4) {
|
|
7216
7216
|
case 2:
|
7217
7217
|
this.url = this.connectSettings.url || this.url;
|
7218
7218
|
i = this.preprocessBody(this.rawBody, t);
|
7219
|
-
|
7219
|
+
C.request(this, i, e);
|
7220
7220
|
case 5:
|
7221
7221
|
case "end":
|
7222
7222
|
return _context59.stop();
|
@@ -7327,7 +7327,7 @@ var oe = /*#__PURE__*/function (_U5) {
|
|
7327
7327
|
case 4:
|
7328
7328
|
this.url = this.connectSettings.url || this._service_url;
|
7329
7329
|
n = this.preprocessBody(this.rawBody, t), r = oe.createFormDataBody(n, i[0]);
|
7330
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
7330
|
+
v.tempRemoveContentHeader(this.connectSettings, C.request.bind(this, this, r, e), !1);
|
7331
7331
|
case 7:
|
7332
7332
|
case "end":
|
7333
7333
|
return _context61.stop();
|
@@ -7502,19 +7502,19 @@ var wo = /*#__PURE__*/function (_U6) {
|
|
7502
7502
|
_inherits(wo, _U6);
|
7503
7503
|
return _createClass(wo);
|
7504
7504
|
}(U);
|
7505
|
-
var
|
7506
|
-
function
|
7505
|
+
var Co = /*#__PURE__*/function (_wo) {
|
7506
|
+
function Co(e) {
|
7507
7507
|
var _a$language;
|
7508
7508
|
var _this30;
|
7509
|
-
_classCallCheck(this,
|
7509
|
+
_classCallCheck(this, Co);
|
7510
7510
|
var n, r, o, a;
|
7511
7511
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.summarization,
|
7512
7512
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7513
|
-
_this30 = _callSuper(this,
|
7513
|
+
_this30 = _callSuper(this, Co, [e, ie.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
7514
|
return _this30;
|
7515
7515
|
}
|
7516
|
-
_inherits(
|
7517
|
-
return _createClass(
|
7516
|
+
_inherits(Co, _wo);
|
7517
|
+
return _createClass(Co, [{
|
7518
7518
|
key: "preprocessBody",
|
7519
7519
|
value: function preprocessBody(e, t) {
|
7520
7520
|
var i = t[t.length - 1].text;
|
@@ -7546,7 +7546,7 @@ var To = /*#__PURE__*/function (_wo) {
|
|
7546
7546
|
throw new Error("Request settings have not been set up");
|
7547
7547
|
case 2:
|
7548
7548
|
i = this.preprocessBody(this.rawBody, t);
|
7549
|
-
|
7549
|
+
C.request(this, i, e), this.messages = e;
|
7550
7550
|
case 4:
|
7551
7551
|
case "end":
|
7552
7552
|
return _context63.stop();
|
@@ -7577,7 +7577,7 @@ var To = /*#__PURE__*/function (_wo) {
|
|
7577
7577
|
method: "GET",
|
7578
7578
|
headers: (t = this.connectSettings) == null ? void 0 : t.headers
|
7579
7579
|
};
|
7580
|
-
|
7580
|
+
C.executePollRequest(this, _i14, n, this.messages);
|
7581
7581
|
}
|
7582
7582
|
return _context64.abrupt("return", {
|
7583
7583
|
makingAnotherRequest: !0
|
@@ -7792,7 +7792,7 @@ var fn = /*#__PURE__*/function (_U7) {
|
|
7792
7792
|
}
|
7793
7793
|
throw new Error("No file was added");
|
7794
7794
|
case 4:
|
7795
|
-
|
7795
|
+
C.request(this, i[0], e, !1);
|
7796
7796
|
case 5:
|
7797
7797
|
case "end":
|
7798
7798
|
return _context67.stop();
|
@@ -7891,7 +7891,7 @@ var vi = /*#__PURE__*/function (_ls) {
|
|
7891
7891
|
throw new Error("Request settings have not been set up");
|
7892
7892
|
case 2:
|
7893
7893
|
i = this.preprocessBody(this.rawBody, t);
|
7894
|
-
|
7894
|
+
C.request(this, i, e, !1);
|
7895
7895
|
case 4:
|
7896
7896
|
case "end":
|
7897
7897
|
return _context69.stop();
|
@@ -7978,7 +7978,7 @@ var wt = /*#__PURE__*/function (_ls2) {
|
|
7978
7978
|
}
|
7979
7979
|
throw new Error("No file was added");
|
7980
7980
|
case 4:
|
7981
|
-
(r = this.connectSettings) != null && r.headers && (this.connectSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"),
|
7981
|
+
(r = this.connectSettings) != null && r.headers && (this.connectSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), C.request(this, i[0], e, !1);
|
7982
7982
|
case 5:
|
7983
7983
|
case "end":
|
7984
7984
|
return _context71.stop();
|
@@ -8028,21 +8028,21 @@ wt.HELP_LINK =
|
|
8028
8028
|
// eslint-disable-next-line max-len
|
8029
8029
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
8030
8030
|
var tn = wt;
|
8031
|
-
var
|
8031
|
+
var To = /*#__PURE__*/function (_U9) {
|
8032
8032
|
// prettier-ignore
|
8033
|
-
function
|
8033
|
+
function To(e) {
|
8034
8034
|
var _this35;
|
8035
|
-
_classCallCheck(this,
|
8035
|
+
_classCallCheck(this, To);
|
8036
8036
|
var n, r, o;
|
8037
8037
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.translation,
|
8038
8038
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
8039
|
-
_this35 = _callSuper(this,
|
8039
|
+
_this35 = _callSuper(this, To, [e, ie.buildTranslationKeyVerificationDetails(t.region), ie.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this35.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this35.keyHelpUrl =
|
8040
8040
|
// eslint-disable-next-line max-len
|
8041
8041
|
"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
8042
|
return _this35;
|
8043
8043
|
}
|
8044
|
-
_inherits(
|
8045
|
-
return _createClass(
|
8044
|
+
_inherits(To, _U9);
|
8045
|
+
return _createClass(To, [{
|
8046
8046
|
key: "preprocessBody",
|
8047
8047
|
value: function preprocessBody(e) {
|
8048
8048
|
var t = e[e.length - 1].text;
|
@@ -8065,7 +8065,7 @@ var Co = /*#__PURE__*/function (_U9) {
|
|
8065
8065
|
throw new Error("Request settings have not been set up");
|
8066
8066
|
case 2:
|
8067
8067
|
i = this.preprocessBody(t);
|
8068
|
-
|
8068
|
+
C.request(this, i, e);
|
8069
8069
|
case 4:
|
8070
8070
|
case "end":
|
8071
8071
|
return _context73.stop();
|
@@ -8107,11 +8107,11 @@ var Co = /*#__PURE__*/function (_U9) {
|
|
8107
8107
|
}()
|
8108
8108
|
}]);
|
8109
8109
|
}(U);
|
8110
|
-
var
|
8111
|
-
function
|
8112
|
-
_classCallCheck(this,
|
8110
|
+
var ce = /*#__PURE__*/function () {
|
8111
|
+
function ce() {
|
8112
|
+
_classCallCheck(this, ce);
|
8113
8113
|
}
|
8114
|
-
return _createClass(
|
8114
|
+
return _createClass(ce, null, [{
|
8115
8115
|
key: "storeFiles",
|
8116
8116
|
value: function () {
|
8117
8117
|
var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(e, t, i) {
|
@@ -8202,7 +8202,7 @@ var Ie = /*#__PURE__*/function () {
|
|
8202
8202
|
l({
|
8203
8203
|
src: d.target.result,
|
8204
8204
|
name: t[a].name,
|
8205
|
-
type:
|
8205
|
+
type: ce.getType(t, a)
|
8206
8206
|
});
|
8207
8207
|
};
|
8208
8208
|
});
|
@@ -8240,7 +8240,7 @@ var Ie = /*#__PURE__*/function () {
|
|
8240
8240
|
l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
|
8241
8241
|
path: l.text,
|
8242
8242
|
fileId: l.file_path.file_id,
|
8243
|
-
name:
|
8243
|
+
name: ce.getFileName(l.text)
|
8244
8244
|
});
|
8245
8245
|
});
|
8246
8246
|
}), t != null && t.image_file && i.push({
|
@@ -8262,7 +8262,7 @@ var Ie = /*#__PURE__*/function () {
|
|
8262
8262
|
break;
|
8263
8263
|
}
|
8264
8264
|
_context78.next = 4;
|
8265
|
-
return
|
8265
|
+
return ce.getFiles(e, t);
|
8266
8266
|
case 4:
|
8267
8267
|
r = _context78.sent;
|
8268
8268
|
(o = n == null ? void 0 : n.text) != null && o.value && r.forEach(function (l, c) {
|
@@ -8296,9 +8296,9 @@ var Ie = /*#__PURE__*/function () {
|
|
8296
8296
|
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8297
8297
|
while (1) switch (_context79.prev = _context79.next) {
|
8298
8298
|
case 0:
|
8299
|
-
n =
|
8299
|
+
n = ce.getFileDetails(t, i);
|
8300
8300
|
_context79.next = 3;
|
8301
|
-
return
|
8301
|
+
return ce.getFilesAndNewText(e, n, t.role, i);
|
8302
8302
|
case 3:
|
8303
8303
|
return _context79.abrupt("return", _context79.sent);
|
8304
8304
|
case 4:
|
@@ -8312,6 +8312,79 @@ var Ie = /*#__PURE__*/function () {
|
|
8312
8312
|
}
|
8313
8313
|
return getFilesAndText;
|
8314
8314
|
}()
|
8315
|
+
}, {
|
8316
|
+
key: "parseMesages",
|
8317
|
+
value: function parseMesages(e, t) {
|
8318
|
+
var i = [];
|
8319
|
+
if (t) i = e.data;else for (var n = 0; n < e.data.length; n += 1) {
|
8320
|
+
var r = e.data[n];
|
8321
|
+
if (r.role === "assistant") i.push(r);else break;
|
8322
|
+
}
|
8323
|
+
return i;
|
8324
|
+
}
|
8325
|
+
// test this using this prompt and it should give 2 text mesages and a file:
|
8326
|
+
// "give example data for a csv and create a suitable bar chart"
|
8327
|
+
}, {
|
8328
|
+
key: "parseContent",
|
8329
|
+
value: function parseContent(e, t) {
|
8330
|
+
var i = [];
|
8331
|
+
return t.forEach( /*#__PURE__*/function () {
|
8332
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(n) {
|
8333
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
8334
|
+
while (1) switch (_context81.prev = _context81.next) {
|
8335
|
+
case 0:
|
8336
|
+
n.content.filter(function (r) {
|
8337
|
+
return !!r.text || !!r.image_file;
|
8338
|
+
}).sort(function (r) {
|
8339
|
+
return r.text ? -1 : r.image_file ? 1 : 0;
|
8340
|
+
}).forEach( /*#__PURE__*/function () {
|
8341
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(r) {
|
8342
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8343
|
+
while (1) switch (_context80.prev = _context80.next) {
|
8344
|
+
case 0:
|
8345
|
+
i.push(ce.getFilesAndText(e, n, r));
|
8346
|
+
case 1:
|
8347
|
+
case "end":
|
8348
|
+
return _context80.stop();
|
8349
|
+
}
|
8350
|
+
}, _callee80);
|
8351
|
+
}));
|
8352
|
+
return function (_x151) {
|
8353
|
+
return _ref12.apply(this, arguments);
|
8354
|
+
};
|
8355
|
+
}());
|
8356
|
+
case 1:
|
8357
|
+
case "end":
|
8358
|
+
return _context81.stop();
|
8359
|
+
}
|
8360
|
+
}, _callee81);
|
8361
|
+
}));
|
8362
|
+
return function (_x150) {
|
8363
|
+
return _ref11.apply(this, arguments);
|
8364
|
+
};
|
8365
|
+
}()), i;
|
8366
|
+
}
|
8367
|
+
}, {
|
8368
|
+
key: "processAPIMessages",
|
8369
|
+
value: function () {
|
8370
|
+
var _processAPIMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e, t, i) {
|
8371
|
+
var n, r;
|
8372
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8373
|
+
while (1) switch (_context82.prev = _context82.next) {
|
8374
|
+
case 0:
|
8375
|
+
n = ce.parseMesages(t, i), r = ce.parseContent(e, n);
|
8376
|
+
return _context82.abrupt("return", Promise.all(r));
|
8377
|
+
case 2:
|
8378
|
+
case "end":
|
8379
|
+
return _context82.stop();
|
8380
|
+
}
|
8381
|
+
}, _callee82);
|
8382
|
+
}));
|
8383
|
+
function processAPIMessages(_x152, _x153, _x154) {
|
8384
|
+
return _processAPIMessages.apply(this, arguments);
|
8385
|
+
}
|
8386
|
+
return processAPIMessages;
|
8387
|
+
}()
|
8315
8388
|
}]);
|
8316
8389
|
}();
|
8317
8390
|
var F = /*#__PURE__*/function (_U10) {
|
@@ -8333,8 +8406,8 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8333
8406
|
u = _this36$config.thread_id,
|
8334
8407
|
f = _this36$config.load_thread_history;
|
8335
8408
|
Object.assign(_this36.newAssistantDetails, h), u && (_this36.sessionId = u), f && (_this36.shouldFetchHistory = !0);
|
8336
|
-
var
|
8337
|
-
m =
|
8409
|
+
var _ref13 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.assistant,
|
8410
|
+
m = _ref13.function_handler;
|
8338
8411
|
m && (_this36._functionHandler = m);
|
8339
8412
|
} else (l = t.openAI) != null && l.assistant && (t.openAI.assistant = n);
|
8340
8413
|
(_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 +8417,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8344
8417
|
return _createClass(F, [{
|
8345
8418
|
key: "fetchHistoryFunc",
|
8346
8419
|
value: function () {
|
8347
|
-
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8420
|
+
var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83() {
|
8348
8421
|
var _this37 = this;
|
8349
8422
|
var e;
|
8350
|
-
return _regeneratorRuntime().wrap(function
|
8351
|
-
while (1) switch (
|
8423
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8424
|
+
while (1) switch (_context83.prev = _context83.next) {
|
8352
8425
|
case 0:
|
8353
8426
|
setTimeout(function () {
|
8354
8427
|
return _this37.deepChat.disableSubmitButton();
|
8355
8428
|
}, 2);
|
8356
|
-
|
8357
|
-
|
8429
|
+
_context83.prev = 1;
|
8430
|
+
_context83.next = 4;
|
8358
8431
|
return this.getThreadMessages(this.sessionId, !0);
|
8359
8432
|
case 4:
|
8360
|
-
e =
|
8361
|
-
return
|
8433
|
+
e = _context83.sent;
|
8434
|
+
return _context83.abrupt("return", (this.deepChat.disableSubmitButton(!1), e.reverse()));
|
8362
8435
|
case 8:
|
8363
|
-
|
8364
|
-
|
8365
|
-
return
|
8436
|
+
_context83.prev = 8;
|
8437
|
+
_context83.t0 = _context83["catch"](1);
|
8438
|
+
return _context83.abrupt("return", [{
|
8366
8439
|
error: "failed to fetch thread history"
|
8367
8440
|
}]);
|
8368
8441
|
case 11:
|
8369
8442
|
case "end":
|
8370
|
-
return
|
8443
|
+
return _context83.stop();
|
8371
8444
|
}
|
8372
|
-
},
|
8445
|
+
}, _callee83, this, [[1, 8]]);
|
8373
8446
|
}));
|
8374
8447
|
function fetchHistoryFunc() {
|
8375
8448
|
return _fetchHistoryFunc.apply(this, arguments);
|
@@ -8401,71 +8474,71 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8401
8474
|
if (this.messages = e, this.sessionId) {
|
8402
8475
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/messages");
|
8403
8476
|
var n = this.processMessage(t, i);
|
8404
|
-
|
8477
|
+
C.request(this, n, e);
|
8405
8478
|
} else {
|
8406
8479
|
this.url = "".concat(F.THREAD_PREFIX, "/runs");
|
8407
8480
|
var _n2 = this.createNewThreadMessages(this.rawBody, t, i);
|
8408
|
-
this.isSSEStream ? this.createStreamRun(_n2) :
|
8481
|
+
this.isSSEStream ? this.createStreamRun(_n2) : C.request(this, _n2, e);
|
8409
8482
|
}
|
8410
8483
|
}
|
8411
8484
|
}, {
|
8412
8485
|
key: "callServiceAPI",
|
8413
8486
|
value: function () {
|
8414
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8487
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(e, t, i) {
|
8415
8488
|
var _r$assistant_id;
|
8416
8489
|
var r, n;
|
8417
|
-
return _regeneratorRuntime().wrap(function
|
8418
|
-
while (1) switch (
|
8490
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8491
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8419
8492
|
case 0:
|
8420
8493
|
if (!(this.waitingForStreamResponse = !1, !this.connectSettings)) {
|
8421
|
-
|
8494
|
+
_context84.next = 2;
|
8422
8495
|
break;
|
8423
8496
|
}
|
8424
8497
|
throw new Error("Request settings have not been set up");
|
8425
8498
|
case 2:
|
8426
8499
|
if (!((_r$assistant_id = (r = this.rawBody).assistant_id) !== null && _r$assistant_id !== void 0)) {
|
8427
|
-
|
8500
|
+
_context84.next = 6;
|
8428
8501
|
break;
|
8429
8502
|
}
|
8430
8503
|
_r$assistant_id;
|
8431
|
-
|
8504
|
+
_context84.next = 12;
|
8432
8505
|
break;
|
8433
8506
|
case 6:
|
8434
|
-
|
8435
|
-
if (
|
8436
|
-
|
8507
|
+
_context84.t0 = this.config.assistant_id;
|
8508
|
+
if (_context84.t0) {
|
8509
|
+
_context84.next = 11;
|
8437
8510
|
break;
|
8438
8511
|
}
|
8439
|
-
|
8512
|
+
_context84.next = 10;
|
8440
8513
|
return this.createNewAssistant();
|
8441
8514
|
case 10:
|
8442
|
-
|
8515
|
+
_context84.t0 = _context84.sent;
|
8443
8516
|
case 11:
|
8444
|
-
r.assistant_id =
|
8517
|
+
r.assistant_id = _context84.t0;
|
8445
8518
|
case 12:
|
8446
8519
|
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
|
8447
8520
|
if (!i) {
|
8448
|
-
|
8521
|
+
_context84.next = 19;
|
8449
8522
|
break;
|
8450
8523
|
}
|
8451
|
-
|
8452
|
-
return
|
8524
|
+
_context84.next = 16;
|
8525
|
+
return ce.storeFiles(this, e, i);
|
8453
8526
|
case 16:
|
8454
|
-
|
8455
|
-
|
8527
|
+
_context84.t1 = _context84.sent;
|
8528
|
+
_context84.next = 20;
|
8456
8529
|
break;
|
8457
8530
|
case 19:
|
8458
|
-
|
8531
|
+
_context84.t1 = void 0;
|
8459
8532
|
case 20:
|
8460
|
-
n =
|
8533
|
+
n = _context84.t1;
|
8461
8534
|
this.connectSettings.method = "POST", this.callService(e, t, n);
|
8462
8535
|
case 22:
|
8463
8536
|
case "end":
|
8464
|
-
return
|
8537
|
+
return _context84.stop();
|
8465
8538
|
}
|
8466
|
-
},
|
8539
|
+
}, _callee84, this);
|
8467
8540
|
}));
|
8468
|
-
function callServiceAPI(
|
8541
|
+
function callServiceAPI(_x155, _x156, _x157) {
|
8469
8542
|
return _callServiceAPI18.apply(this, arguments);
|
8470
8543
|
}
|
8471
8544
|
return callServiceAPI;
|
@@ -8473,27 +8546,27 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8473
8546
|
}, {
|
8474
8547
|
key: "createNewAssistant",
|
8475
8548
|
value: function () {
|
8476
|
-
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8549
|
+
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
|
8477
8550
|
var e;
|
8478
|
-
return _regeneratorRuntime().wrap(function
|
8479
|
-
while (1) switch (
|
8551
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8552
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8480
8553
|
case 0:
|
8481
|
-
|
8554
|
+
_context85.prev = 0;
|
8482
8555
|
this.url = F.NEW_ASSISTANT_URL;
|
8483
|
-
|
8556
|
+
_context85.next = 4;
|
8484
8557
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
|
8485
8558
|
case 4:
|
8486
|
-
e =
|
8487
|
-
return
|
8559
|
+
e = _context85.sent;
|
8560
|
+
return _context85.abrupt("return", (this.config.assistant_id = e.id, this.config.assistant_id));
|
8488
8561
|
case 8:
|
8489
|
-
|
8490
|
-
|
8491
|
-
console.error(
|
8562
|
+
_context85.prev = 8;
|
8563
|
+
_context85.t0 = _context85["catch"](0);
|
8564
|
+
console.error(_context85.t0), console.error("Failed to create a new assistant");
|
8492
8565
|
case 11:
|
8493
8566
|
case "end":
|
8494
|
-
return
|
8567
|
+
return _context85.stop();
|
8495
8568
|
}
|
8496
|
-
},
|
8569
|
+
}, _callee85, this, [[0, 8]]);
|
8497
8570
|
}));
|
8498
8571
|
function createNewAssistant() {
|
8499
8572
|
return _createNewAssistant.apply(this, arguments);
|
@@ -8512,43 +8585,43 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8512
8585
|
}, {
|
8513
8586
|
key: "extractResultData",
|
8514
8587
|
value: function () {
|
8515
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8588
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e) {
|
8516
8589
|
var n, t, i;
|
8517
|
-
return _regeneratorRuntime().wrap(function
|
8518
|
-
while (1) switch (
|
8590
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8591
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8519
8592
|
case 0:
|
8520
8593
|
if (!(this.waitingForStreamResponse || this.isSSEStream && this.sessionId)) {
|
8521
|
-
|
8594
|
+
_context86.next = 4;
|
8522
8595
|
break;
|
8523
8596
|
}
|
8524
|
-
|
8597
|
+
_context86.next = 3;
|
8525
8598
|
return this.handleStream(e);
|
8526
8599
|
case 3:
|
8527
|
-
return
|
8600
|
+
return _context86.abrupt("return", _context86.sent);
|
8528
8601
|
case 4:
|
8529
8602
|
if (!e.error) {
|
8530
|
-
|
8603
|
+
_context86.next = 6;
|
8531
8604
|
break;
|
8532
8605
|
}
|
8533
8606
|
throw e.error.message;
|
8534
8607
|
case 6:
|
8535
|
-
|
8608
|
+
_context86.next = 8;
|
8536
8609
|
return this.assignThreadAndRun(e);
|
8537
8610
|
case 8:
|
8538
8611
|
t = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
8539
8612
|
method: "GET",
|
8540
8613
|
headers: (n = this.connectSettings) == null ? void 0 : n.headers
|
8541
8614
|
};
|
8542
|
-
return
|
8615
|
+
return _context86.abrupt("return", (C.executePollRequest(this, t, i, this.messages), {
|
8543
8616
|
makingAnotherRequest: !0
|
8544
8617
|
}));
|
8545
8618
|
case 10:
|
8546
8619
|
case "end":
|
8547
|
-
return
|
8620
|
+
return _context86.stop();
|
8548
8621
|
}
|
8549
|
-
},
|
8622
|
+
}, _callee86, this);
|
8550
8623
|
}));
|
8551
|
-
function extractResultData(
|
8624
|
+
function extractResultData(_x158) {
|
8552
8625
|
return _extractResultData21.apply(this, arguments);
|
8553
8626
|
}
|
8554
8627
|
return extractResultData;
|
@@ -8556,32 +8629,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8556
8629
|
}, {
|
8557
8630
|
key: "assignThreadAndRun",
|
8558
8631
|
value: function () {
|
8559
|
-
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8632
|
+
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e) {
|
8560
8633
|
var t;
|
8561
|
-
return _regeneratorRuntime().wrap(function
|
8562
|
-
while (1) switch (
|
8634
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8635
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8563
8636
|
case 0:
|
8564
8637
|
if (!this.sessionId) {
|
8565
|
-
|
8638
|
+
_context87.next = 8;
|
8566
8639
|
break;
|
8567
8640
|
}
|
8568
8641
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8569
|
-
|
8642
|
+
_context87.next = 4;
|
8570
8643
|
return P.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8571
8644
|
case 4:
|
8572
|
-
t =
|
8645
|
+
t = _context87.sent;
|
8573
8646
|
this.run_id = t.id;
|
8574
|
-
|
8647
|
+
_context87.next = 9;
|
8575
8648
|
break;
|
8576
8649
|
case 8:
|
8577
8650
|
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
|
8578
8651
|
case 9:
|
8579
8652
|
case "end":
|
8580
|
-
return
|
8653
|
+
return _context87.stop();
|
8581
8654
|
}
|
8582
|
-
},
|
8655
|
+
}, _callee87, this);
|
8583
8656
|
}));
|
8584
|
-
function assignThreadAndRun(
|
8657
|
+
function assignThreadAndRun(_x159) {
|
8585
8658
|
return _assignThreadAndRun.apply(this, arguments);
|
8586
8659
|
}
|
8587
8660
|
return assignThreadAndRun;
|
@@ -8589,64 +8662,39 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8589
8662
|
}, {
|
8590
8663
|
key: "getThreadMessages",
|
8591
8664
|
value: function () {
|
8592
|
-
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8593
|
-
var _this38 = this;
|
8665
|
+
var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e) {
|
8594
8666
|
var t,
|
8595
|
-
|
8596
|
-
a,
|
8597
|
-
i,
|
8667
|
+
n,
|
8598
8668
|
r,
|
8599
|
-
|
8600
|
-
|
8601
|
-
|
8669
|
+
i,
|
8670
|
+
_args88 = arguments;
|
8671
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8672
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8602
8673
|
case 0:
|
8603
|
-
t =
|
8674
|
+
t = _args88.length > 1 && _args88[1] !== undefined ? _args88[1] : !1;
|
8604
8675
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(e, "/messages");
|
8605
|
-
|
8676
|
+
_context88.next = 4;
|
8606
8677
|
return P.directFetch(this, {}, "GET");
|
8607
8678
|
case 4:
|
8608
|
-
i =
|
8609
|
-
|
8610
|
-
if (!
|
8611
|
-
|
8679
|
+
i = _context88.sent;
|
8680
|
+
_context88.t0 = !t && this.deepChat.responseInterceptor;
|
8681
|
+
if (!_context88.t0) {
|
8682
|
+
_context88.next = 10;
|
8612
8683
|
break;
|
8613
8684
|
}
|
8614
|
-
|
8615
|
-
return (
|
8685
|
+
_context88.next = 9;
|
8686
|
+
return (r = (n = this.deepChat).responseInterceptor) == null ? void 0 : r.call(n, i);
|
8616
8687
|
case 9:
|
8617
|
-
i =
|
8688
|
+
i = _context88.sent;
|
8618
8689
|
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:
|
8690
|
+
return _context88.abrupt("return", ce.processAPIMessages(this, i, t));
|
8691
|
+
case 11:
|
8644
8692
|
case "end":
|
8645
|
-
return
|
8693
|
+
return _context88.stop();
|
8646
8694
|
}
|
8647
|
-
},
|
8695
|
+
}, _callee88, this);
|
8648
8696
|
}));
|
8649
|
-
function getThreadMessages(
|
8697
|
+
function getThreadMessages(_x160) {
|
8650
8698
|
return _getThreadMessages.apply(this, arguments);
|
8651
8699
|
}
|
8652
8700
|
return getThreadMessages;
|
@@ -8654,55 +8702,60 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8654
8702
|
}, {
|
8655
8703
|
key: "extractPollResultData",
|
8656
8704
|
value: function () {
|
8657
|
-
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8658
|
-
var
|
8659
|
-
|
8660
|
-
|
8705
|
+
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e) {
|
8706
|
+
var _this38 = this;
|
8707
|
+
var r, t, i, o, _o$pop, a, l, n;
|
8708
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
8709
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8661
8710
|
case 0:
|
8662
8711
|
t = e.status, i = e.required_action;
|
8663
8712
|
if (!(t === "queued" || t === "in_progress")) {
|
8664
|
-
|
8713
|
+
_context89.next = 3;
|
8665
8714
|
break;
|
8666
8715
|
}
|
8667
|
-
return
|
8716
|
+
return _context89.abrupt("return", {
|
8668
8717
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8669
8718
|
});
|
8670
8719
|
case 3:
|
8671
8720
|
if (!(t === "completed" && this.messages)) {
|
8672
|
-
|
8721
|
+
_context89.next = 11;
|
8673
8722
|
break;
|
8674
8723
|
}
|
8675
|
-
|
8724
|
+
_context89.next = 6;
|
8676
8725
|
return this.getThreadMessages(e.thread_id);
|
8677
8726
|
case 6:
|
8678
|
-
o =
|
8679
|
-
_o$ = o
|
8680
|
-
a = _o
|
8681
|
-
l = _o
|
8682
|
-
return
|
8727
|
+
o = _context89.sent;
|
8728
|
+
_o$pop = o.pop();
|
8729
|
+
a = _o$pop.text;
|
8730
|
+
l = _o$pop.files;
|
8731
|
+
return _context89.abrupt("return", (setTimeout(function () {
|
8732
|
+
o.forEach(function (c) {
|
8733
|
+
return _this38.deepChat.addMessage(c);
|
8734
|
+
});
|
8735
|
+
}), {
|
8683
8736
|
text: a,
|
8684
8737
|
_sessionId: this.sessionId,
|
8685
8738
|
files: l
|
8686
|
-
});
|
8739
|
+
}));
|
8687
8740
|
case 11:
|
8688
8741
|
n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
|
8689
8742
|
if (!(t === "requires_action" && n)) {
|
8690
|
-
|
8743
|
+
_context89.next = 16;
|
8691
8744
|
break;
|
8692
8745
|
}
|
8693
|
-
|
8746
|
+
_context89.next = 15;
|
8694
8747
|
return this.handleTools(n);
|
8695
8748
|
case 15:
|
8696
|
-
return
|
8749
|
+
return _context89.abrupt("return", _context89.sent);
|
8697
8750
|
case 16:
|
8698
8751
|
throw Error("Thread run status: ".concat(t));
|
8699
8752
|
case 17:
|
8700
8753
|
case "end":
|
8701
|
-
return
|
8754
|
+
return _context89.stop();
|
8702
8755
|
}
|
8703
|
-
},
|
8756
|
+
}, _callee89, this);
|
8704
8757
|
}));
|
8705
|
-
function extractPollResultData(
|
8758
|
+
function extractPollResultData(_x161) {
|
8706
8759
|
return _extractPollResultData5.apply(this, arguments);
|
8707
8760
|
}
|
8708
8761
|
return extractPollResultData;
|
@@ -8710,13 +8763,13 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8710
8763
|
}, {
|
8711
8764
|
key: "handleTools",
|
8712
8765
|
value: function () {
|
8713
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8766
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
|
8714
8767
|
var t, i, n;
|
8715
|
-
return _regeneratorRuntime().wrap(function
|
8716
|
-
while (1) switch (
|
8768
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
8769
|
+
while (1) switch (_context90.prev = _context90.next) {
|
8717
8770
|
case 0:
|
8718
8771
|
if (this._functionHandler) {
|
8719
|
-
|
8772
|
+
_context90.next = 2;
|
8720
8773
|
break;
|
8721
8774
|
}
|
8722
8775
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8727,14 +8780,14 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8727
8780
|
arguments: r["function"].arguments
|
8728
8781
|
};
|
8729
8782
|
});
|
8730
|
-
|
8783
|
+
_context90.next = 5;
|
8731
8784
|
return this._functionHandler(t);
|
8732
8785
|
case 5:
|
8733
|
-
i =
|
8786
|
+
i = _context90.sent;
|
8734
8787
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8735
8788
|
return typeof r != "string";
|
8736
8789
|
}) || e.length !== i.length)) {
|
8737
|
-
|
8790
|
+
_context90.next = 8;
|
8738
8791
|
break;
|
8739
8792
|
}
|
8740
8793
|
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 +8800,32 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8747
8800
|
});
|
8748
8801
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8749
8802
|
if (!this.isSSEStream) {
|
8750
|
-
|
8803
|
+
_context90.next = 15;
|
8751
8804
|
break;
|
8752
8805
|
}
|
8753
|
-
|
8806
|
+
_context90.next = 13;
|
8754
8807
|
return this.createStreamRun({
|
8755
8808
|
tool_outputs: n
|
8756
8809
|
});
|
8757
8810
|
case 13:
|
8758
|
-
|
8811
|
+
_context90.next = 17;
|
8759
8812
|
break;
|
8760
8813
|
case 15:
|
8761
|
-
|
8814
|
+
_context90.next = 17;
|
8762
8815
|
return P.directFetch(this, {
|
8763
8816
|
tool_outputs: n
|
8764
8817
|
}, "POST");
|
8765
8818
|
case 17:
|
8766
|
-
return
|
8819
|
+
return _context90.abrupt("return", {
|
8767
8820
|
timeoutMS: F.POLLING_TIMEOUT_MS
|
8768
8821
|
});
|
8769
8822
|
case 18:
|
8770
8823
|
case "end":
|
8771
|
-
return
|
8824
|
+
return _context90.stop();
|
8772
8825
|
}
|
8773
|
-
},
|
8826
|
+
}, _callee90, this);
|
8774
8827
|
}));
|
8775
|
-
function handleTools(
|
8828
|
+
function handleTools(_x162) {
|
8776
8829
|
return _handleTools.apply(this, arguments);
|
8777
8830
|
}
|
8778
8831
|
return handleTools;
|
@@ -8780,43 +8833,43 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8780
8833
|
}, {
|
8781
8834
|
key: "handleStream",
|
8782
8835
|
value: function () {
|
8783
|
-
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8836
|
+
var _handleStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
|
8784
8837
|
var i, n, t, r;
|
8785
|
-
return _regeneratorRuntime().wrap(function
|
8786
|
-
while (1) switch (
|
8838
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
8839
|
+
while (1) switch (_context91.prev = _context91.next) {
|
8787
8840
|
case 0:
|
8788
8841
|
t = (n = (i = e.required_action) == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : n.tool_calls;
|
8789
8842
|
if (!(e.status === "requires_action" && t)) {
|
8790
|
-
|
8843
|
+
_context91.next = 6;
|
8791
8844
|
break;
|
8792
8845
|
}
|
8793
8846
|
this.run_id = e.id;
|
8794
|
-
|
8847
|
+
_context91.next = 5;
|
8795
8848
|
return this.handleTools(t);
|
8796
8849
|
case 5:
|
8797
|
-
return
|
8850
|
+
return _context91.abrupt("return", _context91.sent);
|
8798
8851
|
case 6:
|
8799
8852
|
if (!this.waitingForStreamResponse) {
|
8800
|
-
|
8853
|
+
_context91.next = 8;
|
8801
8854
|
break;
|
8802
8855
|
}
|
8803
|
-
return
|
8856
|
+
return _context91.abrupt("return", this.parseStreamResult(e));
|
8804
8857
|
case 8:
|
8805
8858
|
if (this.isSSEStream && this.sessionId) {
|
8806
8859
|
this.url = "".concat(F.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8807
8860
|
r = JSON.parse(JSON.stringify(this.rawBody));
|
8808
8861
|
this.createStreamRun(r);
|
8809
8862
|
}
|
8810
|
-
return
|
8863
|
+
return _context91.abrupt("return", {
|
8811
8864
|
makingAnotherRequest: !0
|
8812
8865
|
});
|
8813
8866
|
case 10:
|
8814
8867
|
case "end":
|
8815
|
-
return
|
8868
|
+
return _context91.stop();
|
8816
8869
|
}
|
8817
|
-
},
|
8870
|
+
}, _callee91, this);
|
8818
8871
|
}));
|
8819
|
-
function handleStream(
|
8872
|
+
function handleStream(_x163) {
|
8820
8873
|
return _handleStream.apply(this, arguments);
|
8821
8874
|
}
|
8822
8875
|
return handleStream;
|
@@ -8836,21 +8889,21 @@ var F = /*#__PURE__*/function (_U10) {
|
|
8836
8889
|
}, {
|
8837
8890
|
key: "createStreamRun",
|
8838
8891
|
value: function () {
|
8839
|
-
var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8840
|
-
return _regeneratorRuntime().wrap(function
|
8841
|
-
while (1) switch (
|
8892
|
+
var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e) {
|
8893
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
8894
|
+
while (1) switch (_context92.prev = _context92.next) {
|
8842
8895
|
case 0:
|
8843
8896
|
e.stream = !0;
|
8844
8897
|
this.waitingForStreamResponse = !0;
|
8845
|
-
|
8846
|
-
return
|
8898
|
+
_context92.next = 4;
|
8899
|
+
return T.request(this, e, this.messages, !0, !0);
|
8847
8900
|
case 4:
|
8848
8901
|
case "end":
|
8849
|
-
return
|
8902
|
+
return _context92.stop();
|
8850
8903
|
}
|
8851
|
-
},
|
8904
|
+
}, _callee92, this);
|
8852
8905
|
}));
|
8853
|
-
function createStreamRun(
|
8906
|
+
function createStreamRun(_x164) {
|
8854
8907
|
return _createStreamRun.apply(this, arguments);
|
8855
8908
|
}
|
8856
8909
|
return createStreamRun;
|
@@ -8907,46 +8960,46 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8907
8960
|
var l = this.preprocessBody(this.rawBody, r);
|
8908
8961
|
n = ae.createFormDataBody(l, i[0], i[1]);
|
8909
8962
|
} else this.url = ae.IMAGE_VARIATIONS_URL, n = ae.createFormDataBody(this.rawBody, i[0]);
|
8910
|
-
v.tempRemoveContentHeader(this.connectSettings,
|
8963
|
+
v.tempRemoveContentHeader(this.connectSettings, C.request.bind(this, this, n, e), !1);
|
8911
8964
|
}
|
8912
8965
|
}, {
|
8913
8966
|
key: "callServiceAPI",
|
8914
8967
|
value: function () {
|
8915
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8968
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e, t, i) {
|
8916
8969
|
var n, r;
|
8917
|
-
return _regeneratorRuntime().wrap(function
|
8918
|
-
while (1) switch (
|
8970
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
8971
|
+
while (1) switch (_context93.prev = _context93.next) {
|
8919
8972
|
case 0:
|
8920
8973
|
if ((n = this.connectSettings) != null && n.headers) {
|
8921
|
-
|
8974
|
+
_context93.next = 2;
|
8922
8975
|
break;
|
8923
8976
|
}
|
8924
8977
|
throw new Error("Request settings have not been set up");
|
8925
8978
|
case 2:
|
8926
8979
|
if (!(i != null && i[0])) {
|
8927
|
-
|
8980
|
+
_context93.next = 6;
|
8928
8981
|
break;
|
8929
8982
|
}
|
8930
8983
|
this.callApiWithImage(e, t, i);
|
8931
|
-
|
8984
|
+
_context93.next = 11;
|
8932
8985
|
break;
|
8933
8986
|
case 6:
|
8934
8987
|
if (this.connectSettings) {
|
8935
|
-
|
8988
|
+
_context93.next = 8;
|
8936
8989
|
break;
|
8937
8990
|
}
|
8938
8991
|
throw new Error("Request settings have not been set up");
|
8939
8992
|
case 8:
|
8940
8993
|
this.url = ae.IMAGE_GENERATION_URL;
|
8941
8994
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
8942
|
-
|
8995
|
+
C.request(this, r, e);
|
8943
8996
|
case 11:
|
8944
8997
|
case "end":
|
8945
|
-
return
|
8998
|
+
return _context93.stop();
|
8946
8999
|
}
|
8947
|
-
},
|
9000
|
+
}, _callee93, this);
|
8948
9001
|
}));
|
8949
|
-
function callServiceAPI(
|
9002
|
+
function callServiceAPI(_x165, _x166, _x167) {
|
8950
9003
|
return _callServiceAPI19.apply(this, arguments);
|
8951
9004
|
}
|
8952
9005
|
return callServiceAPI;
|
@@ -8954,17 +9007,17 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8954
9007
|
}, {
|
8955
9008
|
key: "extractResultData",
|
8956
9009
|
value: function () {
|
8957
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8958
|
-
return _regeneratorRuntime().wrap(function
|
8959
|
-
while (1) switch (
|
9010
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e) {
|
9011
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
9012
|
+
while (1) switch (_context94.prev = _context94.next) {
|
8960
9013
|
case 0:
|
8961
9014
|
if (!e.error) {
|
8962
|
-
|
9015
|
+
_context94.next = 2;
|
8963
9016
|
break;
|
8964
9017
|
}
|
8965
9018
|
throw e.error.message;
|
8966
9019
|
case 2:
|
8967
|
-
return
|
9020
|
+
return _context94.abrupt("return", {
|
8968
9021
|
files: e.data.map(function (i) {
|
8969
9022
|
return i.url ? {
|
8970
9023
|
src: i.url,
|
@@ -8977,11 +9030,11 @@ var ae = /*#__PURE__*/function (_U11) {
|
|
8977
9030
|
});
|
8978
9031
|
case 3:
|
8979
9032
|
case "end":
|
8980
|
-
return
|
9033
|
+
return _context94.stop();
|
8981
9034
|
}
|
8982
|
-
},
|
9035
|
+
}, _callee94);
|
8983
9036
|
}));
|
8984
|
-
function extractResultData(
|
9037
|
+
function extractResultData(_x168) {
|
8985
9038
|
return _extractResultData22.apply(this, arguments);
|
8986
9039
|
}
|
8987
9040
|
return extractResultData;
|
@@ -9023,8 +9076,8 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9023
9076
|
var n = (r = t.openAI) == null ? void 0 : r.chat;
|
9024
9077
|
if (_typeof(n) == "object") {
|
9025
9078
|
n.system_prompt && (_this40._systemMessage = yt.generateSystemMessage(n.system_prompt));
|
9026
|
-
var
|
9027
|
-
c =
|
9079
|
+
var _ref14 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.chat,
|
9080
|
+
c = _ref14.function_handler;
|
9028
9081
|
c && (_this40._functionHandler = c), _this40.cleanConfig(n), Object.assign(_this40.rawBody, n);
|
9029
9082
|
}
|
9030
9083
|
(_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,26 +9109,26 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9056
9109
|
}, {
|
9057
9110
|
key: "callServiceAPI",
|
9058
9111
|
value: function () {
|
9059
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9112
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t) {
|
9060
9113
|
var i, n;
|
9061
|
-
return _regeneratorRuntime().wrap(function
|
9062
|
-
while (1) switch (
|
9114
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
9115
|
+
while (1) switch (_context95.prev = _context95.next) {
|
9063
9116
|
case 0:
|
9064
9117
|
if (this.connectSettings) {
|
9065
|
-
|
9118
|
+
_context95.next = 2;
|
9066
9119
|
break;
|
9067
9120
|
}
|
9068
9121
|
throw new Error("Request settings have not been set up");
|
9069
9122
|
case 2:
|
9070
9123
|
i = this.preprocessBody(this.rawBody, t), n = this.stream;
|
9071
|
-
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0,
|
9124
|
+
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, T.request(this, i, e)) : C.request(this, i, e);
|
9072
9125
|
case 4:
|
9073
9126
|
case "end":
|
9074
|
-
return
|
9127
|
+
return _context95.stop();
|
9075
9128
|
}
|
9076
|
-
},
|
9129
|
+
}, _callee95, this);
|
9077
9130
|
}));
|
9078
|
-
function callServiceAPI(
|
9131
|
+
function callServiceAPI(_x169, _x170) {
|
9079
9132
|
return _callServiceAPI20.apply(this, arguments);
|
9080
9133
|
}
|
9081
9134
|
return callServiceAPI;
|
@@ -9083,29 +9136,29 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9083
9136
|
}, {
|
9084
9137
|
key: "extractResultData",
|
9085
9138
|
value: function () {
|
9086
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9139
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t, i) {
|
9087
9140
|
var n, r, o, a;
|
9088
|
-
return _regeneratorRuntime().wrap(function
|
9089
|
-
while (1) switch (
|
9141
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
9142
|
+
while (1) switch (_context96.prev = _context96.next) {
|
9090
9143
|
case 0:
|
9091
9144
|
if (!e.error) {
|
9092
|
-
|
9145
|
+
_context96.next = 2;
|
9093
9146
|
break;
|
9094
9147
|
}
|
9095
9148
|
throw e.error.message;
|
9096
9149
|
case 2:
|
9097
|
-
return
|
9150
|
+
return _context96.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
9151
|
text: e.choices[0].message.content
|
9099
9152
|
} : {
|
9100
9153
|
text: ""
|
9101
9154
|
});
|
9102
9155
|
case 3:
|
9103
9156
|
case "end":
|
9104
|
-
return
|
9157
|
+
return _context96.stop();
|
9105
9158
|
}
|
9106
|
-
},
|
9159
|
+
}, _callee96, this);
|
9107
9160
|
}));
|
9108
|
-
function extractResultData(
|
9161
|
+
function extractResultData(_x171, _x172, _x173) {
|
9109
9162
|
return _extractResultData23.apply(this, arguments);
|
9110
9163
|
}
|
9111
9164
|
return extractResultData;
|
@@ -9113,37 +9166,37 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9113
9166
|
}, {
|
9114
9167
|
key: "extractStreamResult",
|
9115
9168
|
value: function () {
|
9116
|
-
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9169
|
+
var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
|
9117
9170
|
var _this41 = this;
|
9118
9171
|
var n, r, o;
|
9119
|
-
return _regeneratorRuntime().wrap(function
|
9120
|
-
while (1) switch (
|
9172
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
9173
|
+
while (1) switch (_context97.prev = _context97.next) {
|
9121
9174
|
case 0:
|
9122
9175
|
n = e.delta, r = e.finish_reason;
|
9123
9176
|
if (!(r === "tool_calls")) {
|
9124
|
-
|
9177
|
+
_context97.next = 7;
|
9125
9178
|
break;
|
9126
9179
|
}
|
9127
9180
|
this.asyncCallInProgress = !0;
|
9128
9181
|
o = {
|
9129
9182
|
tool_calls: this._streamToolCalls
|
9130
9183
|
};
|
9131
|
-
return
|
9184
|
+
return _context97.abrupt("return", (this._streamToolCalls = void 0, this.handleTools(o, t, i)));
|
9132
9185
|
case 7:
|
9133
9186
|
n != null && n.tool_calls && (this._streamToolCalls ? n.tool_calls.forEach(function (o, a) {
|
9134
9187
|
_this41._streamToolCalls && (_this41._streamToolCalls[a]["function"].arguments += o["function"].arguments);
|
9135
9188
|
}) : this._streamToolCalls = n.tool_calls);
|
9136
9189
|
case 8:
|
9137
|
-
return
|
9190
|
+
return _context97.abrupt("return", {
|
9138
9191
|
text: (n == null ? void 0 : n.content) || ""
|
9139
9192
|
});
|
9140
9193
|
case 9:
|
9141
9194
|
case "end":
|
9142
|
-
return
|
9195
|
+
return _context97.stop();
|
9143
9196
|
}
|
9144
|
-
},
|
9197
|
+
}, _callee97, this);
|
9145
9198
|
}));
|
9146
|
-
function extractStreamResult(
|
9199
|
+
function extractStreamResult(_x174, _x175, _x176) {
|
9147
9200
|
return _extractStreamResult.apply(this, arguments);
|
9148
9201
|
}
|
9149
9202
|
return extractStreamResult;
|
@@ -9151,13 +9204,13 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9151
9204
|
}, {
|
9152
9205
|
key: "handleTools",
|
9153
9206
|
value: function () {
|
9154
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9207
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e, t, i) {
|
9155
9208
|
var a, l, c, d, h, n, r, o, u, _u;
|
9156
|
-
return _regeneratorRuntime().wrap(function
|
9157
|
-
while (1) switch (
|
9209
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
9210
|
+
while (1) switch (_context98.prev = _context98.next) {
|
9158
9211
|
case 0:
|
9159
9212
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
9160
|
-
|
9213
|
+
_context98.next = 2;
|
9161
9214
|
break;
|
9162
9215
|
}
|
9163
9216
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -9169,28 +9222,28 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9169
9222
|
arguments: u["function"].arguments
|
9170
9223
|
};
|
9171
9224
|
});
|
9172
|
-
|
9225
|
+
_context98.next = 6;
|
9173
9226
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
9174
9227
|
case 6:
|
9175
|
-
o =
|
9228
|
+
o = _context98.sent;
|
9176
9229
|
if (!o.text) {
|
9177
|
-
|
9230
|
+
_context98.next = 15;
|
9178
9231
|
break;
|
9179
9232
|
}
|
9180
9233
|
u = {
|
9181
9234
|
text: o.text
|
9182
9235
|
};
|
9183
|
-
|
9236
|
+
_context98.next = 11;
|
9184
9237
|
return (c = (l = this.deepChat).responseInterceptor) == null ? void 0 : c.call(l, u);
|
9185
9238
|
case 11:
|
9186
|
-
|
9187
|
-
if (
|
9188
|
-
|
9239
|
+
_context98.t0 = _context98.sent;
|
9240
|
+
if (_context98.t0) {
|
9241
|
+
_context98.next = 14;
|
9189
9242
|
break;
|
9190
9243
|
}
|
9191
|
-
|
9244
|
+
_context98.t0 = u;
|
9192
9245
|
case 14:
|
9193
|
-
return
|
9246
|
+
return _context98.abrupt("return", _context98.t0);
|
9194
9247
|
case 15:
|
9195
9248
|
if (!(n.messages.push({
|
9196
9249
|
tool_calls: e.tool_calls,
|
@@ -9199,7 +9252,7 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9199
9252
|
}), Array.isArray(o) && !o.find(function (u) {
|
9200
9253
|
return typeof u != "string";
|
9201
9254
|
}) || r.length === o.length)) {
|
9202
|
-
|
9255
|
+
_context98.next = 35;
|
9203
9256
|
break;
|
9204
9257
|
}
|
9205
9258
|
o.forEach(function (u, f) {
|
@@ -9212,46 +9265,46 @@ var yt = /*#__PURE__*/function (_U12) {
|
|
9212
9265
|
content: u.response
|
9213
9266
|
});
|
9214
9267
|
}), delete n.tools, delete n.tool_choice, delete n.stream;
|
9215
|
-
|
9216
|
-
|
9268
|
+
_context98.prev = 17;
|
9269
|
+
_context98.next = 20;
|
9217
9270
|
return t == null ? void 0 : t(n).then(function (f) {
|
9218
9271
|
return v.processResponseByType(f);
|
9219
9272
|
});
|
9220
9273
|
case 20:
|
9221
|
-
_u =
|
9222
|
-
|
9274
|
+
_u = _context98.sent;
|
9275
|
+
_context98.next = 23;
|
9223
9276
|
return (h = (d = this.deepChat).responseInterceptor) == null ? void 0 : h.call(d, _u);
|
9224
9277
|
case 23:
|
9225
|
-
|
9226
|
-
if (
|
9227
|
-
|
9278
|
+
_context98.t1 = _context98.sent;
|
9279
|
+
if (_context98.t1) {
|
9280
|
+
_context98.next = 26;
|
9228
9281
|
break;
|
9229
9282
|
}
|
9230
|
-
|
9283
|
+
_context98.t1 = _u;
|
9231
9284
|
case 26:
|
9232
|
-
_u =
|
9285
|
+
_u = _context98.t1;
|
9233
9286
|
if (!_u.error) {
|
9234
|
-
|
9287
|
+
_context98.next = 29;
|
9235
9288
|
break;
|
9236
9289
|
}
|
9237
9290
|
throw _u.error.message;
|
9238
9291
|
case 29:
|
9239
|
-
return
|
9292
|
+
return _context98.abrupt("return", {
|
9240
9293
|
text: _u.choices[0].message.content || ""
|
9241
9294
|
});
|
9242
9295
|
case 32:
|
9243
|
-
|
9244
|
-
|
9245
|
-
throw this.asyncCallInProgress = !1,
|
9296
|
+
_context98.prev = 32;
|
9297
|
+
_context98.t2 = _context98["catch"](17);
|
9298
|
+
throw this.asyncCallInProgress = !1, _context98.t2;
|
9246
9299
|
case 35:
|
9247
9300
|
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
9301
|
case 36:
|
9249
9302
|
case "end":
|
9250
|
-
return
|
9303
|
+
return _context98.stop();
|
9251
9304
|
}
|
9252
|
-
},
|
9305
|
+
}, _callee98, this, [[17, 32]]);
|
9253
9306
|
}));
|
9254
|
-
function handleTools(
|
9307
|
+
function handleTools(_x177, _x178, _x179) {
|
9255
9308
|
return _handleTools2.apply(this, arguments);
|
9256
9309
|
}
|
9257
9310
|
return handleTools;
|
@@ -9315,26 +9368,26 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9315
9368
|
}, {
|
9316
9369
|
key: "callServiceAPI",
|
9317
9370
|
value: function () {
|
9318
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9371
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t) {
|
9319
9372
|
var i;
|
9320
|
-
return _regeneratorRuntime().wrap(function
|
9321
|
-
while (1) switch (
|
9373
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
9374
|
+
while (1) switch (_context99.prev = _context99.next) {
|
9322
9375
|
case 0:
|
9323
9376
|
if (this.connectSettings) {
|
9324
|
-
|
9377
|
+
_context99.next = 2;
|
9325
9378
|
break;
|
9326
9379
|
}
|
9327
9380
|
throw new Error("Request settings have not been set up");
|
9328
9381
|
case 2:
|
9329
9382
|
i = this.preprocessBody(this.rawBody, t);
|
9330
|
-
|
9383
|
+
C.request(this, i, e);
|
9331
9384
|
case 4:
|
9332
9385
|
case "end":
|
9333
|
-
return
|
9386
|
+
return _context99.stop();
|
9334
9387
|
}
|
9335
|
-
},
|
9388
|
+
}, _callee99, this);
|
9336
9389
|
}));
|
9337
|
-
function callServiceAPI(
|
9390
|
+
function callServiceAPI(_x180, _x181) {
|
9338
9391
|
return _callServiceAPI21.apply(this, arguments);
|
9339
9392
|
}
|
9340
9393
|
return callServiceAPI;
|
@@ -9342,26 +9395,26 @@ var ko = /*#__PURE__*/function (_un3) {
|
|
9342
9395
|
}, {
|
9343
9396
|
key: "extractResultData",
|
9344
9397
|
value: function () {
|
9345
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9346
|
-
return _regeneratorRuntime().wrap(function
|
9347
|
-
while (1) switch (
|
9398
|
+
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e) {
|
9399
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
9400
|
+
while (1) switch (_context100.prev = _context100.next) {
|
9348
9401
|
case 0:
|
9349
9402
|
if (!e.message) {
|
9350
|
-
|
9403
|
+
_context100.next = 2;
|
9351
9404
|
break;
|
9352
9405
|
}
|
9353
9406
|
throw e.message;
|
9354
9407
|
case 2:
|
9355
|
-
return
|
9408
|
+
return _context100.abrupt("return", {
|
9356
9409
|
text: e.text
|
9357
9410
|
});
|
9358
9411
|
case 3:
|
9359
9412
|
case "end":
|
9360
|
-
return
|
9413
|
+
return _context100.stop();
|
9361
9414
|
}
|
9362
|
-
},
|
9415
|
+
}, _callee100);
|
9363
9416
|
}));
|
9364
|
-
function extractResultData(
|
9417
|
+
function extractResultData(_x182) {
|
9365
9418
|
return _extractResultData24.apply(this, arguments);
|
9366
9419
|
}
|
9367
9420
|
return extractResultData;
|
@@ -9433,26 +9486,26 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9433
9486
|
}, {
|
9434
9487
|
key: "callServiceAPI",
|
9435
9488
|
value: function () {
|
9436
|
-
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9489
|
+
var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e, t) {
|
9437
9490
|
var i;
|
9438
|
-
return _regeneratorRuntime().wrap(function
|
9439
|
-
while (1) switch (
|
9491
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
9492
|
+
while (1) switch (_context101.prev = _context101.next) {
|
9440
9493
|
case 0:
|
9441
9494
|
if (this.connectSettings) {
|
9442
|
-
|
9495
|
+
_context101.next = 2;
|
9443
9496
|
break;
|
9444
9497
|
}
|
9445
9498
|
throw new Error("Request settings have not been set up");
|
9446
9499
|
case 2:
|
9447
9500
|
i = this.preprocessBody(this.rawBody, t);
|
9448
|
-
|
9501
|
+
C.request(this, i, e);
|
9449
9502
|
case 4:
|
9450
9503
|
case "end":
|
9451
|
-
return
|
9504
|
+
return _context101.stop();
|
9452
9505
|
}
|
9453
|
-
},
|
9506
|
+
}, _callee101, this);
|
9454
9507
|
}));
|
9455
|
-
function callServiceAPI(
|
9508
|
+
function callServiceAPI(_x183, _x184) {
|
9456
9509
|
return _callServiceAPI22.apply(this, arguments);
|
9457
9510
|
}
|
9458
9511
|
return callServiceAPI;
|
@@ -9460,26 +9513,26 @@ var Ao = /*#__PURE__*/function (_U13) {
|
|
9460
9513
|
}, {
|
9461
9514
|
key: "extractResultData",
|
9462
9515
|
value: function () {
|
9463
|
-
var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9464
|
-
return _regeneratorRuntime().wrap(function
|
9465
|
-
while (1) switch (
|
9516
|
+
var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e) {
|
9517
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
9518
|
+
while (1) switch (_context102.prev = _context102.next) {
|
9466
9519
|
case 0:
|
9467
9520
|
if (!e.message) {
|
9468
|
-
|
9521
|
+
_context102.next = 2;
|
9469
9522
|
break;
|
9470
9523
|
}
|
9471
9524
|
throw e.message;
|
9472
9525
|
case 2:
|
9473
|
-
return
|
9526
|
+
return _context102.abrupt("return", {
|
9474
9527
|
text: e.text
|
9475
9528
|
});
|
9476
9529
|
case 3:
|
9477
9530
|
case "end":
|
9478
|
-
return
|
9531
|
+
return _context102.stop();
|
9479
9532
|
}
|
9480
|
-
},
|
9533
|
+
}, _callee102);
|
9481
9534
|
}));
|
9482
|
-
function extractResultData(
|
9535
|
+
function extractResultData(_x185) {
|
9483
9536
|
return _extractResultData25.apply(this, arguments);
|
9484
9537
|
}
|
9485
9538
|
return extractResultData;
|
@@ -9508,8 +9561,8 @@ var Mo = /*#__PURE__*/function () {
|
|
9508
9561
|
if (t.azure) {
|
9509
9562
|
if (t.azure.speechToText) return new tn(e);
|
9510
9563
|
if (t.azure.textToSpeech) return new en(e);
|
9511
|
-
if (t.azure.summarization) return new
|
9512
|
-
if (t.azure.translation) return new
|
9564
|
+
if (t.azure.summarization) return new Co(e);
|
9565
|
+
if (t.azure.translation) return new To(e);
|
9513
9566
|
}
|
9514
9567
|
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new ri(e) : t.stabilityAI.imageToImageUpscale ? new ni(e) : t.stabilityAI.imageToImageMasking ? new si(e) : new oi(e);
|
9515
9568
|
if (t.mistral) return new Ao(e);
|
@@ -9641,20 +9694,20 @@ var Te = /*#__PURE__*/function () {
|
|
9641
9694
|
}, {
|
9642
9695
|
key: "addNewImageMessage",
|
9643
9696
|
value: function () {
|
9644
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9697
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e, t, i) {
|
9645
9698
|
var n, r;
|
9646
|
-
return _regeneratorRuntime().wrap(function
|
9647
|
-
while (1) switch (
|
9699
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
9700
|
+
while (1) switch (_context103.prev = _context103.next) {
|
9648
9701
|
case 0:
|
9649
9702
|
n = Te.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
9650
9703
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), q.addMessage(e, r, "image", i);
|
9651
9704
|
case 2:
|
9652
9705
|
case "end":
|
9653
|
-
return
|
9706
|
+
return _context103.stop();
|
9654
9707
|
}
|
9655
|
-
},
|
9708
|
+
}, _callee103);
|
9656
9709
|
}));
|
9657
|
-
function addNewImageMessage(
|
9710
|
+
function addNewImageMessage(_x186, _x187, _x188) {
|
9658
9711
|
return _addNewImageMessage.apply(this, arguments);
|
9659
9712
|
}
|
9660
9713
|
return addNewImageMessage;
|
@@ -9701,16 +9754,16 @@ var Te = /*#__PURE__*/function () {
|
|
9701
9754
|
}
|
9702
9755
|
}]);
|
9703
9756
|
}();
|
9704
|
-
var
|
9705
|
-
function
|
9757
|
+
var ke = /*#__PURE__*/function (_ot) {
|
9758
|
+
function ke(e, t, i) {
|
9706
9759
|
var _this44;
|
9707
|
-
_classCallCheck(this,
|
9760
|
+
_classCallCheck(this, ke);
|
9708
9761
|
var a, l;
|
9709
|
-
_this44 = _callSuper(this,
|
9762
|
+
_this44 = _callSuper(this, ke, [e]);
|
9710
9763
|
var n = t.permittedErrorPrefixes,
|
9711
9764
|
r = t.introPanelMarkUp,
|
9712
9765
|
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 =
|
9766
|
+
_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
9767
|
return JSON.parse(JSON.stringify(_this44.messages));
|
9715
9768
|
}, 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
9769
|
_this44.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
@@ -9721,8 +9774,8 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9721
9774
|
}), t.fetchHistory && _this44.fetchHistory(t.fetchHistory);
|
9722
9775
|
return _this44;
|
9723
9776
|
}
|
9724
|
-
_inherits(
|
9725
|
-
return _createClass(
|
9777
|
+
_inherits(ke, _ot);
|
9778
|
+
return _createClass(ke, [{
|
9726
9779
|
key: "prepareDemo",
|
9727
9780
|
value: function prepareDemo(e) {
|
9728
9781
|
_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 +9813,9 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9760
9813
|
key: "populateHistory",
|
9761
9814
|
value: function populateHistory(e) {
|
9762
9815
|
var _this45 = this;
|
9763
|
-
var t = e.history ||
|
9816
|
+
var t = e.history || he.processHistory(e);
|
9764
9817
|
t && (t.forEach(function (i) {
|
9765
|
-
|
9818
|
+
he.processHistoryFile(i), _this45.addNewMessage(i, !0);
|
9766
9819
|
}), setTimeout(function () {
|
9767
9820
|
return j.scrollToBottom(_this45.elementRef);
|
9768
9821
|
}, 0));
|
@@ -9770,15 +9823,15 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9770
9823
|
}, {
|
9771
9824
|
key: "fetchHistory",
|
9772
9825
|
value: function () {
|
9773
|
-
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9826
|
+
var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
|
9774
9827
|
var _this46 = this;
|
9775
|
-
return _regeneratorRuntime().wrap(function
|
9776
|
-
while (1) switch (
|
9828
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
9829
|
+
while (1) switch (_context104.prev = _context104.next) {
|
9777
9830
|
case 0:
|
9778
|
-
|
9831
|
+
_context104.next = 2;
|
9779
9832
|
return e();
|
9780
9833
|
case 2:
|
9781
|
-
|
9834
|
+
_context104.sent.forEach(function (i) {
|
9782
9835
|
return _this46.addAnyMessage(i, !0);
|
9783
9836
|
});
|
9784
9837
|
setTimeout(function () {
|
@@ -9786,11 +9839,11 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9786
9839
|
}, 0);
|
9787
9840
|
case 4:
|
9788
9841
|
case "end":
|
9789
|
-
return
|
9842
|
+
return _context104.stop();
|
9790
9843
|
}
|
9791
|
-
},
|
9844
|
+
}, _callee104);
|
9792
9845
|
}));
|
9793
|
-
function fetchHistory(
|
9846
|
+
function fetchHistory(_x189) {
|
9794
9847
|
return _fetchHistory.apply(this, arguments);
|
9795
9848
|
}
|
9796
9849
|
return fetchHistory;
|
@@ -9806,7 +9859,7 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9806
9859
|
key: "addNewMessage",
|
9807
9860
|
value: function addNewMessage(e) {
|
9808
9861
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
9809
|
-
var i =
|
9862
|
+
var i = ke.createMessageContent(e),
|
9810
9863
|
n = {
|
9811
9864
|
status: e.overwrite
|
9812
9865
|
};
|
@@ -9834,7 +9887,7 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9834
9887
|
value: function removeMessageOnError() {
|
9835
9888
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
9836
9889
|
t = e == null ? void 0 : e.bubbleElement;
|
9837
|
-
(t != null && t.classList.contains(
|
9890
|
+
(t != null && t.classList.contains(Se.MESSAGE_CLASS) && t.textContent === "" || ke.isTemporaryElement(e)) && this.removeLastMessage();
|
9838
9891
|
}
|
9839
9892
|
// prettier-ignore
|
9840
9893
|
}, {
|
@@ -9842,7 +9895,7 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9842
9895
|
value: function addNewErrorMessage(e, t) {
|
9843
9896
|
var l, c, d, h, u;
|
9844
9897
|
this.removeMessageOnError();
|
9845
|
-
var i =
|
9898
|
+
var i = ke.createBaseElements(),
|
9846
9899
|
n = i.outerContainer,
|
9847
9900
|
r = i.bubbleElement;
|
9848
9901
|
r.classList.add("error-message-text");
|
@@ -9857,10 +9910,10 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9857
9910
|
if (e) {
|
9858
9911
|
if (this._displayServiceErrorMessages) return e;
|
9859
9912
|
if (typeof e == "string" && this._permittedErrorPrefixes) {
|
9860
|
-
var t =
|
9913
|
+
var t = ke.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, e);
|
9861
9914
|
if (t) return t;
|
9862
9915
|
} else if (Array.isArray(e) && this._permittedErrorPrefixes) for (var _t3 = 0; _t3 < e.length; _t3 += 1) {
|
9863
|
-
var _i17 =
|
9916
|
+
var _i17 = ke.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, e[_t3]);
|
9864
9917
|
if (_i17) return _i17;
|
9865
9918
|
}
|
9866
9919
|
}
|
@@ -9885,16 +9938,16 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9885
9938
|
}, {
|
9886
9939
|
key: "populateIntroPanel",
|
9887
9940
|
value: function populateIntroPanel(e, t, i) {
|
9888
|
-
(e || t) && (this._introPanel = new ci(e, t, i), this._introPanel._elementRef && (
|
9941
|
+
(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
9942
|
}
|
9890
9943
|
}, {
|
9891
9944
|
key: "addMultipleFiles",
|
9892
9945
|
value: function () {
|
9893
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9894
|
-
return _regeneratorRuntime().wrap(function
|
9895
|
-
while (1) switch (
|
9946
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e) {
|
9947
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
9948
|
+
while (1) switch (_context105.prev = _context105.next) {
|
9896
9949
|
case 0:
|
9897
|
-
return
|
9950
|
+
return _context105.abrupt("return", Promise.all((e || []).map(function (t) {
|
9898
9951
|
return new Promise(function (i) {
|
9899
9952
|
if (!t.type || t.type === "any") {
|
9900
9953
|
var n = t.file.name || q.DEFAULT_FILE_NAME;
|
@@ -9917,11 +9970,11 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9917
9970
|
})));
|
9918
9971
|
case 1:
|
9919
9972
|
case "end":
|
9920
|
-
return
|
9973
|
+
return _context105.stop();
|
9921
9974
|
}
|
9922
|
-
},
|
9975
|
+
}, _callee105);
|
9923
9976
|
}));
|
9924
|
-
function addMultipleFiles(
|
9977
|
+
function addMultipleFiles(_x190) {
|
9925
9978
|
return _addMultipleFiles.apply(this, arguments);
|
9926
9979
|
}
|
9927
9980
|
return addMultipleFiles;
|
@@ -9933,7 +9986,7 @@ var Ce = /*#__PURE__*/function (_ot) {
|
|
9933
9986
|
var i = [];
|
9934
9987
|
this.messageElementRefs.forEach(function (o) {
|
9935
9988
|
var a = o.bubbleElement.classList;
|
9936
|
-
a.contains("loading-message-text") || a.contains(
|
9989
|
+
a.contains("loading-message-text") || a.contains(Se.MESSAGE_CLASS) ? i.push(o) : o.outerContainer.remove();
|
9937
9990
|
}), Array.from(this.elementRef.children).forEach(function (o) {
|
9938
9991
|
var l;
|
9939
9992
|
var a = (l = o.children[0]) == null ? void 0 : l.children[0];
|
@@ -10063,11 +10116,11 @@ var J = /*#__PURE__*/function () {
|
|
10063
10116
|
}]);
|
10064
10117
|
}();
|
10065
10118
|
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,
|
10119
|
+
var de = /*#__PURE__*/function () {
|
10120
|
+
function de() {
|
10121
|
+
_classCallCheck(this, de);
|
10069
10122
|
}
|
10070
|
-
return _createClass(
|
10123
|
+
return _createClass(de, null, [{
|
10071
10124
|
key: "unsetAllCSS",
|
10072
10125
|
value: function unsetAllCSS(e, t) {
|
10073
10126
|
var i, n;
|
@@ -10088,7 +10141,7 @@ var ce = /*#__PURE__*/function () {
|
|
10088
10141
|
}, {
|
10089
10142
|
key: "setElementCssUpToState",
|
10090
10143
|
value: function setElementCssUpToState(e, t, i) {
|
10091
|
-
|
10144
|
+
de.setElementsCSS(e, t, "default"), i !== "default" && (de.setElementsCSS(e, t, "hover"), i !== "hover" && de.setElementsCSS(e, t, "click"));
|
10092
10145
|
}
|
10093
10146
|
}]);
|
10094
10147
|
}();
|
@@ -10102,22 +10155,22 @@ var Bt = /*#__PURE__*/function () {
|
|
10102
10155
|
return _createClass(Bt, [{
|
10103
10156
|
key: "buttonMouseLeave",
|
10104
10157
|
value: function buttonMouseLeave(e) {
|
10105
|
-
this._mouseState.state = "default", e && (
|
10158
|
+
this._mouseState.state = "default", e && (de.unsetAllCSS(this.elementRef, e), de.setElementsCSS(this.elementRef, e, "default"));
|
10106
10159
|
}
|
10107
10160
|
}, {
|
10108
10161
|
key: "buttonMouseEnter",
|
10109
10162
|
value: function buttonMouseEnter(e) {
|
10110
|
-
this._mouseState.state = "hover", e &&
|
10163
|
+
this._mouseState.state = "hover", e && de.setElementsCSS(this.elementRef, e, "hover");
|
10111
10164
|
}
|
10112
10165
|
}, {
|
10113
10166
|
key: "buttonMouseUp",
|
10114
10167
|
value: function buttonMouseUp(e) {
|
10115
|
-
e &&
|
10168
|
+
e && de.unsetActionCSS(this.elementRef, e), this.buttonMouseEnter(e);
|
10116
10169
|
}
|
10117
10170
|
}, {
|
10118
10171
|
key: "buttonMouseDown",
|
10119
10172
|
value: function buttonMouseDown(e) {
|
10120
|
-
this._mouseState.state = "click", e &&
|
10173
|
+
this._mouseState.state = "click", e && de.setElementsCSS(this.elementRef, e, "click");
|
10121
10174
|
}
|
10122
10175
|
// be careful not to use onclick as that is used for button functionality
|
10123
10176
|
}, {
|
@@ -10131,7 +10184,7 @@ var Bt = /*#__PURE__*/function () {
|
|
10131
10184
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
10132
10185
|
var _i19 = e[t],
|
10133
10186
|
n = _i19 && this._customStyles[_i19];
|
10134
|
-
n &&
|
10187
|
+
n && de.unsetActionCSS(this.elementRef, n);
|
10135
10188
|
}
|
10136
10189
|
}
|
10137
10190
|
}, {
|
@@ -10140,7 +10193,7 @@ var Bt = /*#__PURE__*/function () {
|
|
10140
10193
|
if (!this._customStyles) return;
|
10141
10194
|
t && this.unsetCustomStateStyles(t);
|
10142
10195
|
var i = this._customStyles[e];
|
10143
|
-
i &&
|
10196
|
+
i && de.setElementCssUpToState(this.elementRef, i, this._mouseState.state), this.setEvents(i);
|
10144
10197
|
}
|
10145
10198
|
}]);
|
10146
10199
|
}();
|
@@ -10633,11 +10686,11 @@ gt.IS_SAFARI = function () {
|
|
10633
10686
|
return gt._IS_SAFARI === void 0 && (gt._IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), gt._IS_SAFARI;
|
10634
10687
|
};
|
10635
10688
|
var Ut = {},
|
10636
|
-
|
10637
|
-
Object.defineProperty(
|
10689
|
+
Ci = {};
|
10690
|
+
Object.defineProperty(Ci, "__esModule", {
|
10638
10691
|
value: !0
|
10639
10692
|
});
|
10640
|
-
|
10693
|
+
Ci.EventListeners = void 0;
|
10641
10694
|
var te = /*#__PURE__*/function () {
|
10642
10695
|
function te() {
|
10643
10696
|
_classCallCheck(this, te);
|
@@ -10680,13 +10733,13 @@ var te = /*#__PURE__*/function () {
|
|
10680
10733
|
}
|
10681
10734
|
}]);
|
10682
10735
|
}();
|
10683
|
-
|
10736
|
+
Ci.EventListeners = te;
|
10684
10737
|
te.KEY_DOWN_TIMEOUT = null;
|
10685
|
-
var
|
10686
|
-
Object.defineProperty(
|
10738
|
+
var Ti = {};
|
10739
|
+
Object.defineProperty(Ti, "__esModule", {
|
10687
10740
|
value: !0
|
10688
10741
|
});
|
10689
|
-
|
10742
|
+
Ti.PreResultUtils = void 0;
|
10690
10743
|
var qo = /*#__PURE__*/function () {
|
10691
10744
|
function qo() {
|
10692
10745
|
_classCallCheck(this, qo);
|
@@ -10701,7 +10754,7 @@ var qo = /*#__PURE__*/function () {
|
|
10701
10754
|
}
|
10702
10755
|
}]);
|
10703
10756
|
}();
|
10704
|
-
|
10757
|
+
Ti.PreResultUtils = qo;
|
10705
10758
|
var Ht = {},
|
10706
10759
|
qt = {};
|
10707
10760
|
Object.defineProperty(qt, "__esModule", {
|
@@ -11112,12 +11165,12 @@ Object.defineProperty(Ut, "__esModule", {
|
|
11112
11165
|
value: !0
|
11113
11166
|
});
|
11114
11167
|
Ut.Speech = void 0;
|
11115
|
-
var Hn =
|
11116
|
-
Ko =
|
11168
|
+
var Hn = Ci,
|
11169
|
+
Ko = Ti,
|
11117
11170
|
qn = Ht,
|
11118
11171
|
$t = qt,
|
11119
11172
|
Ui = ki,
|
11120
|
-
|
11173
|
+
ue = Ze,
|
11121
11174
|
Hi = Ai,
|
11122
11175
|
zn = ft,
|
11123
11176
|
Vn = Ye,
|
@@ -11125,7 +11178,7 @@ var Hn = Ti,
|
|
11125
11178
|
var Jo = /*#__PURE__*/function () {
|
11126
11179
|
function Jo() {
|
11127
11180
|
_classCallCheck(this, Jo);
|
11128
|
-
this.finalTranscript = "", this.interimSpan =
|
11181
|
+
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
11182
|
}
|
11130
11183
|
return _createClass(Jo, [{
|
11131
11184
|
key: "prepareBeforeStart",
|
@@ -11138,12 +11191,12 @@ var Jo = /*#__PURE__*/function () {
|
|
11138
11191
|
if (!r) return;
|
11139
11192
|
this.prepare(r);
|
11140
11193
|
} 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"],
|
11194
|
+
(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
11195
|
}
|
11143
11196
|
}, {
|
11144
11197
|
key: "prepare",
|
11145
11198
|
value: function prepare(e) {
|
11146
|
-
Hi.Padding.setState(this, e), Ui.Highlight.setState(this, e), this.isTargetInShadow =
|
11199
|
+
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
11200
|
}
|
11148
11201
|
// there was an attempt to optimize this by not having to restart the service and just reset state:
|
11149
11202
|
// unfortunately it did not work because the service would still continue firing the intermediate and final results
|
@@ -11187,7 +11240,7 @@ var Jo = /*#__PURE__*/function () {
|
|
11187
11240
|
}, {
|
11188
11241
|
key: "updateGenericElement",
|
11189
11242
|
value: function updateGenericElement(e, t, i) {
|
11190
|
-
this.isHighlighted && Ui.Highlight.removeForGeneric(this, e), this.spansPopulated ||
|
11243
|
+
this.isHighlighted && Ui.Highlight.removeForGeneric(this, e), this.spansPopulated || ue.Elements.appendSpans(this, e);
|
11191
11244
|
var n = (i ? "" : this.startPadding) + qi.Text.lineBreak(this.finalTranscript);
|
11192
11245
|
this.finalSpan.innerHTML = n;
|
11193
11246
|
var r = $t.AutoScroll.isRequired(this.autoScroll, e);
|
@@ -11198,7 +11251,7 @@ var Jo = /*#__PURE__*/function () {
|
|
11198
11251
|
}, {
|
11199
11252
|
key: "finalise",
|
11200
11253
|
value: function finalise(e) {
|
11201
|
-
this._genericElement && (e ? (this.finalSpan =
|
11254
|
+
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
11255
|
}
|
11203
11256
|
}, {
|
11204
11257
|
key: "setInterimColorToFinal",
|
@@ -11372,26 +11425,26 @@ var fi = /*#__PURE__*/function () {
|
|
11372
11425
|
}, {
|
11373
11426
|
key: "getNewSpeechConfig",
|
11374
11427
|
value: function () {
|
11375
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11376
|
-
return _regeneratorRuntime().wrap(function
|
11377
|
-
while (1) switch (
|
11428
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(e, t) {
|
11429
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
11430
|
+
while (1) switch (_context106.prev = _context106.next) {
|
11378
11431
|
case 0:
|
11379
11432
|
if (!t.region) {
|
11380
|
-
|
11433
|
+
_context106.next = 2;
|
11381
11434
|
break;
|
11382
11435
|
}
|
11383
|
-
return
|
11436
|
+
return _context106.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
11437
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11385
11438
|
})["catch"](function (i) {
|
11386
11439
|
return console.error(i), null;
|
11387
11440
|
}) : null);
|
11388
11441
|
case 2:
|
11389
11442
|
case "end":
|
11390
|
-
return
|
11443
|
+
return _context106.stop();
|
11391
11444
|
}
|
11392
|
-
},
|
11445
|
+
}, _callee106);
|
11393
11446
|
}));
|
11394
|
-
function getNewSpeechConfig(
|
11447
|
+
function getNewSpeechConfig(_x191, _x192) {
|
11395
11448
|
return _getNewSpeechConfig.apply(this, arguments);
|
11396
11449
|
}
|
11397
11450
|
return getNewSpeechConfig;
|
@@ -11404,23 +11457,23 @@ var fi = /*#__PURE__*/function () {
|
|
11404
11457
|
}, {
|
11405
11458
|
key: "get",
|
11406
11459
|
value: function () {
|
11407
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11460
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107(e, t) {
|
11408
11461
|
var i;
|
11409
|
-
return _regeneratorRuntime().wrap(function
|
11410
|
-
while (1) switch (
|
11462
|
+
return _regeneratorRuntime().wrap(function _callee107$(_context107) {
|
11463
|
+
while (1) switch (_context107.prev = _context107.next) {
|
11411
11464
|
case 0:
|
11412
|
-
|
11465
|
+
_context107.next = 2;
|
11413
11466
|
return fi.getNewSpeechConfig(e, t);
|
11414
11467
|
case 2:
|
11415
|
-
i =
|
11416
|
-
return
|
11468
|
+
i = _context107.sent;
|
11469
|
+
return _context107.abrupt("return", (i && fi.process(i, t), i));
|
11417
11470
|
case 4:
|
11418
11471
|
case "end":
|
11419
|
-
return
|
11472
|
+
return _context107.stop();
|
11420
11473
|
}
|
11421
|
-
},
|
11474
|
+
}, _callee107);
|
11422
11475
|
}));
|
11423
|
-
function get(
|
11476
|
+
function get(_x193, _x194) {
|
11424
11477
|
return _get.apply(this, arguments);
|
11425
11478
|
}
|
11426
11479
|
return get;
|
@@ -11506,28 +11559,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11506
11559
|
}, {
|
11507
11560
|
key: "startAsync",
|
11508
11561
|
value: function () {
|
11509
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11562
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee108(e) {
|
11510
11563
|
var t;
|
11511
|
-
return _regeneratorRuntime().wrap(function
|
11512
|
-
while (1) switch (
|
11564
|
+
return _regeneratorRuntime().wrap(function _callee108$(_context108) {
|
11565
|
+
while (1) switch (_context108.prev = _context108.next) {
|
11513
11566
|
case 0:
|
11514
|
-
|
11515
|
-
if (!
|
11516
|
-
|
11567
|
+
_context108.t0 = this.validate(e);
|
11568
|
+
if (!_context108.t0) {
|
11569
|
+
_context108.next = 6;
|
11517
11570
|
break;
|
11518
11571
|
}
|
11519
|
-
|
11572
|
+
_context108.next = 4;
|
11520
11573
|
return this.instantiateService(e);
|
11521
11574
|
case 4:
|
11522
11575
|
this._translations = e == null ? void 0 : e.translations;
|
11523
11576
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11524
11577
|
case 6:
|
11525
11578
|
case "end":
|
11526
|
-
return
|
11579
|
+
return _context108.stop();
|
11527
11580
|
}
|
11528
|
-
},
|
11581
|
+
}, _callee108, this);
|
11529
11582
|
}));
|
11530
|
-
function startAsync(
|
11583
|
+
function startAsync(_x195) {
|
11531
11584
|
return _startAsync.apply(this, arguments);
|
11532
11585
|
}
|
11533
11586
|
return startAsync;
|
@@ -11540,28 +11593,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
|
|
11540
11593
|
}, {
|
11541
11594
|
key: "instantiateService",
|
11542
11595
|
value: function () {
|
11543
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11596
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee109(e) {
|
11544
11597
|
var t, i, n, r;
|
11545
|
-
return _regeneratorRuntime().wrap(function
|
11546
|
-
while (1) switch (
|
11598
|
+
return _regeneratorRuntime().wrap(function _callee109$(_context109) {
|
11599
|
+
while (1) switch (_context109.prev = _context109.next) {
|
11547
11600
|
case 0:
|
11548
11601
|
t = pi.getAPI();
|
11549
11602
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11550
|
-
|
11603
|
+
_context109.next = 4;
|
11551
11604
|
return Kn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11552
11605
|
case 4:
|
11553
|
-
n =
|
11606
|
+
n = _context109.sent;
|
11554
11607
|
if (n) {
|
11555
11608
|
r = new t.SpeechRecognizer(n, i);
|
11556
11609
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11557
11610
|
} else this.error("Unable to contact Azure server");
|
11558
11611
|
case 6:
|
11559
11612
|
case "end":
|
11560
|
-
return
|
11613
|
+
return _context109.stop();
|
11561
11614
|
}
|
11562
|
-
},
|
11615
|
+
}, _callee109, this);
|
11563
11616
|
}));
|
11564
|
-
function instantiateService(
|
11617
|
+
function instantiateService(_x196) {
|
11565
11618
|
return _instantiateService.apply(this, arguments);
|
11566
11619
|
}
|
11567
11620
|
return instantiateService;
|
@@ -11736,12 +11789,12 @@ var na = /*#__PURE__*/function () {
|
|
11736
11789
|
}
|
11737
11790
|
}]);
|
11738
11791
|
}();
|
11739
|
-
var
|
11740
|
-
function
|
11792
|
+
var Ct = /*#__PURE__*/function (_Lt) {
|
11793
|
+
function Ct(e, t, i) {
|
11741
11794
|
var _this56;
|
11742
|
-
_classCallCheck(this,
|
11795
|
+
_classCallCheck(this, Ct);
|
11743
11796
|
var o;
|
11744
|
-
_this56 = _callSuper(this,
|
11797
|
+
_this56 = _callSuper(this, Ct, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
|
11745
11798
|
var _this56$processConfig = _this56.processConfiguration(t, e.speechToText),
|
11746
11799
|
n = _this56$processConfig.serviceName,
|
11747
11800
|
r = _this56$processConfig.processedConfig;
|
@@ -11755,8 +11808,8 @@ var Tt = /*#__PURE__*/function (_Lt) {
|
|
11755
11808
|
return _this56;
|
11756
11809
|
}
|
11757
11810
|
// prettier-ignore
|
11758
|
-
_inherits(
|
11759
|
-
return _createClass(
|
11811
|
+
_inherits(Ct, _Lt);
|
11812
|
+
return _createClass(Ct, [{
|
11760
11813
|
key: "processConfiguration",
|
11761
11814
|
value: function processConfiguration(e, t) {
|
11762
11815
|
var _i$displayInterimResu, _i$textColor, _i$translations, _i$commands;
|
@@ -11780,7 +11833,7 @@ var Tt = /*#__PURE__*/function (_Lt) {
|
|
11780
11833
|
removeNewText: !0
|
11781
11834
|
}) : null;
|
11782
11835
|
}), i.submitAfterSilence && (this._silenceSubmit = new na(i.submitAfterSilence, i.stopAfterSubmit)), {
|
11783
|
-
serviceName:
|
11836
|
+
serviceName: Ct.getServiceName(i),
|
11784
11837
|
processedConfig: o
|
11785
11838
|
};
|
11786
11839
|
}
|
@@ -11832,38 +11885,38 @@ var Tt = /*#__PURE__*/function (_Lt) {
|
|
11832
11885
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
11833
11886
|
e.click(), t || setTimeout(function () {
|
11834
11887
|
return e.click();
|
11835
|
-
},
|
11888
|
+
}, Ct.MICROPHONE_RESET_TIMEOUT_MS);
|
11836
11889
|
}
|
11837
11890
|
}]);
|
11838
11891
|
}(Lt);
|
11839
|
-
|
11840
|
-
var Ot =
|
11841
|
-
var
|
11892
|
+
Ct.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
11893
|
+
var Ot = Ct;
|
11894
|
+
var xe = /*#__PURE__*/function () {
|
11842
11895
|
// prettier-ignore
|
11843
|
-
function
|
11896
|
+
function xe(e, t, i, n) {
|
11844
11897
|
var _this58 = this;
|
11845
|
-
_classCallCheck(this,
|
11898
|
+
_classCallCheck(this, xe);
|
11846
11899
|
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
11900
|
_this58._validationHandler = e._validationHandler;
|
11848
11901
|
});
|
11849
11902
|
}
|
11850
|
-
return _createClass(
|
11903
|
+
return _createClass(xe, [{
|
11851
11904
|
key: "attemptAddFile",
|
11852
11905
|
value: function attemptAddFile(e, t) {
|
11853
|
-
return
|
11906
|
+
return xe.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
11854
11907
|
}
|
11855
11908
|
}, {
|
11856
11909
|
key: "addAttachmentBasedOnType",
|
11857
11910
|
value: function addAttachmentBasedOnType(e, t, i) {
|
11858
|
-
var n =
|
11911
|
+
var n = xe.getTypeFromBlob(e);
|
11859
11912
|
if (n === "image") {
|
11860
|
-
var r =
|
11913
|
+
var r = xe.createImageAttachment(t);
|
11861
11914
|
this.addFileAttachment(e, "image", r, i);
|
11862
11915
|
} else if (n === "audio") {
|
11863
11916
|
var _r2 = Nt.createAudioAttachment(t);
|
11864
11917
|
this.addFileAttachment(e, "audio", _r2, i);
|
11865
11918
|
} else {
|
11866
|
-
var _r3 =
|
11919
|
+
var _r3 = xe.createAnyFileAttachment(e.name);
|
11867
11920
|
this.addFileAttachment(e, "any", _r3, i);
|
11868
11921
|
}
|
11869
11922
|
}
|
@@ -11871,7 +11924,7 @@ var Ee = /*#__PURE__*/function () {
|
|
11871
11924
|
key: "addFileAttachment",
|
11872
11925
|
value: function addFileAttachment(e, t, i, n) {
|
11873
11926
|
var a;
|
11874
|
-
var r =
|
11927
|
+
var r = xe.createContainer(i);
|
11875
11928
|
if (this._attachments.length >= this._fileCountLimit) {
|
11876
11929
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
11877
11930
|
l == null || l.click();
|
@@ -11973,19 +12026,19 @@ var Ee = /*#__PURE__*/function () {
|
|
11973
12026
|
}();
|
11974
12027
|
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
12028
|
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
|
-
|
12029
|
+
ve = /*#__PURE__*/function (_xe) {
|
11977
12030
|
// prettier-ignore
|
11978
|
-
function
|
11979
|
-
_classCallCheck(this,
|
11980
|
-
return _callSuper(this,
|
12031
|
+
function ve(e, t, i, n) {
|
12032
|
+
_classCallCheck(this, ve);
|
12033
|
+
return _callSuper(this, ve, [e, t, i, n]);
|
11981
12034
|
}
|
11982
|
-
_inherits(
|
11983
|
-
return _createClass(
|
12035
|
+
_inherits(ve, _xe);
|
12036
|
+
return _createClass(ve, [{
|
11984
12037
|
key: "createTimer",
|
11985
12038
|
value: function createTimer(e, t) {
|
11986
12039
|
var _this59 = this;
|
11987
12040
|
var i = 0;
|
11988
|
-
var n = t !== void 0 && t <
|
12041
|
+
var n = t !== void 0 && t < ve.TIMER_LIMIT_S ? t : ve.TIMER_LIMIT_S;
|
11989
12042
|
return setInterval(function () {
|
11990
12043
|
var a;
|
11991
12044
|
i += 1, i === n && ((a = _this59.stopPlaceholderCallback) == null || a.call(_this59), _this59.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -11997,7 +12050,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
11997
12050
|
}, {
|
11998
12051
|
key: "createPlaceholderAudioAttachment",
|
11999
12052
|
value: function createPlaceholderAudioAttachment(e) {
|
12000
|
-
var t =
|
12053
|
+
var t = ve.createAudioContainer(),
|
12001
12054
|
i = document.createElement("div");
|
12002
12055
|
i.classList.add("audio-placeholder-text-3-digits");
|
12003
12056
|
var n = document.createElement("div");
|
@@ -12034,7 +12087,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12034
12087
|
key: "completePlaceholderAttachment",
|
12035
12088
|
value: function completePlaceholderAttachment(e, t) {
|
12036
12089
|
var i = this._activePlaceholderAttachment;
|
12037
|
-
i && (i.file = e,
|
12090
|
+
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
12091
|
}
|
12039
12092
|
}, {
|
12040
12093
|
key: "removePlaceholderAttachment",
|
@@ -12074,8 +12127,8 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12074
12127
|
}, {
|
12075
12128
|
key: "createAudioAttachment",
|
12076
12129
|
value: function createAudioAttachment(e) {
|
12077
|
-
var t =
|
12078
|
-
return
|
12130
|
+
var t = ve.createAudioContainer();
|
12131
|
+
return ve.addAudioElements(t, e), t;
|
12079
12132
|
}
|
12080
12133
|
}, {
|
12081
12134
|
key: "stopAttachmentPlayback",
|
@@ -12084,9 +12137,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12084
12137
|
(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
12138
|
}
|
12086
12139
|
}]);
|
12087
|
-
}(
|
12088
|
-
|
12089
|
-
var Nt =
|
12140
|
+
}(xe);
|
12141
|
+
ve.TIMER_LIMIT_S = 5999;
|
12142
|
+
var Nt = ve;
|
12090
12143
|
var ra = /*#__PURE__*/function () {
|
12091
12144
|
function ra() {
|
12092
12145
|
_classCallCheck(this, ra);
|
@@ -12096,7 +12149,7 @@ var ra = /*#__PURE__*/function () {
|
|
12096
12149
|
value:
|
12097
12150
|
// prettier-ignore
|
12098
12151
|
function create(e, t, i, n, r) {
|
12099
|
-
return r === "audio" ? new Nt(e, t, i, n) : new
|
12152
|
+
return r === "audio" ? new Nt(e, t, i, n) : new xe(e, t, i, n);
|
12100
12153
|
}
|
12101
12154
|
}]);
|
12102
12155
|
}();
|
@@ -12136,33 +12189,33 @@ var zt = /*#__PURE__*/function () {
|
|
12136
12189
|
}, {
|
12137
12190
|
key: "completePlaceholders",
|
12138
12191
|
value: function () {
|
12139
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12140
|
-
return _regeneratorRuntime().wrap(function
|
12141
|
-
while (1) switch (
|
12192
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee111() {
|
12193
|
+
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
12194
|
+
while (1) switch (_context111.prev = _context111.next) {
|
12142
12195
|
case 0:
|
12143
|
-
|
12196
|
+
_context111.next = 2;
|
12144
12197
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
12145
|
-
var
|
12198
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee110(e) {
|
12146
12199
|
var t;
|
12147
|
-
return _regeneratorRuntime().wrap(function
|
12148
|
-
while (1) switch (
|
12200
|
+
return _regeneratorRuntime().wrap(function _callee110$(_context110) {
|
12201
|
+
while (1) switch (_context110.prev = _context110.next) {
|
12149
12202
|
case 0:
|
12150
|
-
return
|
12203
|
+
return _context110.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
12151
12204
|
case 1:
|
12152
12205
|
case "end":
|
12153
|
-
return
|
12206
|
+
return _context110.stop();
|
12154
12207
|
}
|
12155
|
-
},
|
12208
|
+
}, _callee110);
|
12156
12209
|
}));
|
12157
|
-
return function (
|
12158
|
-
return
|
12210
|
+
return function (_x197) {
|
12211
|
+
return _ref15.apply(this, arguments);
|
12159
12212
|
};
|
12160
12213
|
}()));
|
12161
12214
|
case 2:
|
12162
12215
|
case "end":
|
12163
|
-
return
|
12216
|
+
return _context111.stop();
|
12164
12217
|
}
|
12165
|
-
},
|
12218
|
+
}, _callee111, this);
|
12166
12219
|
}));
|
12167
12220
|
function completePlaceholders() {
|
12168
12221
|
return _completePlaceholders.apply(this, arguments);
|
@@ -12378,15 +12431,15 @@ var xt = /*#__PURE__*/function (_Bt3) {
|
|
12378
12431
|
}
|
12379
12432
|
}]);
|
12380
12433
|
}(Bt);
|
12381
|
-
var
|
12382
|
-
function
|
12383
|
-
_classCallCheck(this,
|
12434
|
+
var ye = /*#__PURE__*/function () {
|
12435
|
+
function ye() {
|
12436
|
+
_classCallCheck(this, ye);
|
12384
12437
|
}
|
12385
|
-
return _createClass(
|
12438
|
+
return _createClass(ye, null, [{
|
12386
12439
|
key: "create",
|
12387
12440
|
value: function create(e, t, i) {
|
12388
|
-
var n =
|
12389
|
-
|
12441
|
+
var n = ye.createElement(i);
|
12442
|
+
ye.addEvents(n, e, t), e.appendChild(n);
|
12390
12443
|
}
|
12391
12444
|
}, {
|
12392
12445
|
key: "createElement",
|
@@ -12398,13 +12451,13 @@ var ve = /*#__PURE__*/function () {
|
|
12398
12451
|
key: "addEvents",
|
12399
12452
|
value: function addEvents(e, t, i) {
|
12400
12453
|
t.ondragenter = function (n) {
|
12401
|
-
n.preventDefault(),
|
12454
|
+
n.preventDefault(), ye.display(e);
|
12402
12455
|
}, e.ondragleave = function (n) {
|
12403
|
-
n.preventDefault(),
|
12456
|
+
n.preventDefault(), ye.hide(e);
|
12404
12457
|
}, e.ondragover = function (n) {
|
12405
12458
|
n.preventDefault();
|
12406
12459
|
}, e.ondrop = function (n) {
|
12407
|
-
n.preventDefault(),
|
12460
|
+
n.preventDefault(), ye.uploadFile(i, n), ye.hide(e);
|
12408
12461
|
};
|
12409
12462
|
}
|
12410
12463
|
}, {
|
@@ -12447,26 +12500,26 @@ var Fe = /*#__PURE__*/function () {
|
|
12447
12500
|
}, {
|
12448
12501
|
key: "useValidationFunc",
|
12449
12502
|
value: function () {
|
12450
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12503
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee112(e, t, i, n) {
|
12451
12504
|
var r, o, a, l;
|
12452
|
-
return _regeneratorRuntime().wrap(function
|
12453
|
-
while (1) switch (
|
12505
|
+
return _regeneratorRuntime().wrap(function _callee112$(_context112) {
|
12506
|
+
while (1) switch (_context112.prev = _context112.next) {
|
12454
12507
|
case 0:
|
12455
12508
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
12456
|
-
|
12509
|
+
_context112.next = 3;
|
12457
12510
|
return i.completePlaceholders();
|
12458
12511
|
case 3:
|
12459
12512
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
12460
12513
|
return c.file;
|
12461
12514
|
});
|
12462
|
-
return
|
12515
|
+
return _context112.abrupt("return", Fe.validate(e, n, o, l));
|
12463
12516
|
case 5:
|
12464
12517
|
case "end":
|
12465
|
-
return
|
12518
|
+
return _context112.stop();
|
12466
12519
|
}
|
12467
|
-
},
|
12520
|
+
}, _callee112);
|
12468
12521
|
}));
|
12469
|
-
function useValidationFunc(
|
12522
|
+
function useValidationFunc(_x198, _x199, _x200, _x201) {
|
12470
12523
|
return _useValidationFunc.apply(this, arguments);
|
12471
12524
|
}
|
12472
12525
|
return useValidationFunc;
|
@@ -12474,22 +12527,22 @@ var Fe = /*#__PURE__*/function () {
|
|
12474
12527
|
}, {
|
12475
12528
|
key: "useValidationFuncProgrammatic",
|
12476
12529
|
value: function () {
|
12477
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12530
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee113(e, t, i) {
|
12478
12531
|
var r, n;
|
12479
|
-
return _regeneratorRuntime().wrap(function
|
12480
|
-
while (1) switch (
|
12532
|
+
return _regeneratorRuntime().wrap(function _callee113$(_context113) {
|
12533
|
+
while (1) switch (_context113.prev = _context113.next) {
|
12481
12534
|
case 0:
|
12482
12535
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
12483
12536
|
return o.file;
|
12484
12537
|
});
|
12485
|
-
return
|
12538
|
+
return _context113.abrupt("return", Fe.validate(e, i, t.text, n, !0));
|
12486
12539
|
case 2:
|
12487
12540
|
case "end":
|
12488
|
-
return
|
12541
|
+
return _context113.stop();
|
12489
12542
|
}
|
12490
|
-
},
|
12543
|
+
}, _callee113);
|
12491
12544
|
}));
|
12492
|
-
function useValidationFuncProgrammatic(
|
12545
|
+
function useValidationFuncProgrammatic(_x202, _x203, _x204) {
|
12493
12546
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
12494
12547
|
}
|
12495
12548
|
return useValidationFuncProgrammatic;
|
@@ -12503,29 +12556,29 @@ var Fe = /*#__PURE__*/function () {
|
|
12503
12556
|
}, {
|
12504
12557
|
key: "attach",
|
12505
12558
|
value: function attach(e, t, i, n, r) {
|
12506
|
-
var o = e.validateInput ||
|
12559
|
+
var o = e.validateInput || he.processValidateInput(e);
|
12507
12560
|
e._validationHandler = /*#__PURE__*/function () {
|
12508
|
-
var
|
12561
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee114(a) {
|
12509
12562
|
var l;
|
12510
|
-
return _regeneratorRuntime().wrap(function
|
12511
|
-
while (1) switch (
|
12563
|
+
return _regeneratorRuntime().wrap(function _callee114$(_context114) {
|
12564
|
+
while (1) switch (_context114.prev = _context114.next) {
|
12512
12565
|
case 0:
|
12513
12566
|
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Fe.validateWebsocket(t, r))) {
|
12514
|
-
|
12567
|
+
_context114.next = 2;
|
12515
12568
|
break;
|
12516
12569
|
}
|
12517
|
-
return
|
12570
|
+
return _context114.abrupt("return", !1);
|
12518
12571
|
case 2:
|
12519
12572
|
l = o || t.canSendMessage;
|
12520
|
-
return
|
12573
|
+
return _context114.abrupt("return", l ? a ? Fe.useValidationFuncProgrammatic(l, a, r) : Fe.useValidationFunc(l, i, n, r) : null);
|
12521
12574
|
case 4:
|
12522
12575
|
case "end":
|
12523
|
-
return
|
12576
|
+
return _context114.stop();
|
12524
12577
|
}
|
12525
|
-
},
|
12578
|
+
}, _callee114);
|
12526
12579
|
}));
|
12527
|
-
return function (
|
12528
|
-
return
|
12580
|
+
return function (_x205) {
|
12581
|
+
return _ref16.apply(this, arguments);
|
12529
12582
|
};
|
12530
12583
|
}();
|
12531
12584
|
}
|
@@ -12764,12 +12817,12 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12764
12817
|
}, {
|
12765
12818
|
key: "submitFromInput",
|
12766
12819
|
value: function () {
|
12767
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12820
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee115() {
|
12768
12821
|
var t, e, _i22;
|
12769
|
-
return _regeneratorRuntime().wrap(function
|
12770
|
-
while (1) switch (
|
12822
|
+
return _regeneratorRuntime().wrap(function _callee115$(_context115) {
|
12823
|
+
while (1) switch (_context115.prev = _context115.next) {
|
12771
12824
|
case 0:
|
12772
|
-
|
12825
|
+
_context115.next = 2;
|
12773
12826
|
return this._fileAttachments.completePlaceholders();
|
12774
12827
|
case 2:
|
12775
12828
|
e = this._fileAttachments.getAllFileData();
|
@@ -12785,9 +12838,9 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12785
12838
|
}
|
12786
12839
|
case 4:
|
12787
12840
|
case "end":
|
12788
|
-
return
|
12841
|
+
return _context115.stop();
|
12789
12842
|
}
|
12790
|
-
},
|
12843
|
+
}, _callee115, this);
|
12791
12844
|
}));
|
12792
12845
|
function submitFromInput() {
|
12793
12846
|
return _submitFromInput.apply(this, arguments);
|
@@ -12797,31 +12850,31 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12797
12850
|
}, {
|
12798
12851
|
key: "programmaticSubmit",
|
12799
12852
|
value: function () {
|
12800
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12853
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee116(e) {
|
12801
12854
|
var _this71 = this;
|
12802
12855
|
var t;
|
12803
|
-
return _regeneratorRuntime().wrap(function
|
12804
|
-
while (1) switch (
|
12856
|
+
return _regeneratorRuntime().wrap(function _callee116$(_context116) {
|
12857
|
+
while (1) switch (_context116.prev = _context116.next) {
|
12805
12858
|
case 0:
|
12806
|
-
typeof e == "string" && (e =
|
12859
|
+
typeof e == "string" && (e = he.processSubmitUserMessage(e));
|
12807
12860
|
t = {
|
12808
12861
|
text: e.text
|
12809
12862
|
};
|
12810
12863
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
12811
12864
|
return {
|
12812
12865
|
file: i,
|
12813
|
-
type:
|
12866
|
+
type: xe.getTypeFromBlob(i)
|
12814
12867
|
};
|
12815
12868
|
})), setTimeout(function () {
|
12816
12869
|
return _this71.attemptSubmit(t, !0);
|
12817
12870
|
});
|
12818
12871
|
case 3:
|
12819
12872
|
case "end":
|
12820
|
-
return
|
12873
|
+
return _context116.stop();
|
12821
12874
|
}
|
12822
|
-
},
|
12875
|
+
}, _callee116);
|
12823
12876
|
}));
|
12824
|
-
function programmaticSubmit(
|
12877
|
+
function programmaticSubmit(_x206) {
|
12825
12878
|
return _programmaticSubmit.apply(this, arguments);
|
12826
12879
|
}
|
12827
12880
|
return programmaticSubmit;
|
@@ -12829,52 +12882,52 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12829
12882
|
}, {
|
12830
12883
|
key: "attemptSubmit",
|
12831
12884
|
value: function () {
|
12832
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12885
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee117(e) {
|
12833
12886
|
var t,
|
12834
12887
|
r,
|
12835
12888
|
o,
|
12836
12889
|
a,
|
12837
12890
|
i,
|
12838
12891
|
n,
|
12839
|
-
|
12840
|
-
return _regeneratorRuntime().wrap(function
|
12841
|
-
while (1) switch (
|
12892
|
+
_args117 = arguments;
|
12893
|
+
return _regeneratorRuntime().wrap(function _callee117$(_context117) {
|
12894
|
+
while (1) switch (_context117.prev = _context117.next) {
|
12842
12895
|
case 0:
|
12843
|
-
t =
|
12844
|
-
|
12896
|
+
t = _args117.length > 1 && _args117[1] !== undefined ? _args117[1] : !1;
|
12897
|
+
_context117.next = 3;
|
12845
12898
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12846
12899
|
case 3:
|
12847
|
-
|
12848
|
-
|
12849
|
-
if (!(
|
12850
|
-
|
12900
|
+
_context117.t0 = _context117.sent;
|
12901
|
+
_context117.t1 = !1;
|
12902
|
+
if (!(_context117.t0 === _context117.t1)) {
|
12903
|
+
_context117.next = 7;
|
12851
12904
|
break;
|
12852
12905
|
}
|
12853
|
-
return
|
12906
|
+
return _context117.abrupt("return");
|
12854
12907
|
case 7:
|
12855
12908
|
this.changeToLoadingIcon();
|
12856
|
-
|
12909
|
+
_context117.next = 10;
|
12857
12910
|
return this.addNewMessage(e);
|
12858
12911
|
case 10:
|
12859
12912
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
12860
|
-
|
12913
|
+
Tt.clear(this._inputElementRef);
|
12861
12914
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
12862
12915
|
return l.file;
|
12863
12916
|
}), n = {
|
12864
12917
|
text: e.text === "" ? void 0 : e.text,
|
12865
12918
|
files: i
|
12866
12919
|
};
|
12867
|
-
|
12920
|
+
_context117.next = 15;
|
12868
12921
|
return this._serviceIO.callAPI(n, this._messages);
|
12869
12922
|
case 15:
|
12870
12923
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12871
12924
|
case 16:
|
12872
12925
|
case "end":
|
12873
|
-
return
|
12926
|
+
return _context117.stop();
|
12874
12927
|
}
|
12875
|
-
},
|
12928
|
+
}, _callee117, this);
|
12876
12929
|
}));
|
12877
|
-
function attemptSubmit(
|
12930
|
+
function attemptSubmit(_x207) {
|
12878
12931
|
return _attemptSubmit.apply(this, arguments);
|
12879
12932
|
}
|
12880
12933
|
return attemptSubmit;
|
@@ -12882,35 +12935,35 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12882
12935
|
}, {
|
12883
12936
|
key: "addNewMessage",
|
12884
12937
|
value: function () {
|
12885
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12938
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee118(_ref17) {
|
12886
12939
|
var e, t, i;
|
12887
|
-
return _regeneratorRuntime().wrap(function
|
12888
|
-
while (1) switch (
|
12940
|
+
return _regeneratorRuntime().wrap(function _callee118$(_context118) {
|
12941
|
+
while (1) switch (_context118.prev = _context118.next) {
|
12889
12942
|
case 0:
|
12890
|
-
e =
|
12943
|
+
e = _ref17.text, t = _ref17.files;
|
12891
12944
|
i = {
|
12892
12945
|
role: b.USER_ROLE
|
12893
12946
|
};
|
12894
12947
|
e && (i.text = e);
|
12895
|
-
|
12896
|
-
if (!
|
12897
|
-
|
12948
|
+
_context118.t0 = t;
|
12949
|
+
if (!_context118.t0) {
|
12950
|
+
_context118.next = 8;
|
12898
12951
|
break;
|
12899
12952
|
}
|
12900
|
-
|
12953
|
+
_context118.next = 7;
|
12901
12954
|
return this._messages.addMultipleFiles(t);
|
12902
12955
|
case 7:
|
12903
|
-
i.files =
|
12956
|
+
i.files = _context118.sent;
|
12904
12957
|
case 8:
|
12905
12958
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12906
12959
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12907
12960
|
case 10:
|
12908
12961
|
case "end":
|
12909
|
-
return
|
12962
|
+
return _context118.stop();
|
12910
12963
|
}
|
12911
|
-
},
|
12964
|
+
}, _callee118, this);
|
12912
12965
|
}));
|
12913
|
-
function addNewMessage(
|
12966
|
+
function addNewMessage(_x208) {
|
12914
12967
|
return _addNewMessage.apply(this, arguments);
|
12915
12968
|
}
|
12916
12969
|
return addNewMessage;
|
@@ -13149,7 +13202,7 @@ var _t = /*#__PURE__*/function () {
|
|
13149
13202
|
function _t(e, t, i, n) {
|
13150
13203
|
_classCallCheck(this, _t);
|
13151
13204
|
this.elementRef = _t.createPanelElement(e.inputAreaStyle);
|
13152
|
-
var r = new
|
13205
|
+
var r = new Tt(e, i),
|
13153
13206
|
o = {},
|
13154
13207
|
a = this.createFileUploadComponents(e, i, n, o);
|
13155
13208
|
e.speechToText && !o.microphone && (o.microphone = {
|
@@ -13179,7 +13232,7 @@ var _t = /*#__PURE__*/function () {
|
|
13179
13232
|
button: new oa(_d, t.recordAudio)
|
13180
13233
|
};
|
13181
13234
|
}
|
13182
|
-
return
|
13235
|
+
return ye.isEnabled(r, e.dragAndDrop) && ye.create(i, r, e.dragAndDrop), r;
|
13183
13236
|
}
|
13184
13237
|
// prettier-ignore
|
13185
13238
|
}], [{
|
@@ -13228,7 +13281,7 @@ var vn = /*#__PURE__*/function () {
|
|
13228
13281
|
value: function createElements(e, t, i) {
|
13229
13282
|
var n = document.createElement("div");
|
13230
13283
|
n.id = "chat-view";
|
13231
|
-
var r = new
|
13284
|
+
var r = new ke(e, t, i);
|
13232
13285
|
t.websocket && z.createConnection(t, r);
|
13233
13286
|
var o = new _t(e, r, t, n);
|
13234
13287
|
return j.addElements(n, r.elementRef, o.elementRef), n;
|
@@ -13252,7 +13305,16 @@ var y = /*#__PURE__*/function (_Xi) {
|
|
13252
13305
|
function y() {
|
13253
13306
|
var _this78;
|
13254
13307
|
_classCallCheck(this, y);
|
13255
|
-
_this78 = _callSuper(this, y), _this78.
|
13308
|
+
_this78 = _callSuper(this, y), _this78.connect = {
|
13309
|
+
// stream: true,
|
13310
|
+
}, _this78.directConnection = {
|
13311
|
+
openAI: {
|
13312
|
+
assistant: {
|
13313
|
+
assistant_id: "asst_dDy5gBApC0nd2puFgj8pEecp"
|
13314
|
+
},
|
13315
|
+
key: "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"
|
13316
|
+
}
|
13317
|
+
}, _this78.getMessages = function () {
|
13256
13318
|
return [];
|
13257
13319
|
}, _this78.submitUserMessage = function () {
|
13258
13320
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
@@ -13278,7 +13340,7 @@ var y = /*#__PURE__*/function (_Xi) {
|
|
13278
13340
|
key: "onRender",
|
13279
13341
|
value: function onRender() {
|
13280
13342
|
var _this$_childElement;
|
13281
|
-
Xt.attemptAppendStyleSheetToHead(this.style),
|
13343
|
+
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
13344
|
}
|
13283
13345
|
}, {
|
13284
13346
|
key: "disconnectedCallback",
|