deep-chat-dev 9.0.166 → 9.0.167

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/dist/deepChat.js CHANGED
@@ -450,7 +450,7 @@ var En = "Make sure the events are using {text: string} or {html: string} format
450
450
  }]);
451
451
  }();
452
452
  gi.CODE_SNIPPET_GENERATION_JUMP = 0.5;
453
- var j = gi;
453
+ var U = gi;
454
454
  var bi = /*#__PURE__*/function () {
455
455
  function bi() {
456
456
  _classCallCheck(this, bi);
@@ -2954,7 +2954,7 @@ var Me = /*#__PURE__*/function () {
2954
2954
  }]);
2955
2955
  }();
2956
2956
  Me.DEFAULT_FILE_NAME = "file";
2957
- var q = Me;
2957
+ var B = Me;
2958
2958
  var Qt = /*#__PURE__*/function () {
2959
2959
  function Qt() {
2960
2960
  _classCallCheck(this, Qt);
@@ -2968,7 +2968,7 @@ var Qt = /*#__PURE__*/function () {
2968
2968
  isHistory: i,
2969
2969
  isInitial: i
2970
2970
  }));
2971
- q.reAddFileRefToObject(t, n), (r = e.onMessage) == null || r.call(e, n), e.dispatchEvent(new CustomEvent("message", {
2971
+ B.reAddFileRefToObject(t, n), (r = e.onMessage) == null || r.call(e, n), e.dispatchEvent(new CustomEvent("message", {
2972
2972
  detail: n
2973
2973
  })), he.fireOnNewMessage(e, n);
2974
2974
  }
@@ -2996,11 +2996,11 @@ var Qt = /*#__PURE__*/function () {
2996
2996
  }
2997
2997
  }]);
2998
2998
  }();
2999
- var B = /*#__PURE__*/function () {
3000
- function B() {
3001
- _classCallCheck(this, B);
2999
+ var j = /*#__PURE__*/function () {
3000
+ function j() {
3001
+ _classCallCheck(this, j);
3002
3002
  }
3003
- return _createClass(B, null, [{
3003
+ return _createClass(j, null, [{
3004
3004
  key: "applyCustomStylesToElements",
3005
3005
  value: function applyCustomStylesToElements(e, t, i) {
3006
3006
  if (i && (Object.assign(e.outerContainer.style, i.outerContainer), Object.assign(e.innerContainer.style, i.innerContainer), Object.assign(e.bubbleElement.style, i.bubble), t)) {
@@ -3012,7 +3012,7 @@ var B = /*#__PURE__*/function () {
3012
3012
  }, {
3013
3013
  key: "applySideStyles",
3014
3014
  value: function applySideStyles(e, t, i, n) {
3015
- n && (B.applyCustomStylesToElements(e, i, n.shared), t === b.USER_ROLE ? B.applyCustomStylesToElements(e, i, n.user) : (B.applyCustomStylesToElements(e, i, n.ai), B.applyCustomStylesToElements(e, i, n[t])));
3015
+ n && (j.applyCustomStylesToElements(e, i, n.shared), t === b.USER_ROLE ? j.applyCustomStylesToElements(e, i, n.user) : (j.applyCustomStylesToElements(e, i, n.ai), j.applyCustomStylesToElements(e, i, n[t])));
3016
3016
  }
3017
3017
  }, {
3018
3018
  key: "isElementsStyles",
@@ -3024,7 +3024,7 @@ var B = /*#__PURE__*/function () {
3024
3024
  key: "applyCustomStyles",
3025
3025
  value: function applyCustomStyles(e, t, i, n, r) {
3026
3026
  var o;
3027
- r && e["default"] !== r ? B.isElementsStyles(r) ? (B.applyCustomStylesToElements(t, n, (o = e["default"]) == null ? void 0 : o.shared), B.applyCustomStylesToElements(t, n, r)) : (B.applySideStyles(t, i, n, e["default"]), B.applySideStyles(t, i, n, r)) : B.applySideStyles(t, i, n, e["default"]);
3027
+ r && e["default"] !== r ? j.isElementsStyles(r) ? (j.applyCustomStylesToElements(t, n, (o = e["default"]) == null ? void 0 : o.shared), j.applyCustomStylesToElements(t, n, r)) : (j.applySideStyles(t, i, n, e["default"]), j.applySideStyles(t, i, n, r)) : j.applySideStyles(t, i, n, e["default"]);
3028
3028
  }
3029
3029
  // prettier-ignore
3030
3030
  }, {
@@ -3081,7 +3081,7 @@ var ot = /*#__PURE__*/function () {
3081
3081
  var _this4 = this;
3082
3082
  var i = this.createNewMessageElement(e, t);
3083
3083
  return this.elementRef.appendChild(i.outerContainer), setTimeout(function () {
3084
- return j.scrollToBottom(_this4.elementRef);
3084
+ return U.scrollToBottom(_this4.elementRef);
3085
3085
  }), i;
3086
3086
  }
3087
3087
  }, {
@@ -3115,7 +3115,7 @@ var ot = /*#__PURE__*/function () {
3115
3115
  }, {
3116
3116
  key: "applyCustomStyles",
3117
3117
  value: function applyCustomStyles(e, t, i, n) {
3118
- e && this.messageStyles && B.applyCustomStyles(this.messageStyles, e, t, i, n);
3118
+ e && this.messageStyles && j.applyCustomStyles(this.messageStyles, e, t, i, n);
3119
3119
  }
3120
3120
  }, {
3121
3121
  key: "removeLastMessage",
@@ -3201,13 +3201,13 @@ var Re = /*#__PURE__*/function () {
3201
3201
  if (this._hasStreamEnded) return;
3202
3202
  if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(A.INVALID_STREAM_EVENT);
3203
3203
  var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
3204
- i = j.isScrollbarAtBottomOfElement(this._messages.elementRef),
3204
+ i = U.isScrollbarAtBottomOfElement(this._messages.elementRef),
3205
3205
  n = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
3206
3206
  if (!this._elements && this._streamedContent === "") this.setInitialState(n, t, e == null ? void 0 : e.role);else {
3207
3207
  if (this._streamType !== n) return console.error(A.INVALID_STREAM_EVENT_MIX);
3208
3208
  this.updateBasedOnType(t, n, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
3209
3209
  }
3210
- i && j.scrollToBottom(this._messages.elementRef);
3210
+ i && U.scrollToBottom(this._messages.elementRef);
3211
3211
  }
3212
3212
  }, {
3213
3213
  key: "setInitialState",
@@ -4916,17 +4916,17 @@ var We = /*#__PURE__*/function () {
4916
4916
  }
4917
4917
  }]);
4918
4918
  }();
4919
- var U = /*#__PURE__*/function (_We) {
4919
+ var H = /*#__PURE__*/function (_We) {
4920
4920
  // prettier-ignore
4921
- function U(e, t, i, n, r) {
4921
+ function H(e, t, i, n, r) {
4922
4922
  var _this8;
4923
- _classCallCheck(this, U);
4923
+ _classCallCheck(this, H);
4924
4924
  var o;
4925
- _this8 = _callSuper(this, U, [e, r]), _this8.insertKeyPlaceholderText = "API Key", _this8.keyHelpUrl = "", Object.assign(_this8.rawBody, (o = e.connect) == null ? void 0 : o.additionalBodyProps), _this8.keyVerificationDetails = t, _this8.buildHeadersFunc = i, n && _this8.setApiKeyProperties(n), _this8.connectSettings = _this8.buildConnectSettings(_this8.key || "", e.connect);
4925
+ _this8 = _callSuper(this, H, [e, r]), _this8.insertKeyPlaceholderText = "API Key", _this8.keyHelpUrl = "", Object.assign(_this8.rawBody, (o = e.connect) == null ? void 0 : o.additionalBodyProps), _this8.keyVerificationDetails = t, _this8.buildHeadersFunc = i, n && _this8.setApiKeyProperties(n), _this8.connectSettings = _this8.buildConnectSettings(_this8.key || "", e.connect);
4926
4926
  return _this8;
4927
4927
  }
4928
- _inherits(U, _We);
4929
- return _createClass(U, [{
4928
+ _inherits(H, _We);
4929
+ return _createClass(H, [{
4930
4930
  key: "setApiKeyProperties",
4931
4931
  value: function setApiKeyProperties(e) {
4932
4932
  this.key = e.key, e.validateKeyProperty && (this.validateKeyProperty = e.validateKeyProperty);
@@ -5433,7 +5433,7 @@ var On = {
5433
5433
  var t;
5434
5434
  ((t = this._webModel.introMessage) == null ? void 0 : t.autoScroll) !== !1 && setTimeout(function () {
5435
5435
  var i, n;
5436
- (i = _this13._messages) != null && i.elementRef && j.scrollToTop((n = _this13._messages) == null ? void 0 : n.elementRef);
5436
+ (i = _this13._messages) != null && i.elementRef && U.scrollToTop((n = _this13._messages) == null ? void 0 : n.elementRef);
5437
5437
  }, e);
5438
5438
  }
5439
5439
  // prettier-ignore
@@ -5565,7 +5565,7 @@ var On = {
5565
5565
  sendUpdate: !1
5566
5566
  }), i && (setTimeout(function () {
5567
5567
  var p;
5568
- return j.scrollToBottom((p = _this14._messages) == null ? void 0 : p.elementRef);
5568
+ return U.scrollToBottom((p = _this14._messages) == null ? void 0 : p.elementRef);
5569
5569
  }), i = !1);
5570
5570
  };
5571
5571
  w.chat.setInitProgressCallback(n);
@@ -5958,7 +5958,7 @@ var ii = /*#__PURE__*/function () {
5958
5958
  }
5959
5959
  }]);
5960
5960
  }();
5961
- var St = /*#__PURE__*/function (_U) {
5961
+ var St = /*#__PURE__*/function (_H) {
5962
5962
  // prettier-ignore
5963
5963
  function St(e, t, i, n, r, o) {
5964
5964
  var _this16;
@@ -5967,7 +5967,7 @@ var St = /*#__PURE__*/function (_U) {
5967
5967
  return _this16;
5968
5968
  }
5969
5969
  // prettier-ignore
5970
- _inherits(St, _U);
5970
+ _inherits(St, _H);
5971
5971
  return _createClass(St, [{
5972
5972
  key: "preprocessBody",
5973
5973
  value: function preprocessBody(e, t, i) {
@@ -6006,7 +6006,7 @@ var St = /*#__PURE__*/function (_U) {
6006
6006
  return callServiceAPI;
6007
6007
  }()
6008
6008
  }]);
6009
- }(U);
6009
+ }(H);
6010
6010
  St.URL_PREFIX = "https://api-inference.huggingface.co/models/";
6011
6011
  var we = St;
6012
6012
  var Dt = /*#__PURE__*/function (_we) {
@@ -6191,7 +6191,7 @@ var me = /*#__PURE__*/function () {
6191
6191
  }
6192
6192
  }]);
6193
6193
  }();
6194
- var _i = /*#__PURE__*/function (_U2) {
6194
+ var _i = /*#__PURE__*/function (_H2) {
6195
6195
  // prettier-ignore
6196
6196
  function _i(e, t, i, n, r) {
6197
6197
  var _this18;
@@ -6199,9 +6199,9 @@ var _i = /*#__PURE__*/function (_U2) {
6199
6199
  _this18 = _callSuper(this, _i, [e, t, i, n, r]), _this18.insertKeyPlaceholderText = "Stability AI API Key", _this18.keyHelpUrl = "https://platform.stability.ai/docs/getting-started/authentication", _this18.permittedErrorPrefixes = ["Incorrect", "invalid_"];
6200
6200
  return _this18;
6201
6201
  }
6202
- _inherits(_i, _U2);
6202
+ _inherits(_i, _H2);
6203
6203
  return _createClass(_i);
6204
- }(U);
6204
+ }(H);
6205
6205
  var ni = /*#__PURE__*/function (_i10) {
6206
6206
  function ni(e) {
6207
6207
  var _this19;
@@ -6992,16 +6992,16 @@ var ai = /*#__PURE__*/function () {
6992
6992
  }
6993
6993
  }]);
6994
6994
  }();
6995
- var un = /*#__PURE__*/function (_U3) {
6995
+ var un = /*#__PURE__*/function (_H3) {
6996
6996
  function un(e, t, i, n, r) {
6997
6997
  var _this26;
6998
6998
  _classCallCheck(this, un);
6999
6999
  _this26 = _callSuper(this, un, [e, ai.buildKeyVerificationDetails(), ai.buildHeaders, r]), _this26.insertKeyPlaceholderText = "Cohere API Key", _this26.keyHelpUrl = "https://dashboard.cohere.ai/api-keys", _this26.permittedErrorPrefixes = ["invalid"], _this26.url = t, _this26.textInputPlaceholderText = i, n && _typeof(n) == "object" && Object.assign(_this26.rawBody, n);
7000
7000
  return _this26;
7001
7001
  }
7002
- _inherits(un, _U3);
7002
+ _inherits(un, _H3);
7003
7003
  return _createClass(un);
7004
- }(U);
7004
+ }(H);
7005
7005
  var _o = /*#__PURE__*/function (_un) {
7006
7006
  function _o(e) {
7007
7007
  _classCallCheck(this, _o);
@@ -7218,7 +7218,7 @@ var P = /*#__PURE__*/function () {
7218
7218
  }()
7219
7219
  }]);
7220
7220
  }();
7221
- var nt = /*#__PURE__*/function (_U4) {
7221
+ var nt = /*#__PURE__*/function (_H4) {
7222
7222
  function nt(e) {
7223
7223
  var _o$model, _a$voice;
7224
7224
  var _this27;
@@ -7231,7 +7231,7 @@ var nt = /*#__PURE__*/function (_U4) {
7231
7231
  _typeof(n) == "object" && Object.assign(_this27.rawBody, n), (_o$model = (o = _this27.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model = nt.DEFAULT_MODEL, (_a$voice = (a = _this27.rawBody).voice) !== null && _a$voice !== void 0 ? _a$voice : a.voice = nt.DEFAULT_VOIDE, _this27.textInputPlaceholderText = "Insert text to generate audio", _this27.rawBody.response_format = "mp3";
7232
7232
  return _this27;
7233
7233
  }
7234
- _inherits(nt, _U4);
7234
+ _inherits(nt, _H4);
7235
7235
  return _createClass(nt, [{
7236
7236
  key: "preprocessBody",
7237
7237
  value: function preprocessBody(e, t) {
@@ -7312,10 +7312,10 @@ var nt = /*#__PURE__*/function (_U4) {
7312
7312
  return extractResultData;
7313
7313
  }()
7314
7314
  }]);
7315
- }(U);
7315
+ }(H);
7316
7316
  nt.DEFAULT_MODEL = "tts-1", nt.DEFAULT_VOIDE = "alloy";
7317
7317
  var Yi = nt;
7318
- var ae = /*#__PURE__*/function (_U5) {
7318
+ var ae = /*#__PURE__*/function (_H5) {
7319
7319
  function ae(e) {
7320
7320
  var _o$model2;
7321
7321
  var _this28;
@@ -7330,7 +7330,7 @@ var ae = /*#__PURE__*/function (_U5) {
7330
7330
  _typeof(n) == "object" && (_this28.processConfig(n), ae.cleanConfig(n), Object.assign(_this28.rawBody, n)), (_o$model2 = (o = _this28.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = ae.DEFAULT_MODEL, _this28.rawBody.response_format = "json", _this28.canSendMessage = ae.canSendFileMessage;
7331
7331
  return _this28;
7332
7332
  }
7333
- _inherits(ae, _U5);
7333
+ _inherits(ae, _H5);
7334
7334
  return _createClass(ae, [{
7335
7335
  key: "processConfig",
7336
7336
  value: function processConfig(e) {
@@ -7425,7 +7425,7 @@ var ae = /*#__PURE__*/function (_U5) {
7425
7425
  }), i;
7426
7426
  }
7427
7427
  }]);
7428
- }(U);
7428
+ }(H);
7429
7429
  ae.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", ae.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", ae.DEFAULT_MODEL = "whisper-1";
7430
7430
  var Qi = ae;
7431
7431
  var ne = /*#__PURE__*/function () {
@@ -7529,7 +7529,7 @@ var ne = /*#__PURE__*/function () {
7529
7529
  }
7530
7530
  }]);
7531
7531
  }();
7532
- var wo = /*#__PURE__*/function (_U6) {
7532
+ var wo = /*#__PURE__*/function (_H6) {
7533
7533
  // prettier-ignore
7534
7534
  function wo(e, t, i, n, r) {
7535
7535
  var _this29;
@@ -7539,9 +7539,9 @@ var wo = /*#__PURE__*/function (_U6) {
7539
7539
  "https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this29.permittedErrorPrefixes = ["Access"];
7540
7540
  return _this29;
7541
7541
  }
7542
- _inherits(wo, _U6);
7542
+ _inherits(wo, _H6);
7543
7543
  return _createClass(wo);
7544
- }(U);
7544
+ }(H);
7545
7545
  var To = /*#__PURE__*/function (_wo) {
7546
7546
  function To(e) {
7547
7547
  var _a$language;
@@ -7800,7 +7800,7 @@ var vt = /*#__PURE__*/function () {
7800
7800
  }
7801
7801
  }]);
7802
7802
  }();
7803
- var fn = /*#__PURE__*/function (_U7) {
7803
+ var fn = /*#__PURE__*/function (_H7) {
7804
7804
  function fn(e) {
7805
7805
  var _this31;
7806
7806
  _classCallCheck(this, fn);
@@ -7811,7 +7811,7 @@ var fn = /*#__PURE__*/function (_U7) {
7811
7811
  }]), _this31.insertKeyPlaceholderText = "AssemblyAI API Key", _this31.keyHelpUrl = "https://www.assemblyai.com/app/account", _this31.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>AssemblyAI Audio</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started\">here</a> for more info.\n </p>", _this31.url = "https://api.assemblyai.com/v2/upload", _this31.isTextInputDisabled = !0, _this31.textInputPlaceholderText = "Upload an audio file", _this31.permittedErrorPrefixes = ["Authentication", "Invalid"], _this31.canSendMessage = fn.canFileSendMessage;
7812
7812
  return _this31;
7813
7813
  }
7814
- _inherits(fn, _U7);
7814
+ _inherits(fn, _H7);
7815
7815
  return _createClass(fn, [{
7816
7816
  key: "callServiceAPI",
7817
7817
  value: function () {
@@ -7883,8 +7883,8 @@ var fn = /*#__PURE__*/function (_U7) {
7883
7883
  return !!(t != null && t[0]);
7884
7884
  }
7885
7885
  }]);
7886
- }(U);
7887
- var ls = /*#__PURE__*/function (_U8) {
7886
+ }(H);
7887
+ var ls = /*#__PURE__*/function (_H8) {
7888
7888
  // prettier-ignore
7889
7889
  function ls(e, t, i, n, r) {
7890
7890
  var _this32;
@@ -7894,9 +7894,9 @@ var ls = /*#__PURE__*/function (_U8) {
7894
7894
  "https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
7895
7895
  return _this32;
7896
7896
  }
7897
- _inherits(ls, _U8);
7897
+ _inherits(ls, _H8);
7898
7898
  return _createClass(ls);
7899
- }(U);
7899
+ }(H);
7900
7900
  var vi = /*#__PURE__*/function (_ls) {
7901
7901
  // prettier-ignore
7902
7902
  function vi(e) {
@@ -8068,7 +8068,7 @@ wt.HELP_LINK =
8068
8068
  // eslint-disable-next-line max-len
8069
8069
  "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
8070
8070
  var tn = wt;
8071
- var Co = /*#__PURE__*/function (_U9) {
8071
+ var Co = /*#__PURE__*/function (_H9) {
8072
8072
  // prettier-ignore
8073
8073
  function Co(e) {
8074
8074
  var _this35;
@@ -8081,7 +8081,7 @@ var Co = /*#__PURE__*/function (_U9) {
8081
8081
  "https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this35.url = "", _this35.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
8082
8082
  return _this35;
8083
8083
  }
8084
- _inherits(Co, _U9);
8084
+ _inherits(Co, _H9);
8085
8085
  return _createClass(Co, [{
8086
8086
  key: "preprocessBody",
8087
8087
  value: function preprocessBody(e) {
@@ -8146,7 +8146,7 @@ var Co = /*#__PURE__*/function (_U9) {
8146
8146
  return extractResultData;
8147
8147
  }()
8148
8148
  }]);
8149
- }(U);
8149
+ }(H);
8150
8150
  var z = /*#__PURE__*/function () {
8151
8151
  function z() {
8152
8152
  _classCallCheck(this, z);
@@ -8268,6 +8268,7 @@ var z = /*#__PURE__*/function () {
8268
8268
  var t = e.split("/");
8269
8269
  return t[t.length - 1];
8270
8270
  }
8271
+ // prettier-ignore
8271
8272
  }, {
8272
8273
  key: "getFileDetails",
8273
8274
  value: function getFileDetails(e, t) {
@@ -8277,7 +8278,9 @@ var z = /*#__PURE__*/function () {
8277
8278
  var o, a;
8278
8279
  (a = (o = r.text) == null ? void 0 : o.annotations) == null || a.forEach(function (l) {
8279
8280
  var c;
8280
- l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
8281
+ l.text && l.text.startsWith("sandbox:") && !B.isImageFile({
8282
+ src: l.text
8283
+ }) && (c = l.file_path) != null && c.file_id && i.push({
8281
8284
  path: l.text,
8282
8285
  fileId: l.file_path.file_id,
8283
8286
  name: z.getFileName(l.text)
@@ -8360,7 +8363,7 @@ var z = /*#__PURE__*/function () {
8360
8363
  var r = e.data[n];
8361
8364
  if (r.role === "assistant") i.push(r);else break;
8362
8365
  }
8363
- return i;
8366
+ return i.reverse();
8364
8367
  }
8365
8368
  // test this using this prompt and it should give 2 text mesages and a file:
8366
8369
  // "give example data for a csv and create a suitable bar chart"
@@ -8449,7 +8452,7 @@ var z = /*#__PURE__*/function () {
8449
8452
  }()
8450
8453
  }]);
8451
8454
  }();
8452
- var F = /*#__PURE__*/function (_U10) {
8455
+ var F = /*#__PURE__*/function (_H10) {
8453
8456
  function F(e) {
8454
8457
  var _c$headers, _d$OpenAIBeta;
8455
8458
  var _this36;
@@ -8475,7 +8478,7 @@ var F = /*#__PURE__*/function (_U10) {
8475
8478
  (_c$headers = (c = _this36.connectSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_d$OpenAIBeta = (d = _this36.connectSettings.headers)["OpenAI-Beta"]) !== null && _d$OpenAIBeta !== void 0 ? _d$OpenAIBeta : d["OpenAI-Beta"] = "assistants=v1", _this36.maxMessages = 1, _this36.isSSEStream = !!(_this36.stream && (_typeof(_this36.stream) != "object" || !_this36.stream.simulation)), _this36.shouldFetchHistory && _this36.sessionId && (_this36.fetchHistory = _this36.fetchHistoryFunc.bind(_this36));
8476
8479
  return _this36;
8477
8480
  }
8478
- _inherits(F, _U10);
8481
+ _inherits(F, _H10);
8479
8482
  return _createClass(F, [{
8480
8483
  key: "fetchHistoryFunc",
8481
8484
  value: function () {
@@ -8767,7 +8770,7 @@ var F = /*#__PURE__*/function (_U10) {
8767
8770
  value: function () {
8768
8771
  var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
8769
8772
  var _this38 = this;
8770
- var r, t, i, o, _o$pop, a, l, n;
8773
+ var r, t, i, o, _o$shift, a, l, n;
8771
8774
  return _regeneratorRuntime().wrap(function _callee91$(_context91) {
8772
8775
  while (1) switch (_context91.prev = _context91.next) {
8773
8776
  case 0:
@@ -8788,9 +8791,9 @@ var F = /*#__PURE__*/function (_U10) {
8788
8791
  return this.getThreadMessages(e.thread_id);
8789
8792
  case 6:
8790
8793
  o = _context91.sent;
8791
- _o$pop = o.pop();
8792
- a = _o$pop.text;
8793
- l = _o$pop.files;
8794
+ _o$shift = o.shift();
8795
+ a = _o$shift.text;
8796
+ l = _o$shift.files;
8794
8797
  return _context91.abrupt("return", (setTimeout(function () {
8795
8798
  o.forEach(function (c) {
8796
8799
  return _this38.deepChat.addMessage(c);
@@ -9032,10 +9035,10 @@ var F = /*#__PURE__*/function (_U10) {
9032
9035
  return createStreamRun;
9033
9036
  }()
9034
9037
  }]);
9035
- }(U);
9038
+ }(H);
9036
9039
  F.THREAD_PREFIX = "https://api.openai.com/v1/threads", F.NEW_ASSISTANT_URL = "https://api.openai.com/v1/assistants", F.POLLING_TIMEOUT_MS = 800;
9037
9040
  var nn = F;
9038
- var le = /*#__PURE__*/function (_U11) {
9041
+ var le = /*#__PURE__*/function (_H11) {
9039
9042
  function le(e) {
9040
9043
  var _this39;
9041
9044
  _classCallCheck(this, le);
@@ -9064,7 +9067,7 @@ var le = /*#__PURE__*/function (_U11) {
9064
9067
  _typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage = le.canFileSendMessage;
9065
9068
  return _this39;
9066
9069
  }
9067
- _inherits(le, _U11);
9070
+ _inherits(le, _H11);
9068
9071
  return _createClass(le, [{
9069
9072
  key: "preprocessBody",
9070
9073
  value: function preprocessBody(e, t) {
@@ -9184,10 +9187,10 @@ var le = /*#__PURE__*/function (_U11) {
9184
9187
  }), n;
9185
9188
  }
9186
9189
  }]);
9187
- }(U);
9190
+ }(H);
9188
9191
  le.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", le.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", le.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
9189
9192
  var sn = le;
9190
- var yt = /*#__PURE__*/function (_U12) {
9193
+ var yt = /*#__PURE__*/function (_H12) {
9191
9194
  function yt(e) {
9192
9195
  var _this40$maxMessages, _l$model;
9193
9196
  var _this40;
@@ -9206,7 +9209,7 @@ var yt = /*#__PURE__*/function (_U12) {
9206
9209
  (_this40$maxMessages = _this40.maxMessages) !== null && _this40$maxMessages !== void 0 ? _this40$maxMessages : _this40.maxMessages = -1, (_l$model = (l = _this40.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-3.5-turbo";
9207
9210
  return _this40;
9208
9211
  }
9209
- _inherits(yt, _U12);
9212
+ _inherits(yt, _H12);
9210
9213
  return _createClass(yt, [{
9211
9214
  key: "cleanConfig",
9212
9215
  value: function cleanConfig(e) {
@@ -9460,7 +9463,7 @@ var yt = /*#__PURE__*/function (_U12) {
9460
9463
  return e.text;
9461
9464
  }
9462
9465
  }]);
9463
- }(U);
9466
+ }(H);
9464
9467
  var ko = /*#__PURE__*/function (_un3) {
9465
9468
  function ko(e) {
9466
9469
  var _this42$maxMessages;
@@ -9575,7 +9578,7 @@ var li = /*#__PURE__*/function () {
9575
9578
  }
9576
9579
  }]);
9577
9580
  }();
9578
- var Ao = /*#__PURE__*/function (_U13) {
9581
+ var Ao = /*#__PURE__*/function (_H13) {
9579
9582
  function Ao(e) {
9580
9583
  var _this43$maxMessages, _n$model;
9581
9584
  var _this43;
@@ -9585,7 +9588,7 @@ var Ao = /*#__PURE__*/function (_U13) {
9585
9588
  _this43 = _callSuper(this, Ao, [e, li.buildKeyVerificationDetails(), li.buildHeaders, i]), _this43.insertKeyPlaceholderText = "Mistral API Key", _this43.keyHelpUrl = "https://console.mistral.ai/api-keys/", _this43.url = "https://api.mistral.ai/v1/chat/completions", _this43.permittedErrorPrefixes = ["invalid"], i && (_this43.cleanConfig(i), Object.assign(_this43.rawBody, i)), (_this43$maxMessages = _this43.maxMessages) !== null && _this43$maxMessages !== void 0 ? _this43$maxMessages : _this43.maxMessages = -1, (_n$model = (n = _this43.rawBody).model) !== null && _n$model !== void 0 ? _n$model : n.model = "open-mistral-7b";
9586
9589
  return _this43;
9587
9590
  }
9588
- _inherits(Ao, _U13);
9591
+ _inherits(Ao, _H13);
9589
9592
  return _createClass(Ao, [{
9590
9593
  key: "cleanConfig",
9591
9594
  value: function cleanConfig(e) {
@@ -9661,7 +9664,7 @@ var Ao = /*#__PURE__*/function (_U13) {
9661
9664
  return extractResultData;
9662
9665
  }()
9663
9666
  }]);
9664
- }(U);
9667
+ }(H);
9665
9668
  var Mo = /*#__PURE__*/function () {
9666
9669
  function Mo() {
9667
9670
  _classCallCheck(this, Mo);
@@ -9811,7 +9814,7 @@ var Ce = /*#__PURE__*/function () {
9811
9814
  key: "createImage",
9812
9815
  value: function createImage(e, t) {
9813
9816
  var i = new Image();
9814
- return i.src = e.src, q.scrollDownOnImageLoad(i.src, t), q.processContent("image", i, i.src, e.name);
9817
+ return i.src = e.src, B.scrollDownOnImageLoad(i.src, t), B.processContent("image", i, i.src, e.name);
9815
9818
  }
9816
9819
  // WORK - image still does not scroll down when loaded
9817
9820
  }, {
@@ -9823,7 +9826,7 @@ var Ce = /*#__PURE__*/function () {
9823
9826
  while (1) switch (_context106.prev = _context106.next) {
9824
9827
  case 0:
9825
9828
  n = Ce.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
9826
- r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), q.addMessage(e, r, "image", i);
9829
+ r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), B.addMessage(e, r, "image", i);
9827
9830
  case 2:
9828
9831
  case "end":
9829
9832
  return _context106.stop();
@@ -9846,7 +9849,7 @@ var Ce = /*#__PURE__*/function () {
9846
9849
  value: function addNewAudioMessage(e, t, i) {
9847
9850
  var n = Ce.createAudioElement(t, i),
9848
9851
  r = e.createNewMessageElement("", i);
9849
- r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"), q.addMessage(e, r, "audio", i);
9852
+ r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"), B.addMessage(e, r, "audio", i);
9850
9853
  }
9851
9854
  }, {
9852
9855
  key: "createAnyFile",
@@ -9858,21 +9861,21 @@ var Ce = /*#__PURE__*/function () {
9858
9861
  var n = Z.createSVGElement(Io);
9859
9862
  n.classList.add("any-file-message-icon"), i.appendChild(n);
9860
9863
  var r = document.createElement("div");
9861
- return r.classList.add("any-file-message-text"), r.textContent = e.name || q.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), q.processContent("any", t, e.src, r.textContent);
9864
+ return r.classList.add("any-file-message-text"), r.textContent = e.name || B.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), B.processContent("any", t, e.src, r.textContent);
9862
9865
  }
9863
9866
  }, {
9864
9867
  key: "addNewAnyFileMessage",
9865
9868
  value: function addNewAnyFileMessage(e, t, i) {
9866
9869
  var n = e.createNewMessageElement("", i),
9867
9870
  r = Ce.createAnyFile(t);
9868
- n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r), q.addMessage(e, n, "file", i);
9871
+ n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r), B.addMessage(e, n, "file", i);
9869
9872
  }
9870
9873
  // no overwrite previous message logic as it is complex to track which files are to be overwritten
9871
9874
  }, {
9872
9875
  key: "addMessages",
9873
9876
  value: function addMessages(e, t, i) {
9874
9877
  t.forEach(function (n) {
9875
- n.ref && (n = q.removeFileRef(n)), q.isAudioFile(n) ? Ce.addNewAudioMessage(e, n, i) : q.isImageFile(n) ? Ce.addNewImageMessage(e, n, i) : Ce.addNewAnyFileMessage(e, n, i);
9878
+ n.ref && (n = B.removeFileRef(n)), B.isAudioFile(n) ? Ce.addNewAudioMessage(e, n, i) : B.isImageFile(n) ? Ce.addNewImageMessage(e, n, i) : Ce.addNewAnyFileMessage(e, n, i);
9876
9879
  });
9877
9880
  }
9878
9881
  }]);
@@ -9888,7 +9891,7 @@ var ke = /*#__PURE__*/function (_ot) {
9888
9891
  o = t.demo;
9889
9892
  _this44._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this44._onClearMessages = Qt.onClearMessages.bind(_this44, e), _this44._onError = Qt.onError.bind(_this44, e), _this44._displayLoadingMessage = ke.getDisplayLoadingMessage(e, t), _this44._permittedErrorPrefixes = n, _this44.addSetupMessageIfNeeded(e, t) || _this44.populateIntroPanel(i, r, e.introPanelStyle), _this44.addIntroductoryMessage(e, t), _this44.populateHistory(e), _this44._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
9890
9893
  return JSON.parse(JSON.stringify(_this44.messages));
9891
- }, e.clearMessages = _this44.clearMessages.bind(_this44, t), e.refreshMessages = _this44.refreshTextMessages.bind(_this44), e.scrollToBottom = j.scrollToBottom.bind(_this44, _this44.elementRef), e.addMessage = function (c, d) {
9894
+ }, e.clearMessages = _this44.clearMessages.bind(_this44, t), e.refreshMessages = _this44.refreshTextMessages.bind(_this44), e.scrollToBottom = U.scrollToBottom.bind(_this44, _this44.elementRef), e.addMessage = function (c, d) {
9892
9895
  _this44.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
9893
9896
  sendUpdate: !!d
9894
9897
  }), !d);
@@ -9940,7 +9943,7 @@ var ke = /*#__PURE__*/function (_ot) {
9940
9943
  t && (t.forEach(function (i) {
9941
9944
  he.processHistoryFile(i), _this45.addNewMessage(i, !0);
9942
9945
  }), setTimeout(function () {
9943
- return j.scrollToBottom(_this45.elementRef);
9946
+ return U.scrollToBottom(_this45.elementRef);
9944
9947
  }, 0));
9945
9948
  }
9946
9949
  }, {
@@ -9958,7 +9961,7 @@ var ke = /*#__PURE__*/function (_ot) {
9958
9961
  return _this46.addAnyMessage(i, !0);
9959
9962
  });
9960
9963
  setTimeout(function () {
9961
- return j.scrollToBottom(_this46.elementRef);
9964
+ return U.scrollToBottom(_this46.elementRef);
9962
9965
  }, 0);
9963
9966
  case 4:
9964
9967
  case "end":
@@ -10024,8 +10027,8 @@ var ke = /*#__PURE__*/function (_ot) {
10024
10027
  r.classList.add("error-message-text");
10025
10028
  var o = this.getPermittedMessage(t) || ((l = this._errorMessageOverrides) == null ? void 0 : l[e]) || ((c = this._errorMessageOverrides) == null ? void 0 : c["default"]) || "Error, please try again.";
10026
10029
  this.renderText(r, o);
10027
- var a = B.extractParticularSharedStyles(["fontSize", "fontFamily"], (d = this.messageStyles) == null ? void 0 : d["default"]);
10028
- B.applyCustomStylesToElements(i, !1, a), B.applyCustomStylesToElements(i, !1, (h = this.messageStyles) == null ? void 0 : h.error), this.elementRef.appendChild(n), j.scrollToBottom(this.elementRef), this.textToSpeech && rt.speak(o, this.textToSpeech), (u = this._onError) == null || u.call(this, o);
10030
+ var a = j.extractParticularSharedStyles(["fontSize", "fontFamily"], (d = this.messageStyles) == null ? void 0 : d["default"]);
10031
+ j.applyCustomStylesToElements(i, !1, a), j.applyCustomStylesToElements(i, !1, (h = this.messageStyles) == null ? void 0 : h.error), this.elementRef.appendChild(n), U.scrollToBottom(this.elementRef), this.textToSpeech && rt.speak(o, this.textToSpeech), (u = this._onError) == null || u.call(this, o);
10029
10032
  }
10030
10033
  }, {
10031
10034
  key: "getPermittedMessage",
@@ -10056,7 +10059,7 @@ var ke = /*#__PURE__*/function (_ot) {
10056
10059
  i = e.bubbleElement;
10057
10060
  i.classList.add("loading-message-text");
10058
10061
  var n = document.createElement("div");
10059
- n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, b.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), pn.set(i, this.messageStyles), this.elementRef.appendChild(t), j.scrollToBottom(this.elementRef);
10062
+ n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, b.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), pn.set(i, this.messageStyles), this.elementRef.appendChild(t), U.scrollToBottom(this.elementRef);
10060
10063
  }
10061
10064
  }, {
10062
10065
  key: "populateIntroPanel",
@@ -10073,7 +10076,7 @@ var ke = /*#__PURE__*/function (_ot) {
10073
10076
  return _context108.abrupt("return", Promise.all((e || []).map(function (t) {
10074
10077
  return new Promise(function (i) {
10075
10078
  if (!t.type || t.type === "any") {
10076
- var n = t.file.name || q.DEFAULT_FILE_NAME;
10079
+ var n = t.file.name || B.DEFAULT_FILE_NAME;
10077
10080
  i({
10078
10081
  name: n,
10079
10082
  type: "any",
@@ -10517,11 +10520,11 @@ var at = /*#__PURE__*/function (_Bt) {
10517
10520
  }
10518
10521
  }]);
10519
10522
  }(Bt);
10520
- var H = /*#__PURE__*/function () {
10521
- function H() {
10522
- _classCallCheck(this, H);
10523
+ var q = /*#__PURE__*/function () {
10524
+ function q() {
10525
+ _classCallCheck(this, q);
10523
10526
  }
10524
- return _createClass(H, null, [{
10527
+ return _createClass(q, null, [{
10525
10528
  key: "addToDropup",
10526
10529
  value:
10527
10530
  // prettier-ignore
@@ -10570,25 +10573,25 @@ var H = /*#__PURE__*/function () {
10570
10573
  }, {
10571
10574
  key: "generatePositions",
10572
10575
  value: function generatePositions(e) {
10573
- var t = H.createPositionsObj();
10576
+ var t = q.createPositionsObj();
10574
10577
  Object.keys(e).forEach(function (n) {
10575
10578
  var o;
10576
10579
  var r = (o = e[n]) == null ? void 0 : o.button.position;
10577
- r && H.setPosition(e, n, t[r]);
10578
- }), t["inside-right"].length === 0 && e.submit && H.setPosition(e, "submit", t["inside-right"]), t["outside-right"].length === 0 && (e.submit ? H.setPosition(e, "submit", t["outside-right"]) : e.microphone ? H.setPosition(e, "microphone", t["outside-right"]) : e.camera && H.setPosition(e, "camera", t["outside-right"])), e.submit && H.setPosition(e, "submit", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]), e.microphone && H.setPosition(e, "microphone", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]);
10580
+ r && q.setPosition(e, n, t[r]);
10581
+ }), t["inside-right"].length === 0 && e.submit && q.setPosition(e, "submit", t["inside-right"]), t["outside-right"].length === 0 && (e.submit ? q.setPosition(e, "submit", t["outside-right"]) : e.microphone ? q.setPosition(e, "microphone", t["outside-right"]) : e.camera && q.setPosition(e, "camera", t["outside-right"])), e.submit && q.setPosition(e, "submit", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]), e.microphone && q.setPosition(e, "microphone", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]);
10579
10582
  var i = Object.keys(e);
10580
10583
  return i.length > 1 || t["dropup-menu"].length > 0 ? Nn.forEach(function (n) {
10581
10584
  e[n] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[n]), {}, {
10582
10585
  buttonType: n
10583
10586
  }));
10584
- }) : i.length === 1 && H.setPosition(e, i[0], t["outside-right"].length === 0 ? t["outside-right"] : t["outside-left"]), t;
10587
+ }) : i.length === 1 && q.setPosition(e, i[0], t["outside-right"].length === 0 ? t["outside-right"] : t["outside-left"]), t;
10585
10588
  }
10586
10589
  // prettier-ignore
10587
10590
  }, {
10588
10591
  key: "addButtons",
10589
10592
  value: function addButtons(e, t, i, n) {
10590
- var r = H.generatePositions(t);
10591
- return H.addToSideContainer(e, r), r["dropup-menu"].length > 0 && H.addToDropup(e, r, i, n), r;
10593
+ var r = q.generatePositions(t);
10594
+ return q.addToSideContainer(e, r), r["dropup-menu"].length > 0 && q.addToDropup(e, r, i, n), r;
10592
10595
  }
10593
10596
  }]);
10594
10597
  }();
@@ -12231,7 +12234,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12231
12234
  }, {
12232
12235
  key: "addAudioElements",
12233
12236
  value: function addAudioElements(e, t) {
12234
- var i = e.parentElement ? j.cloneElement(e) : e,
12237
+ var i = e.parentElement ? U.cloneElement(e) : e,
12235
12238
  n = document.createElement("audio");
12236
12239
  n.src = t;
12237
12240
  var r = Z.createSVGElement(sa);
@@ -13286,6 +13289,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
13286
13289
  i && _this77.addClickEvent(e, t, i.modalContainerStyle, i.files), _this77.elementRef.classList.add("upload-file-button"), _this77.elementRef.appendChild(n.styles), _this77.reapplyStateStyle("styles");
13287
13290
  return _this77;
13288
13291
  }
13292
+ // need to know if the button is going to be stored inside a menu
13289
13293
  _inherits(mi, _Bt5);
13290
13294
  return _createClass(mi, [{
13291
13295
  key: "createInnerElements",
@@ -13388,9 +13392,9 @@ var _t = /*#__PURE__*/function () {
13388
13392
  }, {
13389
13393
  key: "addElements",
13390
13394
  value: function addElements(e, t, i, n, r, o) {
13391
- j.addElements(e, t.elementRef);
13395
+ U.addElements(e, t.elementRef);
13392
13396
  var a = ht.create(),
13393
- l = H.addButtons(a, i, n, o);
13397
+ l = q.addButtons(a, i, n, o);
13394
13398
  on.set(t.inputElementRef, a, r.elementRef, l), ht.add(e, a);
13395
13399
  }
13396
13400
  }]);
@@ -13407,7 +13411,7 @@ var vn = /*#__PURE__*/function () {
13407
13411
  var r = new ke(e, t, i);
13408
13412
  t.websocket && V.createConnection(t, r);
13409
13413
  var o = new _t(e, r, t, n);
13410
- return j.addElements(n, r.elementRef, o.elementRef), n;
13414
+ return U.addElements(n, r.elementRef, o.elementRef), n;
13411
13415
  }
13412
13416
  }, {
13413
13417
  key: "render",
@@ -13454,7 +13458,7 @@ var y = /*#__PURE__*/function (_Xi) {
13454
13458
  key: "onRender",
13455
13459
  value: function onRender() {
13456
13460
  var _this$_childElement;
13457
- Xt.attemptAppendStyleSheetToHead(this.style), he.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = Mo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (bt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), bt.applyDefaultStyleToComponent(this.style, this.chatStyle), he.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? Jt.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof U) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], vn.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof U && D.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Qt.onRender(this);
13461
+ Xt.attemptAppendStyleSheetToHead(this.style), he.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = Mo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (bt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), bt.applyDefaultStyleToComponent(this.style, this.chatStyle), he.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? Jt.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof H) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], vn.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof H && D.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Qt.onRender(this);
13458
13462
  }
13459
13463
  }, {
13460
13464
  key: "disconnectedCallback",