deep-chat-dev 9.0.222 → 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 +2328 -2329
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +130 -135
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -207,7 +207,7 @@ 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
213
|
var D = /* @__PURE__ */function (n) {
|
@@ -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",
|
@@ -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
|
};
|
@@ -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);
|
@@ -3770,7 +3770,7 @@ function _wo() {
|
|
3770
3770
|
}));
|
3771
3771
|
return _wo.apply(this, arguments);
|
3772
3772
|
}
|
3773
|
-
function
|
3773
|
+
function Co(n) {
|
3774
3774
|
var e,
|
3775
3775
|
t,
|
3776
3776
|
i,
|
@@ -3798,7 +3798,7 @@ function To(n) {
|
|
3798
3798
|
l === a ? e = void 0 : l !== 0 && (e = e.subarray(l), t -= l);
|
3799
3799
|
};
|
3800
3800
|
}
|
3801
|
-
function
|
3801
|
+
function To(n, e, t) {
|
3802
3802
|
var i = Ys();
|
3803
3803
|
var s = new TextDecoder();
|
3804
3804
|
return function (o, a) {
|
@@ -3895,7 +3895,7 @@ function Ro(n, e) {
|
|
3895
3895
|
return Fe(Q);
|
3896
3896
|
case 7:
|
3897
3897
|
_context4.next = 9;
|
3898
|
-
return wo(Q.body, To(
|
3898
|
+
return wo(Q.body, Co(To(function (F) {
|
3899
3899
|
F ? u[Qs] = F : delete u[Qs];
|
3900
3900
|
}, function (F) {
|
3901
3901
|
v = F;
|
@@ -4642,11 +4642,11 @@ var Ie = /*#__PURE__*/function () {
|
|
4642
4642
|
}
|
4643
4643
|
}]);
|
4644
4644
|
}();
|
4645
|
-
var
|
4646
|
-
function
|
4647
|
-
_classCallCheck(this,
|
4645
|
+
var T = /*#__PURE__*/function () {
|
4646
|
+
function T() {
|
4647
|
+
_classCallCheck(this, T);
|
4648
4648
|
}
|
4649
|
-
return _createClass(
|
4649
|
+
return _createClass(T, null, [{
|
4650
4650
|
key: "request",
|
4651
4651
|
value: // prettier-ignore
|
4652
4652
|
function () {
|
@@ -4802,7 +4802,7 @@ var C = /*#__PURE__*/function () {
|
|
4802
4802
|
case 11:
|
4803
4803
|
a = _context17.sent;
|
4804
4804
|
a.timeoutMS ? setTimeout(function () {
|
4805
|
-
|
4805
|
+
T.executePollRequest(e, t, i, s);
|
4806
4806
|
}, a.timeoutMS) : A.isSimulatable(e.stream, a) ? A.simulate(s, e.streamHandlers, a) : (s.addNewMessage(a), r());
|
4807
4807
|
case 13:
|
4808
4808
|
case "end":
|
@@ -4862,7 +4862,7 @@ var C = /*#__PURE__*/function () {
|
|
4862
4862
|
body: h,
|
4863
4863
|
headers: a
|
4864
4864
|
};
|
4865
|
-
e.connectSettings.credentials && (f.credentials = e.connectSettings.credentials),
|
4865
|
+
e.connectSettings.credentials && (f.credentials = e.connectSettings.credentials), T.executePollRequest(e, c, f, i);
|
4866
4866
|
case 12:
|
4867
4867
|
case "end":
|
4868
4868
|
return _context18.stop();
|
@@ -5093,11 +5093,11 @@ var vt = /*#__PURE__*/function () {
|
|
5093
5093
|
}();
|
5094
5094
|
vt.FAILED_ERROR_MESSAGE = "Failed to load history";
|
5095
5095
|
var Vt = vt;
|
5096
|
-
var
|
5097
|
-
function
|
5098
|
-
_classCallCheck(this,
|
5096
|
+
var Tt = /*#__PURE__*/function () {
|
5097
|
+
function Tt() {
|
5098
|
+
_classCallCheck(this, Tt);
|
5099
5099
|
}
|
5100
|
-
return _createClass(
|
5100
|
+
return _createClass(Tt, null, [{
|
5101
5101
|
key: "getCharacterLimitMessages",
|
5102
5102
|
value: function getCharacterLimitMessages(e, t) {
|
5103
5103
|
var r;
|
@@ -5124,7 +5124,7 @@ var Ct = /*#__PURE__*/function () {
|
|
5124
5124
|
}, {
|
5125
5125
|
key: "processMessages",
|
5126
5126
|
value: function processMessages(e, t, i) {
|
5127
|
-
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);
|
5128
5128
|
}
|
5129
5129
|
}]);
|
5130
5130
|
}();
|
@@ -5267,7 +5267,7 @@ var nt = /*#__PURE__*/function () {
|
|
5267
5267
|
while (1) switch (_context24.prev = _context24.next) {
|
5268
5268
|
case 0:
|
5269
5269
|
i = _args24.length > 2 && _args24[2] !== undefined ? _args24[2] : !0;
|
5270
|
-
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));
|
5271
5271
|
case 2:
|
5272
5272
|
case "end":
|
5273
5273
|
return _context24.stop();
|
@@ -5366,7 +5366,7 @@ var nt = /*#__PURE__*/function () {
|
|
5366
5366
|
}
|
5367
5367
|
throw new Error("Request settings have not been set up");
|
5368
5368
|
case 2:
|
5369
|
-
i =
|
5369
|
+
i = Tt.processMessages(t.messageToElements.map(function (_ref12) {
|
5370
5370
|
var _ref13 = _slicedToArray(_ref12, 1),
|
5371
5371
|
s = _ref13[0];
|
5372
5372
|
return s;
|
@@ -5494,7 +5494,7 @@ var G = /*#__PURE__*/function (_nt) {
|
|
5494
5494
|
o = _this$keyVerification.createHeaders,
|
5495
5495
|
a = _this$keyVerification.body,
|
5496
5496
|
l = (o == null ? void 0 : o(e)) || this.buildHeadersFunc(e);
|
5497
|
-
|
5497
|
+
T.verifyKey(e, i, l, s, this.keyAuthenticated.bind(this, t.onSuccess), t.onFail, t.onLoad, r, a);
|
5498
5498
|
}
|
5499
5499
|
}, {
|
5500
5500
|
key: "isDirectConnection",
|
@@ -5932,17 +5932,17 @@ var en = {
|
|
5932
5932
|
}],
|
5933
5933
|
use_web_worker: !0
|
5934
5934
|
},
|
5935
|
-
|
5936
|
-
function
|
5935
|
+
C = /*#__PURE__*/function (_nt2) {
|
5936
|
+
function C(e) {
|
5937
5937
|
var _this15;
|
5938
|
-
_classCallCheck(this,
|
5938
|
+
_classCallCheck(this, C);
|
5939
5939
|
var t, i;
|
5940
|
-
_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);
|
5941
5941
|
return _this15;
|
5942
5942
|
}
|
5943
5943
|
// need ref of messages object as web model exhibits unique behaviour to manipulate chat
|
5944
|
-
_inherits(
|
5945
|
-
return _createClass(
|
5944
|
+
_inherits(C, _nt2);
|
5945
|
+
return _createClass(C, [{
|
5946
5946
|
key: "setUpMessages",
|
5947
5947
|
value: function setUpMessages(e) {
|
5948
5948
|
var _this16 = this;
|
@@ -5956,7 +5956,7 @@ var en = {
|
|
5956
5956
|
var _this17 = this;
|
5957
5957
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
5958
5958
|
var i;
|
5959
|
-
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 () {
|
5960
5960
|
return _this17.findModelInWindow(e, t + 1);
|
5961
5961
|
}, 1e3);
|
5962
5962
|
}
|
@@ -6059,8 +6059,8 @@ var en = {
|
|
6059
6059
|
key: "attemptToCreateChat",
|
6060
6060
|
value: function attemptToCreateChat() {
|
6061
6061
|
var t;
|
6062
|
-
if (
|
6063
|
-
(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);
|
6064
6064
|
return;
|
6065
6065
|
}
|
6066
6066
|
if (this._isModelLoaded || this._isModelLoading) return;
|
@@ -6071,7 +6071,7 @@ var en = {
|
|
6071
6071
|
key: "getConfig",
|
6072
6072
|
value: function getConfig() {
|
6073
6073
|
var i;
|
6074
|
-
var e =
|
6074
|
+
var e = C.DEFAULT_MODEL;
|
6075
6075
|
this._webModel.model && (e = this._webModel.model);
|
6076
6076
|
var t = JSON.parse(JSON.stringify(en));
|
6077
6077
|
if (this._webModel.urls) {
|
@@ -6095,7 +6095,7 @@ var en = {
|
|
6095
6095
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
6096
6096
|
while (1) switch (_context32.prev = _context32.next) {
|
6097
6097
|
case 0:
|
6098
|
-
this.scrollToTop(),
|
6098
|
+
this.scrollToTop(), C.chat = e, this._isModelLoading = !0;
|
6099
6099
|
i = ((o = this._webModel.introMessage) == null ? void 0 : o.displayed) === !1;
|
6100
6100
|
s = function s(u) {
|
6101
6101
|
var m;
|
@@ -6108,7 +6108,7 @@ var en = {
|
|
6108
6108
|
return Z.scrollToBottom((p = _this19._messages) == null ? void 0 : p.elementRef);
|
6109
6109
|
}), i = !1);
|
6110
6110
|
};
|
6111
|
-
|
6111
|
+
C.chat.setInitProgressCallback(s);
|
6112
6112
|
_context32.prev = 4;
|
6113
6113
|
_this$getConfig = this.getConfig(), u = _this$getConfig.model, m = _this$getConfig.appConfig, p = {};
|
6114
6114
|
this._webModel.instruction && (p.conv_config = {
|
@@ -6116,7 +6116,7 @@ var en = {
|
|
6116
6116
|
});
|
6117
6117
|
this._conversationHistory.length > 0 && (p.conversation_history = this._conversationHistory);
|
6118
6118
|
_context32.next = 10;
|
6119
|
-
return
|
6119
|
+
return C.chat.reload(u, p, m, t);
|
6120
6120
|
case 10:
|
6121
6121
|
r = _context32.sent;
|
6122
6122
|
_context32.next = 16;
|
@@ -6154,19 +6154,19 @@ var en = {
|
|
6154
6154
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
6155
6155
|
while (1) switch (_context33.prev = _context33.next) {
|
6156
6156
|
case 0:
|
6157
|
-
(t = this._messages) == null || t.addNewErrorMessage("service",
|
6157
|
+
(t = this._messages) == null || t.addNewErrorMessage("service", C.GENERIC_ERROR);
|
6158
6158
|
console.error(e);
|
6159
6159
|
this._isModelLoaded = !1;
|
6160
6160
|
this._isModelLoading = !1;
|
6161
|
-
_context33.t0 =
|
6161
|
+
_context33.t0 = C.chat;
|
6162
6162
|
if (!_context33.t0) {
|
6163
6163
|
_context33.next = 9;
|
6164
6164
|
break;
|
6165
6165
|
}
|
6166
6166
|
_context33.next = 8;
|
6167
|
-
return
|
6167
|
+
return C.chat.unload();
|
6168
6168
|
case 8:
|
6169
|
-
|
6169
|
+
C.chat = void 0;
|
6170
6170
|
case 9:
|
6171
6171
|
case "end":
|
6172
6172
|
return _context33.stop();
|
@@ -6194,7 +6194,7 @@ var en = {
|
|
6194
6194
|
text: _context34.t0
|
6195
6195
|
};
|
6196
6196
|
_context34.next = 6;
|
6197
|
-
return
|
6197
|
+
return C.processResponse(this.deepChat, e, s);
|
6198
6198
|
case 6:
|
6199
6199
|
r = _context34.sent;
|
6200
6200
|
r && e.addNewMessage(r), this.completionsHandlers.onFinish();
|
@@ -6230,7 +6230,7 @@ var en = {
|
|
6230
6230
|
while (1) switch (_context35.prev = _context35.next) {
|
6231
6231
|
case 0:
|
6232
6232
|
_context35.next = 2;
|
6233
|
-
return
|
6233
|
+
return C.processResponse(_this20.deepChat, e, {
|
6234
6234
|
text: o
|
6235
6235
|
});
|
6236
6236
|
case 2:
|
@@ -6369,7 +6369,7 @@ var en = {
|
|
6369
6369
|
case 6:
|
6370
6370
|
return _context39.abrupt("return");
|
6371
6371
|
case 7:
|
6372
|
-
!
|
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));
|
6373
6373
|
case 8:
|
6374
6374
|
case "end":
|
6375
6375
|
return _context39.stop();
|
@@ -6450,7 +6450,7 @@ var en = {
|
|
6450
6450
|
}, {
|
6451
6451
|
key: "clearAllCache",
|
6452
6452
|
value: function clearAllCache() {
|
6453
|
-
|
6453
|
+
C.clearCache("webllm/model"), C.clearCache("webllm/wasm");
|
6454
6454
|
}
|
6455
6455
|
}, {
|
6456
6456
|
key: "clearCache",
|
@@ -6465,8 +6465,8 @@ var en = {
|
|
6465
6465
|
}
|
6466
6466
|
}]);
|
6467
6467
|
}(nt);
|
6468
|
-
|
6469
|
-
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;
|
6470
6470
|
var vi = /*#__PURE__*/function () {
|
6471
6471
|
function vi() {
|
6472
6472
|
_classCallCheck(this, vi);
|
@@ -6533,7 +6533,7 @@ var Ut = /*#__PURE__*/function (_G) {
|
|
6533
6533
|
throw new Error("Request settings have not been set up");
|
6534
6534
|
case 2:
|
6535
6535
|
s = this.preprocessBody(this.rawBody, t, i);
|
6536
|
-
|
6536
|
+
T.request(this, s, e);
|
6537
6537
|
case 4:
|
6538
6538
|
case "end":
|
6539
6539
|
return _context41.stop();
|
@@ -6583,7 +6583,7 @@ var Qt = /*#__PURE__*/function (_Be) {
|
|
6583
6583
|
}
|
6584
6584
|
throw new Error("No file was added");
|
6585
6585
|
case 4:
|
6586
|
-
|
6586
|
+
T.poll(this, i[0], e, !1);
|
6587
6587
|
case 5:
|
6588
6588
|
case "end":
|
6589
6589
|
return _context42.stop();
|
@@ -6702,11 +6702,11 @@ var No = /*#__PURE__*/function (_Qt2) {
|
|
6702
6702
|
}]);
|
6703
6703
|
}(Qt);
|
6704
6704
|
var ei = "data:image/png;base64,";
|
6705
|
-
var
|
6706
|
-
function
|
6707
|
-
_classCallCheck(this,
|
6705
|
+
var Ce = /*#__PURE__*/function () {
|
6706
|
+
function Ce() {
|
6707
|
+
_classCallCheck(this, Ce);
|
6708
6708
|
}
|
6709
|
-
return _createClass(
|
6709
|
+
return _createClass(Ce, null, [{
|
6710
6710
|
key: "buildHeaders",
|
6711
6711
|
value: function buildHeaders(e) {
|
6712
6712
|
return {
|
@@ -6726,7 +6726,7 @@ var Te = /*#__PURE__*/function () {
|
|
6726
6726
|
return {
|
6727
6727
|
url: "https://api.stability.ai/v1/engines/list",
|
6728
6728
|
method: "GET",
|
6729
|
-
handleVerificationResult:
|
6729
|
+
handleVerificationResult: Ce.handleVerificationResult
|
6730
6730
|
};
|
6731
6731
|
}
|
6732
6732
|
}]);
|
@@ -6757,7 +6757,7 @@ var yi = /*#__PURE__*/function (_ji) {
|
|
6757
6757
|
}
|
6758
6758
|
}
|
6759
6759
|
};
|
6760
|
-
_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>";
|
6761
6761
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6762
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;
|
6763
6763
|
return _this24;
|
@@ -6793,7 +6793,7 @@ var yi = /*#__PURE__*/function (_ji) {
|
|
6793
6793
|
throw new Error("Image was not found");
|
6794
6794
|
case 4:
|
6795
6795
|
s = this.createFormDataBody(this.rawBody, i[0]);
|
6796
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
6796
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
6797
6797
|
case 6:
|
6798
6798
|
case "end":
|
6799
6799
|
return _context45.stop();
|
@@ -6864,7 +6864,7 @@ var Ei = /*#__PURE__*/function (_ji2) {
|
|
6864
6864
|
}
|
6865
6865
|
}
|
6866
6866
|
};
|
6867
|
-
_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>";
|
6868
6868
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6869
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;
|
6870
6870
|
return _this25;
|
@@ -6900,7 +6900,7 @@ var Ei = /*#__PURE__*/function (_ji2) {
|
|
6900
6900
|
throw new Error("Image was not found");
|
6901
6901
|
case 4:
|
6902
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);
|
6903
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
6903
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6904
6904
|
case 6:
|
6905
6905
|
case "end":
|
6906
6906
|
return _context47.stop();
|
@@ -7233,7 +7233,7 @@ var Si = /*#__PURE__*/function (_ji3) {
|
|
7233
7233
|
}
|
7234
7234
|
}
|
7235
7235
|
};
|
7236
|
-
_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>";
|
7237
7237
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7238
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;
|
7239
7239
|
return _this28;
|
@@ -7269,7 +7269,7 @@ var Si = /*#__PURE__*/function (_ji3) {
|
|
7269
7269
|
throw new Error("Image was not found");
|
7270
7270
|
case 4:
|
7271
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);
|
7272
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
7272
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7273
7273
|
case 6:
|
7274
7274
|
case "end":
|
7275
7275
|
return _context54.stop();
|
@@ -7371,7 +7371,7 @@ var xi = /*#__PURE__*/function (_ji4) {
|
|
7371
7371
|
var r;
|
7372
7372
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7373
7373
|
i = t.stabilityAI;
|
7374
|
-
_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>";
|
7375
7375
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7376
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;
|
7377
7377
|
return _this29;
|
@@ -7401,7 +7401,7 @@ var xi = /*#__PURE__*/function (_ji4) {
|
|
7401
7401
|
throw new Error("Request settings have not been set up");
|
7402
7402
|
case 2:
|
7403
7403
|
i = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
7404
|
-
|
7404
|
+
T.request(this, i, e);
|
7405
7405
|
case 4:
|
7406
7406
|
case "end":
|
7407
7407
|
return _context57.stop();
|
@@ -7881,7 +7881,7 @@ var ie = /*#__PURE__*/function () {
|
|
7881
7881
|
}]);
|
7882
7882
|
}();
|
7883
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.";
|
7884
|
-
var
|
7884
|
+
var Te = ie;
|
7885
7885
|
var je = /*#__PURE__*/function (_G3) {
|
7886
7886
|
// prettier-ignore
|
7887
7887
|
function je(e, t, i, s, r, o) {
|
@@ -7940,7 +7940,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
7940
7940
|
key: "processMessage",
|
7941
7941
|
value: function processMessage(e, t) {
|
7942
7942
|
var i = this.totalMessagesMaxCharLength || -1,
|
7943
|
-
s =
|
7943
|
+
s = Tt.getCharacterLimitMessages(e, i)[0];
|
7944
7944
|
if (t && t.length > 0) {
|
7945
7945
|
var r = this.filesToolType;
|
7946
7946
|
if (typeof this.filesToolType == "function") {
|
@@ -7980,11 +7980,11 @@ var je = /*#__PURE__*/function (_G3) {
|
|
7980
7980
|
if (this.messages = e, this.sessionId) {
|
7981
7981
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/").concat(this.sessionId, "/messages").concat(this.urlSegments.createMessagePostfix);
|
7982
7982
|
var s = this.processMessage(t, i);
|
7983
|
-
|
7983
|
+
T.request(this, s, e);
|
7984
7984
|
} else {
|
7985
7985
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/runs").concat(this.urlSegments.threadsPosfix);
|
7986
7986
|
var _s2 = this.createNewThreadMessages(this.rawBody, t, i);
|
7987
|
-
this.isSSEStream ? this.createStreamRun(_s2) :
|
7987
|
+
this.isSSEStream ? this.createStreamRun(_s2) : T.request(this, _s2, e);
|
7988
7988
|
}
|
7989
7989
|
}
|
7990
7990
|
}, {
|
@@ -8028,7 +8028,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8028
8028
|
break;
|
8029
8029
|
}
|
8030
8030
|
_context71.next = 16;
|
8031
|
-
return
|
8031
|
+
return Te.storeFiles(this, e, i, this.urlSegments.storeFiles);
|
8032
8032
|
case 16:
|
8033
8033
|
_context71.t1 = _context71.sent;
|
8034
8034
|
_context71.next = 20;
|
@@ -8111,7 +8111,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8111
8111
|
_context73.next = 6;
|
8112
8112
|
break;
|
8113
8113
|
}
|
8114
|
-
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;
|
8115
8115
|
case 6:
|
8116
8116
|
_context73.next = 8;
|
8117
8117
|
return this.assignThreadAndRun(e);
|
@@ -8120,7 +8120,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8120
8120
|
method: "GET",
|
8121
8121
|
headers: (s = this.connectSettings) == null ? void 0 : s.headers
|
8122
8122
|
};
|
8123
|
-
return _context73.abrupt("return", (
|
8123
|
+
return _context73.abrupt("return", (T.executePollRequest(this, t, i, this.messages), {
|
8124
8124
|
makingAnotherRequest: !0
|
8125
8125
|
}));
|
8126
8126
|
case 10:
|
@@ -8195,7 +8195,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8195
8195
|
case 9:
|
8196
8196
|
i = _context75.sent;
|
8197
8197
|
case 10:
|
8198
|
-
return _context75.abrupt("return",
|
8198
|
+
return _context75.abrupt("return", Te.processAPIMessages(this, i, t, this.urlSegments));
|
8199
8199
|
case 11:
|
8200
8200
|
case "end":
|
8201
8201
|
return _context75.stop();
|
@@ -8296,7 +8296,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8296
8296
|
_context77.next = 8;
|
8297
8297
|
break;
|
8298
8298
|
}
|
8299
|
-
throw Error(
|
8299
|
+
throw Error(Te.FUNCTION_TOOL_RESP_ERROR);
|
8300
8300
|
case 8:
|
8301
8301
|
_context77.next = 10;
|
8302
8302
|
return Promise.all(i);
|
@@ -8308,7 +8308,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8308
8308
|
_context77.next = 13;
|
8309
8309
|
break;
|
8310
8310
|
}
|
8311
|
-
throw Error(
|
8311
|
+
throw Error(Te.FUNCTION_TOOL_RESP_ERROR);
|
8312
8312
|
case 13:
|
8313
8313
|
r = s.map(function (l, c) {
|
8314
8314
|
return {
|
@@ -8413,7 +8413,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8413
8413
|
}
|
8414
8414
|
l = e.content.find(function (d) {
|
8415
8415
|
return !!d.text;
|
8416
|
-
}) || e.content[0], c =
|
8416
|
+
}) || e.content[0], c = Te.getFilesAndText.bind(this, this, {
|
8417
8417
|
role: "assistant",
|
8418
8418
|
content: e.content
|
8419
8419
|
}, this.urlSegments, l);
|
@@ -8437,7 +8437,7 @@ var je = /*#__PURE__*/function (_G3) {
|
|
8437
8437
|
break;
|
8438
8438
|
}
|
8439
8439
|
_context79.next = 11;
|
8440
|
-
return
|
8440
|
+
return Te.processStreamMessages(this, e.delta.content, this.urlSegments);
|
8441
8441
|
case 11:
|
8442
8442
|
_l = _context79.sent;
|
8443
8443
|
return _context79.abrupt("return", {
|
@@ -8640,7 +8640,7 @@ var zo = /*#__PURE__*/function (_Is) {
|
|
8640
8640
|
throw new Error("Request settings have not been set up");
|
8641
8641
|
case 2:
|
8642
8642
|
i = this.preprocessBody(this.rawBody, t);
|
8643
|
-
|
8643
|
+
T.request(this, i, e);
|
8644
8644
|
case 4:
|
8645
8645
|
case "end":
|
8646
8646
|
return _context81.stop();
|
@@ -8790,7 +8790,7 @@ var Go = /*#__PURE__*/function (_Is2) {
|
|
8790
8790
|
throw new Error("Request settings have not been set up");
|
8791
8791
|
case 2:
|
8792
8792
|
i = this.preprocessBody(this.rawBody, t);
|
8793
|
-
|
8793
|
+
T.request(this, i, e);
|
8794
8794
|
case 4:
|
8795
8795
|
case "end":
|
8796
8796
|
return _context83.stop();
|
@@ -8869,7 +8869,7 @@ var Et = /*#__PURE__*/function (_G5) {
|
|
8869
8869
|
case 2:
|
8870
8870
|
this.url = this.connectSettings.url || this.url;
|
8871
8871
|
i = this.preprocessBody(this.rawBody, t);
|
8872
|
-
|
8872
|
+
T.request(this, i, e);
|
8873
8873
|
case 5:
|
8874
8874
|
case "end":
|
8875
8875
|
return _context85.stop();
|
@@ -8980,7 +8980,7 @@ var me = /*#__PURE__*/function (_G6) {
|
|
8980
8980
|
case 4:
|
8981
8981
|
this.url = this.connectSettings.url || this._service_url;
|
8982
8982
|
s = this.preprocessBody(this.rawBody, t), r = me.createFormDataBody(s, i[0]);
|
8983
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
8983
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
8984
8984
|
case 7:
|
8985
8985
|
case "end":
|
8986
8986
|
return _context87.stop();
|
@@ -9205,7 +9205,7 @@ var jt = /*#__PURE__*/function (_Vo) {
|
|
9205
9205
|
throw new Error("Request settings have not been set up");
|
9206
9206
|
case 2:
|
9207
9207
|
i = this.preprocessBody(this.rawBody, t);
|
9208
|
-
|
9208
|
+
T.request(this, i, e), this.messages = e;
|
9209
9209
|
case 4:
|
9210
9210
|
case "end":
|
9211
9211
|
return _context89.stop();
|
@@ -9236,7 +9236,7 @@ var jt = /*#__PURE__*/function (_Vo) {
|
|
9236
9236
|
method: "GET",
|
9237
9237
|
headers: (t = this.connectSettings) == null ? void 0 : t.headers
|
9238
9238
|
};
|
9239
|
-
|
9239
|
+
T.executePollRequest(this, _i12, s, this.messages);
|
9240
9240
|
}
|
9241
9241
|
return _context90.abrupt("return", {
|
9242
9242
|
makingAnotherRequest: !0
|
@@ -9455,7 +9455,7 @@ var Ls = /*#__PURE__*/function (_G8) {
|
|
9455
9455
|
}
|
9456
9456
|
throw new Error("No file was added");
|
9457
9457
|
case 4:
|
9458
|
-
|
9458
|
+
T.request(this, i[0], e, !1);
|
9459
9459
|
case 5:
|
9460
9460
|
case "end":
|
9461
9461
|
return _context93.stop();
|
@@ -9560,7 +9560,7 @@ var Ye = /*#__PURE__*/function (_Mn) {
|
|
9560
9560
|
throw new Error("Request settings have not been set up");
|
9561
9561
|
case 2:
|
9562
9562
|
i = this.preprocessBody(this.rawBody, t);
|
9563
|
-
|
9563
|
+
T.request(this, i, e, !1);
|
9564
9564
|
case 4:
|
9565
9565
|
case "end":
|
9566
9566
|
return _context95.stop();
|
@@ -9657,7 +9657,7 @@ var He = /*#__PURE__*/function (_Mn2) {
|
|
9657
9657
|
}
|
9658
9658
|
throw new Error("No file was added");
|
9659
9659
|
case 4:
|
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"),
|
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);
|
9661
9661
|
case 5:
|
9662
9662
|
case "end":
|
9663
9663
|
return _context97.stop();
|
@@ -9746,7 +9746,7 @@ var $o = /*#__PURE__*/function (_G10) {
|
|
9746
9746
|
throw new Error("Request settings have not been set up");
|
9747
9747
|
case 2:
|
9748
9748
|
i = this.preprocessBody(t);
|
9749
|
-
|
9749
|
+
T.request(this, i, e);
|
9750
9750
|
case 4:
|
9751
9751
|
case "end":
|
9752
9752
|
return _context99.stop();
|
@@ -9823,7 +9823,7 @@ var xt = /*#__PURE__*/function (_G11) {
|
|
9823
9823
|
function preprocessBody(e, t) {
|
9824
9824
|
var _i$max_tokens;
|
9825
9825
|
var i = JSON.parse(JSON.stringify(e)),
|
9826
|
-
s =
|
9826
|
+
s = Tt.getCharacterLimitMessages(t, this.totalMessagesMaxCharLength ? this.totalMessagesMaxCharLength - this._systemMessage.content.length : -1).map(function (r) {
|
9827
9827
|
return {
|
9828
9828
|
content: xt.getContent(r),
|
9829
9829
|
role: r.role === b.USER_ROLE ? "user" : "assistant"
|
@@ -9848,7 +9848,7 @@ var xt = /*#__PURE__*/function (_G11) {
|
|
9848
9848
|
throw new Error("Request settings have not been set up");
|
9849
9849
|
case 2:
|
9850
9850
|
i = this.preprocessBody(this.rawBody, t), s = this.stream;
|
9851
|
-
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);
|
9852
9852
|
case 4:
|
9853
9853
|
case "end":
|
9854
9854
|
return _context101.stop();
|
@@ -10157,7 +10157,7 @@ var ge = /*#__PURE__*/function (_G12) {
|
|
10157
10157
|
var l = this.preprocessBody(this.rawBody, r);
|
10158
10158
|
s = ge.createFormDataBody(l, i[0], i[1]);
|
10159
10159
|
} else this.url = ge.IMAGE_VARIATIONS_URL, s = ge.createFormDataBody(this.rawBody, i[0]);
|
10160
|
-
E.tempRemoveContentHeader(this.connectSettings,
|
10160
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
10161
10161
|
}
|
10162
10162
|
}, {
|
10163
10163
|
key: "callServiceAPI",
|
@@ -10189,7 +10189,7 @@ var ge = /*#__PURE__*/function (_G12) {
|
|
10189
10189
|
case 8:
|
10190
10190
|
this.url = ge.IMAGE_GENERATION_URL;
|
10191
10191
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
10192
|
-
|
10192
|
+
T.request(this, r, e);
|
10193
10193
|
case 11:
|
10194
10194
|
case "end":
|
10195
10195
|
return _context105.stop();
|
@@ -10303,7 +10303,7 @@ var Wo = /*#__PURE__*/function (_Is3) {
|
|
10303
10303
|
throw new Error("Request settings have not been set up");
|
10304
10304
|
case 2:
|
10305
10305
|
i = this.preprocessBody(this.rawBody, t);
|
10306
|
-
|
10306
|
+
T.request(this, i, e);
|
10307
10307
|
case 4:
|
10308
10308
|
case "end":
|
10309
10309
|
return _context107.stop();
|
@@ -10344,11 +10344,11 @@ var Wo = /*#__PURE__*/function (_Is3) {
|
|
10344
10344
|
}()
|
10345
10345
|
}]);
|
10346
10346
|
}(Is);
|
10347
|
-
var
|
10348
|
-
function
|
10349
|
-
_classCallCheck(this,
|
10347
|
+
var Ci = /*#__PURE__*/function () {
|
10348
|
+
function Ci() {
|
10349
|
+
_classCallCheck(this, Ci);
|
10350
10350
|
}
|
10351
|
-
return _createClass(
|
10351
|
+
return _createClass(Ci, null, [{
|
10352
10352
|
key: "buildHeaders",
|
10353
10353
|
value: function buildHeaders(e) {
|
10354
10354
|
return {
|
@@ -10370,7 +10370,7 @@ var Ti = /*#__PURE__*/function () {
|
|
10370
10370
|
return {
|
10371
10371
|
url: "https://api.mistral.ai/v1/models",
|
10372
10372
|
method: "GET",
|
10373
|
-
handleVerificationResult:
|
10373
|
+
handleVerificationResult: Ci.handleVerificationResult
|
10374
10374
|
};
|
10375
10375
|
}
|
10376
10376
|
}]);
|
@@ -10382,7 +10382,7 @@ var Ko = /*#__PURE__*/function (_G13) {
|
|
10382
10382
|
_classCallCheck(this, Ko);
|
10383
10383
|
var s;
|
10384
10384
|
var i = JSON.parse(JSON.stringify(e.directConnection)).mistral;
|
10385
|
-
_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";
|
10386
10386
|
return _this51;
|
10387
10387
|
}
|
10388
10388
|
_inherits(Ko, _G13);
|
@@ -10421,7 +10421,7 @@ var Ko = /*#__PURE__*/function (_G13) {
|
|
10421
10421
|
throw new Error("Request settings have not been set up");
|
10422
10422
|
case 2:
|
10423
10423
|
i = this.preprocessBody(this.rawBody, t);
|
10424
|
-
|
10424
|
+
T.request(this, i, e);
|
10425
10425
|
case 4:
|
10426
10426
|
case "end":
|
10427
10427
|
return _context109.stop();
|
@@ -10530,21 +10530,21 @@ function x(n) {
|
|
10530
10530
|
i._attributes_[s] = ws.attibutes[n], i._attributeToProperty_[s] = t;
|
10531
10531
|
};
|
10532
10532
|
}
|
10533
|
-
var
|
10534
|
-
function
|
10535
|
-
_classCallCheck(this,
|
10533
|
+
var Ti = /*#__PURE__*/function () {
|
10534
|
+
function Ti(e, t, i) {
|
10535
|
+
_classCallCheck(this, Ti);
|
10536
10536
|
this._isDisplayed = !1, e ? (this._elementRef = this.createIntroPanelWithChild(e, i), this._isDisplayed = !0) : t && (this._elementRef = this.createInternalIntroPanel(t, i), this._isDisplayed = !0);
|
10537
10537
|
}
|
10538
|
-
return _createClass(
|
10538
|
+
return _createClass(Ti, [{
|
10539
10539
|
key: "createIntroPanelWithChild",
|
10540
10540
|
value: function createIntroPanelWithChild(e, t) {
|
10541
|
-
var i =
|
10541
|
+
var i = Ti.createIntroPanel(t);
|
10542
10542
|
return e.style.display === "none" && (e.style.display = "block"), i.appendChild(e), i;
|
10543
10543
|
}
|
10544
10544
|
}, {
|
10545
10545
|
key: "createInternalIntroPanel",
|
10546
10546
|
value: function createInternalIntroPanel(e, t) {
|
10547
|
-
var i =
|
10547
|
+
var i = Ti.createIntroPanel(t);
|
10548
10548
|
return i.id = "internal-intro-panel", i.innerHTML = e, i;
|
10549
10549
|
}
|
10550
10550
|
}, {
|
@@ -10593,7 +10593,7 @@ var Zo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
10593
10593
|
key: "createAudioElement",
|
10594
10594
|
value: function createAudioElement(e, t) {
|
10595
10595
|
var i = document.createElement("audio");
|
10596
|
-
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;
|
10597
10597
|
}
|
10598
10598
|
}, {
|
10599
10599
|
key: "createNewAudioMessage",
|
@@ -10947,7 +10947,7 @@ var de = /*#__PURE__*/function (_De) {
|
|
10947
10947
|
}, {
|
10948
10948
|
key: "populateIntroPanel",
|
10949
10949
|
value: function populateIntroPanel(e, t, i) {
|
10950
|
-
(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)));
|
10951
10951
|
}
|
10952
10952
|
}, {
|
10953
10953
|
key: "addMultipleFiles",
|
@@ -11067,7 +11067,7 @@ var B = /*#__PURE__*/function () {
|
|
11067
11067
|
}]);
|
11068
11068
|
}();
|
11069
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
|
11070
|
+
var Cs = B;
|
11071
11071
|
var At = /*#__PURE__*/function () {
|
11072
11072
|
function At() {
|
11073
11073
|
_classCallCheck(this, At);
|
@@ -13057,7 +13057,7 @@ var Le = /*#__PURE__*/function () {
|
|
13057
13057
|
key: "createAnyFileAttachment",
|
13058
13058
|
value: function createAnyFileAttachment(e) {
|
13059
13059
|
var t = document.createElement("div");
|
13060
|
-
t.classList.add("border-bound-attachment"),
|
13060
|
+
t.classList.add("border-bound-attachment"), Ct.IS_SAFARI && t.classList.add("border-bound-attachment-safari");
|
13061
13061
|
var i = document.createElement("div");
|
13062
13062
|
i.classList.add("any-file-attachment-text");
|
13063
13063
|
var s = document.createElement("div");
|
@@ -13150,7 +13150,7 @@ var wa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
13150
13150
|
key: "createAudioContainer",
|
13151
13151
|
value: function createAudioContainer() {
|
13152
13152
|
var e = document.createElement("div");
|
13153
|
-
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;
|
13154
13154
|
}
|
13155
13155
|
}, {
|
13156
13156
|
key: "addAudioElements",
|
@@ -13187,11 +13187,11 @@ var wa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
13187
13187
|
}(Le);
|
13188
13188
|
Me.TIMER_LIMIT_S = 5999;
|
13189
13189
|
var Xt = Me;
|
13190
|
-
var
|
13191
|
-
function
|
13192
|
-
_classCallCheck(this,
|
13190
|
+
var Ca = /*#__PURE__*/function () {
|
13191
|
+
function Ca() {
|
13192
|
+
_classCallCheck(this, Ca);
|
13193
13193
|
}
|
13194
|
-
return _createClass(
|
13194
|
+
return _createClass(Ca, null, [{
|
13195
13195
|
key: "create",
|
13196
13196
|
value:
|
13197
13197
|
// prettier-ignore
|
@@ -13211,7 +13211,7 @@ var oi = /*#__PURE__*/function () {
|
|
13211
13211
|
return _createClass(oi, [{
|
13212
13212
|
key: "addType",
|
13213
13213
|
value: function addType(e, t, i) {
|
13214
|
-
var s =
|
13214
|
+
var s = Ca.create(e, t, this.toggleContainerDisplay.bind(this), this.elementRef, i);
|
13215
13215
|
return this._fileAttachmentsTypes.push(s), s;
|
13216
13216
|
}
|
13217
13217
|
}, {
|
@@ -13645,16 +13645,16 @@ var In = /*#__PURE__*/function () {
|
|
13645
13645
|
}
|
13646
13646
|
}]);
|
13647
13647
|
}();
|
13648
|
-
var
|
13649
|
-
function
|
13648
|
+
var Ta = /*#__PURE__*/function (_Kt2) {
|
13649
|
+
function Ta(e, t) {
|
13650
13650
|
var _this72;
|
13651
|
-
_classCallCheck(this,
|
13651
|
+
_classCallCheck(this, Ta);
|
13652
13652
|
var i, s;
|
13653
|
-
_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));
|
13654
13654
|
return _this72;
|
13655
13655
|
}
|
13656
|
-
_inherits(
|
13657
|
-
return _createClass(
|
13656
|
+
_inherits(Ta, _Kt2);
|
13657
|
+
return _createClass(Ta, [{
|
13658
13658
|
key: "buttonClick",
|
13659
13659
|
value: function buttonClick() {
|
13660
13660
|
this._waitingForBrowserApproval || (this.isActive ? this.stop() : (this._waitingForBrowserApproval = !0, this.record()));
|
@@ -14080,7 +14080,7 @@ var k = /*#__PURE__*/function (_ti4) {
|
|
14080
14080
|
}]);
|
14081
14081
|
}(ti);
|
14082
14082
|
k.SUBMIT_CLASS = "submit-button", k.LOADING_CLASS = "loading-button", k.DISABLED_CLASS = "disabled-button";
|
14083
|
-
var
|
14083
|
+
var Ts = k;
|
14084
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",
|
14085
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",
|
14086
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>",
|
@@ -14253,7 +14253,7 @@ var Ft = /*#__PURE__*/function () {
|
|
14253
14253
|
e.speechToText && !r.microphone && (r.microphone = {
|
14254
14254
|
button: new Zt(e, a, t.addNewErrorMessage.bind(t))
|
14255
14255
|
});
|
14256
|
-
var l = new
|
14256
|
+
var l = new Ts(e, a, t, i, o, r);
|
14257
14257
|
a.submit = l.submitFromInput.bind(l), $e.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
|
14258
14258
|
button: l
|
14259
14259
|
}, Ft.addElements(this.elementRef, a, r, s, o, e.dropupStyles);
|
@@ -14274,7 +14274,7 @@ var Ft = /*#__PURE__*/function () {
|
|
14274
14274
|
if ((l = t.recordAudio) != null && l.files) {
|
14275
14275
|
var _d = ((c = s.audio) == null ? void 0 : c.fileType) || r.addType(e, t.recordAudio.files, "audio");
|
14276
14276
|
s.microphone = {
|
14277
|
-
button: new
|
14277
|
+
button: new Ta(_d, t.recordAudio)
|
14278
14278
|
};
|
14279
14279
|
}
|
14280
14280
|
return Re.isEnabled(r, e.dragAndDrop) && Re.create(i, r, e.dragAndDrop), r;
|
@@ -14313,7 +14313,7 @@ var Ft = /*#__PURE__*/function () {
|
|
14313
14313
|
Z.addElements(e, t.elementRef);
|
14314
14314
|
var a = At.create(),
|
14315
14315
|
l = $.addButtons(a, i, s, o);
|
14316
|
-
|
14316
|
+
Cs.set(t.inputElementRef, a, r.elementRef, l), At.add(e, a);
|
14317
14317
|
}
|
14318
14318
|
}]);
|
14319
14319
|
}();
|
@@ -14349,12 +14349,7 @@ var S = /*#__PURE__*/function (_ps) {
|
|
14349
14349
|
function S() {
|
14350
14350
|
var _this85;
|
14351
14351
|
_classCallCheck(this, S);
|
14352
|
-
_this85 = _callSuper(this, S), _this85.
|
14353
|
-
openAI: {
|
14354
|
-
speechToText: !0,
|
14355
|
-
key: "placeholder-key"
|
14356
|
-
}
|
14357
|
-
}, _this85.getMessages = function () {
|
14352
|
+
_this85 = _callSuper(this, S), _this85.getMessages = function () {
|
14358
14353
|
return [];
|
14359
14354
|
}, _this85.submitUserMessage = function () {
|
14360
14355
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|