deep-chat-dev 9.0.221 → 9.0.223
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 +5306 -5292
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +207 -197
- package/dist/views/chat/messages/history/loadingHistory.d.ts +2 -1
- package/dist/views/chat/messages/history/loadingHistory.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -207,12 +207,12 @@ pt.DEFAULT_COMPONENT_STYLE = {
|
|
207
207
|
};
|
208
208
|
var Lt = pt;
|
209
209
|
var it;
|
210
|
-
var
|
210
|
+
var Ct = (it = /*#__PURE__*/_createClass(function it() {
|
211
211
|
_classCallCheck(this, it);
|
212
212
|
}), it.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), it.IS_CHROMIUM = window.chrome, it);
|
213
|
-
var
|
213
|
+
var D = /* @__PURE__ */function (n) {
|
214
214
|
return n.ESCAPE = "Escape", n.ENTER = "Enter", n.TAB = "Tab", n.ARROW_UP = "ArrowUp", n.ARROW_DOWN = "ArrowDown", n.ARROW_RIGHT = "ArrowRight", n.ARROW_LEFT = "ArrowLeft", n.BACKSPACE = "Backspace", n.DELETE = "Delete", n.META = "Meta", n.CONTROL = "Control", n;
|
215
|
-
}(
|
215
|
+
}(D || {});
|
216
216
|
var Ke = /*#__PURE__*/function () {
|
217
217
|
function Ke() {
|
218
218
|
_classCallCheck(this, Ke);
|
@@ -249,7 +249,7 @@ var Ke = /*#__PURE__*/function () {
|
|
249
249
|
}
|
250
250
|
}]);
|
251
251
|
}();
|
252
|
-
Ke.PERMITTED_KEYS = /* @__PURE__ */new Set([
|
252
|
+
Ke.PERMITTED_KEYS = /* @__PURE__ */new Set([D.BACKSPACE, D.DELETE, D.ARROW_RIGHT, D.ARROW_LEFT, D.ARROW_DOWN, D.ARROW_UP, D.META, D.CONTROL, D.ENTER]);
|
253
253
|
var cs = Ke;
|
254
254
|
var Pn = /*#__PURE__*/function () {
|
255
255
|
function Pn() {
|
@@ -282,7 +282,7 @@ var Je = /*#__PURE__*/function () {
|
|
282
282
|
function clear() {
|
283
283
|
var t;
|
284
284
|
var e = window.scrollY;
|
285
|
-
this.inputElementRef.classList.contains("text-input-disabled") || (Object.assign(this.inputElementRef.style, (t = this._config.placeholder) == null ? void 0 : t.style), this.inputElementRef.textContent = "", Yt.focusEndOfInput(this.inputElementRef)),
|
285
|
+
this.inputElementRef.classList.contains("text-input-disabled") || (Object.assign(this.inputElementRef.style, (t = this._config.placeholder) == null ? void 0 : t.style), this.inputElementRef.textContent = "", Yt.focusEndOfInput(this.inputElementRef)), Ct.IS_CHROMIUM && window.scrollTo({
|
286
286
|
top: e
|
287
287
|
});
|
288
288
|
}
|
@@ -291,7 +291,7 @@ var Je = /*#__PURE__*/function () {
|
|
291
291
|
value: function createInputElement() {
|
292
292
|
var t, i, s, r;
|
293
293
|
var e = document.createElement("div");
|
294
|
-
return e.id = Je.TEXT_INPUT_ID, e.classList.add("text-input-styling"),
|
294
|
+
return e.id = Je.TEXT_INPUT_ID, e.classList.add("text-input-styling"), Ct.IS_CHROMIUM && Je.preventAutomaticScrollUpOnNewLine(e), typeof this._config.disabled == "boolean" && this._config.disabled === !0 ? (e.contentEditable = "false", e.classList.add("text-input-disabled")) : (e.contentEditable = "true", this.addEventListeners(e)), Object.assign(e.style, (t = this._config.styles) == null ? void 0 : t.text), Object.assign(e.style, (i = this._config.placeholder) == null ? void 0 : i.style), (r = (s = this._config.placeholder) == null ? void 0 : s.style) != null && r.color || e.setAttribute("textcolor", ""), e;
|
295
295
|
}
|
296
296
|
}, {
|
297
297
|
key: "removePlaceholderStyle",
|
@@ -318,7 +318,7 @@ var Je = /*#__PURE__*/function () {
|
|
318
318
|
key: "onKeydown",
|
319
319
|
value: function onKeydown(e) {
|
320
320
|
var t;
|
321
|
-
e.key ===
|
321
|
+
e.key === D.ENTER && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), (t = this.submit) == null || t.call(this));
|
322
322
|
}
|
323
323
|
}, {
|
324
324
|
key: "onInput",
|
@@ -386,7 +386,7 @@ var Yt = /*#__PURE__*/function () {
|
|
386
386
|
key: "focusFromParentElement",
|
387
387
|
value: function focusFromParentElement(e) {
|
388
388
|
var t = e.querySelector("#".concat(pi.TEXT_INPUT_ID));
|
389
|
-
t && (
|
389
|
+
t && (Ct.IS_SAFARI && t.focus(), Yt.focusEndOfInput(t));
|
390
390
|
}
|
391
391
|
}]);
|
392
392
|
}();
|
@@ -1448,7 +1448,7 @@ function wn(n, e) {
|
|
1448
1448
|
}
|
1449
1449
|
return !1;
|
1450
1450
|
}
|
1451
|
-
function
|
1451
|
+
function Cn(n) {
|
1452
1452
|
return n.trim().replace(/\s+/g, " ").toUpperCase();
|
1453
1453
|
}
|
1454
1454
|
function Qn(n, e, t, i) {
|
@@ -1458,7 +1458,7 @@ function Qn(n, e, t, i) {
|
|
1458
1458
|
if (!_n(s, o)) return -1;
|
1459
1459
|
for (d = s.linkContent, o = s.pos, c = o, o = o + 1; o < a && (l = s.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1460
1460
|
for (o < a && c !== o && wn(s, o) ? (h = s.linkContent, o = s.pos) : (h = "", o = c); o < a && s.src.charCodeAt(o) === 32;) o++;
|
1461
|
-
return o < a && s.src.charCodeAt(o) !== 10 ? -1 : (f =
|
1461
|
+
return o < a && s.src.charCodeAt(o) !== 10 ? -1 : (f = Cn(n.slice(1, r)), _typeof(i.references[f]) > "u" && (i.references[f] = {
|
1462
1462
|
title: h,
|
1463
1463
|
href: d
|
1464
1464
|
}), o);
|
@@ -1646,11 +1646,11 @@ function hr(n) {
|
|
1646
1646
|
}
|
1647
1647
|
}
|
1648
1648
|
var ts = [["block", Zn], ["abbr", Yn], ["references", er], ["inline", tr], ["footnote_tail", ir], ["abbr2", sr], ["replacements", lr], ["smartquotes", hr]];
|
1649
|
-
function
|
1649
|
+
function Tn() {
|
1650
1650
|
this.options = {}, this.ruler = new re();
|
1651
1651
|
for (var n = 0; n < ts.length; n++) this.ruler.push(ts[n][0], ts[n][1]);
|
1652
1652
|
}
|
1653
|
-
|
1653
|
+
Tn.prototype.process = function (n) {
|
1654
1654
|
var e, t, i;
|
1655
1655
|
for (i = this.ruler.getRules(""), e = 0, t = i.length; e < t; e++) i[e](n);
|
1656
1656
|
};
|
@@ -1843,7 +1843,7 @@ function br(n, e, t, i) {
|
|
1843
1843
|
L,
|
1844
1844
|
Y = !0,
|
1845
1845
|
Q,
|
1846
|
-
|
1846
|
+
F,
|
1847
1847
|
ze,
|
1848
1848
|
Mt;
|
1849
1849
|
if ((h = Ks(n, e)) >= 0) v = !0;else if ((h = Ws(n, e)) >= 0) v = !1;else return !1;
|
@@ -1866,7 +1866,7 @@ function br(n, e, t, i) {
|
|
1866
1866
|
type: "list_item_close",
|
1867
1867
|
level: --n.level
|
1868
1868
|
}), s = e = n.line, L[1] = s, y = n.bMarks[e], !(s >= t || n.isEmpty(s) || n.tShift[s] < n.blkIndent));) {
|
1869
|
-
for (Mt = !1,
|
1869
|
+
for (Mt = !1, F = 0, ze = Q.length; F < ze; F++) if (Q[F](n, s, t, !0)) {
|
1870
1870
|
Mt = !0;
|
1871
1871
|
break;
|
1872
1872
|
}
|
@@ -1990,7 +1990,7 @@ function is(n, e) {
|
|
1990
1990
|
i = n.eMarks[e];
|
1991
1991
|
return n.src.substr(t, i - t);
|
1992
1992
|
}
|
1993
|
-
function
|
1993
|
+
function Cr(n, e, t, i) {
|
1994
1994
|
var s, r, o, a, l, c, d, h, f, u, m;
|
1995
1995
|
if (e + 2 > t || (l = e + 1, n.tShift[l] < n.blkIndent) || (o = n.bMarks[l] + n.tShift[l], o >= n.eMarks[l]) || (s = n.src.charCodeAt(o), s !== 124 && s !== 45 && s !== 58) || (r = is(n, e + 1), !/^[-:| ]+$/.test(r)) || (c = r.split("|"), c <= 2)) return !1;
|
1996
1996
|
for (h = [], a = 0; a < c.length; a++) {
|
@@ -2077,7 +2077,7 @@ function li(n, e) {
|
|
2077
2077
|
r = n.eMarks[e];
|
2078
2078
|
return s >= r || (i = n.src.charCodeAt(s++), i !== 126 && i !== 58) || (t = n.skipSpaces(s), s === t) || t >= r ? -1 : t;
|
2079
2079
|
}
|
2080
|
-
function
|
2080
|
+
function Tr(n, e) {
|
2081
2081
|
var t,
|
2082
2082
|
i,
|
2083
2083
|
s = n.level + 2;
|
@@ -2123,7 +2123,7 @@ function Ar(n, e, t, i) {
|
|
2123
2123
|
return n.tokens.push({
|
2124
2124
|
type: "dl_close",
|
2125
2125
|
level: --n.level
|
2126
|
-
}), l[1] = d, n.line = d, y &&
|
2126
|
+
}), l[1] = d, n.line = d, y && Tr(n, c), !0;
|
2127
2127
|
}
|
2128
2128
|
function kr(n, e) {
|
2129
2129
|
var t,
|
@@ -2159,7 +2159,7 @@ function kr(n, e) {
|
|
2159
2159
|
level: n.level
|
2160
2160
|
})), !0;
|
2161
2161
|
}
|
2162
|
-
var ci = [["code", ur], ["fences", fr, ["paragraph", "blockquote", "list"]], ["blockquote", pr, ["paragraph", "blockquote", "list"]], ["hr", mr, ["paragraph", "blockquote", "list"]], ["list", br, ["paragraph", "blockquote"]], ["footnote", vr, ["paragraph"]], ["heading", yr, ["paragraph", "blockquote"]], ["lheading", Er], ["htmlblock", wr, ["paragraph", "blockquote"]], ["table",
|
2162
|
+
var ci = [["code", ur], ["fences", fr, ["paragraph", "blockquote", "list"]], ["blockquote", pr, ["paragraph", "blockquote", "list"]], ["hr", mr, ["paragraph", "blockquote", "list"]], ["list", br, ["paragraph", "blockquote"]], ["footnote", vr, ["paragraph"]], ["heading", yr, ["paragraph", "blockquote"]], ["lheading", Er], ["htmlblock", wr, ["paragraph", "blockquote"]], ["table", Cr, ["paragraph"]], ["deflist", Ar, ["paragraph"]], ["paragraph", kr]];
|
2163
2163
|
function Ms() {
|
2164
2164
|
this.ruler = new re();
|
2165
2165
|
for (var n = 0; n < ci.length; n++) this.ruler.push(ci[n][0], ci[n][1], {
|
@@ -2502,7 +2502,7 @@ function Vr(n, e) {
|
|
2502
2502
|
} else {
|
2503
2503
|
if (n.linkLevel > 0) return !1;
|
2504
2504
|
for (; a < f && (c = n.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
2505
|
-
if (a < f && n.src.charCodeAt(a) === 91 && (u = a + 1, a = zt(n, a), a >= 0 ? s = n.src.slice(u, a++) : a = u - 1), s || (_typeof(s) > "u" && (a = i + 1), s = n.src.slice(t, i)), l = n.env.references[
|
2505
|
+
if (a < f && n.src.charCodeAt(a) === 91 && (u = a + 1, a = zt(n, a), a >= 0 ? s = n.src.slice(u, a++) : a = u - 1), s || (_typeof(s) > "u" && (a = i + 1), s = n.src.slice(t, i)), l = n.env.references[Cn(s)], !l) return n.pos = h, !1;
|
2506
2506
|
r = l.href, o = l.title;
|
2507
2507
|
}
|
2508
2508
|
return e || (n.pos = t, n.posMax = i, d ? n.push({
|
@@ -2804,7 +2804,7 @@ function kn(n, e, t) {
|
|
2804
2804
|
this.src = e, this.env = t, this.options = n.options, this.tokens = [], this.inlineMode = !1, this.inline = n.inline, this.block = n.block, this.renderer = n.renderer, this.typographer = n.typographer;
|
2805
2805
|
}
|
2806
2806
|
function xe(n, e) {
|
2807
|
-
typeof n != "string" && (e = n, n = "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 Ui(), this.block = new Ms(), this.core = new
|
2807
|
+
typeof n != "string" && (e = n, n = "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 Ui(), this.block = new Ms(), this.core = new Tn(), this.renderer = new ks(), this.ruler = new re(), this.options = {}, this.configure(So[n]), this.set(e || {});
|
2808
2808
|
}
|
2809
2809
|
xe.prototype.set = function (n) {
|
2810
2810
|
En(this.options, n);
|
@@ -2978,11 +2978,11 @@ var mi = /*#__PURE__*/function () {
|
|
2978
2978
|
}
|
2979
2979
|
}]);
|
2980
2980
|
}();
|
2981
|
-
var
|
2982
|
-
function
|
2983
|
-
_classCallCheck(this,
|
2981
|
+
var N = /*#__PURE__*/function () {
|
2982
|
+
function N() {
|
2983
|
+
_classCallCheck(this, N);
|
2984
2984
|
}
|
2985
|
-
return _createClass(
|
2985
|
+
return _createClass(N, null, [{
|
2986
2986
|
key: "generateLoadingRingElement",
|
2987
2987
|
value: function generateLoadingRingElement() {
|
2988
2988
|
var e = document.createElement("div");
|
@@ -2998,18 +2998,18 @@ var F = /*#__PURE__*/function () {
|
|
2998
2998
|
value: function addLoadHistoryMessage(e, t) {
|
2999
2999
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
3000
3000
|
var o, a, l, c, d, h, f, u;
|
3001
|
-
e.bubbleElement.classList.add(
|
3002
|
-
var s = i ?
|
3001
|
+
e.bubbleElement.classList.add(N.CLASS);
|
3002
|
+
var s = i ? N.FULL_VIEW_CLASS : N.SMALL_CLASS;
|
3003
3003
|
e.outerContainer.classList.add(s);
|
3004
3004
|
var r = i ? (c = (l = (a = (o = t.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.history) == null ? void 0 : l.full) == null ? void 0 : c.styles : (u = (f = (h = (d = t.messageStyles) == null ? void 0 : d.loading) == null ? void 0 : h.history) == null ? void 0 : f.small) == null ? void 0 : u.styles;
|
3005
|
-
|
3005
|
+
N.apply(t, e, r), t.elementRef.prepend(e.outerContainer);
|
3006
3006
|
}
|
3007
3007
|
}, {
|
3008
3008
|
key: "createDefaultElements",
|
3009
3009
|
value: function createDefaultElements(e) {
|
3010
3010
|
var t = e.createMessageElements("", b.AI_ROLE),
|
3011
3011
|
i = t.bubbleElement,
|
3012
|
-
s =
|
3012
|
+
s = N.generateLoadingRingElement();
|
3013
3013
|
return i.appendChild(s), t;
|
3014
3014
|
}
|
3015
3015
|
}, {
|
@@ -3018,25 +3018,32 @@ var F = /*#__PURE__*/function () {
|
|
3018
3018
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3019
3019
|
var r, o, a, l;
|
3020
3020
|
var i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html,
|
3021
|
-
s = i ? Se.createElements(e, i, b.AI_ROLE, !0) :
|
3022
|
-
return
|
3021
|
+
s = i ? Se.createElements(e, i, b.AI_ROLE, !0) : N.createDefaultElements(e);
|
3022
|
+
return N.addLoadHistoryMessage(s, e, t), s;
|
3023
3023
|
}
|
3024
3024
|
}, {
|
3025
|
-
key: "
|
3026
|
-
value: function
|
3025
|
+
key: "tryChangeViewToSmall",
|
3026
|
+
value: function tryChangeViewToSmall(e, t) {
|
3027
3027
|
var i, s, r, o, a, l, c, d;
|
3028
|
-
if (t != null && t.outerContainer.classList.contains(
|
3029
|
-
t.outerContainer.classList.replace(
|
3028
|
+
if (t != null && t.outerContainer.classList.contains(N.FULL_VIEW_CLASS)) {
|
3029
|
+
t.outerContainer.classList.replace(N.FULL_VIEW_CLASS, N.SMALL_CLASS);
|
3030
3030
|
var h = (o = (r = (s = (i = e.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.history) == null ? void 0 : r.small) == null ? void 0 : o.styles;
|
3031
|
-
h &&
|
3031
|
+
h && N.apply(e, t, h);
|
3032
3032
|
var f = (d = (c = (l = (a = e.messageStyles) == null ? void 0 : a.loading) == null ? void 0 : l.history) == null ? void 0 : c.small) == null ? void 0 : d.html;
|
3033
|
-
f && (t.bubbleElement.innerHTML = f);
|
3033
|
+
return f && (t.bubbleElement.innerHTML = f), !0;
|
3034
3034
|
}
|
3035
|
+
return !1;
|
3036
|
+
}
|
3037
|
+
}, {
|
3038
|
+
key: "changeFullViewToSmall",
|
3039
|
+
value: function changeFullViewToSmall(e) {
|
3040
|
+
var t = e.messageElementRefs[e.messageElementRefs.length - 1];
|
3041
|
+
N.tryChangeViewToSmall(e, t) || N.tryChangeViewToSmall(e, e.messageElementRefs[0]);
|
3035
3042
|
}
|
3036
3043
|
}]);
|
3037
3044
|
}();
|
3038
|
-
|
3039
|
-
var Ne =
|
3045
|
+
N.CLASS = "loading-history-message", N.FULL_VIEW_CLASS = "loading-history-message-full-view", N.SMALL_CLASS = "loading-history-message-small";
|
3046
|
+
var Ne = N;
|
3040
3047
|
var pe = /*#__PURE__*/function () {
|
3041
3048
|
function pe(e) {
|
3042
3049
|
var _this3 = this;
|
@@ -3097,7 +3104,7 @@ var pe = /*#__PURE__*/function () {
|
|
3097
3104
|
var r;
|
3098
3105
|
(r = this._introPanel) == null || r.hide();
|
3099
3106
|
var s = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3100
|
-
return Ne.changeFullViewToSmall(this
|
3107
|
+
return Ne.changeFullViewToSmall(this), pe.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
|
3101
3108
|
}
|
3102
3109
|
// this can be tested by having an ai message, then a temp ai message with html that submits new user message:
|
3103
3110
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/258
|
@@ -3763,7 +3770,7 @@ function _wo() {
|
|
3763
3770
|
}));
|
3764
3771
|
return _wo.apply(this, arguments);
|
3765
3772
|
}
|
3766
|
-
function
|
3773
|
+
function Co(n) {
|
3767
3774
|
var e,
|
3768
3775
|
t,
|
3769
3776
|
i,
|
@@ -3791,7 +3798,7 @@ function To(n) {
|
|
3791
3798
|
l === a ? e = void 0 : l !== 0 && (e = e.subarray(l), t -= l);
|
3792
3799
|
};
|
3793
3800
|
}
|
3794
|
-
function
|
3801
|
+
function To(n, e, t) {
|
3795
3802
|
var i = Ys();
|
3796
3803
|
var s = new TextDecoder();
|
3797
3804
|
return function (o, a) {
|
@@ -3871,7 +3878,7 @@ function Ro(n, e) {
|
|
3871
3878
|
}
|
3872
3879
|
function _L() {
|
3873
3880
|
_L = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
3874
|
-
var Y, Q,
|
3881
|
+
var Y, Q, F;
|
3875
3882
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3876
3883
|
while (1) switch (_context4.prev = _context4.next) {
|
3877
3884
|
case 0:
|
@@ -3888,10 +3895,10 @@ function Ro(n, e) {
|
|
3888
3895
|
return Fe(Q);
|
3889
3896
|
case 7:
|
3890
3897
|
_context4.next = 9;
|
3891
|
-
return wo(Q.body, To(
|
3892
|
-
|
3893
|
-
}, function (
|
3894
|
-
v =
|
3898
|
+
return wo(Q.body, Co(To(function (F) {
|
3899
|
+
F ? u[Qs] = F : delete u[Qs];
|
3900
|
+
}, function (F) {
|
3901
|
+
v = F;
|
3895
3902
|
}, r)));
|
3896
3903
|
case 9:
|
3897
3904
|
o == null || o();
|
@@ -3903,10 +3910,10 @@ function Ro(n, e) {
|
|
3903
3910
|
_context4.prev = 14;
|
3904
3911
|
_context4.t0 = _context4["catch"](1);
|
3905
3912
|
if (!m.signal.aborted) try {
|
3906
|
-
|
3907
|
-
window.clearTimeout(y), y = window.setTimeout(L,
|
3908
|
-
} catch (
|
3909
|
-
P(), f(
|
3913
|
+
F = (Y = a == null ? void 0 : a(_context4.t0)) !== null && Y !== void 0 ? Y : v;
|
3914
|
+
window.clearTimeout(y), y = window.setTimeout(L, F);
|
3915
|
+
} catch (F) {
|
3916
|
+
P(), f(F);
|
3910
3917
|
}
|
3911
3918
|
case 17:
|
3912
3919
|
case "end":
|
@@ -4022,7 +4029,7 @@ var A = /*#__PURE__*/function () {
|
|
4022
4029
|
},
|
4023
4030
|
onmessage: function onmessage(L) {
|
4024
4031
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
4025
|
-
var Y, Q,
|
4032
|
+
var Y, Q, F, ze, Mt;
|
4026
4033
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
4027
4034
|
while (1) switch (_context6.prev = _context6.next) {
|
4028
4035
|
case 0:
|
@@ -4046,7 +4053,7 @@ var A = /*#__PURE__*/function () {
|
|
4046
4053
|
_context6.t0 = ze;
|
4047
4054
|
case 7:
|
4048
4055
|
Mt = _context6.t0;
|
4049
|
-
(
|
4056
|
+
(F = e.extractResultData) == null || F.call(e, Mt, m, a).then(function (Ge) {
|
4050
4057
|
e.asyncCallInProgress && Ge && Ge.text !== "" ? (A.simulate(i, e.streamHandlers, Ge), h(), e.asyncCallInProgress = !1) : A.upsertWFiles(i, u.upsertStreamedMessage.bind(u), u, Ge);
|
4051
4058
|
})["catch"](function (Ge) {
|
4052
4059
|
return E.displayError(i, Ge);
|
@@ -4635,11 +4642,11 @@ var Ie = /*#__PURE__*/function () {
|
|
4635
4642
|
}
|
4636
4643
|
}]);
|
4637
4644
|
}();
|
4638
|
-
var
|
4639
|
-
function
|
4640
|
-
_classCallCheck(this,
|
4645
|
+
var T = /*#__PURE__*/function () {
|
4646
|
+
function T() {
|
4647
|
+
_classCallCheck(this, T);
|
4641
4648
|
}
|
4642
|
-
return _createClass(
|
4649
|
+
return _createClass(T, null, [{
|
4643
4650
|
key: "request",
|
4644
4651
|
value: // prettier-ignore
|
4645
4652
|
function () {
|
@@ -4795,7 +4802,7 @@ var C = /*#__PURE__*/function () {
|
|
4795
4802
|
case 11:
|
4796
4803
|
a = _context17.sent;
|
4797
4804
|
a.timeoutMS ? setTimeout(function () {
|
4798
|
-
|
4805
|
+
T.executePollRequest(e, t, i, s);
|
4799
4806
|
}, a.timeoutMS) : A.isSimulatable(e.stream, a) ? A.simulate(s, e.streamHandlers, a) : (s.addNewMessage(a), r());
|
4800
4807
|
case 13:
|
4801
4808
|
case "end":
|
@@ -4855,7 +4862,7 @@ var C = /*#__PURE__*/function () {
|
|
4855
4862
|
body: h,
|
4856
4863
|
headers: a
|
4857
4864
|
};
|
4858
|
-
e.connectSettings.credentials && (f.credentials = e.connectSettings.credentials),
|
4865
|
+
e.connectSettings.credentials && (f.credentials = e.connectSettings.credentials), T.executePollRequest(e, c, f, i);
|
4859
4866
|
case 12:
|
4860
4867
|
case "end":
|
4861
4868
|
return _context18.stop();
|
@@ -5086,11 +5093,11 @@ var vt = /*#__PURE__*/function () {
|
|
5086
5093
|
}();
|
5087
5094
|
vt.FAILED_ERROR_MESSAGE = "Failed to load history";
|
5088
5095
|
var Vt = vt;
|
5089
|
-
var
|
5090
|
-
function
|
5091
|
-
_classCallCheck(this,
|
5096
|
+
var Tt = /*#__PURE__*/function () {
|
5097
|
+
function Tt() {
|
5098
|
+
_classCallCheck(this, Tt);
|
5092
5099
|
}
|
5093
|
-
return _createClass(
|
5100
|
+
return _createClass(Tt, null, [{
|
5094
5101
|
key: "getCharacterLimitMessages",
|
5095
5102
|
value: function getCharacterLimitMessages(e, t) {
|
5096
5103
|
var r;
|
@@ -5117,7 +5124,7 @@ var Ct = /*#__PURE__*/function () {
|
|
5117
5124
|
}, {
|
5118
5125
|
key: "processMessages",
|
5119
5126
|
value: function processMessages(e, t, i) {
|
5120
|
-
return t !== void 0 ? t > 0 && (e =
|
5127
|
+
return t !== void 0 ? t > 0 && (e = Tt.getMaxMessages(e, t)) : e = [e[e.length - 1]], e = JSON.parse(JSON.stringify(e)), i === void 0 ? e : Tt.getCharacterLimitMessages(e, i);
|
5121
5128
|
}
|
5122
5129
|
}]);
|
5123
5130
|
}();
|
@@ -5260,7 +5267,7 @@ var nt = /*#__PURE__*/function () {
|
|
5260
5267
|
while (1) switch (_context24.prev = _context24.next) {
|
5261
5268
|
case 0:
|
5262
5269
|
i = _args24.length > 2 && _args24[2] !== undefined ? _args24[2] : !0;
|
5263
|
-
return _context24.abrupt("return", this.stream && !A.isSimulation(this.stream) ? A.request(this, e, t, i) :
|
5270
|
+
return _context24.abrupt("return", this.stream && !A.isSimulation(this.stream) ? A.request(this, e, t, i) : T.request(this, e, t, i));
|
5264
5271
|
case 2:
|
5265
5272
|
case "end":
|
5266
5273
|
return _context24.stop();
|
@@ -5359,7 +5366,7 @@ var nt = /*#__PURE__*/function () {
|
|
5359
5366
|
}
|
5360
5367
|
throw new Error("Request settings have not been set up");
|
5361
5368
|
case 2:
|
5362
|
-
i =
|
5369
|
+
i = Tt.processMessages(t.messageToElements.map(function (_ref12) {
|
5363
5370
|
var _ref13 = _slicedToArray(_ref12, 1),
|
5364
5371
|
s = _ref13[0];
|
5365
5372
|
return s;
|
@@ -5487,7 +5494,7 @@ var G = /*#__PURE__*/function (_nt) {
|
|
5487
5494
|
o = _this$keyVerification.createHeaders,
|
5488
5495
|
a = _this$keyVerification.body,
|
5489
5496
|
l = (o == null ? void 0 : o(e)) || this.buildHeadersFunc(e);
|
5490
|
-
|
5497
|
+
T.verifyKey(e, i, l, s, this.keyAuthenticated.bind(this, t.onSuccess), t.onFail, t.onLoad, r, a);
|
5491
5498
|
}
|
5492
5499
|
}, {
|
5493
5500
|
key: "isDirectConnection",
|
@@ -5678,7 +5685,7 @@ var H = /*#__PURE__*/function () {
|
|
5678
5685
|
},
|
5679
5686
|
a = H.verifyKey.bind(this, e, o, r);
|
5680
5687
|
t.onclick = a, e.onkeydown = function (l) {
|
5681
|
-
!e.classList.contains("loading") && l.key ===
|
5688
|
+
!e.classList.contains("loading") && l.key === D.ENTER && a();
|
5682
5689
|
};
|
5683
5690
|
}
|
5684
5691
|
}, {
|
@@ -5925,17 +5932,17 @@ var en = {
|
|
5925
5932
|
}],
|
5926
5933
|
use_web_worker: !0
|
5927
5934
|
},
|
5928
|
-
|
5929
|
-
function
|
5935
|
+
C = /*#__PURE__*/function (_nt2) {
|
5936
|
+
function C(e) {
|
5930
5937
|
var _this15;
|
5931
|
-
_classCallCheck(this,
|
5938
|
+
_classCallCheck(this, C);
|
5932
5939
|
var t, i;
|
5933
|
-
_this15 = _callSuper(this,
|
5940
|
+
_this15 = _callSuper(this, C, [e]), _this15._isModelLoaded = !1, _this15._isModelLoading = !1, _this15._loadOnFirstMessage = !1, _this15._webModel = {}, _this15.permittedErrorPrefixes = [C.MULTIPLE_MODELS_ERROR, C.WEB_LLM_NOT_FOUND_ERROR, C.GENERIC_ERROR], _this15._conversationHistory = [], _typeof(e.webModel) == "object" && (_this15._webModel = e.webModel), (t = _this15._webModel.load) != null && t.clearCache && C.clearAllCache(), _this15.findModelInWindow(e), _this15.canSendMessage = _this15.canSubmit.bind(_assertThisInitialized(_this15)), _this15._chatEl = (i = e.shadowRoot) == null ? void 0 : i.children[0], e.history && C.setUpHistory(_this15._conversationHistory, e.history);
|
5934
5941
|
return _this15;
|
5935
5942
|
}
|
5936
5943
|
// need ref of messages object as web model exhibits unique behaviour to manipulate chat
|
5937
|
-
_inherits(
|
5938
|
-
return _createClass(
|
5944
|
+
_inherits(C, _nt2);
|
5945
|
+
return _createClass(C, [{
|
5939
5946
|
key: "setUpMessages",
|
5940
5947
|
value: function setUpMessages(e) {
|
5941
5948
|
var _this16 = this;
|
@@ -5949,7 +5956,7 @@ var en = {
|
|
5949
5956
|
var _this17 = this;
|
5950
5957
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
5951
5958
|
var i;
|
5952
|
-
window.webLLM ? this.configureInit(this.shouldAddIntroMessage(e.introMessage)) : t >
|
5959
|
+
window.webLLM ? this.configureInit(this.shouldAddIntroMessage(e.introMessage)) : t > C.MODULE_SEARCH_LIMIT_S ? ((i = this._messages) == null || i.addNewErrorMessage("service", C.WEB_LLM_NOT_FOUND_ERROR), console.error("The deep-chat-web-llm module has not been attached to the window object. Please see the following guide:"), console.error("https://deepchat.dev/examples/externalModules")) : setTimeout(function () {
|
5953
5960
|
return _this17.findModelInWindow(e, t + 1);
|
5954
5961
|
}, 1e3);
|
5955
5962
|
}
|
@@ -6052,8 +6059,8 @@ var en = {
|
|
6052
6059
|
key: "attemptToCreateChat",
|
6053
6060
|
value: function attemptToCreateChat() {
|
6054
6061
|
var t;
|
6055
|
-
if (
|
6056
|
-
(t = this._messages) == null || t.addNewErrorMessage("service",
|
6062
|
+
if (C.chat) {
|
6063
|
+
(t = this._messages) == null || t.addNewErrorMessage("service", C.MULTIPLE_MODELS_ERROR), console.error(C.MULTIPLE_MODELS_ERROR);
|
6057
6064
|
return;
|
6058
6065
|
}
|
6059
6066
|
if (this._isModelLoaded || this._isModelLoading) return;
|
@@ -6064,7 +6071,7 @@ var en = {
|
|
6064
6071
|
key: "getConfig",
|
6065
6072
|
value: function getConfig() {
|
6066
6073
|
var i;
|
6067
|
-
var e =
|
6074
|
+
var e = C.DEFAULT_MODEL;
|
6068
6075
|
this._webModel.model && (e = this._webModel.model);
|
6069
6076
|
var t = JSON.parse(JSON.stringify(en));
|
6070
6077
|
if (this._webModel.urls) {
|
@@ -6088,7 +6095,7 @@ var en = {
|
|
6088
6095
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
6089
6096
|
while (1) switch (_context32.prev = _context32.next) {
|
6090
6097
|
case 0:
|
6091
|
-
this.scrollToTop(),
|
6098
|
+
this.scrollToTop(), C.chat = e, this._isModelLoading = !0;
|
6092
6099
|
i = ((o = this._webModel.introMessage) == null ? void 0 : o.displayed) === !1;
|
6093
6100
|
s = function s(u) {
|
6094
6101
|
var m;
|
@@ -6101,7 +6108,7 @@ var en = {
|
|
6101
6108
|
return Z.scrollToBottom((p = _this19._messages) == null ? void 0 : p.elementRef);
|
6102
6109
|
}), i = !1);
|
6103
6110
|
};
|
6104
|
-
|
6111
|
+
C.chat.setInitProgressCallback(s);
|
6105
6112
|
_context32.prev = 4;
|
6106
6113
|
_this$getConfig = this.getConfig(), u = _this$getConfig.model, m = _this$getConfig.appConfig, p = {};
|
6107
6114
|
this._webModel.instruction && (p.conv_config = {
|
@@ -6109,7 +6116,7 @@ var en = {
|
|
6109
6116
|
});
|
6110
6117
|
this._conversationHistory.length > 0 && (p.conversation_history = this._conversationHistory);
|
6111
6118
|
_context32.next = 10;
|
6112
|
-
return
|
6119
|
+
return C.chat.reload(u, p, m, t);
|
6113
6120
|
case 10:
|
6114
6121
|
r = _context32.sent;
|
6115
6122
|
_context32.next = 16;
|
@@ -6147,19 +6154,19 @@ var en = {
|
|
6147
6154
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
6148
6155
|
while (1) switch (_context33.prev = _context33.next) {
|
6149
6156
|
case 0:
|
6150
|
-
(t = this._messages) == null || t.addNewErrorMessage("service",
|
6157
|
+
(t = this._messages) == null || t.addNewErrorMessage("service", C.GENERIC_ERROR);
|
6151
6158
|
console.error(e);
|
6152
6159
|
this._isModelLoaded = !1;
|
6153
6160
|
this._isModelLoading = !1;
|
6154
|
-
_context33.t0 =
|
6161
|
+
_context33.t0 = C.chat;
|
6155
6162
|
if (!_context33.t0) {
|
6156
6163
|
_context33.next = 9;
|
6157
6164
|
break;
|
6158
6165
|
}
|
6159
6166
|
_context33.next = 8;
|
6160
|
-
return
|
6167
|
+
return C.chat.unload();
|
6161
6168
|
case 8:
|
6162
|
-
|
6169
|
+
C.chat = void 0;
|
6163
6170
|
case 9:
|
6164
6171
|
case "end":
|
6165
6172
|
return _context33.stop();
|
@@ -6187,7 +6194,7 @@ var en = {
|
|
6187
6194
|
text: _context34.t0
|
6188
6195
|
};
|
6189
6196
|
_context34.next = 6;
|
6190
|
-
return
|
6197
|
+
return C.processResponse(this.deepChat, e, s);
|
6191
6198
|
case 6:
|
6192
6199
|
r = _context34.sent;
|
6193
6200
|
r && e.addNewMessage(r), this.completionsHandlers.onFinish();
|
@@ -6223,7 +6230,7 @@ var en = {
|
|
6223
6230
|
while (1) switch (_context35.prev = _context35.next) {
|
6224
6231
|
case 0:
|
6225
6232
|
_context35.next = 2;
|
6226
|
-
return
|
6233
|
+
return C.processResponse(_this20.deepChat, e, {
|
6227
6234
|
text: o
|
6228
6235
|
});
|
6229
6236
|
case 2:
|
@@ -6362,7 +6369,7 @@ var en = {
|
|
6362
6369
|
case 6:
|
6363
6370
|
return _context39.abrupt("return");
|
6364
6371
|
case 7:
|
6365
|
-
!
|
6372
|
+
!C.chat || this._isModelLoading || ((i = this._webModel.introMessage) != null && i.removeAfterMessage && ((s = this._removeIntro) == null || s.call(this)), e.addLoadingMessage(), this.generateResp(e, t, C.chat));
|
6366
6373
|
case 8:
|
6367
6374
|
case "end":
|
6368
6375
|
return _context39.stop();
|
@@ -6443,7 +6450,7 @@ var en = {
|
|
6443
6450
|
}, {
|
6444
6451
|
key: "clearAllCache",
|
6445
6452
|
value: function clearAllCache() {
|
6446
|
-
|
6453
|
+
C.clearCache("webllm/model"), C.clearCache("webllm/wasm");
|
6447
6454
|
}
|
6448
6455
|
}, {
|
6449
6456
|
key: "clearCache",
|
@@ -6458,8 +6465,8 @@ var en = {
|
|
6458
6465
|
}
|
6459
6466
|
}]);
|
6460
6467
|
}(nt);
|
6461
|
-
|
6462
|
-
var $t =
|
6468
|
+
C.GENERIC_ERROR = "Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.", C.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models", C.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found", C.DEFAULT_MODEL = "Llama-2-7b-chat-hf-q4f32_1", C.MODULE_SEARCH_LIMIT_S = 5;
|
6469
|
+
var $t = C;
|
6463
6470
|
var vi = /*#__PURE__*/function () {
|
6464
6471
|
function vi() {
|
6465
6472
|
_classCallCheck(this, vi);
|
@@ -6526,7 +6533,7 @@ var Ut = /*#__PURE__*/function (_G) {
|
|
6526
6533
|
throw new Error("Request settings have not been set up");
|
6527
6534
|
case 2:
|
6528
6535
|
s = this.preprocessBody(this.rawBody, t, i);
|
6529
|
-
|
6536
|
+
T.request(this, s, e);
|
6530
6537
|
case 4:
|
6531
6538
|
case "end":
|
6532
6539
|
return _context41.stop();
|
@@ -6576,7 +6583,7 @@ var Qt = /*#__PURE__*/function (_Be) {
|
|
6576
6583
|
}
|
6577
6584
|
throw new Error("No file was added");
|
6578
6585
|
case 4:
|
6579
|
-
|
6586
|
+
T.poll(this, i[0], e, !1);
|
6580
6587
|
case 5:
|
6581
6588
|
case "end":
|
6582
6589
|
return _context42.stop();
|
@@ -6695,11 +6702,11 @@ var No = /*#__PURE__*/function (_Qt2) {
|
|
6695
6702
|
}]);
|
6696
6703
|
}(Qt);
|
6697
6704
|
var ei = "data:image/png;base64,";
|
6698
|
-
var
|
6699
|
-
function
|
6700
|
-
_classCallCheck(this,
|
6705
|
+
var Ce = /*#__PURE__*/function () {
|
6706
|
+
function Ce() {
|
6707
|
+
_classCallCheck(this, Ce);
|
6701
6708
|
}
|
6702
|
-
return _createClass(
|
6709
|
+
return _createClass(Ce, null, [{
|
6703
6710
|
key: "buildHeaders",
|
6704
6711
|
value: function buildHeaders(e) {
|
6705
6712
|
return {
|
@@ -6719,7 +6726,7 @@ var Te = /*#__PURE__*/function () {
|
|
6719
6726
|
return {
|
6720
6727
|
url: "https://api.stability.ai/v1/engines/list",
|
6721
6728
|
method: "GET",
|
6722
|
-
handleVerificationResult:
|
6729
|
+
handleVerificationResult: Ce.handleVerificationResult
|
6723
6730
|
};
|
6724
6731
|
}
|
6725
6732
|
}]);
|
@@ -6750,7 +6757,7 @@ var yi = /*#__PURE__*/function (_ji) {
|
|
6750
6757
|
}
|
6751
6758
|
}
|
6752
6759
|
};
|
6753
|
-
_this24 = _callSuper(this, yi, [e,
|
6760
|
+
_this24 = _callSuper(this, yi, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i, s]), _this24.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this24.textInputPlaceholderText = "Describe image changes", _this24.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>";
|
6754
6761
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6755
6762
|
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), yi.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = yi.canSendFileMessage;
|
6756
6763
|
return _this24;
|
@@ -6786,7 +6793,7 @@ var yi = /*#__PURE__*/function (_ji) {
|
|
6786
6793
|
throw new Error("Image was not found");
|
6787
6794
|
case 4:
|
6788
6795
|
s = this.createFormDataBody(this.rawBody, i[0]);
|
6789
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
6796
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
6790
6797
|
case 6:
|
6791
6798
|
case "end":
|
6792
6799
|
return _context45.stop();
|
@@ -6857,7 +6864,7 @@ var Ei = /*#__PURE__*/function (_ji2) {
|
|
6857
6864
|
}
|
6858
6865
|
}
|
6859
6866
|
};
|
6860
|
-
_this25 = _callSuper(this, Ei, [e,
|
6867
|
+
_this25 = _callSuper(this, Ei, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this25._maskSource = "MASK_IMAGE_WHITE", _this25.textInputPlaceholderText = "Describe image changes", _this25.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>";
|
6861
6868
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6862
6869
|
_typeof(r) == "object" && (r.engine_id && (_this25.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this25._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this25._maskSource = r.mask_source), Ei.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = Ei.canSendFileTextMessage;
|
6863
6870
|
return _this25;
|
@@ -6893,7 +6900,7 @@ var Ei = /*#__PURE__*/function (_ji2) {
|
|
6893
6900
|
throw new Error("Image was not found");
|
6894
6901
|
case 4:
|
6895
6902
|
s = (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], s);
|
6896
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
6903
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6897
6904
|
case 6:
|
6898
6905
|
case "end":
|
6899
6906
|
return _context47.stop();
|
@@ -7226,7 +7233,7 @@ var Si = /*#__PURE__*/function (_ji3) {
|
|
7226
7233
|
}
|
7227
7234
|
}
|
7228
7235
|
};
|
7229
|
-
_this28 = _callSuper(this, Si, [e,
|
7236
|
+
_this28 = _callSuper(this, Si, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i, s]), _this28.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this28.textInputPlaceholderText = "Describe image changes", _this28.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>";
|
7230
7237
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7231
7238
|
_typeof(r) == "object" && (r.engine_id && (_this28.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this28._imageWeight = r.weight), Si.cleanConfig(r), Object.assign(_this28.rawBody, r)), _this28.canSendMessage = Si.canSendFileTextMessage;
|
7232
7239
|
return _this28;
|
@@ -7262,7 +7269,7 @@ var Si = /*#__PURE__*/function (_ji3) {
|
|
7262
7269
|
throw new Error("Image was not found");
|
7263
7270
|
case 4:
|
7264
7271
|
s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], s);
|
7265
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
7272
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7266
7273
|
case 6:
|
7267
7274
|
case "end":
|
7268
7275
|
return _context54.stop();
|
@@ -7364,7 +7371,7 @@ var xi = /*#__PURE__*/function (_ji4) {
|
|
7364
7371
|
var r;
|
7365
7372
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7366
7373
|
i = t.stabilityAI;
|
7367
|
-
_this29 = _callSuper(this, xi, [e,
|
7374
|
+
_this29 = _callSuper(this, xi, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this29.textInputPlaceholderText = "Describe an image", _this29.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>";
|
7368
7375
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7369
7376
|
_typeof(s) == "object" && (s.engine_id && (_this29.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this29._imageWeight = s.weight), xi.cleanConfig(s), Object.assign(_this29.rawBody, s)), _this29.canSendMessage = xi.canSendTextMessage;
|
7370
7377
|
return _this29;
|
@@ -7394,7 +7401,7 @@ var xi = /*#__PURE__*/function (_ji4) {
|
|
7394
7401
|
throw new Error("Request settings have not been set up");
|
7395
7402
|
case 2:
|
7396
7403
|
i = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
7397
|
-
|
7404
|
+
T.request(this, i, e);
|
7398
7405
|
case 4:
|
7399
7406
|
case "end":
|
7400
7407
|
return _context57.stop();
|
@@ -7874,7 +7881,7 @@ var ie = /*#__PURE__*/function () {
|
|
7874
7881
|
}]);
|
7875
7882
|
}();
|
7876
7883
|
ie.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ie.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
|
7877
|
-
var
|
7884
|
+
var Te = ie;
|
7878
7885
|
var je = /*#__PURE__*/function (_G3) {
|
7879
7886
|
// prettier-ignore
|
7880
7887
|
function je(e, t, i, s, r, o) {
|
@@ -7933,7 +7940,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
7933
7940
|
key: "processMessage",
|
7934
7941
|
value: function processMessage(e, t) {
|
7935
7942
|
var i = this.totalMessagesMaxCharLength || -1,
|
7936
|
-
s =
|
7943
|
+
s = Tt.getCharacterLimitMessages(e, i)[0];
|
7937
7944
|
if (t && t.length > 0) {
|
7938
7945
|
var r = this.filesToolType;
|
7939
7946
|
if (typeof this.filesToolType == "function") {
|
@@ -7973,11 +7980,11 @@ var je = /*#__PURE__*/function (_G3) {
|
|
7973
7980
|
if (this.messages = e, this.sessionId) {
|
7974
7981
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/").concat(this.sessionId, "/messages").concat(this.urlSegments.createMessagePostfix);
|
7975
7982
|
var s = this.processMessage(t, i);
|
7976
|
-
|
7983
|
+
T.request(this, s, e);
|
7977
7984
|
} else {
|
7978
7985
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/runs").concat(this.urlSegments.threadsPosfix);
|
7979
7986
|
var _s2 = this.createNewThreadMessages(this.rawBody, t, i);
|
7980
|
-
this.isSSEStream ? this.createStreamRun(_s2) :
|
7987
|
+
this.isSSEStream ? this.createStreamRun(_s2) : T.request(this, _s2, e);
|
7981
7988
|
}
|
7982
7989
|
}
|
7983
7990
|
}, {
|
@@ -8021,7 +8028,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8021
8028
|
break;
|
8022
8029
|
}
|
8023
8030
|
_context71.next = 16;
|
8024
|
-
return
|
8031
|
+
return Te.storeFiles(this, e, i, this.urlSegments.storeFiles);
|
8025
8032
|
case 16:
|
8026
8033
|
_context71.t1 = _context71.sent;
|
8027
8034
|
_context71.next = 20;
|
@@ -8104,7 +8111,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8104
8111
|
_context73.next = 6;
|
8105
8112
|
break;
|
8106
8113
|
}
|
8107
|
-
throw e.error.message.startsWith(
|
8114
|
+
throw e.error.message.startsWith(Te.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
|
8108
8115
|
case 6:
|
8109
8116
|
_context73.next = 8;
|
8110
8117
|
return this.assignThreadAndRun(e);
|
@@ -8113,7 +8120,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8113
8120
|
method: "GET",
|
8114
8121
|
headers: (s = this.connectSettings) == null ? void 0 : s.headers
|
8115
8122
|
};
|
8116
|
-
return _context73.abrupt("return", (
|
8123
|
+
return _context73.abrupt("return", (T.executePollRequest(this, t, i, this.messages), {
|
8117
8124
|
makingAnotherRequest: !0
|
8118
8125
|
}));
|
8119
8126
|
case 10:
|
@@ -8188,7 +8195,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8188
8195
|
case 9:
|
8189
8196
|
i = _context75.sent;
|
8190
8197
|
case 10:
|
8191
|
-
return _context75.abrupt("return",
|
8198
|
+
return _context75.abrupt("return", Te.processAPIMessages(this, i, t, this.urlSegments));
|
8192
8199
|
case 11:
|
8193
8200
|
case "end":
|
8194
8201
|
return _context75.stop();
|
@@ -8289,7 +8296,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8289
8296
|
_context77.next = 8;
|
8290
8297
|
break;
|
8291
8298
|
}
|
8292
|
-
throw Error(
|
8299
|
+
throw Error(Te.FUNCTION_TOOL_RESP_ERROR);
|
8293
8300
|
case 8:
|
8294
8301
|
_context77.next = 10;
|
8295
8302
|
return Promise.all(i);
|
@@ -8301,7 +8308,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8301
8308
|
_context77.next = 13;
|
8302
8309
|
break;
|
8303
8310
|
}
|
8304
|
-
throw Error(
|
8311
|
+
throw Error(Te.FUNCTION_TOOL_RESP_ERROR);
|
8305
8312
|
case 13:
|
8306
8313
|
r = s.map(function (l, c) {
|
8307
8314
|
return {
|
@@ -8406,7 +8413,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8406
8413
|
}
|
8407
8414
|
l = e.content.find(function (d) {
|
8408
8415
|
return !!d.text;
|
8409
|
-
}) || e.content[0], c =
|
8416
|
+
}) || e.content[0], c = Te.getFilesAndText.bind(this, this, {
|
8410
8417
|
role: "assistant",
|
8411
8418
|
content: e.content
|
8412
8419
|
}, this.urlSegments, l);
|
@@ -8430,7 +8437,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8430
8437
|
break;
|
8431
8438
|
}
|
8432
8439
|
_context79.next = 11;
|
8433
|
-
return
|
8440
|
+
return Te.processStreamMessages(this, e.delta.content, this.urlSegments);
|
8434
8441
|
case 11:
|
8435
8442
|
_l = _context79.sent;
|
8436
8443
|
return _context79.abrupt("return", {
|
@@ -8633,7 +8640,7 @@ var zo = /*#__PURE__*/function (_Is) {
|
|
8633
8640
|
throw new Error("Request settings have not been set up");
|
8634
8641
|
case 2:
|
8635
8642
|
i = this.preprocessBody(this.rawBody, t);
|
8636
|
-
|
8643
|
+
T.request(this, i, e);
|
8637
8644
|
case 4:
|
8638
8645
|
case "end":
|
8639
8646
|
return _context81.stop();
|
@@ -8783,7 +8790,7 @@ var Go = /*#__PURE__*/function (_Is2) {
|
|
8783
8790
|
throw new Error("Request settings have not been set up");
|
8784
8791
|
case 2:
|
8785
8792
|
i = this.preprocessBody(this.rawBody, t);
|
8786
|
-
|
8793
|
+
T.request(this, i, e);
|
8787
8794
|
case 4:
|
8788
8795
|
case "end":
|
8789
8796
|
return _context83.stop();
|
@@ -8862,7 +8869,7 @@ var Et = /*#__PURE__*/function (_G5) {
|
|
8862
8869
|
case 2:
|
8863
8870
|
this.url = this.connectSettings.url || this.url;
|
8864
8871
|
i = this.preprocessBody(this.rawBody, t);
|
8865
|
-
|
8872
|
+
T.request(this, i, e);
|
8866
8873
|
case 5:
|
8867
8874
|
case "end":
|
8868
8875
|
return _context85.stop();
|
@@ -8973,7 +8980,7 @@ var me = /*#__PURE__*/function (_G6) {
|
|
8973
8980
|
case 4:
|
8974
8981
|
this.url = this.connectSettings.url || this._service_url;
|
8975
8982
|
s = this.preprocessBody(this.rawBody, t), r = me.createFormDataBody(s, i[0]);
|
8976
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
8983
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
8977
8984
|
case 7:
|
8978
8985
|
case "end":
|
8979
8986
|
return _context87.stop();
|
@@ -9198,7 +9205,7 @@ var jt = /*#__PURE__*/function (_Vo) {
|
|
9198
9205
|
throw new Error("Request settings have not been set up");
|
9199
9206
|
case 2:
|
9200
9207
|
i = this.preprocessBody(this.rawBody, t);
|
9201
|
-
|
9208
|
+
T.request(this, i, e), this.messages = e;
|
9202
9209
|
case 4:
|
9203
9210
|
case "end":
|
9204
9211
|
return _context89.stop();
|
@@ -9229,7 +9236,7 @@ var jt = /*#__PURE__*/function (_Vo) {
|
|
9229
9236
|
method: "GET",
|
9230
9237
|
headers: (t = this.connectSettings) == null ? void 0 : t.headers
|
9231
9238
|
};
|
9232
|
-
|
9239
|
+
T.executePollRequest(this, _i12, s, this.messages);
|
9233
9240
|
}
|
9234
9241
|
return _context90.abrupt("return", {
|
9235
9242
|
makingAnotherRequest: !0
|
@@ -9448,7 +9455,7 @@ var Ls = /*#__PURE__*/function (_G8) {
|
|
9448
9455
|
}
|
9449
9456
|
throw new Error("No file was added");
|
9450
9457
|
case 4:
|
9451
|
-
|
9458
|
+
T.request(this, i[0], e, !1);
|
9452
9459
|
case 5:
|
9453
9460
|
case "end":
|
9454
9461
|
return _context93.stop();
|
@@ -9553,7 +9560,7 @@ var Ye = /*#__PURE__*/function (_Mn) {
|
|
9553
9560
|
throw new Error("Request settings have not been set up");
|
9554
9561
|
case 2:
|
9555
9562
|
i = this.preprocessBody(this.rawBody, t);
|
9556
|
-
|
9563
|
+
T.request(this, i, e, !1);
|
9557
9564
|
case 4:
|
9558
9565
|
case "end":
|
9559
9566
|
return _context95.stop();
|
@@ -9650,7 +9657,7 @@ var He = /*#__PURE__*/function (_Mn2) {
|
|
9650
9657
|
}
|
9651
9658
|
throw new Error("No file was added");
|
9652
9659
|
case 4:
|
9653
|
-
(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"),
|
9660
|
+
(r = this.connectSettings) != null && r.headers && (this.connectSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), T.request(this, i[0], e, !1);
|
9654
9661
|
case 5:
|
9655
9662
|
case "end":
|
9656
9663
|
return _context97.stop();
|
@@ -9739,7 +9746,7 @@ var $o = /*#__PURE__*/function (_G10) {
|
|
9739
9746
|
throw new Error("Request settings have not been set up");
|
9740
9747
|
case 2:
|
9741
9748
|
i = this.preprocessBody(t);
|
9742
|
-
|
9749
|
+
T.request(this, i, e);
|
9743
9750
|
case 4:
|
9744
9751
|
case "end":
|
9745
9752
|
return _context99.stop();
|
@@ -9816,7 +9823,7 @@ var xt = /*#__PURE__*/function (_G11) {
|
|
9816
9823
|
function preprocessBody(e, t) {
|
9817
9824
|
var _i$max_tokens;
|
9818
9825
|
var i = JSON.parse(JSON.stringify(e)),
|
9819
|
-
s =
|
9826
|
+
s = Tt.getCharacterLimitMessages(t, this.totalMessagesMaxCharLength ? this.totalMessagesMaxCharLength - this._systemMessage.content.length : -1).map(function (r) {
|
9820
9827
|
return {
|
9821
9828
|
content: xt.getContent(r),
|
9822
9829
|
role: r.role === b.USER_ROLE ? "user" : "assistant"
|
@@ -9841,7 +9848,7 @@ var xt = /*#__PURE__*/function (_G11) {
|
|
9841
9848
|
throw new Error("Request settings have not been set up");
|
9842
9849
|
case 2:
|
9843
9850
|
i = this.preprocessBody(this.rawBody, t), s = this.stream;
|
9844
|
-
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0, A.request(this, i, e)) :
|
9851
|
+
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0, A.request(this, i, e)) : T.request(this, i, e);
|
9845
9852
|
case 4:
|
9846
9853
|
case "end":
|
9847
9854
|
return _context101.stop();
|
@@ -10150,7 +10157,7 @@ var ge = /*#__PURE__*/function (_G12) {
|
|
10150
10157
|
var l = this.preprocessBody(this.rawBody, r);
|
10151
10158
|
s = ge.createFormDataBody(l, i[0], i[1]);
|
10152
10159
|
} else this.url = ge.IMAGE_VARIATIONS_URL, s = ge.createFormDataBody(this.rawBody, i[0]);
|
10153
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
10160
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
10154
10161
|
}
|
10155
10162
|
}, {
|
10156
10163
|
key: "callServiceAPI",
|
@@ -10182,7 +10189,7 @@ var ge = /*#__PURE__*/function (_G12) {
|
|
10182
10189
|
case 8:
|
10183
10190
|
this.url = ge.IMAGE_GENERATION_URL;
|
10184
10191
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
10185
|
-
|
10192
|
+
T.request(this, r, e);
|
10186
10193
|
case 11:
|
10187
10194
|
case "end":
|
10188
10195
|
return _context105.stop();
|
@@ -10296,7 +10303,7 @@ var Wo = /*#__PURE__*/function (_Is3) {
|
|
10296
10303
|
throw new Error("Request settings have not been set up");
|
10297
10304
|
case 2:
|
10298
10305
|
i = this.preprocessBody(this.rawBody, t);
|
10299
|
-
|
10306
|
+
T.request(this, i, e);
|
10300
10307
|
case 4:
|
10301
10308
|
case "end":
|
10302
10309
|
return _context107.stop();
|
@@ -10337,11 +10344,11 @@ var Wo = /*#__PURE__*/function (_Is3) {
|
|
10337
10344
|
}()
|
10338
10345
|
}]);
|
10339
10346
|
}(Is);
|
10340
|
-
var
|
10341
|
-
function
|
10342
|
-
_classCallCheck(this,
|
10347
|
+
var Ci = /*#__PURE__*/function () {
|
10348
|
+
function Ci() {
|
10349
|
+
_classCallCheck(this, Ci);
|
10343
10350
|
}
|
10344
|
-
return _createClass(
|
10351
|
+
return _createClass(Ci, null, [{
|
10345
10352
|
key: "buildHeaders",
|
10346
10353
|
value: function buildHeaders(e) {
|
10347
10354
|
return {
|
@@ -10363,7 +10370,7 @@ var Ti = /*#__PURE__*/function () {
|
|
10363
10370
|
return {
|
10364
10371
|
url: "https://api.mistral.ai/v1/models",
|
10365
10372
|
method: "GET",
|
10366
|
-
handleVerificationResult:
|
10373
|
+
handleVerificationResult: Ci.handleVerificationResult
|
10367
10374
|
};
|
10368
10375
|
}
|
10369
10376
|
}]);
|
@@ -10375,7 +10382,7 @@ var Ko = /*#__PURE__*/function (_G13) {
|
|
10375
10382
|
_classCallCheck(this, Ko);
|
10376
10383
|
var s;
|
10377
10384
|
var i = JSON.parse(JSON.stringify(e.directConnection)).mistral;
|
10378
|
-
_this51 = _callSuper(this, Ko, [e,
|
10385
|
+
_this51 = _callSuper(this, Ko, [e, Ci.buildKeyVerificationDetails(), Ci.buildHeaders, i]), _this51.insertKeyPlaceholderText = "Mistral API Key", _this51.keyHelpUrl = "https://console.mistral.ai/api-keys/", _this51.url = "https://api.mistral.ai/v1/chat/completions", _this51.permittedErrorPrefixes = ["invalid"], i && (_this51.cleanConfig(i), Object.assign(_this51.rawBody, i)), (_this51$maxMessages = _this51.maxMessages) !== null && _this51$maxMessages !== void 0 ? _this51$maxMessages : _this51.maxMessages = -1, (_s$model = (s = _this51.rawBody).model) !== null && _s$model !== void 0 ? _s$model : s.model = "open-mistral-7b";
|
10379
10386
|
return _this51;
|
10380
10387
|
}
|
10381
10388
|
_inherits(Ko, _G13);
|
@@ -10414,7 +10421,7 @@ var Ko = /*#__PURE__*/function (_G13) {
|
|
10414
10421
|
throw new Error("Request settings have not been set up");
|
10415
10422
|
case 2:
|
10416
10423
|
i = this.preprocessBody(this.rawBody, t);
|
10417
|
-
|
10424
|
+
T.request(this, i, e);
|
10418
10425
|
case 4:
|
10419
10426
|
case "end":
|
10420
10427
|
return _context109.stop();
|
@@ -10523,21 +10530,21 @@ function x(n) {
|
|
10523
10530
|
i._attributes_[s] = ws.attibutes[n], i._attributeToProperty_[s] = t;
|
10524
10531
|
};
|
10525
10532
|
}
|
10526
|
-
var
|
10527
|
-
function
|
10528
|
-
_classCallCheck(this,
|
10533
|
+
var Ti = /*#__PURE__*/function () {
|
10534
|
+
function Ti(e, t, i) {
|
10535
|
+
_classCallCheck(this, Ti);
|
10529
10536
|
this._isDisplayed = !1, e ? (this._elementRef = this.createIntroPanelWithChild(e, i), this._isDisplayed = !0) : t && (this._elementRef = this.createInternalIntroPanel(t, i), this._isDisplayed = !0);
|
10530
10537
|
}
|
10531
|
-
return _createClass(
|
10538
|
+
return _createClass(Ti, [{
|
10532
10539
|
key: "createIntroPanelWithChild",
|
10533
10540
|
value: function createIntroPanelWithChild(e, t) {
|
10534
|
-
var i =
|
10541
|
+
var i = Ti.createIntroPanel(t);
|
10535
10542
|
return e.style.display === "none" && (e.style.display = "block"), i.appendChild(e), i;
|
10536
10543
|
}
|
10537
10544
|
}, {
|
10538
10545
|
key: "createInternalIntroPanel",
|
10539
10546
|
value: function createInternalIntroPanel(e, t) {
|
10540
|
-
var i =
|
10547
|
+
var i = Ti.createIntroPanel(t);
|
10541
10548
|
return i.id = "internal-intro-panel", i.innerHTML = e, i;
|
10542
10549
|
}
|
10543
10550
|
}, {
|
@@ -10586,7 +10593,7 @@ var Zo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
10586
10593
|
key: "createAudioElement",
|
10587
10594
|
value: function createAudioElement(e, t) {
|
10588
10595
|
var i = document.createElement("audio");
|
10589
|
-
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0,
|
10596
|
+
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0, Ct.IS_SAFARI && (i.classList.add("audio-player-safari"), i.classList.add(t === b.USER_ROLE ? "audio-player-safari-right" : "audio-player-safari-left")), i;
|
10590
10597
|
}
|
10591
10598
|
}, {
|
10592
10599
|
key: "createNewAudioMessage",
|
@@ -10790,10 +10797,13 @@ var de = /*#__PURE__*/function (_De) {
|
|
10790
10797
|
return _createClass(de, [{
|
10791
10798
|
key: "prepareDemo",
|
10792
10799
|
value: function prepareDemo(e) {
|
10793
|
-
var t
|
10794
|
-
if (_typeof(e) == "object"
|
10795
|
-
|
10796
|
-
|
10800
|
+
var t;
|
10801
|
+
if (_typeof(e) == "object") {
|
10802
|
+
if (e.displayLoading) {
|
10803
|
+
var _i14 = e.displayLoading.history;
|
10804
|
+
_i14 != null && _i14.small && Ne.addMessage(this, !1), _i14 != null && _i14.full && Ne.addMessage(this);
|
10805
|
+
}
|
10806
|
+
e.displayErrors && (e.displayErrors["default"] && this.addNewErrorMessage("", ""), e.displayErrors.service && this.addNewErrorMessage("service", ""), e.displayErrors.speechToText && this.addNewErrorMessage("speechToText", "")), (t = e.displayLoading) != null && t.message && this.addLoadingMessage(), e.response && (this.customDemoResponse = e.response);
|
10797
10807
|
}
|
10798
10808
|
}
|
10799
10809
|
}, {
|
@@ -10810,11 +10820,11 @@ var de = /*#__PURE__*/function (_De) {
|
|
10810
10820
|
}, {
|
10811
10821
|
key: "addIntroductoryMessages",
|
10812
10822
|
value: function addIntroductoryMessages(e, t) {
|
10813
|
-
var
|
10823
|
+
var _i15,
|
10814
10824
|
_this53 = this;
|
10815
10825
|
e != null && e.shadowRoot && (this._introMessage = e.introMessage);
|
10816
10826
|
var i = this._introMessage;
|
10817
|
-
t != null && t.isWebModel() && ((
|
10827
|
+
t != null && t.isWebModel() && ((_i15 = i) !== null && _i15 !== void 0 ? _i15 : i = t.getIntroMessage(i)), i && (Array.isArray(i) ? i.forEach(function (s, r) {
|
10818
10828
|
r !== 0 && b.hideRoleElements(_this53.messageElementRefs, !!_this53._avatars, !!_this53._names), _this53.addIntroductoryMessage(s);
|
10819
10829
|
}) : this.addIntroductoryMessage(i));
|
10820
10830
|
}
|
@@ -10899,8 +10909,8 @@ var de = /*#__PURE__*/function (_De) {
|
|
10899
10909
|
value: function getPermittedMessage(e) {
|
10900
10910
|
if (e) {
|
10901
10911
|
var t = de.extractErrorMessages(e);
|
10902
|
-
for (var
|
10903
|
-
var s = t[
|
10912
|
+
for (var _i16 = 0; _i16 < t.length; _i16 += 1) {
|
10913
|
+
var s = t[_i16];
|
10904
10914
|
if (typeof s == "string") {
|
10905
10915
|
if (this._displayServiceErrorMessages) return s;
|
10906
10916
|
if (this._permittedErrorPrefixes) {
|
@@ -10937,7 +10947,7 @@ var de = /*#__PURE__*/function (_De) {
|
|
10937
10947
|
}, {
|
10938
10948
|
key: "populateIntroPanel",
|
10939
10949
|
value: function populateIntroPanel(e, t, i) {
|
10940
|
-
(e || t) && (this._introPanel = new
|
10950
|
+
(e || t) && (this._introPanel = new Ti(e, t, i), this._introPanel._elementRef && (se.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
10941
10951
|
}
|
10942
10952
|
}, {
|
10943
10953
|
key: "addMultipleFiles",
|
@@ -11007,7 +11017,7 @@ var de = /*#__PURE__*/function (_De) {
|
|
11007
11017
|
}, {
|
11008
11018
|
key: "checkPermittedErrorPrefixes",
|
11009
11019
|
value: function checkPermittedErrorPrefixes(e, t) {
|
11010
|
-
for (var
|
11020
|
+
for (var _i17 = 0; _i17 < e.length; _i17 += 1) if (t.startsWith(e[_i17])) return t;
|
11011
11021
|
}
|
11012
11022
|
}, {
|
11013
11023
|
key: "extractErrorMessages",
|
@@ -11021,11 +11031,11 @@ var de = /*#__PURE__*/function (_De) {
|
|
11021
11031
|
}
|
11022
11032
|
}]);
|
11023
11033
|
}(De);
|
11024
|
-
var
|
11025
|
-
function
|
11026
|
-
_classCallCheck(this,
|
11034
|
+
var B = /*#__PURE__*/function () {
|
11035
|
+
function B() {
|
11036
|
+
_classCallCheck(this, B);
|
11027
11037
|
}
|
11028
|
-
return _createClass(
|
11038
|
+
return _createClass(B, null, [{
|
11029
11039
|
key: "adjustInputPadding",
|
11030
11040
|
value: function adjustInputPadding(e, t) {
|
11031
11041
|
t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
|
@@ -11033,7 +11043,7 @@ var D = /*#__PURE__*/function () {
|
|
11033
11043
|
}, {
|
11034
11044
|
key: "adjustForOutsideButton",
|
11035
11045
|
value: function adjustForOutsideButton(e, t, i) {
|
11036
|
-
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(
|
11046
|
+
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(B.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(B.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add(B.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(B.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
|
11037
11047
|
}
|
11038
11048
|
// when submit is the only button
|
11039
11049
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -11041,10 +11051,10 @@ var D = /*#__PURE__*/function () {
|
|
11041
11051
|
key: "adjustOutsideSubmit",
|
11042
11052
|
value: function adjustOutsideSubmit(e, t, i) {
|
11043
11053
|
if (!(i["inside-left"].length > 0 || i["inside-right"].length > 0)) {
|
11044
|
-
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(
|
11054
|
+
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(B.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(B.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (s) {
|
11045
11055
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
11046
11056
|
});
|
11047
|
-
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(
|
11057
|
+
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(B.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(B.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (s) {
|
11048
11058
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
11049
11059
|
});
|
11050
11060
|
}
|
@@ -11052,12 +11062,12 @@ var D = /*#__PURE__*/function () {
|
|
11052
11062
|
}, {
|
11053
11063
|
key: "set",
|
11054
11064
|
value: function set(e, t, i, s) {
|
11055
|
-
!!
|
11065
|
+
!!B.adjustOutsideSubmit(t, i, s) || B.adjustForOutsideButton(t, i, s), B.adjustInputPadding(e, s);
|
11056
11066
|
}
|
11057
11067
|
}]);
|
11058
11068
|
}();
|
11059
|
-
|
11060
|
-
var
|
11069
|
+
B.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment", B.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment", B.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment", B.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
|
11070
|
+
var Cs = B;
|
11061
11071
|
var At = /*#__PURE__*/function () {
|
11062
11072
|
function At() {
|
11063
11073
|
_classCallCheck(this, At);
|
@@ -11207,8 +11217,8 @@ var ti = /*#__PURE__*/function () {
|
|
11207
11217
|
key: "unsetCustomStateStyles",
|
11208
11218
|
value: function unsetCustomStateStyles(e) {
|
11209
11219
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
11210
|
-
var
|
11211
|
-
s =
|
11220
|
+
var _i18 = e[t],
|
11221
|
+
s = _i18 && this._customStyles[_i18];
|
11212
11222
|
s && ve.unsetActionCSS(this.elementRef, s);
|
11213
11223
|
}
|
11214
11224
|
}
|
@@ -11341,7 +11351,7 @@ var Os = /*#__PURE__*/function () {
|
|
11341
11351
|
key: "windowKeyDown",
|
11342
11352
|
value: function windowKeyDown(e, t) {
|
11343
11353
|
var i, s, r;
|
11344
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
11354
|
+
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === D.ESCAPE ? (this.close(), (i = this.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === D.ENTER ? ((s = this.highlightedItem) == null || s.click(), (r = this.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === D.ARROW_DOWN ? Wt.focusSiblingItem(this.highlightedItem || this.elementRef.children[this.elementRef.children.length - 1], this.elementRef, !0) : t.key === D.ARROW_UP && Wt.focusSiblingItem(this.highlightedItem || this.elementRef.children[0], this.elementRef, !1));
|
11345
11355
|
}
|
11346
11356
|
}], [{
|
11347
11357
|
key: "createElement",
|
@@ -11852,10 +11862,10 @@ var ca = /*#__PURE__*/function () {
|
|
11852
11862
|
key: "appendSpans",
|
11853
11863
|
value: function appendSpans(e, t) {
|
11854
11864
|
if (e.spansPopulated = !0, e.insertInCursorLocation && document.activeElement === t) {
|
11855
|
-
var
|
11856
|
-
if (
|
11857
|
-
var s =
|
11858
|
-
s.insertNode(e.scrollingSpan), s.insertNode(e.interimSpan), s.insertNode(e.finalSpan), s.collapse(!1),
|
11865
|
+
var _i19 = window.getSelection();
|
11866
|
+
if (_i19 != null && _i19.focusNode) {
|
11867
|
+
var s = _i19.getRangeAt(0);
|
11868
|
+
s.insertNode(e.scrollingSpan), s.insertNode(e.interimSpan), s.insertNode(e.finalSpan), s.collapse(!1), _i19.removeAllRanges(), _i19.addRange(s);
|
11859
11869
|
return;
|
11860
11870
|
}
|
11861
11871
|
}
|
@@ -12356,9 +12366,9 @@ var Ri = /*#__PURE__*/function (_ga$Speech) {
|
|
12356
12366
|
if (_typeof(e.results) > "u" && _this59._service) _this59._service.onend = null, _this59._service.stop();else if (_this59._extractText && !_this59._stopping) {
|
12357
12367
|
var _this59$_extractText = _this59._extractText(e, _this59.finalTranscript, _this59._translations),
|
12358
12368
|
t = _this59$_extractText.interimTranscript,
|
12359
|
-
|
12369
|
+
_i20 = _this59$_extractText.finalTranscript,
|
12360
12370
|
s = _this59$_extractText.newText;
|
12361
|
-
_this59.updateElements(t,
|
12371
|
+
_this59.updateElements(t, _i20, s);
|
12362
12372
|
}
|
12363
12373
|
});
|
12364
12374
|
}
|
@@ -13047,7 +13057,7 @@ var Le = /*#__PURE__*/function () {
|
|
13047
13057
|
key: "createAnyFileAttachment",
|
13048
13058
|
value: function createAnyFileAttachment(e) {
|
13049
13059
|
var t = document.createElement("div");
|
13050
|
-
t.classList.add("border-bound-attachment"),
|
13060
|
+
t.classList.add("border-bound-attachment"), Ct.IS_SAFARI && t.classList.add("border-bound-attachment-safari");
|
13051
13061
|
var i = document.createElement("div");
|
13052
13062
|
i.classList.add("any-file-attachment-text");
|
13053
13063
|
var s = document.createElement("div");
|
@@ -13140,7 +13150,7 @@ var wa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
13140
13150
|
key: "createAudioContainer",
|
13141
13151
|
value: function createAudioContainer() {
|
13142
13152
|
var e = document.createElement("div");
|
13143
|
-
return e.classList.add("border-bound-attachment", "audio-attachment-icon-container"),
|
13153
|
+
return e.classList.add("border-bound-attachment", "audio-attachment-icon-container"), Ct.IS_SAFARI && e.classList.add("border-bound-attachment-safari"), e;
|
13144
13154
|
}
|
13145
13155
|
}, {
|
13146
13156
|
key: "addAudioElements",
|
@@ -13177,11 +13187,11 @@ var wa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
13177
13187
|
}(Le);
|
13178
13188
|
Me.TIMER_LIMIT_S = 5999;
|
13179
13189
|
var Xt = Me;
|
13180
|
-
var
|
13181
|
-
function
|
13182
|
-
_classCallCheck(this,
|
13190
|
+
var Ca = /*#__PURE__*/function () {
|
13191
|
+
function Ca() {
|
13192
|
+
_classCallCheck(this, Ca);
|
13183
13193
|
}
|
13184
|
-
return _createClass(
|
13194
|
+
return _createClass(Ca, null, [{
|
13185
13195
|
key: "create",
|
13186
13196
|
value:
|
13187
13197
|
// prettier-ignore
|
@@ -13201,7 +13211,7 @@ var oi = /*#__PURE__*/function () {
|
|
13201
13211
|
return _createClass(oi, [{
|
13202
13212
|
key: "addType",
|
13203
13213
|
value: function addType(e, t, i) {
|
13204
|
-
var s =
|
13214
|
+
var s = Ca.create(e, t, this.toggleContainerDisplay.bind(this), this.elementRef, i);
|
13205
13215
|
return this._fileAttachmentsTypes.push(s), s;
|
13206
13216
|
}
|
13207
13217
|
}, {
|
@@ -13347,7 +13357,7 @@ var be = /*#__PURE__*/function () {
|
|
13347
13357
|
key: "windowKeyDown",
|
13348
13358
|
value: function windowKeyDown(e, t) {
|
13349
13359
|
var i, s;
|
13350
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
13360
|
+
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === D.ESCAPE ? (this.close(), (i = this.extensionCloseCallback) == null || i.call(this)) : t.key === D.ENTER && (this.close(), (s = this.extensionCloseCallback) == null || s.call(this)));
|
13351
13361
|
}
|
13352
13362
|
}], [{
|
13353
13363
|
key: "createContainer",
|
@@ -13635,16 +13645,16 @@ var In = /*#__PURE__*/function () {
|
|
13635
13645
|
}
|
13636
13646
|
}]);
|
13637
13647
|
}();
|
13638
|
-
var
|
13639
|
-
function
|
13648
|
+
var Ta = /*#__PURE__*/function (_Kt2) {
|
13649
|
+
function Ta(e, t) {
|
13640
13650
|
var _this72;
|
13641
|
-
_classCallCheck(this,
|
13651
|
+
_classCallCheck(this, Ta);
|
13642
13652
|
var i, s;
|
13643
|
-
_this72 = _callSuper(this,
|
13653
|
+
_this72 = _callSuper(this, Ta, [t.button]), _this72._waitingForBrowserApproval = !1, _this72._audioType = e, _this72._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this72._maxDurationSeconds = (s = t.files) == null ? void 0 : s.maxDurationSeconds, _this72.elementRef.onclick = _this72.buttonClick.bind(_assertThisInitialized(_this72));
|
13644
13654
|
return _this72;
|
13645
13655
|
}
|
13646
|
-
_inherits(
|
13647
|
-
return _createClass(
|
13656
|
+
_inherits(Ta, _Kt2);
|
13657
|
+
return _createClass(Ta, [{
|
13648
13658
|
key: "buttonClick",
|
13649
13659
|
value: function buttonClick() {
|
13650
13660
|
this._waitingForBrowserApproval || (this.isActive ? this.stop() : (this._waitingForBrowserApproval = !0, this.record()));
|
@@ -14070,7 +14080,7 @@ var k = /*#__PURE__*/function (_ti4) {
|
|
14070
14080
|
}]);
|
14071
14081
|
}(ti);
|
14072
14082
|
k.SUBMIT_CLASS = "submit-button", k.LOADING_CLASS = "loading-button", k.DISABLED_CLASS = "disabled-button";
|
14073
|
-
var
|
14083
|
+
var Ts = k;
|
14074
14084
|
var ka = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M27.1 14.313V5.396L24.158 8.34c-2.33-2.325-5.033-3.503-8.11-3.503C9.902 4.837 4.901 9.847 4.899 16c.001 6.152 5.003 11.158 11.15 11.16 4.276 0 9.369-2.227 10.836-8.478l.028-.122h-3.23l-.022.068c-1.078 3.242-4.138 5.421-7.613 5.421a8 8 0 0 1-5.691-2.359A7.993 7.993 0 0 1 8 16.001c0-4.438 3.611-8.049 8.05-8.049 2.069 0 3.638.58 5.924 2.573l-3.792 3.789H27.1z\"/>\n</svg>\n",
|
14075
14085
|
Ma = "<?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>capture</title>\n <path d=\"M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z\"></path>\n</svg>\n",
|
14076
14086
|
Ra = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z\"/>\n</svg>",
|
@@ -14151,8 +14161,8 @@ var Ds = /*#__PURE__*/function (_et) {
|
|
14151
14161
|
var _e4 = atob(this._dataURL.split(",")[1]),
|
14152
14162
|
t = new Array(_e4.length);
|
14153
14163
|
for (var a = 0; a < _e4.length; a++) t[a] = _e4.charCodeAt(a);
|
14154
|
-
var
|
14155
|
-
s = new Blob([
|
14164
|
+
var _i21 = new Uint8Array(t),
|
14165
|
+
s = new Blob([_i21], {
|
14156
14166
|
type: this._format
|
14157
14167
|
}),
|
14158
14168
|
r = this._format === "image/jpeg" ? "jpeg" : "png",
|
@@ -14168,8 +14178,8 @@ var Ds = /*#__PURE__*/function (_et) {
|
|
14168
14178
|
if (!this._stopped) {
|
14169
14179
|
if (!this._dataURL) {
|
14170
14180
|
t.width = e.videoWidth, t.height = e.videoHeight;
|
14171
|
-
var
|
14172
|
-
|
14181
|
+
var _i22 = t.getContext("2d");
|
14182
|
+
_i22 == null || _i22.drawImage(e, 0, 0, t.width, t.height);
|
14173
14183
|
}
|
14174
14184
|
requestAnimationFrame(this.updateCanvas.bind(this, e, t));
|
14175
14185
|
}
|
@@ -14243,7 +14253,7 @@ var Ft = /*#__PURE__*/function () {
|
|
14243
14253
|
e.speechToText && !r.microphone && (r.microphone = {
|
14244
14254
|
button: new Zt(e, a, t.addNewErrorMessage.bind(t))
|
14245
14255
|
});
|
14246
|
-
var l = new
|
14256
|
+
var l = new Ts(e, a, t, i, o, r);
|
14247
14257
|
a.submit = l.submitFromInput.bind(l), $e.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
|
14248
14258
|
button: l
|
14249
14259
|
}, Ft.addElements(this.elementRef, a, r, s, o, e.dropupStyles);
|
@@ -14264,7 +14274,7 @@ var Ft = /*#__PURE__*/function () {
|
|
14264
14274
|
if ((l = t.recordAudio) != null && l.files) {
|
14265
14275
|
var _d = ((c = s.audio) == null ? void 0 : c.fileType) || r.addType(e, t.recordAudio.files, "audio");
|
14266
14276
|
s.microphone = {
|
14267
|
-
button: new
|
14277
|
+
button: new Ta(_d, t.recordAudio)
|
14268
14278
|
};
|
14269
14279
|
}
|
14270
14280
|
return Re.isEnabled(r, e.dragAndDrop) && Re.create(i, r, e.dragAndDrop), r;
|
@@ -14303,7 +14313,7 @@ var Ft = /*#__PURE__*/function () {
|
|
14303
14313
|
Z.addElements(e, t.elementRef);
|
14304
14314
|
var a = At.create(),
|
14305
14315
|
l = $.addButtons(a, i, s, o);
|
14306
|
-
|
14316
|
+
Cs.set(t.inputElementRef, a, r.elementRef, l), At.add(e, a);
|
14307
14317
|
}
|
14308
14318
|
}]);
|
14309
14319
|
}();
|