deep-chat-dev 9.0.262 → 9.0.263
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 +17248 -17248
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +356 -356
- package/dist/views/chat/input/textInput/focusUtils.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +2 -2
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -479,7 +479,7 @@ var Ps = "Make sure the events are using {text: string} or {html: string} format
|
|
479
479
|
}]);
|
480
480
|
}();
|
481
481
|
Di.CODE_SNIPPET_GENERATION_JUMP = 0.5;
|
482
|
-
var
|
482
|
+
var G = Di;
|
483
483
|
var Bi = /*#__PURE__*/function () {
|
484
484
|
function Bi() {
|
485
485
|
_classCallCheck(this, Bi);
|
@@ -858,7 +858,7 @@ var Se = /*#__PURE__*/function () {
|
|
858
858
|
var o = i.getElementsByClassName(r);
|
859
859
|
Array.from(o || []).forEach(function (a) {
|
860
860
|
var l = Se.getProcessedStyles(t, a, r);
|
861
|
-
|
861
|
+
X.applyStylesToElement(a, l), Se.applyEvents(a, r);
|
862
862
|
});
|
863
863
|
});
|
864
864
|
var s = i.getElementsByClassName(Kn);
|
@@ -868,11 +868,11 @@ var Se = /*#__PURE__*/function () {
|
|
868
868
|
}
|
869
869
|
}]);
|
870
870
|
}();
|
871
|
-
var
|
872
|
-
function
|
873
|
-
_classCallCheck(this,
|
871
|
+
var X = /*#__PURE__*/function () {
|
872
|
+
function X() {
|
873
|
+
_classCallCheck(this, X);
|
874
874
|
}
|
875
|
-
return _createClass(
|
875
|
+
return _createClass(X, null, [{
|
876
876
|
key: "applyStylesToElement",
|
877
877
|
value: function applyStylesToElement(e, t) {
|
878
878
|
var i = I.processStateful(t);
|
@@ -891,7 +891,7 @@ var J = /*#__PURE__*/function () {
|
|
891
891
|
value: function applyClassUtilitiesToElement(e, t) {
|
892
892
|
var i = t.events,
|
893
893
|
s = t.styles;
|
894
|
-
i &&
|
894
|
+
i && X.applyEventsToElement(e, i), s && !Se.doesElementContainDeepChatClass(e) && X.applyStylesToElement(e, s);
|
895
895
|
}
|
896
896
|
}, {
|
897
897
|
key: "applyCustomClassUtilities",
|
@@ -899,20 +899,20 @@ var J = /*#__PURE__*/function () {
|
|
899
899
|
Object.keys(e).forEach(function (i) {
|
900
900
|
var s = t.getElementsByClassName(i);
|
901
901
|
Array.from(s).forEach(function (r) {
|
902
|
-
e[i] &&
|
902
|
+
e[i] && X.applyClassUtilitiesToElement(r, e[i]);
|
903
903
|
});
|
904
904
|
});
|
905
905
|
}
|
906
906
|
}, {
|
907
907
|
key: "apply",
|
908
908
|
value: function apply(e, t) {
|
909
|
-
Se.applyDeepChatUtilities(e, e.htmlClassUtilities, t),
|
909
|
+
Se.applyDeepChatUtilities(e, e.htmlClassUtilities, t), X.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
910
910
|
}
|
911
911
|
}, {
|
912
912
|
key: "traverseNodes",
|
913
913
|
value: function traverseNodes(e, t) {
|
914
914
|
e.nodeType === Node.ELEMENT_NODE && t.push(e.outerHTML), e.childNodes.forEach(function (i) {
|
915
|
-
|
915
|
+
X.traverseNodes(i, t);
|
916
916
|
});
|
917
917
|
}
|
918
918
|
}, {
|
@@ -921,7 +921,7 @@ var J = /*#__PURE__*/function () {
|
|
921
921
|
var i = new DOMParser().parseFromString(e, "text/html"),
|
922
922
|
s = [];
|
923
923
|
return i.body.childNodes.forEach(function (r) {
|
924
|
-
|
924
|
+
X.traverseNodes(r, s);
|
925
925
|
}), s;
|
926
926
|
}
|
927
927
|
}, {
|
@@ -963,7 +963,7 @@ var ke = /*#__PURE__*/function () {
|
|
963
963
|
}, {
|
964
964
|
key: "overwriteElements",
|
965
965
|
value: function overwriteElements(e, t, i) {
|
966
|
-
i.bubbleElement.innerHTML = t,
|
966
|
+
i.bubbleElement.innerHTML = t, X.apply(e, i.outerContainer), te.flagHTMLUpdateClass(i.bubbleElement);
|
967
967
|
}
|
968
968
|
// prettier-ignore
|
969
969
|
}, {
|
@@ -979,7 +979,7 @@ var ke = /*#__PURE__*/function () {
|
|
979
979
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
980
980
|
var o;
|
981
981
|
var r = ke.createElements(e, t, i, s);
|
982
|
-
return y.fillEmptyMessageElement(r.bubbleElement, t),
|
982
|
+
return y.fillEmptyMessageElement(r.bubbleElement, t), X.apply(e, r.outerContainer), te.flagHTMLUpdateClass(r.bubbleElement), e.applyCustomStyles(r, i, !1, (o = e.messageStyles) == null ? void 0 : o.html), r;
|
983
983
|
}
|
984
984
|
}, {
|
985
985
|
key: "add",
|
@@ -990,7 +990,7 @@ var ke = /*#__PURE__*/function () {
|
|
990
990
|
if (a) return a;
|
991
991
|
s.status = !1;
|
992
992
|
}
|
993
|
-
if (r && e.messageElementRefs.length > 0 &&
|
993
|
+
if (r && e.messageElementRefs.length > 0 && X.isTemporaryBasedOnHTML(t)) return;
|
994
994
|
var o = ke.create(e, t, i, r);
|
995
995
|
return r || ke.addElement(e, o.outerContainer), o;
|
996
996
|
}
|
@@ -2923,11 +2923,11 @@ ut.DEFAULT_PROPERTIES = {
|
|
2923
2923
|
// set target to open in a new tab
|
2924
2924
|
};
|
2925
2925
|
var ti = ut;
|
2926
|
-
var
|
2927
|
-
function
|
2928
|
-
_classCallCheck(this,
|
2926
|
+
var J = /*#__PURE__*/function () {
|
2927
|
+
function J() {
|
2928
|
+
_classCallCheck(this, J);
|
2929
2929
|
}
|
2930
|
-
return _createClass(
|
2930
|
+
return _createClass(J, null, [{
|
2931
2931
|
key: "applyCustomStylesToElements",
|
2932
2932
|
value: function applyCustomStylesToElements(e, t, i) {
|
2933
2933
|
if (i && (Object.assign(e.outerContainer.style, i.outerContainer), Object.assign(e.innerContainer.style, i.innerContainer), Object.assign(e.bubbleElement.style, i.bubble), t)) {
|
@@ -2939,7 +2939,7 @@ var W = /*#__PURE__*/function () {
|
|
2939
2939
|
}, {
|
2940
2940
|
key: "applySideStyles",
|
2941
2941
|
value: function applySideStyles(e, t, i, s) {
|
2942
|
-
s && (
|
2942
|
+
s && (J.applyCustomStylesToElements(e, i, s.shared), t === y.USER_ROLE ? J.applyCustomStylesToElements(e, i, s.user) : (J.applyCustomStylesToElements(e, i, s.ai), J.applyCustomStylesToElements(e, i, s[t])));
|
2943
2943
|
}
|
2944
2944
|
}, {
|
2945
2945
|
key: "isElementsStyles",
|
@@ -2951,7 +2951,7 @@ var W = /*#__PURE__*/function () {
|
|
2951
2951
|
key: "applyCustomStyles",
|
2952
2952
|
value: function applyCustomStyles(e, t, i, s, r) {
|
2953
2953
|
var o;
|
2954
|
-
r && e["default"] !== r ?
|
2954
|
+
r && e["default"] !== r ? J.isElementsStyles(r) ? (J.applyCustomStylesToElements(t, s, (o = e["default"]) == null ? void 0 : o.shared), J.applyCustomStylesToElements(t, s, r)) : (J.applySideStyles(t, i, s, e["default"]), J.applySideStyles(t, i, s, r)) : J.applySideStyles(t, i, s, e["default"]);
|
2955
2955
|
}
|
2956
2956
|
// prettier-ignore
|
2957
2957
|
}, {
|
@@ -3280,14 +3280,11 @@ var Z = /*#__PURE__*/function () {
|
|
3280
3280
|
}, {
|
3281
3281
|
key: "appendNewMessageElementFocusMode",
|
3282
3282
|
value: function appendNewMessageElementFocusMode(e, t) {
|
3283
|
-
var _this6 = this;
|
3284
3283
|
var s;
|
3285
3284
|
var i = this.createNewMessageElement(e, t);
|
3286
3285
|
if (this.appendOuterContainerElemet(i.outerContainer, t), t === "user") {
|
3287
3286
|
var r = typeof this.focusMode != "boolean" && ((s = this.focusMode) == null ? void 0 : s.scroll);
|
3288
|
-
|
3289
|
-
return X.scrollToBottom(_this6.elementRef, r);
|
3290
|
-
});
|
3287
|
+
G.scrollToBottom(this.elementRef, r);
|
3291
3288
|
}
|
3292
3289
|
return i;
|
3293
3290
|
}
|
@@ -3302,10 +3299,10 @@ var Z = /*#__PURE__*/function () {
|
|
3302
3299
|
}, {
|
3303
3300
|
key: "createAndAppendNewMessageElementDefault",
|
3304
3301
|
value: function createAndAppendNewMessageElementDefault(e, t) {
|
3305
|
-
var
|
3302
|
+
var _this6 = this;
|
3306
3303
|
var i = this.createNewMessageElement(e, t);
|
3307
3304
|
return this.appendOuterContainerElemet(i.outerContainer), setTimeout(function () {
|
3308
|
-
return
|
3305
|
+
return G.scrollToBottom(_this6.elementRef);
|
3309
3306
|
}), i;
|
3310
3307
|
}
|
3311
3308
|
}, {
|
@@ -3384,7 +3381,7 @@ var Z = /*#__PURE__*/function () {
|
|
3384
3381
|
}, {
|
3385
3382
|
key: "applyCustomStyles",
|
3386
3383
|
value: function applyCustomStyles(e, t, i, s) {
|
3387
|
-
e && this.messageStyles &&
|
3384
|
+
e && this.messageStyles && J.applyCustomStyles(this.messageStyles, e, t, i, s);
|
3388
3385
|
}
|
3389
3386
|
}, {
|
3390
3387
|
key: "removeMessage",
|
@@ -3422,9 +3419,9 @@ var Z = /*#__PURE__*/function () {
|
|
3422
3419
|
}, {
|
3423
3420
|
key: "refreshTextMessages",
|
3424
3421
|
value: function refreshTextMessages(e) {
|
3425
|
-
var
|
3422
|
+
var _this7 = this;
|
3426
3423
|
this._remarkable = ti.createNew(e), this.messageToElements.forEach(function (t) {
|
3427
|
-
t[1].text && t[0].text &&
|
3424
|
+
t[1].text && t[0].text && _this7.renderText(t[1].text.bubbleElement, t[0].text);
|
3428
3425
|
});
|
3429
3426
|
}
|
3430
3427
|
}], [{
|
@@ -3704,13 +3701,13 @@ var ft = /*#__PURE__*/function () {
|
|
3704
3701
|
if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(k.INVALID_STREAM_EVENT);
|
3705
3702
|
e != null && e.custom && this._message && (this._message.custom = e.custom);
|
3706
3703
|
var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
|
3707
|
-
i =
|
3704
|
+
i = G.isScrollbarAtBottomOfElement(this._messages.elementRef),
|
3708
3705
|
s = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3709
3706
|
if (!this._elements && !this._message) this.setInitialState(s, t, e == null ? void 0 : e.role);else {
|
3710
3707
|
if (this._streamType !== s) return console.error(k.INVALID_STREAM_EVENT_MIX);
|
3711
3708
|
this.updateBasedOnType(t, s, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
|
3712
3709
|
}
|
3713
|
-
i &&
|
3710
|
+
i && G.scrollToBottom(this._messages.elementRef);
|
3714
3711
|
}
|
3715
3712
|
}, {
|
3716
3713
|
key: "setInitialState",
|
@@ -3744,7 +3741,7 @@ var ft = /*#__PURE__*/function () {
|
|
3744
3741
|
var e;
|
3745
3742
|
if (!(this._endStreamAfterOperation || !this._message) && !(this._fileAdded && !this._elements)) {
|
3746
3743
|
if (!this._elements) throw Error(k.NO_VALID_STREAM_EVENTS_SENT);
|
3747
|
-
(e = this._elements.bubbleElement) != null && e.classList.contains(ft.MESSAGE_CLASS) && (this._streamType === "text" ? this._messages.textToSpeech && gt.speak(this._message.text || "", this._messages.textToSpeech) : this._streamType === "html" && this._elements &&
|
3744
|
+
(e = this._elements.bubbleElement) != null && e.classList.contains(ft.MESSAGE_CLASS) && (this._streamType === "text" ? this._messages.textToSpeech && gt.speak(this._message.text || "", this._messages.textToSpeech) : this._streamType === "html" && this._elements && X.apply(this._messages, this._elements.outerContainer), this._elements.bubbleElement.classList.remove(ft.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(he.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
3748
3745
|
}
|
3749
3746
|
}
|
3750
3747
|
}, {
|
@@ -4491,7 +4488,7 @@ var A = /*#__PURE__*/function () {
|
|
4491
4488
|
}
|
4492
4489
|
if (i.html) {
|
4493
4490
|
t.onOpen();
|
4494
|
-
_o3 =
|
4491
|
+
_o3 = X.splitHTML(i.html);
|
4495
4492
|
_o3.length === 0 && (_o3 = i.html.split("")), A.populateMessages(e, _o3, new we(e), r, "html", 0, s);
|
4496
4493
|
}
|
4497
4494
|
i.error && (E.displayError(e, i.error), t.onClose());
|
@@ -4705,7 +4702,7 @@ var q = /*#__PURE__*/function () {
|
|
4705
4702
|
}, {
|
4706
4703
|
key: "assignListeners",
|
4707
4704
|
value: function assignListeners(e, t, i) {
|
4708
|
-
var
|
4705
|
+
var _this8 = this;
|
4709
4706
|
var s = {};
|
4710
4707
|
t.onmessage = /*#__PURE__*/function () {
|
4711
4708
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(r) {
|
@@ -4736,7 +4733,7 @@ var q = /*#__PURE__*/function () {
|
|
4736
4733
|
_context12.next = 13;
|
4737
4734
|
break;
|
4738
4735
|
}
|
4739
|
-
l = q.stream.bind(
|
4736
|
+
l = q.stream.bind(_this8, e, i, s), c = s[o.role || y.AI_ROLE];
|
4740
4737
|
A.upsertWFiles(i, l, c, a);
|
4741
4738
|
_context12.next = 17;
|
4742
4739
|
break;
|
@@ -5006,7 +5003,7 @@ var be = /*#__PURE__*/function () {
|
|
5006
5003
|
}, {
|
5007
5004
|
key: "websocket",
|
5008
5005
|
value: function websocket(e, t) {
|
5009
|
-
var
|
5006
|
+
var _this9 = this;
|
5010
5007
|
var l, c;
|
5011
5008
|
var i = {
|
5012
5009
|
isOpen: !1,
|
@@ -5046,7 +5043,7 @@ var be = /*#__PURE__*/function () {
|
|
5046
5043
|
return typeof m.error == "string";
|
5047
5044
|
});
|
5048
5045
|
if (f) console.error(f.error), t.isLastMessageError() || t.addNewErrorMessage("service", f.error);else if (A.isSimulation(e.stream)) {
|
5049
|
-
m = u, p = q.stream.bind(
|
5046
|
+
m = u, p = q.stream.bind(_this9, e, t, i.roleToStream), g = i.roleToStream[m.role || y.AI_ROLE];
|
5050
5047
|
A.upsertWFiles(t, p, g, m);
|
5051
5048
|
} else h.forEach(function (m) {
|
5052
5049
|
return t.addNewMessage(m);
|
@@ -5347,7 +5344,7 @@ var He = /*#__PURE__*/function () {
|
|
5347
5344
|
key: "fetchHistory",
|
5348
5345
|
value: function () {
|
5349
5346
|
var _fetchHistory = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
|
5350
|
-
var
|
5347
|
+
var _this0 = this;
|
5351
5348
|
var t, i;
|
5352
5349
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
5353
5350
|
while (1) switch (_context22.prev = _context22.next) {
|
@@ -5358,9 +5355,9 @@ var He = /*#__PURE__*/function () {
|
|
5358
5355
|
case 3:
|
5359
5356
|
i = _context22.sent;
|
5360
5357
|
this._messages.removeMessage(t), He.displayIntroMessages(this._messages.messageElementRefs), i.forEach(function (s) {
|
5361
|
-
return
|
5358
|
+
return _this0._messages.addAnyMessage(s, !0);
|
5362
5359
|
}), setTimeout(function () {
|
5363
|
-
return
|
5360
|
+
return G.scrollToBottom(_this0._messages.elementRef);
|
5364
5361
|
}, 0);
|
5365
5362
|
case 5:
|
5366
5363
|
case "end":
|
@@ -5376,7 +5373,7 @@ var He = /*#__PURE__*/function () {
|
|
5376
5373
|
}, {
|
5377
5374
|
key: "processLoadedHistory",
|
5378
5375
|
value: function processLoadedHistory(e) {
|
5379
|
-
var
|
5376
|
+
var _this1 = this;
|
5380
5377
|
var a;
|
5381
5378
|
var _this$_messages = this._messages,
|
5382
5379
|
t = _this$_messages.messageElementRefs,
|
@@ -5387,7 +5384,7 @@ var He = /*#__PURE__*/function () {
|
|
5387
5384
|
})) == null ? void 0 : a.outerContainer,
|
5388
5385
|
o = s.scrollTop;
|
5389
5386
|
e == null || e.reverse().map(function (l) {
|
5390
|
-
var c =
|
5387
|
+
var c = _this1._messages.addAnyMessage(_objectSpread(_objectSpread({}, l), {}, {
|
5391
5388
|
sendUpdate: !0
|
5392
5389
|
}), !0, !0);
|
5393
5390
|
if (c) {
|
@@ -5398,7 +5395,7 @@ var He = /*#__PURE__*/function () {
|
|
5398
5395
|
}).filter(function (l) {
|
5399
5396
|
return !!l;
|
5400
5397
|
}).reverse().forEach(function (l) {
|
5401
|
-
return
|
5398
|
+
return _this1._messages.sendClientUpdate(l, !0);
|
5402
5399
|
}), r && (s.scrollTop = o + r.offsetTop - 40);
|
5403
5400
|
}
|
5404
5401
|
}, {
|
@@ -5421,7 +5418,7 @@ var He = /*#__PURE__*/function () {
|
|
5421
5418
|
key: "setupLoadHistoryOnScroll",
|
5422
5419
|
value: function () {
|
5423
5420
|
var _setupLoadHistoryOnScroll = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
|
5424
|
-
var
|
5421
|
+
var _this10 = this;
|
5425
5422
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
5426
5423
|
while (1) switch (_context24.prev = _context24.next) {
|
5427
5424
|
case 0:
|
@@ -5430,24 +5427,24 @@ var He = /*#__PURE__*/function () {
|
|
5430
5427
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
5431
5428
|
while (1) switch (_context23.prev = _context23.next) {
|
5432
5429
|
case 0:
|
5433
|
-
if (!(!
|
5430
|
+
if (!(!_this10._isLoading && !_this10._isPaginationComplete && _this10._messages.elementRef.scrollTop === 0)) {
|
5434
5431
|
_context23.next = 13;
|
5435
5432
|
break;
|
5436
5433
|
}
|
5437
|
-
|
5438
|
-
t = Be.addMessage(
|
5434
|
+
_this10._isLoading = !0;
|
5435
|
+
t = Be.addMessage(_this10._messages, !1);
|
5439
5436
|
_context23.prev = 3;
|
5440
5437
|
_context23.next = 6;
|
5441
|
-
return e(
|
5438
|
+
return e(_this10._index++);
|
5442
5439
|
case 6:
|
5443
5440
|
i = _context23.sent;
|
5444
|
-
|
5441
|
+
_this10.populateMessages(t, i), _this10._isLoading = !1;
|
5445
5442
|
_context23.next = 13;
|
5446
5443
|
break;
|
5447
5444
|
case 10:
|
5448
5445
|
_context23.prev = 10;
|
5449
5446
|
_context23.t0 = _context23["catch"](3);
|
5450
|
-
|
5447
|
+
_this10._messages.removeMessage(t), _this10._isPaginationComplete = !0, _this10._messages.addNewErrorMessage("service", He.FAILED_ERROR_MESSAGE, !0), console.error(_context23.t0);
|
5451
5448
|
case 13:
|
5452
5449
|
case "end":
|
5453
5450
|
return _context23.stop();
|
@@ -5468,16 +5465,16 @@ var He = /*#__PURE__*/function () {
|
|
5468
5465
|
}, {
|
5469
5466
|
key: "populateInitialHistory",
|
5470
5467
|
value: function populateInitialHistory(e) {
|
5471
|
-
var
|
5468
|
+
var _this11 = this;
|
5472
5469
|
e.forEach(function (t) {
|
5473
|
-
te.processHistoryFile(t),
|
5470
|
+
te.processHistoryFile(t), _this11._messages.addAnyMessage(t, !0);
|
5474
5471
|
});
|
5475
5472
|
}
|
5476
5473
|
}, {
|
5477
5474
|
key: "loadInitialHistory",
|
5478
5475
|
value: function () {
|
5479
5476
|
var _loadInitialHistory = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
|
5480
|
-
var
|
5477
|
+
var _this12 = this;
|
5481
5478
|
var t, i, s;
|
5482
5479
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
5483
5480
|
while (1) switch (_context25.prev = _context25.next) {
|
@@ -5491,7 +5488,7 @@ var He = /*#__PURE__*/function () {
|
|
5491
5488
|
i = _context25.sent;
|
5492
5489
|
s = this._messages.elementRef.scrollTop;
|
5493
5490
|
this.populateMessages(t, i), s === 0 && setTimeout(function () {
|
5494
|
-
return
|
5491
|
+
return G.scrollToBottom(_this12._messages.elementRef);
|
5495
5492
|
}, 0);
|
5496
5493
|
_context25.next = 13;
|
5497
5494
|
break;
|
@@ -5914,17 +5911,17 @@ var nt = /*#__PURE__*/function () {
|
|
5914
5911
|
}
|
5915
5912
|
}]);
|
5916
5913
|
}();
|
5917
|
-
var
|
5914
|
+
var V = /*#__PURE__*/function (_nt) {
|
5918
5915
|
// prettier-ignore
|
5919
|
-
function
|
5920
|
-
var
|
5921
|
-
_classCallCheck(this,
|
5916
|
+
function V(e, t, i, s, r) {
|
5917
|
+
var _this13;
|
5918
|
+
_classCallCheck(this, V);
|
5922
5919
|
var o;
|
5923
|
-
|
5924
|
-
return
|
5920
|
+
_this13 = _callSuper(this, V, [e, r]), _this13.insertKeyPlaceholderText = "API Key", _this13.keyHelpUrl = "", Object.assign(_this13.rawBody, (o = e.connect) == null ? void 0 : o.additionalBodyProps), _this13._keyVerificationDetails = t, _this13._buildHeadersFunc = i, s && _this13.setApiKeyProperties(s), _this13.connectSettings = _this13.buildConnectSettings(_this13.key || "", e.connect);
|
5921
|
+
return _this13;
|
5925
5922
|
}
|
5926
|
-
_inherits(
|
5927
|
-
return _createClass(
|
5923
|
+
_inherits(V, _nt);
|
5924
|
+
return _createClass(V, [{
|
5928
5925
|
key: "setApiKeyProperties",
|
5929
5926
|
value: function setApiKeyProperties(e) {
|
5930
5927
|
this.key = e.key, e.validateKeyProperty && (this.validateKeyProperty = e.validateKeyProperty);
|
@@ -5982,13 +5979,13 @@ var Si = /*#__PURE__*/function () {
|
|
5982
5979
|
var Le = /*#__PURE__*/function (_HTMLElement) {
|
5983
5980
|
// If this is not working, try using propertyName directly
|
5984
5981
|
function Le() {
|
5985
|
-
var
|
5982
|
+
var _this14;
|
5986
5983
|
_classCallCheck(this, Le);
|
5987
|
-
|
5984
|
+
_this14 = _callSuper(this, Le), _this14._waitingToRender_ = !1, _this14._propUpdated_ = !1, Object.keys(Le._attributeToProperty_).forEach(function (e) {
|
5988
5985
|
var t = Le._attributeToProperty_[e];
|
5989
|
-
|
5986
|
+
_this14.constructPropertyAccessors(t), _this14.hasOwnProperty(e) || _this14.constructPropertyAccessors(t, e);
|
5990
5987
|
});
|
5991
|
-
return
|
5988
|
+
return _this14;
|
5992
5989
|
}
|
5993
5990
|
_inherits(Le, _HTMLElement);
|
5994
5991
|
return _createClass(Le, [{
|
@@ -6071,11 +6068,11 @@ var ze = /*#__PURE__*/function () {
|
|
6071
6068
|
}();
|
6072
6069
|
ze.VISIBLE_ICON_ID = "visible-icon";
|
6073
6070
|
var ns = ze;
|
6074
|
-
var
|
6075
|
-
function
|
6076
|
-
_classCallCheck(this,
|
6071
|
+
var K = /*#__PURE__*/function () {
|
6072
|
+
function K() {
|
6073
|
+
_classCallCheck(this, K);
|
6077
6074
|
}
|
6078
|
-
return _createClass(
|
6075
|
+
return _createClass(K, null, [{
|
6079
6076
|
key: "createCautionText",
|
6080
6077
|
value: function createCautionText() {
|
6081
6078
|
var e = document.createElement("a");
|
@@ -6101,13 +6098,13 @@ var V = /*#__PURE__*/function () {
|
|
6101
6098
|
i.id = "insert-key-help-text-container";
|
6102
6099
|
var s = document.createElement("div");
|
6103
6100
|
s.id = "insert-key-help-text-contents";
|
6104
|
-
var r =
|
6101
|
+
var r = K.createFailText();
|
6105
6102
|
if (s.appendChild(r), e) {
|
6106
|
-
var o =
|
6103
|
+
var o = K.createHelpLink(e);
|
6107
6104
|
s.appendChild(o);
|
6108
6105
|
}
|
6109
6106
|
if (t === !0) {
|
6110
|
-
var _o4 =
|
6107
|
+
var _o4 = K.createCautionText();
|
6111
6108
|
s.appendChild(_o4);
|
6112
6109
|
}
|
6113
6110
|
return i.appendChild(s), {
|
@@ -6138,10 +6135,10 @@ var V = /*#__PURE__*/function () {
|
|
6138
6135
|
value: function addVerificationEvents(e, t, i, s, r) {
|
6139
6136
|
var o = {
|
6140
6137
|
onSuccess: s,
|
6141
|
-
onFail:
|
6142
|
-
onLoad:
|
6138
|
+
onFail: K.onFail.bind(this, e, t, i),
|
6139
|
+
onLoad: K.onLoad.bind(this, e, t)
|
6143
6140
|
},
|
6144
|
-
a =
|
6141
|
+
a = K.verifyKey.bind(this, e, o, r);
|
6145
6142
|
t.onclick = a, e.onkeydown = function (l) {
|
6146
6143
|
!e.classList.contains("loading") && l.key === U.ENTER && a();
|
6147
6144
|
};
|
@@ -6163,7 +6160,7 @@ var V = /*#__PURE__*/function () {
|
|
6163
6160
|
var t = document.createElement("div");
|
6164
6161
|
t.id = "insert-key-input-container";
|
6165
6162
|
var i = document.createElement("input");
|
6166
|
-
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus =
|
6163
|
+
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus = K.onInputFocus, t.appendChild(i), t;
|
6167
6164
|
}
|
6168
6165
|
// prettier-ignore
|
6169
6166
|
}, {
|
@@ -6172,28 +6169,28 @@ var V = /*#__PURE__*/function () {
|
|
6172
6169
|
var d;
|
6173
6170
|
var i = document.createElement("div");
|
6174
6171
|
i.id = "insert-key-contents";
|
6175
|
-
var s =
|
6172
|
+
var s = K.createInput(t.insertKeyPlaceholderText),
|
6176
6173
|
r = s.children[0],
|
6177
6174
|
o = ns.create(r);
|
6178
6175
|
s.appendChild(o), i.appendChild(s);
|
6179
|
-
var a =
|
6180
|
-
|
6181
|
-
l =
|
6182
|
-
c =
|
6183
|
-
return i.appendChild(a), i.appendChild(l),
|
6176
|
+
var a = K.createStartButton(),
|
6177
|
+
_K$createHelpTextCont = K.createHelpTextContainer(t.keyHelpUrl, (d = t.deepChat._insertKeyViewStyles) == null ? void 0 : d.displayCautionText),
|
6178
|
+
l = _K$createHelpTextCont.helpTextContainerElement,
|
6179
|
+
c = _K$createHelpTextCont.failTextElement;
|
6180
|
+
return i.appendChild(a), i.appendChild(l), K.addVerificationEvents(r, a, c, e, t), i;
|
6184
6181
|
}
|
6185
6182
|
}, {
|
6186
6183
|
key: "createElements",
|
6187
6184
|
value: function createElements(e, t) {
|
6188
6185
|
var i = document.createElement("div");
|
6189
6186
|
i.id = "insert-key-view";
|
6190
|
-
var s =
|
6187
|
+
var s = K.createContents(e, t);
|
6191
6188
|
return i.appendChild(s), i;
|
6192
6189
|
}
|
6193
6190
|
}, {
|
6194
6191
|
key: "render",
|
6195
6192
|
value: function render(e, t, i) {
|
6196
|
-
var s =
|
6193
|
+
var s = K.createElements(t, i);
|
6197
6194
|
e.replaceChildren(s);
|
6198
6195
|
}
|
6199
6196
|
}]);
|
@@ -6392,30 +6389,30 @@ var Ws = {
|
|
6392
6389
|
},
|
6393
6390
|
T = /*#__PURE__*/function (_nt2) {
|
6394
6391
|
function T(e) {
|
6395
|
-
var
|
6392
|
+
var _this15;
|
6396
6393
|
_classCallCheck(this, T);
|
6397
6394
|
var t, i;
|
6398
|
-
|
6399
|
-
return
|
6395
|
+
_this15 = _callSuper(this, T, [e]), _this15._isModelLoaded = !1, _this15._isModelLoading = !1, _this15._loadOnFirstMessage = !1, _this15._webModel = {}, _this15.permittedErrorPrefixes = [T.MULTIPLE_MODELS_ERROR, T.WEB_LLM_NOT_FOUND_ERROR, T.GENERIC_ERROR], _this15._conversationHistory = [], _typeof(e.webModel) == "object" && (_this15._webModel = e.webModel), (t = _this15._webModel.load) != null && t.clearCache && T.clearAllCache(), _this15.findModelInWindow(e), _this15.canSendMessage = _this15.canSubmit.bind(_assertThisInitialized(_this15)), _this15._chatEl = (i = e.shadowRoot) == null ? void 0 : i.children[0], e.history && T.setUpHistory(_this15._conversationHistory, e.history);
|
6396
|
+
return _this15;
|
6400
6397
|
}
|
6401
6398
|
// need ref of messages object as web model exhibits unique behaviour to manipulate chat
|
6402
6399
|
_inherits(T, _nt2);
|
6403
6400
|
return _createClass(T, [{
|
6404
6401
|
key: "setUpMessages",
|
6405
6402
|
value: function setUpMessages(e) {
|
6406
|
-
var
|
6403
|
+
var _this16 = this;
|
6407
6404
|
this._messages = e, this._removeIntro = function () {
|
6408
|
-
e.removeIntroductoryMessage(),
|
6405
|
+
e.removeIntroductoryMessage(), _this16._removeIntro = void 0;
|
6409
6406
|
};
|
6410
6407
|
}
|
6411
6408
|
}, {
|
6412
6409
|
key: "findModelInWindow",
|
6413
6410
|
value: function findModelInWindow(e) {
|
6414
|
-
var
|
6411
|
+
var _this17 = this;
|
6415
6412
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
6416
6413
|
var i;
|
6417
6414
|
window.webLLM ? this.configureInit(this.shouldAddIntroMessage(e.introMessage)) : t > T.MODULE_SEARCH_LIMIT_S ? ((i = this._messages) == null || i.addNewErrorMessage("service", T.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 () {
|
6418
|
-
return
|
6415
|
+
return _this17.findModelInWindow(e, t + 1);
|
6419
6416
|
}, 1e3);
|
6420
6417
|
}
|
6421
6418
|
}, {
|
@@ -6427,11 +6424,11 @@ var Ws = {
|
|
6427
6424
|
}, {
|
6428
6425
|
key: "scrollToTop",
|
6429
6426
|
value: function scrollToTop(e) {
|
6430
|
-
var
|
6427
|
+
var _this18 = this;
|
6431
6428
|
var t;
|
6432
6429
|
((t = this._webModel.introMessage) == null ? void 0 : t.autoScroll) !== !1 && setTimeout(function () {
|
6433
6430
|
var i, s;
|
6434
|
-
(i =
|
6431
|
+
(i = _this18._messages) != null && i.elementRef && G.scrollToTop((s = _this18._messages) == null ? void 0 : s.elementRef);
|
6435
6432
|
}, e);
|
6436
6433
|
}
|
6437
6434
|
// prettier-ignore
|
@@ -6548,7 +6545,7 @@ var Ws = {
|
|
6548
6545
|
key: "loadModel",
|
6549
6546
|
value: function () {
|
6550
6547
|
var _loadModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e, t) {
|
6551
|
-
var
|
6548
|
+
var _this19 = this;
|
6552
6549
|
var o, a, l, c, d, u, h, i, s, r, _this$getConfig, f, m, p, _f;
|
6553
6550
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
6554
6551
|
while (1) switch (_context35.prev = _context35.next) {
|
@@ -6557,13 +6554,13 @@ var Ws = {
|
|
6557
6554
|
i = ((o = this._webModel.introMessage) == null ? void 0 : o.displayed) === !1;
|
6558
6555
|
s = function s(f) {
|
6559
6556
|
var m;
|
6560
|
-
(m =
|
6557
|
+
(m = _this19._messages) == null || m.addNewMessage({
|
6561
6558
|
html: "<div>".concat(f.text, "</div>"),
|
6562
6559
|
overwrite: !0,
|
6563
6560
|
sendUpdate: !1
|
6564
6561
|
}), i && (setTimeout(function () {
|
6565
6562
|
var p;
|
6566
|
-
return
|
6563
|
+
return G.scrollToBottom((p = _this19._messages) == null ? void 0 : p.elementRef);
|
6567
6564
|
}), i = !1);
|
6568
6565
|
};
|
6569
6566
|
T.chat.setInitProgressCallback(s);
|
@@ -6673,7 +6670,7 @@ var Ws = {
|
|
6673
6670
|
key: "streamResp",
|
6674
6671
|
value: function () {
|
6675
6672
|
var _streamResp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e, t, i) {
|
6676
|
-
var
|
6673
|
+
var _this20 = this;
|
6677
6674
|
var s;
|
6678
6675
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
6679
6676
|
while (1) switch (_context39.prev = _context39.next) {
|
@@ -6690,7 +6687,7 @@ var Ws = {
|
|
6690
6687
|
while (1) switch (_context38.prev = _context38.next) {
|
6691
6688
|
case 0:
|
6692
6689
|
_context38.next = 2;
|
6693
|
-
return T.processResponse(
|
6690
|
+
return T.processResponse(_this20.deepChat, e, {
|
6694
6691
|
text: o
|
6695
6692
|
});
|
6696
6693
|
case 2:
|
@@ -6970,16 +6967,16 @@ var xi = /*#__PURE__*/function () {
|
|
6970
6967
|
}
|
6971
6968
|
}]);
|
6972
6969
|
}();
|
6973
|
-
var Jt = /*#__PURE__*/function (
|
6970
|
+
var Jt = /*#__PURE__*/function (_V) {
|
6974
6971
|
// prettier-ignore
|
6975
6972
|
function Jt(e, t, i, s, r, o) {
|
6976
|
-
var
|
6973
|
+
var _this21;
|
6977
6974
|
_classCallCheck(this, Jt);
|
6978
|
-
|
6979
|
-
return
|
6975
|
+
_this21 = _callSuper(this, Jt, [e, xi.buildKeyVerificationDetails(), xi.buildHeaders, r, o]), _this21.insertKeyPlaceholderText = "Hugging Face Token", _this21.keyHelpUrl = "https://huggingface.co/settings/tokens", _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this21.permittedErrorPrefixes = ["Authorization header"], _this21.url = "".concat(Jt.URL_PREFIX).concat(i), _this21.textInputPlaceholderText = t, _typeof(s) == "object" && (s.model && (_this21.url = "".concat(Jt.URL_PREFIX).concat(s.model)), s.options && (_this21.rawBody.options = s.options), s.parameters && (_this21.rawBody.parameters = s.parameters));
|
6976
|
+
return _this21;
|
6980
6977
|
}
|
6981
6978
|
// prettier-ignore
|
6982
|
-
_inherits(Jt,
|
6979
|
+
_inherits(Jt, _V);
|
6983
6980
|
return _createClass(Jt, [{
|
6984
6981
|
key: "preprocessBody",
|
6985
6982
|
value: function preprocessBody(e, t, i) {
|
@@ -7018,16 +7015,16 @@ var Jt = /*#__PURE__*/function (_G) {
|
|
7018
7015
|
return callServiceAPI;
|
7019
7016
|
}()
|
7020
7017
|
}]);
|
7021
|
-
}(
|
7018
|
+
}(V);
|
7022
7019
|
Jt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
7023
7020
|
var Ue = Jt;
|
7024
7021
|
var li = /*#__PURE__*/function (_Ue) {
|
7025
7022
|
// prettier-ignore
|
7026
7023
|
function li(e, t, i, s, r, o) {
|
7027
|
-
var
|
7024
|
+
var _this22;
|
7028
7025
|
_classCallCheck(this, li);
|
7029
|
-
|
7030
|
-
return
|
7026
|
+
_this22 = _callSuper(this, li, [e, t, i, s, r, o]), _this22.isTextInputDisabled = !0, _this22.canSendMessage = li.canSendFile;
|
7027
|
+
return _this22;
|
7031
7028
|
}
|
7032
7029
|
_inherits(li, _Ue);
|
7033
7030
|
return _createClass(li, [{
|
@@ -7203,20 +7200,20 @@ var Te = /*#__PURE__*/function () {
|
|
7203
7200
|
}
|
7204
7201
|
}]);
|
7205
7202
|
}();
|
7206
|
-
var qi = /*#__PURE__*/function (
|
7203
|
+
var qi = /*#__PURE__*/function (_V2) {
|
7207
7204
|
// prettier-ignore
|
7208
7205
|
function qi(e, t, i, s, r) {
|
7209
|
-
var
|
7206
|
+
var _this23;
|
7210
7207
|
_classCallCheck(this, qi);
|
7211
|
-
|
7212
|
-
return
|
7208
|
+
_this23 = _callSuper(this, qi, [e, t, i, s, r]), _this23.insertKeyPlaceholderText = "Stability AI API Key", _this23.keyHelpUrl = "https://platform.stability.ai/docs/getting-started/authentication", _this23.permittedErrorPrefixes = ["Incorrect", "invalid_"];
|
7209
|
+
return _this23;
|
7213
7210
|
}
|
7214
|
-
_inherits(qi,
|
7211
|
+
_inherits(qi, _V2);
|
7215
7212
|
return _createClass(qi);
|
7216
|
-
}(
|
7213
|
+
}(V);
|
7217
7214
|
var wi = /*#__PURE__*/function (_qi) {
|
7218
7215
|
function wi(e) {
|
7219
|
-
var
|
7216
|
+
var _this24;
|
7220
7217
|
_classCallCheck(this, wi);
|
7221
7218
|
var o;
|
7222
7219
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
@@ -7229,10 +7226,10 @@ var wi = /*#__PURE__*/function (_qi) {
|
|
7229
7226
|
}
|
7230
7227
|
}
|
7231
7228
|
};
|
7232
|
-
|
7229
|
+
_this24 = _callSuper(this, wi, [e, Te.buildKeyVerificationDetails(), Te.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>";
|
7233
7230
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
7234
|
-
_typeof(r) == "object" && (r.engine_id && (
|
7235
|
-
return
|
7231
|
+
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), wi.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = wi.canSendFileMessage;
|
7232
|
+
return _this24;
|
7236
7233
|
}
|
7237
7234
|
_inherits(wi, _qi);
|
7238
7235
|
return _createClass(wi, [{
|
@@ -7323,7 +7320,7 @@ var wi = /*#__PURE__*/function (_qi) {
|
|
7323
7320
|
}(qi);
|
7324
7321
|
var Ai = /*#__PURE__*/function (_qi2) {
|
7325
7322
|
function Ai(e) {
|
7326
|
-
var
|
7323
|
+
var _this25;
|
7327
7324
|
_classCallCheck(this, Ai);
|
7328
7325
|
var o;
|
7329
7326
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
@@ -7336,10 +7333,10 @@ var Ai = /*#__PURE__*/function (_qi2) {
|
|
7336
7333
|
}
|
7337
7334
|
}
|
7338
7335
|
};
|
7339
|
-
|
7336
|
+
_this25 = _callSuper(this, Ai, [e, Te.buildKeyVerificationDetails(), Te.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>";
|
7340
7337
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
7341
|
-
_typeof(r) == "object" && (r.engine_id && (
|
7342
|
-
return
|
7338
|
+
_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), Ai.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = Ai.canSendFileTextMessage;
|
7339
|
+
return _this25;
|
7343
7340
|
}
|
7344
7341
|
_inherits(Ai, _qi2);
|
7345
7342
|
return _createClass(Ai, [{
|
@@ -7517,13 +7514,13 @@ var Ho = /*#__PURE__*/function (_Ue2) {
|
|
7517
7514
|
}(Ue);
|
7518
7515
|
var zo = /*#__PURE__*/function (_Ue3) {
|
7519
7516
|
function zo(e) {
|
7520
|
-
var
|
7517
|
+
var _this26;
|
7521
7518
|
_classCallCheck(this, zo);
|
7522
7519
|
var s, r, o;
|
7523
7520
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.questionAnswer,
|
7524
7521
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7525
|
-
|
7526
|
-
return
|
7522
|
+
_this26 = _callSuper(this, zo, [e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i]), _this26.permittedErrorPrefixes = ["Authorization header", "Error in"], _this26._context = t.context;
|
7523
|
+
return _this26;
|
7527
7524
|
}
|
7528
7525
|
_inherits(zo, _Ue3);
|
7529
7526
|
return _createClass(zo, [{
|
@@ -7610,14 +7607,14 @@ var Go = /*#__PURE__*/function (_Ue4) {
|
|
7610
7607
|
}(Ue);
|
7611
7608
|
var Vo = /*#__PURE__*/function (_Ue5) {
|
7612
7609
|
function Vo(e) {
|
7613
|
-
var
|
7614
|
-
var
|
7610
|
+
var _this27$maxMessages;
|
7611
|
+
var _this27;
|
7615
7612
|
_classCallCheck(this, Vo);
|
7616
7613
|
var s, r, o;
|
7617
7614
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.conversation,
|
7618
7615
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7619
|
-
|
7620
|
-
return
|
7616
|
+
_this27 = _callSuper(this, Vo, [e, "Ask me anything!", "facebook/blenderbot-400M-distill", t, i]), (_this27$maxMessages = _this27.maxMessages) !== null && _this27$maxMessages !== void 0 ? _this27$maxMessages : _this27.maxMessages = -1;
|
7617
|
+
return _this27;
|
7621
7618
|
}
|
7622
7619
|
// prettier-ignore
|
7623
7620
|
_inherits(Vo, _Ue5);
|
@@ -7692,7 +7689,7 @@ var Vo = /*#__PURE__*/function (_Ue5) {
|
|
7692
7689
|
}(Ue);
|
7693
7690
|
var Ti = /*#__PURE__*/function (_qi3) {
|
7694
7691
|
function Ti(e) {
|
7695
|
-
var
|
7692
|
+
var _this28;
|
7696
7693
|
_classCallCheck(this, Ti);
|
7697
7694
|
var o;
|
7698
7695
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
@@ -7705,10 +7702,10 @@ var Ti = /*#__PURE__*/function (_qi3) {
|
|
7705
7702
|
}
|
7706
7703
|
}
|
7707
7704
|
};
|
7708
|
-
|
7705
|
+
_this28 = _callSuper(this, Ti, [e, Te.buildKeyVerificationDetails(), Te.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>";
|
7709
7706
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7710
|
-
_typeof(r) == "object" && (r.engine_id && (
|
7711
|
-
return
|
7707
|
+
_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), Ti.cleanConfig(r), Object.assign(_this28.rawBody, r)), _this28.canSendMessage = Ti.canSendFileTextMessage;
|
7708
|
+
return _this28;
|
7712
7709
|
}
|
7713
7710
|
_inherits(Ti, _qi3);
|
7714
7711
|
return _createClass(Ti, [{
|
@@ -7838,15 +7835,15 @@ var Ko = /*#__PURE__*/function (_Ue6) {
|
|
7838
7835
|
}(Ue);
|
7839
7836
|
var Ci = /*#__PURE__*/function (_qi4) {
|
7840
7837
|
function Ci(e) {
|
7841
|
-
var
|
7838
|
+
var _this29;
|
7842
7839
|
_classCallCheck(this, Ci);
|
7843
7840
|
var r;
|
7844
7841
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7845
7842
|
i = t.stabilityAI;
|
7846
|
-
|
7843
|
+
_this29 = _callSuper(this, Ci, [e, Te.buildKeyVerificationDetails(), Te.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>";
|
7847
7844
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7848
|
-
_typeof(s) == "object" && (s.engine_id && (
|
7849
|
-
return
|
7845
|
+
_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), Ci.cleanConfig(s), Object.assign(_this29.rawBody, s)), _this29.canSendMessage = Ci.canSendTextMessage;
|
7846
|
+
return _this29;
|
7850
7847
|
}
|
7851
7848
|
_inherits(Ci, _qi4);
|
7852
7849
|
return _createClass(Ci, [{
|
@@ -7931,13 +7928,13 @@ var Ci = /*#__PURE__*/function (_qi4) {
|
|
7931
7928
|
}(qi);
|
7932
7929
|
var $o = /*#__PURE__*/function (_Ue7) {
|
7933
7930
|
function $o(e) {
|
7934
|
-
var
|
7931
|
+
var _this30;
|
7935
7932
|
_classCallCheck(this, $o);
|
7936
7933
|
var s, r, o;
|
7937
7934
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.fillMask,
|
7938
7935
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7939
|
-
|
7940
|
-
return
|
7936
|
+
_this30 = _callSuper(this, $o, [e, "The goal of life is [MASK].", "bert-base-uncased", t, i]), _this30.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this30.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
|
7937
|
+
return _this30;
|
7941
7938
|
}
|
7942
7939
|
_inherits($o, _Ue7);
|
7943
7940
|
return _createClass($o, [{
|
@@ -8354,36 +8351,36 @@ var ne = /*#__PURE__*/function () {
|
|
8354
8351
|
}();
|
8355
8352
|
ne.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ne.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.";
|
8356
8353
|
var Me = ne;
|
8357
|
-
var Ge = /*#__PURE__*/function (
|
8354
|
+
var Ge = /*#__PURE__*/function (_V3) {
|
8358
8355
|
// prettier-ignore
|
8359
8356
|
function Ge(e, t, i, s, r, o) {
|
8360
|
-
var
|
8357
|
+
var _this31;
|
8361
8358
|
_classCallCheck(this, Ge);
|
8362
|
-
if (
|
8359
|
+
if (_this31 = _callSuper(this, Ge, [e, s, r, o]), _this31.insertKeyPlaceholderText = "OpenAI API Key", _this31.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this31.url = "", _this31.permittedErrorPrefixes = ["Incorrect", "Please send text", ii.FAILED_ERROR_MESSAGE], _this31.shouldFetchHistory = !1, _this31._searchedForThreadId = !1, _this31._config = {}, _this31._newAssistantDetails = {
|
8363
8360
|
model: "gpt-4"
|
8364
|
-
},
|
8365
|
-
|
8366
|
-
var
|
8367
|
-
a =
|
8368
|
-
l =
|
8369
|
-
c =
|
8370
|
-
Object.assign(
|
8371
|
-
}
|
8372
|
-
|
8373
|
-
return
|
8374
|
-
}
|
8375
|
-
_inherits(Ge,
|
8361
|
+
}, _this31._waitingForStreamResponse = !1, _this31._isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
|
8362
|
+
_this31._config = t;
|
8363
|
+
var _this31$_config = _this31._config,
|
8364
|
+
a = _this31$_config.new_assistant,
|
8365
|
+
l = _this31$_config.thread_id,
|
8366
|
+
c = _this31$_config.load_thread_history;
|
8367
|
+
Object.assign(_this31._newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0);
|
8368
|
+
}
|
8369
|
+
_this31.maxMessages = 1, _this31._isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
|
8370
|
+
return _this31;
|
8371
|
+
}
|
8372
|
+
_inherits(Ge, _V3);
|
8376
8373
|
return _createClass(Ge, [{
|
8377
8374
|
key: "fetchHistoryFunc",
|
8378
8375
|
value: function () {
|
8379
8376
|
var _fetchHistoryFunc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee73() {
|
8380
|
-
var
|
8377
|
+
var _this32 = this;
|
8381
8378
|
var e;
|
8382
8379
|
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
8383
8380
|
while (1) switch (_context73.prev = _context73.next) {
|
8384
8381
|
case 0:
|
8385
8382
|
setTimeout(function () {
|
8386
|
-
return
|
8383
|
+
return _this32.deepChat.disableSubmitButton();
|
8387
8384
|
}, 2);
|
8388
8385
|
_context73.prev = 1;
|
8389
8386
|
_context73.next = 4;
|
@@ -8683,7 +8680,7 @@ var Ge = /*#__PURE__*/function (_G3) {
|
|
8683
8680
|
key: "extractPollResultData",
|
8684
8681
|
value: function () {
|
8685
8682
|
var _extractPollResultData4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee79(e) {
|
8686
|
-
var
|
8683
|
+
var _this33 = this;
|
8687
8684
|
var r, t, i, o, _o$shift, a, l, s;
|
8688
8685
|
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8689
8686
|
while (1) switch (_context79.prev = _context79.next) {
|
@@ -8710,7 +8707,7 @@ var Ge = /*#__PURE__*/function (_G3) {
|
|
8710
8707
|
l = _o$shift.files;
|
8711
8708
|
return _context79.abrupt("return", (setTimeout(function () {
|
8712
8709
|
o.forEach(function (c) {
|
8713
|
-
return
|
8710
|
+
return _this33.deepChat.addMessage(c);
|
8714
8711
|
});
|
8715
8712
|
}), {
|
8716
8713
|
text: a,
|
@@ -9001,26 +8998,26 @@ var Ge = /*#__PURE__*/function (_G3) {
|
|
9001
8998
|
};
|
9002
8999
|
}
|
9003
9000
|
}]);
|
9004
|
-
}(
|
9001
|
+
}(V);
|
9005
9002
|
Ge.POLLING_TIMEOUT_MS = 500;
|
9006
9003
|
var Ri = Ge;
|
9007
9004
|
var Ss = /*#__PURE__*/function (_Ri) {
|
9008
9005
|
function Ss(e) {
|
9009
9006
|
var _a$headers, _l$OpenAIBeta;
|
9010
|
-
var
|
9007
|
+
var _this34;
|
9011
9008
|
_classCallCheck(this, Ss);
|
9012
9009
|
var o, a, l, c, d;
|
9013
9010
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
9014
9011
|
i = t.openAI,
|
9015
9012
|
s = (o = t.openAI) == null ? void 0 : o.assistant,
|
9016
9013
|
r = Ss.buildUrlSegments(s);
|
9017
|
-
if (
|
9014
|
+
if (_this34 = _callSuper(this, Ss, [e, s, r, L.buildKeyVerificationDetails(), L.buildHeaders, i]), (_a$headers = (a = _this34.connectSettings).headers) !== null && _a$headers !== void 0 ? _a$headers : a.headers = {}, (_l$OpenAIBeta = (l = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _l$OpenAIBeta !== void 0 ? _l$OpenAIBeta : l["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34))), _typeof(s) == "object") {
|
9018
9015
|
var _ref24 = (d = (c = e.directConnection) == null ? void 0 : c.openAI) == null ? void 0 : d.assistant,
|
9019
9016
|
u = _ref24.function_handler,
|
9020
9017
|
h = _ref24.files_tool_type;
|
9021
|
-
u && (
|
9018
|
+
u && (_this34.functionHandler = u), h && (_this34.filesToolType = h);
|
9022
9019
|
}
|
9023
|
-
return
|
9020
|
+
return _this34;
|
9024
9021
|
}
|
9025
9022
|
_inherits(Ss, _Ri);
|
9026
9023
|
return _createClass(Ss, null, [{
|
@@ -9074,16 +9071,16 @@ var Mi = /*#__PURE__*/function () {
|
|
9074
9071
|
}
|
9075
9072
|
}]);
|
9076
9073
|
}();
|
9077
|
-
var _s = /*#__PURE__*/function (
|
9074
|
+
var _s = /*#__PURE__*/function (_V4) {
|
9078
9075
|
function _s(e, t, i, s, r) {
|
9079
|
-
var
|
9076
|
+
var _this35;
|
9080
9077
|
_classCallCheck(this, _s);
|
9081
|
-
|
9082
|
-
return
|
9078
|
+
_this35 = _callSuper(this, _s, [e, Mi.buildKeyVerificationDetails(), Mi.buildHeaders, r]), _this35.insertKeyPlaceholderText = "Cohere API Key", _this35.keyHelpUrl = "https://dashboard.cohere.ai/api-keys", _this35.permittedErrorPrefixes = ["invalid"], _this35.url = t, _this35.textInputPlaceholderText = i, s && _typeof(s) == "object" && Object.assign(_this35.rawBody, s);
|
9079
|
+
return _this35;
|
9083
9080
|
}
|
9084
|
-
_inherits(_s,
|
9081
|
+
_inherits(_s, _V4);
|
9085
9082
|
return _createClass(_s);
|
9086
|
-
}(
|
9083
|
+
}(V);
|
9087
9084
|
var Wo = /*#__PURE__*/function (_s3) {
|
9088
9085
|
function Wo(e) {
|
9089
9086
|
_classCallCheck(this, Wo);
|
@@ -9195,7 +9192,7 @@ var ue = ks;
|
|
9195
9192
|
var pt = /*#__PURE__*/function (_Ri2) {
|
9196
9193
|
function pt(e) {
|
9197
9194
|
var _g$headers;
|
9198
|
-
var
|
9195
|
+
var _this36;
|
9199
9196
|
_classCallCheck(this, pt);
|
9200
9197
|
var c, d, u, h, f, m, p, g;
|
9201
9198
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
@@ -9214,20 +9211,20 @@ var pt = /*#__PURE__*/function (_Ri2) {
|
|
9214
9211
|
getFilesPrefix: "".concat(o, "files/"),
|
9215
9212
|
getFilesPostfix: "/content".concat(a)
|
9216
9213
|
};
|
9217
|
-
if (
|
9214
|
+
if (_this36 = _callSuper(this, pt, [e, s == null ? void 0 : s.assistant, l, ue.buildKeyVerificationDetails(r), ue.buildHeaders, i]), _this36.permittedErrorPrefixes = [ue.URL_DETAILS_ERROR_MESSAGE], _this36.insertKeyPlaceholderText = "Azure OpenAI API Key", _this36.keyHelpUrl = "https://learn.microsoft.com/en-us/answers/questions/1193991/how-to-get-the-value-of-openai-api-key", _this36.isTextInputDisabled = !1, _typeof(s == null ? void 0 : s.assistant) == "object") {
|
9218
9215
|
var _ref25 = (p = (m = (f = e.directConnection) == null ? void 0 : f.azure) == null ? void 0 : m.openAI) == null ? void 0 : p.assistant,
|
9219
9216
|
b = _ref25.function_handler,
|
9220
9217
|
M = _ref25.files_tool_type;
|
9221
|
-
b && (
|
9218
|
+
b && (_this36.functionHandler = b), M && (_this36.filesToolType = M);
|
9222
9219
|
}
|
9223
|
-
ue.validateURLDetails(r) ? (_g$headers = (g =
|
9220
|
+
ue.validateURLDetails(r) ? (_g$headers = (g = _this36.connectSettings).headers) !== null && _g$headers !== void 0 ? _g$headers : g.headers = {} : (_this36.isTextInputDisabled = !0, _this36.canSendMessage = function () {
|
9224
9221
|
return !1;
|
9225
9222
|
}, setTimeout(function () {
|
9226
9223
|
e.addMessage({
|
9227
9224
|
error: ue.URL_DETAILS_ERROR_MESSAGE
|
9228
9225
|
});
|
9229
9226
|
}));
|
9230
|
-
return
|
9227
|
+
return _this36;
|
9231
9228
|
}
|
9232
9229
|
_inherits(pt, _Ri2);
|
9233
9230
|
return _createClass(pt);
|
@@ -9519,12 +9516,12 @@ var lt = /*#__PURE__*/function () {
|
|
9519
9516
|
}();
|
9520
9517
|
var Fi = /*#__PURE__*/function (_lt) {
|
9521
9518
|
function Fi(e) {
|
9522
|
-
var
|
9519
|
+
var _this37;
|
9523
9520
|
_classCallCheck(this, Fi);
|
9524
9521
|
var i, s;
|
9525
9522
|
var t = ((s = (i = e == null ? void 0 : e["default"]) == null ? void 0 : i.svg) == null ? void 0 : s.content) || Fi.EMPTY_SVG;
|
9526
|
-
|
9527
|
-
return
|
9523
|
+
_this37 = _callSuper(this, Fi, [document.createElement("div"), t, void 0, e]), _this37.isActive = !1, _this37._innerElements = _this37.createInnerElementsForStates(_this37.customStyles), _this37.changeToDefault();
|
9524
|
+
return _this37;
|
9528
9525
|
}
|
9529
9526
|
_inherits(Fi, _lt);
|
9530
9527
|
return _createClass(Fi, [{
|
@@ -9621,28 +9618,28 @@ var z = /*#__PURE__*/function () {
|
|
9621
9618
|
}();
|
9622
9619
|
var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
9623
9620
|
os = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
9624
|
-
C = /*#__PURE__*/function (
|
9621
|
+
C = /*#__PURE__*/function (_V5) {
|
9625
9622
|
function C(e) {
|
9626
9623
|
var _l$model;
|
9627
|
-
var
|
9624
|
+
var _this38;
|
9628
9625
|
_classCallCheck(this, C);
|
9629
9626
|
var r, o, a, l;
|
9630
9627
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
9631
9628
|
i = C.getKey(e);
|
9632
|
-
|
9629
|
+
_this38 = _callSuper(this, C, [e, L.buildKeyVerificationDetails(), L.buildHeaders, {
|
9633
9630
|
key: i
|
9634
|
-
}]),
|
9631
|
+
}]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38._microphoneButton = null, _this38._toggleButton = null, _this38._errorElement = null, _this38._loadingElement = null, _this38._pc = null, _this38._mediaStream = null, _this38._isMuted = !1;
|
9635
9632
|
var s = (r = t.openAI) == null ? void 0 : r.realtime;
|
9636
9633
|
if (_typeof(s) == "object") {
|
9637
|
-
|
9634
|
+
_this38._avatarConfig = s.avatar, _this38._ephemeralKey = s.ephemeralKey, _this38._errorConfig = s.error, _this38._loadingConfig = s.loading, Object.assign(_this38.rawBody, s.config);
|
9638
9635
|
var _ref26 = ((a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.realtime).config || {},
|
9639
9636
|
c = _ref26.function_handler;
|
9640
|
-
c && (
|
9637
|
+
c && (_this38._functionHandler = c);
|
9641
9638
|
}
|
9642
|
-
(_l$model = (l =
|
9643
|
-
return
|
9639
|
+
(_l$model = (l = _this38.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-4o-realtime-preview-2024-12-17", _this38._avatarConfig = C.buildAvatarConfig(s), _this38._buttonsConfig = C.buildButtonsConfig(s), _this38._avatarEl = C.createAvatar(_this38._avatarConfig), _this38._containerEl = _this38.createContainer(), _this38._deepChat = e;
|
9640
|
+
return _this38;
|
9644
9641
|
}
|
9645
|
-
_inherits(C,
|
9642
|
+
_inherits(C, _V5);
|
9646
9643
|
return _createClass(C, [{
|
9647
9644
|
key: "setUpView",
|
9648
9645
|
value:
|
@@ -9825,11 +9822,11 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9825
9822
|
}, {
|
9826
9823
|
key: "createMicophoneButton",
|
9827
9824
|
value: function createMicophoneButton() {
|
9828
|
-
var
|
9825
|
+
var _this39 = this;
|
9829
9826
|
var t;
|
9830
9827
|
var e = new ki((t = this._buttonsConfig) == null ? void 0 : t.microphone);
|
9831
9828
|
return e.elementRef.classList.add(C.BUTTON_DEFAULT, "deep-chat-openai-realtime-microphone"), e.elementRef.onclick = function () {
|
9832
|
-
e.isActive ? (
|
9829
|
+
e.isActive ? (_this39.toggleMicorphone(!0), e.elementRef.classList.replace(C.MICROPHONE_ACTIVE, C.BUTTON_DEFAULT), e.changeToDefault(), _this39._isMuted = !1) : (_this39.toggleMicorphone(!1), e.elementRef.classList.replace(C.BUTTON_DEFAULT, C.MICROPHONE_ACTIVE), N.removeAriaAttributes(e.elementRef), e.changeToActive(), _this39._isMuted = !0);
|
9833
9830
|
}, e;
|
9834
9831
|
}
|
9835
9832
|
}, {
|
@@ -9843,7 +9840,7 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9843
9840
|
}, {
|
9844
9841
|
key: "createToggleButton",
|
9845
9842
|
value: function createToggleButton() {
|
9846
|
-
var
|
9843
|
+
var _this40 = this;
|
9847
9844
|
var t;
|
9848
9845
|
var e = new ki((t = this._buttonsConfig) == null ? void 0 : t.toggle);
|
9849
9846
|
return e.elementRef.classList.add(C.BUTTON_DEFAULT, "deep-chat-openai-realtime-toggle"), e.elementRef.onclick = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee91() {
|
@@ -9855,52 +9852,52 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9855
9852
|
_context91.next = 4;
|
9856
9853
|
break;
|
9857
9854
|
}
|
9858
|
-
e.changeToDefault(),
|
9855
|
+
e.changeToDefault(), _this40.stop();
|
9859
9856
|
_context91.next = 30;
|
9860
9857
|
break;
|
9861
9858
|
case 4:
|
9862
9859
|
_context91.prev = 4;
|
9863
|
-
if (!
|
9860
|
+
if (!_this40._ephemeralKey) {
|
9864
9861
|
_context91.next = 11;
|
9865
9862
|
break;
|
9866
9863
|
}
|
9867
|
-
|
9864
|
+
_this40.displayLoading();
|
9868
9865
|
_context91.next = 9;
|
9869
|
-
return
|
9866
|
+
return _this40.init(_this40._ephemeralKey);
|
9870
9867
|
case 9:
|
9871
9868
|
_context91.next = 25;
|
9872
9869
|
break;
|
9873
9870
|
case 11:
|
9874
|
-
if (!
|
9871
|
+
if (!_this40._retrievingEphemeralKey) {
|
9875
9872
|
_context91.next = 22;
|
9876
9873
|
break;
|
9877
9874
|
}
|
9878
|
-
|
9875
|
+
_this40.displayLoading();
|
9879
9876
|
_context91.next = 15;
|
9880
|
-
return
|
9877
|
+
return _this40._retrievingEphemeralKey;
|
9881
9878
|
case 15:
|
9882
9879
|
s = _context91.sent;
|
9883
|
-
_context91.t0 = (i =
|
9880
|
+
_context91.t0 = (i = _this40._toggleButton) != null && i.isActive;
|
9884
9881
|
if (!_context91.t0) {
|
9885
9882
|
_context91.next = 20;
|
9886
9883
|
break;
|
9887
9884
|
}
|
9888
9885
|
_context91.next = 20;
|
9889
|
-
return
|
9886
|
+
return _this40.init(s);
|
9890
9887
|
case 20:
|
9891
9888
|
_context91.next = 25;
|
9892
9889
|
break;
|
9893
9890
|
case 22:
|
9894
|
-
|
9891
|
+
_this40.displayLoading();
|
9895
9892
|
_context91.next = 25;
|
9896
|
-
return
|
9893
|
+
return _this40.fetchEphemeralKey(!0);
|
9897
9894
|
case 25:
|
9898
9895
|
_context91.next = 30;
|
9899
9896
|
break;
|
9900
9897
|
case 27:
|
9901
9898
|
_context91.prev = 27;
|
9902
9899
|
_context91.t1 = _context91["catch"](4);
|
9903
|
-
console.error("Failed to start conversation:", _context91.t1),
|
9900
|
+
console.error("Failed to start conversation:", _context91.t1), _this40.displayError(), _this40.hideLoading();
|
9904
9901
|
case 30:
|
9905
9902
|
case "end":
|
9906
9903
|
return _context91.stop();
|
@@ -9912,7 +9909,7 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9912
9909
|
key: "init",
|
9913
9910
|
value: function () {
|
9914
9911
|
var _init2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e) {
|
9915
|
-
var
|
9912
|
+
var _this41 = this;
|
9916
9913
|
var t, i, s, r, o, a, l, c, d;
|
9917
9914
|
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
9918
9915
|
while (1) switch (_context94.prev = _context94.next) {
|
@@ -9945,11 +9942,11 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9945
9942
|
return s.resume();
|
9946
9943
|
case 7:
|
9947
9944
|
c.connect(r);
|
9948
|
-
|
9945
|
+
_this41.monitorFrequencies(r, o);
|
9949
9946
|
_context92.next = 12;
|
9950
9947
|
break;
|
9951
9948
|
case 11:
|
9952
|
-
console.error("No streams found in the ontrack event."),
|
9949
|
+
console.error("No streams found in the ontrack event."), _this41.displayError();
|
9953
9950
|
case 12:
|
9954
9951
|
case "end":
|
9955
9952
|
return _context92.stop();
|
@@ -9965,9 +9962,9 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9965
9962
|
audio: !0
|
9966
9963
|
}).then(function (l) {
|
9967
9964
|
var c;
|
9968
|
-
t ===
|
9965
|
+
t === _this41._pc && (_this41._mediaStream = l, (c = _this41._pc) == null || c.addTrack(_this41._mediaStream.getTracks()[0]), _this41._isMuted && _this41.toggleMicorphone(!1));
|
9969
9966
|
})["catch"](function (l) {
|
9970
|
-
console.error("Error accessing microphone:", l),
|
9967
|
+
console.error("Error accessing microphone:", l), _this41.displayError();
|
9971
9968
|
});
|
9972
9969
|
case 10:
|
9973
9970
|
a = this._pc.createDataChannel("oai-events");
|
@@ -9982,7 +9979,7 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9982
9979
|
_context93.next = 5;
|
9983
9980
|
break;
|
9984
9981
|
}
|
9985
|
-
|
9982
|
+
_this41.removeUnavailable(), _this41._toggleButton && (N.removeAriaAttributes(_this41._toggleButton.elementRef), _this41._toggleButton.changeToActive()), _this41.hideLoading();
|
9986
9983
|
_context93.next = 20;
|
9987
9984
|
break;
|
9988
9985
|
case 5:
|
@@ -9998,19 +9995,19 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9998
9995
|
f = h.name, m = h.call_id;
|
9999
9996
|
_context93.prev = 9;
|
10000
9997
|
_context93.next = 12;
|
10001
|
-
return
|
9998
|
+
return _this41.handleTool(f, h.arguments, m, a);
|
10002
9999
|
case 12:
|
10003
10000
|
_context93.next = 17;
|
10004
10001
|
break;
|
10005
10002
|
case 14:
|
10006
10003
|
_context93.prev = 14;
|
10007
10004
|
_context93.t0 = _context93["catch"](9);
|
10008
|
-
|
10005
|
+
_this41.stopOnError(_context93.t0);
|
10009
10006
|
case 17:
|
10010
10007
|
_context93.next = 20;
|
10011
10008
|
break;
|
10012
10009
|
case 19:
|
10013
|
-
c.type === "error" ?
|
10010
|
+
c.type === "error" ? _this41.stopOnError(c.error.message) : c.type === "invalid_request_error" ? _this41.stopOnError(c.message) : c.type;
|
10014
10011
|
case 20:
|
10015
10012
|
case "end":
|
10016
10013
|
return _context93.stop();
|
@@ -10104,7 +10101,7 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10104
10101
|
}, {
|
10105
10102
|
key: "monitorFrequencies",
|
10106
10103
|
value: function monitorFrequencies(e, t) {
|
10107
|
-
var
|
10104
|
+
var _this42 = this;
|
10108
10105
|
var i = function (_i3) {
|
10109
10106
|
function i() {
|
10110
10107
|
return _i3.apply(this, arguments);
|
@@ -10122,8 +10119,8 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10122
10119
|
r = t.length * 255,
|
10123
10120
|
o = s / r * 100,
|
10124
10121
|
a = 1,
|
10125
|
-
l = a + o / 100 * (((c =
|
10126
|
-
|
10122
|
+
l = a + o / 100 * (((c = _this42._avatarConfig) == null ? void 0 : c.maxScale) - a);
|
10123
|
+
_this42._avatarEl.style.transform = "scale(".concat(l, ")"), requestAnimationFrame(i);
|
10127
10124
|
});
|
10128
10125
|
i();
|
10129
10126
|
}
|
@@ -10299,23 +10296,23 @@ var In = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10299
10296
|
N.removeAriaDisabled(e.elementRef), e.elementRef.classList.remove(C.UNAVAILABLE);
|
10300
10297
|
}
|
10301
10298
|
}]);
|
10302
|
-
}(
|
10299
|
+
}(V);
|
10303
10300
|
C.BUTTON_DEFAULT = "deep-chat-openai-realtime-button-default", C.BUTTON_LOADING = "deep-chat-openai-realtime-button-loading", C.MICROPHONE_ACTIVE = "deep-chat-openai-realtime-microphone-active", C.UNAVAILABLE = "deep-chat-openai-realtime-button-unavailable";
|
10304
10301
|
var as = C;
|
10305
|
-
var mt = /*#__PURE__*/function (
|
10302
|
+
var mt = /*#__PURE__*/function (_V6) {
|
10306
10303
|
function mt(e) {
|
10307
10304
|
var _o$model, _a$voice;
|
10308
|
-
var
|
10305
|
+
var _this43;
|
10309
10306
|
_classCallCheck(this, mt);
|
10310
10307
|
var r, o, a;
|
10311
10308
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
10312
10309
|
i = t == null ? void 0 : t.openAI;
|
10313
|
-
|
10310
|
+
_this43 = _callSuper(this, mt, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i]), _this43.insertKeyPlaceholderText = "OpenAI API Key", _this43.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this43.url = "https://api.openai.com/v1/audio/speech", _this43.permittedErrorPrefixes = ["Invalid"], _this43.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Text To Speech</b></div>\n <p>Generate an audio file based on your text input.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/text-to-speech\">here</a> for more information.</p>";
|
10314
10311
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.textToSpeech;
|
10315
|
-
_typeof(s) == "object" && Object.assign(
|
10316
|
-
return
|
10312
|
+
_typeof(s) == "object" && Object.assign(_this43.rawBody, s), (_o$model = (o = _this43.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model = mt.DEFAULT_MODEL, (_a$voice = (a = _this43.rawBody).voice) !== null && _a$voice !== void 0 ? _a$voice : a.voice = mt.DEFAULT_VOIDE, _this43.textInputPlaceholderText = "Insert text to generate audio", _this43.rawBody.response_format = "mp3";
|
10313
|
+
return _this43;
|
10317
10314
|
}
|
10318
|
-
_inherits(mt,
|
10315
|
+
_inherits(mt, _V6);
|
10319
10316
|
return _createClass(mt, [{
|
10320
10317
|
key: "preprocessBody",
|
10321
10318
|
value: function preprocessBody(e, t) {
|
@@ -10396,25 +10393,25 @@ var mt = /*#__PURE__*/function (_G6) {
|
|
10396
10393
|
return extractResultData;
|
10397
10394
|
}()
|
10398
10395
|
}]);
|
10399
|
-
}(
|
10396
|
+
}(V);
|
10400
10397
|
mt.DEFAULT_MODEL = "tts-1", mt.DEFAULT_VOIDE = "alloy";
|
10401
10398
|
var ls = mt;
|
10402
|
-
var pe = /*#__PURE__*/function (
|
10399
|
+
var pe = /*#__PURE__*/function (_V7) {
|
10403
10400
|
function pe(e) {
|
10404
10401
|
var _o$model2;
|
10405
|
-
var
|
10402
|
+
var _this44;
|
10406
10403
|
_classCallCheck(this, pe);
|
10407
10404
|
var r, o;
|
10408
10405
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
10409
10406
|
i = t == null ? void 0 : t.openAI;
|
10410
|
-
|
10407
|
+
_this44 = _callSuper(this, pe, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, {
|
10411
10408
|
audio: {}
|
10412
|
-
}]),
|
10409
|
+
}]), _this44.insertKeyPlaceholderText = "OpenAI API Key", _this44.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this44.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this44.url = "", _this44.permittedErrorPrefixes = ["Invalid"], _this44.textInputPlaceholderText = "Upload an audio file", _this44._service_url = pe.AUDIO_TRANSCRIPTIONS_URL;
|
10413
10410
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
10414
|
-
_typeof(s) == "object" && (
|
10415
|
-
return
|
10411
|
+
_typeof(s) == "object" && (_this44.processConfig(s), pe.cleanConfig(s), Object.assign(_this44.rawBody, s)), (_o$model2 = (o = _this44.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = pe.DEFAULT_MODEL, _this44.rawBody.response_format = "json", _this44.canSendMessage = pe.canSendFileMessage;
|
10412
|
+
return _this44;
|
10416
10413
|
}
|
10417
|
-
_inherits(pe,
|
10414
|
+
_inherits(pe, _V7);
|
10418
10415
|
return _createClass(pe, [{
|
10419
10416
|
key: "processConfig",
|
10420
10417
|
value: function processConfig(e) {
|
@@ -10509,7 +10506,7 @@ var pe = /*#__PURE__*/function (_G7) {
|
|
10509
10506
|
}), i;
|
10510
10507
|
}
|
10511
10508
|
}]);
|
10512
|
-
}(
|
10509
|
+
}(V);
|
10513
10510
|
pe.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", pe.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", pe.DEFAULT_MODEL = "whisper-1";
|
10514
10511
|
var cs = pe;
|
10515
10512
|
var fe = /*#__PURE__*/function () {
|
@@ -10613,35 +10610,35 @@ var fe = /*#__PURE__*/function () {
|
|
10613
10610
|
}
|
10614
10611
|
}]);
|
10615
10612
|
}();
|
10616
|
-
var Xo = /*#__PURE__*/function (
|
10613
|
+
var Xo = /*#__PURE__*/function (_V8) {
|
10617
10614
|
// prettier-ignore
|
10618
10615
|
function Xo(e, t, i, s, r) {
|
10619
|
-
var
|
10616
|
+
var _this45;
|
10620
10617
|
_classCallCheck(this, Xo);
|
10621
|
-
|
10618
|
+
_this45 = _callSuper(this, Xo, [e, fe.buildLanguageKeyVerificationDetails(i), t, s, r]), _this45.insertKeyPlaceholderText = "Azure Language Subscription Key", _this45.keyHelpUrl =
|
10622
10619
|
// eslint-disable-next-line max-len
|
10623
|
-
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",
|
10624
|
-
return
|
10620
|
+
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this45.permittedErrorPrefixes = ["Access"];
|
10621
|
+
return _this45;
|
10625
10622
|
}
|
10626
|
-
_inherits(Xo,
|
10623
|
+
_inherits(Xo, _V8);
|
10627
10624
|
return _createClass(Xo);
|
10628
|
-
}(
|
10625
|
+
}(V);
|
10629
10626
|
var Yt = /*#__PURE__*/function (_Xo) {
|
10630
10627
|
function Yt(e) {
|
10631
10628
|
var _a$language;
|
10632
|
-
var
|
10629
|
+
var _this46;
|
10633
10630
|
_classCallCheck(this, Yt);
|
10634
10631
|
var s, r, o, a;
|
10635
10632
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.summarization,
|
10636
10633
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
10637
|
-
|
10634
|
+
_this46 = _callSuper(this, Yt, [e, fe.buildSummarizationHeader, t.endpoint, i]), _this46.permittedErrorPrefixes = [Yt.ENDPOINT_ERROR_MESSAGE], _this46.url = "", _this46.textInputPlaceholderText = "Insert text to summarize", _this46.isTextInputDisabled = !1, t.endpoint ? ((_a$language = (a = _this46.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this46.rawBody, t), _this46.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview")) : (_this46.isTextInputDisabled = !0, _this46.canSendMessage = function () {
|
10638
10635
|
return !1;
|
10639
10636
|
}, setTimeout(function () {
|
10640
10637
|
e.addMessage({
|
10641
10638
|
error: Yt.ENDPOINT_ERROR_MESSAGE
|
10642
10639
|
});
|
10643
10640
|
}));
|
10644
|
-
return
|
10641
|
+
return _this46;
|
10645
10642
|
}
|
10646
10643
|
_inherits(Yt, _Xo);
|
10647
10644
|
return _createClass(Yt, [{
|
@@ -10894,18 +10891,18 @@ var Vt = /*#__PURE__*/function () {
|
|
10894
10891
|
}
|
10895
10892
|
}]);
|
10896
10893
|
}();
|
10897
|
-
var xs = /*#__PURE__*/function (
|
10894
|
+
var xs = /*#__PURE__*/function (_V9) {
|
10898
10895
|
function xs(e) {
|
10899
|
-
var
|
10896
|
+
var _this47;
|
10900
10897
|
_classCallCheck(this, xs);
|
10901
10898
|
var i;
|
10902
10899
|
var t = (i = e.directConnection) == null ? void 0 : i.assemblyAI;
|
10903
|
-
|
10900
|
+
_this47 = _callSuper(this, xs, [e, Vt.buildKeyVerificationDetails(), Vt.buildHeaders, t, {
|
10904
10901
|
audio: {}
|
10905
|
-
}]),
|
10906
|
-
return
|
10902
|
+
}]), _this47.insertKeyPlaceholderText = "AssemblyAI API Key", _this47.keyHelpUrl = "https://www.assemblyai.com/app/account", _this47.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>", _this47.url = "https://api.assemblyai.com/v2/upload", _this47.isTextInputDisabled = !0, _this47.textInputPlaceholderText = "Upload an audio file", _this47.permittedErrorPrefixes = ["Authentication", "Invalid"], _this47.canSendMessage = xs.canFileSendMessage;
|
10903
|
+
return _this47;
|
10907
10904
|
}
|
10908
|
-
_inherits(xs,
|
10905
|
+
_inherits(xs, _V9);
|
10909
10906
|
return _createClass(xs, [{
|
10910
10907
|
key: "callServiceAPI",
|
10911
10908
|
value: function () {
|
@@ -10977,37 +10974,37 @@ var xs = /*#__PURE__*/function (_G9) {
|
|
10977
10974
|
return !!(t != null && t[0]);
|
10978
10975
|
}
|
10979
10976
|
}]);
|
10980
|
-
}(
|
10981
|
-
var On = /*#__PURE__*/function (
|
10977
|
+
}(V);
|
10978
|
+
var On = /*#__PURE__*/function (_V0) {
|
10982
10979
|
// prettier-ignore
|
10983
10980
|
function On(e, t, i, s, r) {
|
10984
|
-
var
|
10981
|
+
var _this48;
|
10985
10982
|
_classCallCheck(this, On);
|
10986
|
-
|
10983
|
+
_this48 = _callSuper(this, On, [e, fe.buildSpeechKeyVerificationDetails(i), t, s, r]), _this48.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this48.keyHelpUrl =
|
10987
10984
|
// eslint-disable-next-line max-len
|
10988
10985
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
10989
|
-
return
|
10986
|
+
return _this48;
|
10990
10987
|
}
|
10991
|
-
_inherits(On,
|
10988
|
+
_inherits(On, _V0);
|
10992
10989
|
return _createClass(On);
|
10993
|
-
}(
|
10990
|
+
}(V);
|
10994
10991
|
var Ze = /*#__PURE__*/function (_On) {
|
10995
10992
|
// prettier-ignore
|
10996
10993
|
function Ze(e) {
|
10997
10994
|
var _a$lang, _l$name, _c$gender;
|
10998
|
-
var
|
10995
|
+
var _this49;
|
10999
10996
|
_classCallCheck(this, Ze);
|
11000
10997
|
var s, r, o, a, l, c;
|
11001
10998
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.textToSpeech,
|
11002
10999
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
11003
|
-
|
11000
|
+
_this49 = _callSuper(this, Ze, [e, fe.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this49.permittedErrorPrefixes = [Ze.REGION_ERROR_MESSAGE], _this49.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(Ze.HELP_LINK, "\">here</a> for more info.\n </p>"), _this49.isTextInputDisabled = !1, _this49.url = "", t.region ? (Object.assign(_this49.rawBody, t), (_a$lang = (a = _this49.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this49.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this49.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this49.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1")) : (_this49.isTextInputDisabled = !0, _this49.canSendMessage = function () {
|
11004
11001
|
return !1;
|
11005
11002
|
}, setTimeout(function () {
|
11006
11003
|
e.addMessage({
|
11007
11004
|
error: Ze.REGION_ERROR_MESSAGE
|
11008
11005
|
});
|
11009
11006
|
}));
|
11010
|
-
return
|
11007
|
+
return _this49;
|
11011
11008
|
}
|
11012
11009
|
_inherits(Ze, _On);
|
11013
11010
|
return _createClass(Ze, [{
|
@@ -11082,7 +11079,7 @@ Ze.HELP_LINK =
|
|
11082
11079
|
var hs = Ze;
|
11083
11080
|
var Ve = /*#__PURE__*/function (_On2) {
|
11084
11081
|
function Ve(e) {
|
11085
|
-
var
|
11082
|
+
var _this50;
|
11086
11083
|
_classCallCheck(this, Ve);
|
11087
11084
|
var r, o, a;
|
11088
11085
|
var t = (o = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : o.speechToText,
|
@@ -11094,18 +11091,18 @@ var Ve = /*#__PURE__*/function (_On2) {
|
|
11094
11091
|
}
|
11095
11092
|
}
|
11096
11093
|
};
|
11097
|
-
if (
|
11094
|
+
if (_this50 = _callSuper(this, Ve, [e, fe.buildSpeechToTextHeaders, t.region, i, s]), _this50.permittedErrorPrefixes = [Ve.REGION_ERROR_MESSAGE], _this50.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(Ve.HELP_LINK, "\">here</a> for more info.\n </p>"), _this50.url = "", _this50.isTextInputDisabled = !0, _this50.textInputPlaceholderText = "Upload an audio file", !t.region) _this50.isTextInputDisabled = !0, _this50.canSendMessage = function () {
|
11098
11095
|
return !1;
|
11099
11096
|
}, setTimeout(function () {
|
11100
11097
|
e.addMessage({
|
11101
11098
|
error: Ve.REGION_ERROR_MESSAGE
|
11102
11099
|
});
|
11103
11100
|
});else {
|
11104
|
-
|
11101
|
+
_this50.canSendMessage = Ve.canFileSendMessage;
|
11105
11102
|
var l = t.lang || "en-US";
|
11106
|
-
|
11103
|
+
_this50.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(l, "&format=detailed"), _this50.recordAudio = void 0;
|
11107
11104
|
}
|
11108
|
-
return
|
11105
|
+
return _this50;
|
11109
11106
|
}
|
11110
11107
|
_inherits(Ve, _On2);
|
11111
11108
|
return _createClass(Ve, [{
|
@@ -11180,20 +11177,20 @@ Ve.HELP_LINK =
|
|
11180
11177
|
// eslint-disable-next-line max-len
|
11181
11178
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
|
11182
11179
|
var us = Ve;
|
11183
|
-
var Yo = /*#__PURE__*/function (
|
11180
|
+
var Yo = /*#__PURE__*/function (_V1) {
|
11184
11181
|
// prettier-ignore
|
11185
11182
|
function Yo(e) {
|
11186
|
-
var
|
11183
|
+
var _this51;
|
11187
11184
|
_classCallCheck(this, Yo);
|
11188
11185
|
var s, r, o;
|
11189
11186
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.translation,
|
11190
11187
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
11191
|
-
|
11188
|
+
_this51 = _callSuper(this, Yo, [e, fe.buildTranslationKeyVerificationDetails(t.region), fe.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this51.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this51.keyHelpUrl =
|
11192
11189
|
// eslint-disable-next-line max-len
|
11193
|
-
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",
|
11194
|
-
return
|
11190
|
+
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this51.url = "", _this51.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
11191
|
+
return _this51;
|
11195
11192
|
}
|
11196
|
-
_inherits(Yo,
|
11193
|
+
_inherits(Yo, _V1);
|
11197
11194
|
return _createClass(Yo, [{
|
11198
11195
|
key: "preprocessBody",
|
11199
11196
|
value: function preprocessBody(e) {
|
@@ -11258,29 +11255,29 @@ var Yo = /*#__PURE__*/function (_G1) {
|
|
11258
11255
|
return extractResultData;
|
11259
11256
|
}()
|
11260
11257
|
}]);
|
11261
|
-
}(
|
11262
|
-
var bt = /*#__PURE__*/function (
|
11258
|
+
}(V);
|
11259
|
+
var bt = /*#__PURE__*/function (_V10) {
|
11263
11260
|
// prettier-ignore
|
11264
11261
|
function bt(e, t, i, s, r) {
|
11265
|
-
var
|
11266
|
-
var
|
11262
|
+
var _this52$maxMessages, _p$model;
|
11263
|
+
var _this52;
|
11267
11264
|
_classCallCheck(this, bt);
|
11268
11265
|
var u, h, f, m, p;
|
11269
11266
|
var o = JSON.parse(JSON.stringify(e.directConnection)),
|
11270
11267
|
a = t || L.buildKeyVerificationDetails(),
|
11271
11268
|
l = i || L.buildHeaders,
|
11272
11269
|
c = s || o.openAI;
|
11273
|
-
|
11270
|
+
_this52 = _callSuper(this, bt, [e, a, l, c]), _this52.insertKeyPlaceholderText = "OpenAI API Key", _this52.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this52.url = "https://api.openai.com/v1/chat/completions", _this52.permittedErrorPrefixes = ["Incorrect"], _this52.asyncCallInProgress = !1, _this52._systemMessage = bt.generateSystemMessage("You are a helpful assistant.");
|
11274
11271
|
var d = r || ((u = o.openAI) == null ? void 0 : u.chat);
|
11275
11272
|
if (_typeof(d) == "object") {
|
11276
|
-
d.system_prompt && (
|
11273
|
+
d.system_prompt && (_this52._systemMessage = bt.generateSystemMessage(d.system_prompt));
|
11277
11274
|
var g = (m = (f = (h = e.directConnection) == null ? void 0 : h.openAI) == null ? void 0 : f.chat) == null ? void 0 : m.function_handler;
|
11278
|
-
g && (
|
11275
|
+
g && (_this52._functionHandler = g), _this52.cleanConfig(d), Object.assign(_this52.rawBody, d);
|
11279
11276
|
}
|
11280
|
-
(
|
11281
|
-
return
|
11277
|
+
(_this52$maxMessages = _this52.maxMessages) !== null && _this52$maxMessages !== void 0 ? _this52$maxMessages : _this52.maxMessages = -1, (_p$model = (p = _this52.rawBody).model) !== null && _p$model !== void 0 ? _p$model : p.model = "gpt-4o";
|
11278
|
+
return _this52;
|
11282
11279
|
}
|
11283
|
-
_inherits(bt,
|
11280
|
+
_inherits(bt, _V10);
|
11284
11281
|
return _createClass(bt, [{
|
11285
11282
|
key: "cleanConfig",
|
11286
11283
|
value: function cleanConfig(e) {
|
@@ -11364,7 +11361,7 @@ var bt = /*#__PURE__*/function (_G10) {
|
|
11364
11361
|
key: "extractStreamResult",
|
11365
11362
|
value: function () {
|
11366
11363
|
var _extractStreamResult = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee114(e, t, i) {
|
11367
|
-
var
|
11364
|
+
var _this53 = this;
|
11368
11365
|
var s, r, o;
|
11369
11366
|
return _regeneratorRuntime().wrap(function _callee114$(_context114) {
|
11370
11367
|
while (1) switch (_context114.prev = _context114.next) {
|
@@ -11381,7 +11378,7 @@ var bt = /*#__PURE__*/function (_G10) {
|
|
11381
11378
|
return _context114.abrupt("return", (this._streamToolCalls = void 0, this.handleTools(o, t, i)));
|
11382
11379
|
case 7:
|
11383
11380
|
s != null && s.tool_calls && (this._streamToolCalls ? s.tool_calls.forEach(function (o, a) {
|
11384
|
-
|
11381
|
+
_this53._streamToolCalls && (_this53._streamToolCalls[a]["function"].arguments += o["function"].arguments);
|
11385
11382
|
}) : this._streamToolCalls = s.tool_calls);
|
11386
11383
|
case 8:
|
11387
11384
|
return _context114.abrupt("return", {
|
@@ -11552,29 +11549,29 @@ var bt = /*#__PURE__*/function (_G10) {
|
|
11552
11549
|
return e.text;
|
11553
11550
|
}
|
11554
11551
|
}]);
|
11555
|
-
}(
|
11552
|
+
}(V);
|
11556
11553
|
var ws = /*#__PURE__*/function (_bt) {
|
11557
11554
|
function ws(e) {
|
11558
|
-
var
|
11555
|
+
var _this54;
|
11559
11556
|
_classCallCheck(this, ws);
|
11560
11557
|
var o, a, l, c, d, u, h;
|
11561
11558
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
11562
11559
|
i = t.azure,
|
11563
11560
|
s = ((a = (o = t.azure) == null ? void 0 : o.openAI) == null ? void 0 : a.urlDetails) || {},
|
11564
11561
|
r = (c = (l = t.azure) == null ? void 0 : l.openAI) == null ? void 0 : c.chat;
|
11565
|
-
if (
|
11562
|
+
if (_this54 = _callSuper(this, ws, [e, ue.buildKeyVerificationDetails(s), ue.buildHeaders, i, r]), _this54.permittedErrorPrefixes = [ue.URL_DETAILS_ERROR_MESSAGE], _this54.isTextInputDisabled = !1, _typeof(r) == "object") {
|
11566
11563
|
var _ref31 = (h = (u = (d = e.directConnection) == null ? void 0 : d.azure) == null ? void 0 : u.openAI) == null ? void 0 : h.chat,
|
11567
11564
|
f = _ref31.function_handler;
|
11568
|
-
f && (
|
11565
|
+
f && (_this54._functionHandler = f);
|
11569
11566
|
}
|
11570
|
-
ue.validateURLDetails(s) ?
|
11567
|
+
ue.validateURLDetails(s) ? _this54.url = ws.buildURL(s) : (_this54.isTextInputDisabled = !0, _this54.canSendMessage = function () {
|
11571
11568
|
return !1;
|
11572
11569
|
}, setTimeout(function () {
|
11573
11570
|
e.addMessage({
|
11574
11571
|
error: ue.URL_DETAILS_ERROR_MESSAGE
|
11575
11572
|
});
|
11576
11573
|
}));
|
11577
|
-
return
|
11574
|
+
return _this54;
|
11578
11575
|
}
|
11579
11576
|
_inherits(ws, _bt);
|
11580
11577
|
return _createClass(ws, null, [{
|
@@ -11587,9 +11584,9 @@ var ws = /*#__PURE__*/function (_bt) {
|
|
11587
11584
|
}
|
11588
11585
|
}]);
|
11589
11586
|
}(bt);
|
11590
|
-
var me = /*#__PURE__*/function (
|
11587
|
+
var me = /*#__PURE__*/function (_V11) {
|
11591
11588
|
function me(e) {
|
11592
|
-
var
|
11589
|
+
var _this55;
|
11593
11590
|
_classCallCheck(this, me);
|
11594
11591
|
var o;
|
11595
11592
|
var t = e.directConnection,
|
@@ -11602,21 +11599,21 @@ var me = /*#__PURE__*/function (_G11) {
|
|
11602
11599
|
}
|
11603
11600
|
}
|
11604
11601
|
};
|
11605
|
-
|
11602
|
+
_this55 = _callSuper(this, me, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, s]), _this55.insertKeyPlaceholderText = "OpenAI API Key", _this55.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this55.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this55.url = "", _this55.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
11606
11603
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
11607
|
-
if (
|
11604
|
+
if (_this55.camera) {
|
11608
11605
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
11609
|
-
|
11606
|
+
_this55.camera.files = {
|
11610
11607
|
dimensions: {
|
11611
11608
|
width: a,
|
11612
11609
|
height: a
|
11613
11610
|
}
|
11614
11611
|
};
|
11615
11612
|
}
|
11616
|
-
_typeof(r) == "object" && Object.assign(
|
11617
|
-
return
|
11613
|
+
_typeof(r) == "object" && Object.assign(_this55.rawBody, r), _this55.canSendMessage = me.canFileSendMessage;
|
11614
|
+
return _this55;
|
11618
11615
|
}
|
11619
|
-
_inherits(me,
|
11616
|
+
_inherits(me, _V11);
|
11620
11617
|
return _createClass(me, [{
|
11621
11618
|
key: "preprocessBody",
|
11622
11619
|
value: function preprocessBody(e, t) {
|
@@ -11736,20 +11733,20 @@ var me = /*#__PURE__*/function (_G11) {
|
|
11736
11733
|
}), s;
|
11737
11734
|
}
|
11738
11735
|
}]);
|
11739
|
-
}(
|
11736
|
+
}(V);
|
11740
11737
|
me.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", me.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", me.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
11741
11738
|
var fs = me;
|
11742
11739
|
var Zo = /*#__PURE__*/function (_s5) {
|
11743
11740
|
function Zo(e) {
|
11744
|
-
var
|
11745
|
-
var
|
11741
|
+
var _this56$maxMessages;
|
11742
|
+
var _this56;
|
11746
11743
|
_classCallCheck(this, Zo);
|
11747
11744
|
var r;
|
11748
11745
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
11749
11746
|
i = (r = t.cohere) == null ? void 0 : r.chat,
|
11750
11747
|
s = t.cohere;
|
11751
|
-
|
11752
|
-
return
|
11748
|
+
_this56 = _callSuper(this, Zo, [e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, s]), _typeof(i) == "object" && Object.assign(_this56.rawBody, i), (_this56$maxMessages = _this56.maxMessages) !== null && _this56$maxMessages !== void 0 ? _this56$maxMessages : _this56.maxMessages = -1;
|
11749
|
+
return _this56;
|
11753
11750
|
}
|
11754
11751
|
_inherits(Zo, _s5);
|
11755
11752
|
return _createClass(Zo, [{
|
@@ -11853,17 +11850,17 @@ var Li = /*#__PURE__*/function () {
|
|
11853
11850
|
}
|
11854
11851
|
}]);
|
11855
11852
|
}();
|
11856
|
-
var Qo = /*#__PURE__*/function (
|
11853
|
+
var Qo = /*#__PURE__*/function (_V12) {
|
11857
11854
|
function Qo(e) {
|
11858
|
-
var
|
11859
|
-
var
|
11855
|
+
var _this57$maxMessages, _s$model;
|
11856
|
+
var _this57;
|
11860
11857
|
_classCallCheck(this, Qo);
|
11861
11858
|
var s;
|
11862
11859
|
var i = JSON.parse(JSON.stringify(e.directConnection)).mistral;
|
11863
|
-
|
11864
|
-
return
|
11860
|
+
_this57 = _callSuper(this, Qo, [e, Li.buildKeyVerificationDetails(), Li.buildHeaders, i]), _this57.insertKeyPlaceholderText = "Mistral API Key", _this57.keyHelpUrl = "https://console.mistral.ai/api-keys/", _this57.url = "https://api.mistral.ai/v1/chat/completions", _this57.permittedErrorPrefixes = ["invalid"], i && (_this57.cleanConfig(i), Object.assign(_this57.rawBody, i)), (_this57$maxMessages = _this57.maxMessages) !== null && _this57$maxMessages !== void 0 ? _this57$maxMessages : _this57.maxMessages = -1, (_s$model = (s = _this57.rawBody).model) !== null && _s$model !== void 0 ? _s$model : s.model = "open-mistral-7b";
|
11861
|
+
return _this57;
|
11865
11862
|
}
|
11866
|
-
_inherits(Qo,
|
11863
|
+
_inherits(Qo, _V12);
|
11867
11864
|
return _createClass(Qo, [{
|
11868
11865
|
key: "cleanConfig",
|
11869
11866
|
value: function cleanConfig(e) {
|
@@ -11939,7 +11936,7 @@ var Qo = /*#__PURE__*/function (_G12) {
|
|
11939
11936
|
return extractResultData;
|
11940
11937
|
}()
|
11941
11938
|
}]);
|
11942
|
-
}(
|
11939
|
+
}(V);
|
11943
11940
|
var ea = /*#__PURE__*/function () {
|
11944
11941
|
function ea() {
|
11945
11942
|
_classCallCheck(this, ea);
|
@@ -12044,11 +12041,11 @@ var Ii = /*#__PURE__*/function () {
|
|
12044
12041
|
}]);
|
12045
12042
|
}();
|
12046
12043
|
var ta = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>",
|
12047
|
-
|
12048
|
-
function
|
12049
|
-
_classCallCheck(this,
|
12044
|
+
W = /*#__PURE__*/function () {
|
12045
|
+
function W() {
|
12046
|
+
_classCallCheck(this, W);
|
12050
12047
|
}
|
12051
|
-
return _createClass(
|
12048
|
+
return _createClass(W, null, [{
|
12052
12049
|
key: "createImage",
|
12053
12050
|
value: function createImage(e, t, i) {
|
12054
12051
|
var s = new Image();
|
@@ -12058,9 +12055,9 @@ var ta = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12058
12055
|
}, {
|
12059
12056
|
key: "createImageMessage",
|
12060
12057
|
value: function createImageMessage(e, t, i, s) {
|
12061
|
-
var r =
|
12058
|
+
var r = W.createImage(t, e.elementRef, !s && !e.focusMode),
|
12062
12059
|
o = e.createNewMessageElement("", i);
|
12063
|
-
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(
|
12060
|
+
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(W.IMAGE_BUBBLE_CLASS), {
|
12064
12061
|
type: "image",
|
12065
12062
|
elements: o
|
12066
12063
|
};
|
@@ -12074,9 +12071,9 @@ var ta = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12074
12071
|
}, {
|
12075
12072
|
key: "createNewAudioMessage",
|
12076
12073
|
value: function createNewAudioMessage(e, t, i, s) {
|
12077
|
-
var r =
|
12074
|
+
var r = W.createAudioElement(t, i),
|
12078
12075
|
o = e.createMessageElementsOnOrientation("", i, s);
|
12079
|
-
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(
|
12076
|
+
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(W.AUDIO_BUBBLE_CLASS), {
|
12080
12077
|
type: "audio",
|
12081
12078
|
elements: o
|
12082
12079
|
};
|
@@ -12097,8 +12094,8 @@ var ta = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12097
12094
|
key: "createNewAnyFileMessage",
|
12098
12095
|
value: function createNewAnyFileMessage(e, t, i, s) {
|
12099
12096
|
var r = e.createMessageElementsOnOrientation("", i, s),
|
12100
|
-
o =
|
12101
|
-
return r.bubbleElement.classList.add(
|
12097
|
+
o = W.createAnyFile(t);
|
12098
|
+
return r.bubbleElement.classList.add(W.ANY_FILE_BUBBLE_CLASS), r.bubbleElement.appendChild(o), {
|
12102
12099
|
type: "file",
|
12103
12100
|
elements: r
|
12104
12101
|
};
|
@@ -12108,14 +12105,14 @@ var ta = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12108
12105
|
value: function createMessages(e, t, i) {
|
12109
12106
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
12110
12107
|
return t.map(function (r) {
|
12111
|
-
return r.ref && (r = H.removeFileRef(r)), H.isAudioFile(r) ?
|
12108
|
+
return r.ref && (r = H.removeFileRef(r)), H.isAudioFile(r) ? W.createNewAudioMessage(e, r, i, s) : H.isImageFile(r) ? W.createImageMessage(e, r, i, s) : W.createNewAnyFileMessage(e, r, i, s);
|
12112
12109
|
});
|
12113
12110
|
}
|
12114
12111
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
12115
12112
|
}, {
|
12116
12113
|
key: "addMessages",
|
12117
12114
|
value: function addMessages(e, t, i, s) {
|
12118
|
-
|
12115
|
+
W.createMessages(e, t, i, s).forEach(function (_ref32) {
|
12119
12116
|
var o = _ref32.type,
|
12120
12117
|
a = _ref32.elements;
|
12121
12118
|
H.addMessage(e, a, o, i, s);
|
@@ -12123,8 +12120,8 @@ var ta = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12123
12120
|
}
|
12124
12121
|
}]);
|
12125
12122
|
}();
|
12126
|
-
|
12127
|
-
var Oi =
|
12123
|
+
W.IMAGE_BUBBLE_CLASS = "image-message", W.AUDIO_BUBBLE_CLASS = "audio-message", W.ANY_FILE_BUBBLE_CLASS = "any-file-message";
|
12124
|
+
var Oi = W;
|
12128
12125
|
var le = /*#__PURE__*/function () {
|
12129
12126
|
function le() {
|
12130
12127
|
_classCallCheck(this, le);
|
@@ -12250,29 +12247,29 @@ var ia = /*#__PURE__*/function () {
|
|
12250
12247
|
}();
|
12251
12248
|
var de = /*#__PURE__*/function (_he) {
|
12252
12249
|
function de(e, t, i) {
|
12253
|
-
var
|
12250
|
+
var _this58;
|
12254
12251
|
_classCallCheck(this, de);
|
12255
12252
|
var a, l;
|
12256
|
-
|
12253
|
+
_this58 = _callSuper(this, de, [e]);
|
12257
12254
|
var s = t.permittedErrorPrefixes,
|
12258
12255
|
r = t.introPanelMarkUp,
|
12259
12256
|
o = t.demo;
|
12260
|
-
|
12261
|
-
return y.deepCloneMessagesWithReferences(
|
12257
|
+
_this58._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this58._onClearMessages = yi.onClearMessages.bind(_this58, e), _this58._onError = yi.onError.bind(_this58, e), _this58._isLoadingMessageAllowed = de.getDefaultDisplayLoadingMessage(e, t), _typeof(e.displayLoadingBubble) == "object" && e.displayLoadingBubble.toggle && (e.displayLoadingBubble.toggle = _this58.setLoadingToggle.bind(_this58)), _this58._permittedErrorPrefixes = s, _this58.addSetupMessageIfNeeded(e, t) || _this58.populateIntroPanel(i, r, e.introPanelStyle), o && _this58.prepareDemo(te.processDemo(o), e.loadHistory), _this58.addIntroductoryMessages(e, t), new ii(e, _this58, t), _this58._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
12258
|
+
return y.deepCloneMessagesWithReferences(_this58.messageToElements.map(function (_ref35) {
|
12262
12259
|
var _ref36 = _slicedToArray(_ref35, 1),
|
12263
12260
|
c = _ref36[0];
|
12264
12261
|
return c;
|
12265
12262
|
}));
|
12266
|
-
}, e.clearMessages =
|
12267
|
-
|
12263
|
+
}, e.clearMessages = _this58.clearMessages.bind(_this58, t), e.refreshMessages = _this58.refreshTextMessages.bind(_this58, e.remarkable), e.scrollToBottom = G.scrollToBottom.bind(_this58, _this58.elementRef), e.addMessage = function (c, d) {
|
12264
|
+
_this58.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
12268
12265
|
sendUpdate: !!d
|
12269
12266
|
}), !d);
|
12270
12267
|
}, e.updateMessage = function (c, d) {
|
12271
|
-
return le.update(
|
12272
|
-
}, t.isWebModel() && t.setUpMessages(
|
12273
|
-
|
12268
|
+
return le.update(_this58, c, d);
|
12269
|
+
}, t.isWebModel() && t.setUpMessages(_this58), e.textToSpeech && gt.processConfig(e.textToSpeech, function (c) {
|
12270
|
+
_this58.textToSpeech = c;
|
12274
12271
|
});
|
12275
|
-
return
|
12272
|
+
return _this58;
|
12276
12273
|
}
|
12277
12274
|
_inherits(de, _he);
|
12278
12275
|
return _createClass(de, [{
|
@@ -12307,17 +12304,17 @@ var de = /*#__PURE__*/function (_he) {
|
|
12307
12304
|
}, {
|
12308
12305
|
key: "addIntroductoryMessages",
|
12309
12306
|
value: function addIntroductoryMessages(e, t) {
|
12310
|
-
var
|
12307
|
+
var _this59 = this;
|
12311
12308
|
e != null && e.shadowRoot && (this._introMessage = e.introMessage);
|
12312
12309
|
var i = this._introMessage;
|
12313
12310
|
t != null && t.isWebModel() && (i !== null && i !== void 0 ? i : i = t.getIntroMessage(i));
|
12314
12311
|
var s = !(e != null && e.history) && !!(e != null && e.loadHistory || t != null && t.fetchHistory);
|
12315
12312
|
i && (Array.isArray(i) ? i.forEach(function (r, o) {
|
12316
12313
|
if (o !== 0) {
|
12317
|
-
var a =
|
12318
|
-
y.hideRoleElements(a,
|
12314
|
+
var a = _this59.messageElementRefs[_this59.messageElementRefs.length - 1].innerContainer;
|
12315
|
+
y.hideRoleElements(a, _this59.avatar, _this59.name);
|
12319
12316
|
}
|
12320
|
-
|
12317
|
+
_this59.addIntroductoryMessage(r, s);
|
12321
12318
|
}) : this.addIntroductoryMessage(i, s));
|
12322
12319
|
}
|
12323
12320
|
}, {
|
@@ -12369,7 +12366,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12369
12366
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
12370
12367
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
12371
12368
|
var o;
|
12372
|
-
e.role !== y.USER_ROLE && ((o = this.
|
12369
|
+
e.role !== y.USER_ROLE && ((o = this._hiddenAttachments) == null || o.removeHiddenFiles());
|
12373
12370
|
var s = de.createMessageContent(e),
|
12374
12371
|
r = {
|
12375
12372
|
status: e.overwrite
|
@@ -12404,17 +12401,20 @@ var de = /*#__PURE__*/function (_he) {
|
|
12404
12401
|
}, {
|
12405
12402
|
key: "addNewErrorMessage",
|
12406
12403
|
value: function addNewErrorMessage(e, t) {
|
12404
|
+
var _this60 = this;
|
12407
12405
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
12408
12406
|
var c, d, u, h, f, m;
|
12409
|
-
(c = this.
|
12407
|
+
(c = this._hiddenAttachments) == null || c.readdHiddenFiles(), this.removeMessageOnError();
|
12410
12408
|
var s = this.getPermittedMessage(t) || ((d = this._errorMessageOverrides) == null ? void 0 : d[e]) || ((u = this._errorMessageOverrides) == null ? void 0 : u["default"]) || "Error, please try again.",
|
12411
12409
|
r = this.createMessageElementsOnOrientation(s, "error", i);
|
12412
12410
|
y.hideRoleElements(r.innerContainer, this.avatar, this.name);
|
12413
12411
|
var o = r.bubbleElement,
|
12414
12412
|
a = r.outerContainer;
|
12415
12413
|
o.classList.add(y.ERROR_MESSAGE_TEXT_CLASS), this.renderText(o, s);
|
12416
|
-
var l =
|
12417
|
-
|
12414
|
+
var l = J.extractParticularSharedStyles(["fontSize", "fontFamily"], (h = this.messageStyles) == null ? void 0 : h["default"]);
|
12415
|
+
J.applyCustomStylesToElements(r, !1, l), J.applyCustomStylesToElements(r, !1, (f = this.messageStyles) == null ? void 0 : f.error), i || this.appendOuterContainerElemet(a), this.textToSpeech && gt.speak(s, this.textToSpeech), (m = this._onError) == null || m.call(this, s), setTimeout(function () {
|
12416
|
+
return G.scrollToBottom(_this60.elementRef);
|
12417
|
+
});
|
12418
12418
|
}
|
12419
12419
|
}, {
|
12420
12420
|
key: "getPermittedMessage",
|
@@ -12456,12 +12456,12 @@ var de = /*#__PURE__*/function (_he) {
|
|
12456
12456
|
if (he.isLoadingMessage(t) || !e && !this._isLoadingMessageAllowed) return;
|
12457
12457
|
var i = (a = (o = (r = this.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.message) == null ? void 0 : a.html,
|
12458
12458
|
s = i ? _e.createElements(this, i, y.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
12459
|
-
this.appendOuterContainerElemet(s.outerContainer), s.bubbleElement.classList.add(Ne.BUBBLE_CLASS), this.applyCustomStyles(s, y.AI_ROLE, !1, (d = (c = (l = this.messageStyles) == null ? void 0 : l.loading) == null ? void 0 : c.message) == null ? void 0 : d.styles), this.focusMode ||
|
12459
|
+
this.appendOuterContainerElemet(s.outerContainer), s.bubbleElement.classList.add(Ne.BUBBLE_CLASS), this.applyCustomStyles(s, y.AI_ROLE, !1, (d = (c = (l = this.messageStyles) == null ? void 0 : l.loading) == null ? void 0 : c.message) == null ? void 0 : d.styles), this.focusMode || G.scrollToBottom(this.elementRef);
|
12460
12460
|
}
|
12461
12461
|
}, {
|
12462
12462
|
key: "populateIntroPanel",
|
12463
12463
|
value: function populateIntroPanel(e, t, i) {
|
12464
|
-
(e || t) && (this._introPanel = new Ii(e, t, i), this._introPanel._elementRef && (
|
12464
|
+
(e || t) && (this._introPanel = new Ii(e, t, i), this._introPanel._elementRef && (X.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
12465
12465
|
}
|
12466
12466
|
}, {
|
12467
12467
|
key: "addMultipleFiles",
|
@@ -12470,7 +12470,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12470
12470
|
return _regeneratorRuntime().wrap(function _callee122$(_context122) {
|
12471
12471
|
while (1) switch (_context122.prev = _context122.next) {
|
12472
12472
|
case 0:
|
12473
|
-
return _context122.abrupt("return", (this.
|
12473
|
+
return _context122.abrupt("return", (this._hiddenAttachments = t, Promise.all((e || []).map(function (i) {
|
12474
12474
|
return new Promise(function (s) {
|
12475
12475
|
if (!i.type || i.type === "any") {
|
12476
12476
|
var r = i.file.name || H.DEFAULT_FILE_NAME;
|
@@ -12742,7 +12742,7 @@ var O = /*#__PURE__*/function (_lt2) {
|
|
12742
12742
|
key: "resetDropupItem",
|
12743
12743
|
value: function resetDropupItem(e) {
|
12744
12744
|
var i, s, r;
|
12745
|
-
this.elementRef =
|
12745
|
+
this.elementRef = X.replaceElementWithNewClone(this.elementRef, this._originalElementRef), this.elementRef.innerHTML = "", ((i = e == null ? void 0 : e.svg) == null ? void 0 : i.content) === "" || this.elementRef.appendChild(Ee.createItemIcon(this.svg, (s = this._menuStyles) == null ? void 0 : s.iconContainer)), this.elementRef.appendChild(Ee.createItemText(this.dropupText, (r = this._menuStyles) == null ? void 0 : r.text));
|
12746
12746
|
}
|
12747
12747
|
}, {
|
12748
12748
|
key: "assignDropupItemStyle",
|
@@ -12963,11 +12963,11 @@ var Qe = /*#__PURE__*/function (_lt3) {
|
|
12963
12963
|
}(lt);
|
12964
12964
|
Qe.BUTTON_ICON_CLASS = "dropup-button";
|
12965
12965
|
var Pi = Qe;
|
12966
|
-
var
|
12967
|
-
function
|
12968
|
-
_classCallCheck(this,
|
12966
|
+
var $ = /*#__PURE__*/function () {
|
12967
|
+
function $() {
|
12968
|
+
_classCallCheck(this, $);
|
12969
12969
|
}
|
12970
|
-
return _createClass(
|
12970
|
+
return _createClass($, null, [{
|
12971
12971
|
key: "addToDropup",
|
12972
12972
|
value:
|
12973
12973
|
// prettier-ignore
|
@@ -13019,12 +13019,12 @@ var K = /*#__PURE__*/function () {
|
|
13019
13019
|
}, {
|
13020
13020
|
key: "generatePositionToButtons",
|
13021
13021
|
value: function generatePositionToButtons(e) {
|
13022
|
-
var t =
|
13022
|
+
var t = $.createPositionsToButtonsObj();
|
13023
13023
|
Object.keys(e).forEach(function (s) {
|
13024
13024
|
var o;
|
13025
13025
|
var r = (o = e[s]) == null ? void 0 : o.button.position;
|
13026
|
-
r &&
|
13027
|
-
}), t["inside-right"].length === 0 && e.submit &&
|
13026
|
+
r && $.setPosition(e, s, t[r]);
|
13027
|
+
}), t["inside-right"].length === 0 && e.submit && $.setPosition(e, "submit", t["inside-right"]), t["outside-right"].length === 0 && (e.submit ? $.setPosition(e, "submit", t["outside-right"]) : e.microphone ? $.setPosition(e, "microphone", t["outside-right"]) : e.camera ? $.setPosition(e, "camera", t["outside-right"]) : e["".concat(it.INDICATOR_PREFIX, "1")] && $.setPosition(e, "".concat(it.INDICATOR_PREFIX, "1"), t["outside-right"])), e.submit && $.setPosition(e, "submit", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]), e.microphone && $.setPosition(e, "microphone", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]);
|
13028
13028
|
var i = Object.keys(e);
|
13029
13029
|
return i.length > 1 || t["dropup-menu"].length > 0 ? (Js.forEach(function (s) {
|
13030
13030
|
e[s] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[s]), {}, {
|
@@ -13035,14 +13035,14 @@ var K = /*#__PURE__*/function () {
|
|
13035
13035
|
r.startsWith(it.INDICATOR_PREFIX) && e[r] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[r]), {}, {
|
13036
13036
|
customType: r
|
13037
13037
|
}));
|
13038
|
-
})) : i.length === 1 &&
|
13038
|
+
})) : i.length === 1 && $.setPosition(e, i[0], t["outside-right"].length === 0 ? t["outside-right"] : t["outside-left"]), t;
|
13039
13039
|
}
|
13040
13040
|
// prettier-ignore
|
13041
13041
|
}, {
|
13042
13042
|
key: "addButtons",
|
13043
13043
|
value: function addButtons(e, t, i, s) {
|
13044
|
-
var r =
|
13045
|
-
return
|
13044
|
+
var r = $.generatePositionToButtons(t);
|
13045
|
+
return $.addToSideContainer(e, r), r["dropup-menu"].length > 0 && $.addToDropup(e, r, i, s), r;
|
13046
13046
|
}
|
13047
13047
|
}]);
|
13048
13048
|
}();
|
@@ -14787,7 +14787,7 @@ var Ie = /*#__PURE__*/function (_Pe) {
|
|
14787
14787
|
}, {
|
14788
14788
|
key: "addAudioElements",
|
14789
14789
|
value: function addAudioElements(e, t) {
|
14790
|
-
var i = e.parentElement ?
|
14790
|
+
var i = e.parentElement ? G.cloneElement(e) : e,
|
14791
14791
|
s = document.createElement("audio");
|
14792
14792
|
s.src = t;
|
14793
14793
|
var r = Fe.createSVGElement(In);
|
@@ -15908,9 +15908,9 @@ var Kt = /*#__PURE__*/function () {
|
|
15908
15908
|
}, {
|
15909
15909
|
key: "addElements",
|
15910
15910
|
value: function addElements(e, t, i, s, r, o) {
|
15911
|
-
|
15911
|
+
G.addElements(e, t.elementRef);
|
15912
15912
|
var a = yt.create(),
|
15913
|
-
l =
|
15913
|
+
l = $.addButtons(a, i, s, o);
|
15914
15914
|
ms.set(t.inputElementRef, a, r.elementRef, l), yt.add(e, a);
|
15915
15915
|
}
|
15916
15916
|
}]);
|
@@ -15927,7 +15927,7 @@ var Ms = /*#__PURE__*/function () {
|
|
15927
15927
|
var r = new de(e, t, i);
|
15928
15928
|
t.websocket && q.createConnection(t, r);
|
15929
15929
|
var o = new Kt(e, r, t, s);
|
15930
|
-
return
|
15930
|
+
return G.addElements(s, r.elementRef, o.elementRef), s;
|
15931
15931
|
}
|
15932
15932
|
}, {
|
15933
15933
|
key: "render",
|
@@ -15973,7 +15973,7 @@ var _ = /*#__PURE__*/function (_ss) {
|
|
15973
15973
|
key: "onRender",
|
15974
15974
|
value: function onRender() {
|
15975
15975
|
var _this$_childElement;
|
15976
|
-
bi.attemptAppendStyleSheetToHead(this.style), te.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = ea.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (Ht.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Ht.applyDefaultStyleToComponent(this.style, this.chatStyle), te.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? gi.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof
|
15976
|
+
bi.attemptAppendStyleSheetToHead(this.style), te.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = ea.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (Ht.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Ht.applyDefaultStyleToComponent(this.style, this.chatStyle), te.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? gi.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof V) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Ms.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof V && K.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered || yi.onRender(this), this._hasBeenRendered = !0;
|
15977
15977
|
}
|
15978
15978
|
}, {
|
15979
15979
|
key: "disconnectedCallback",
|