deep-chat-dev 9.0.190 → 9.0.191
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 +11201 -11189
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +158 -152
- package/dist/views/chat/messages/messages.d.ts +1 -0
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -387,7 +387,7 @@ const dt = class dt {
|
|
387
387
|
}
|
388
388
|
};
|
389
389
|
dt.BUBBLE_CLASS = "deep-chat-loading-message-bubble", dt.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
|
390
|
-
let
|
390
|
+
let ke = dt;
|
391
391
|
const Sn = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20fill='%23000000'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2032%2032'%20xml:space='preserve'%3e%3cpath%20d='M23,30.36H9c-2.404,0-4.36-1.956-4.36-4.36V15c0-2.404,1.956-4.36,4.36-4.36h3.659%20c0.167-1.566,1.415-2.813,2.981-2.981V5.333c-1.131-0.174-2-1.154-2-2.333c0-1.301,1.059-2.36,2.36-2.36%20c1.302,0,2.36,1.059,2.36,2.36c0,1.179-0.869,2.159-2,2.333V7.66c1.566,0.167,2.814,1.415,2.981,2.981H23%20c2.404,0,4.36,1.956,4.36,4.36v11C27.36,28.404,25.404,30.36,23,30.36z%20M9,11.36c-2.007,0-3.64,1.633-3.64,3.64v11%20c0,2.007,1.633,3.64,3.64,3.64h14c2.007,0,3.64-1.633,3.64-3.64V15c0-2.007-1.633-3.64-3.64-3.64H9z%20M13.384,10.64h5.231%20C18.439,9.354,17.334,8.36,16,8.36C14.667,8.36,13.561,9.354,13.384,10.64z%20M16,1.36c-0.904,0-1.64,0.736-1.64,1.64%20S15.096,4.64,16,4.64c0.904,0,1.64-0.736,1.64-1.64S16.904,1.36,16,1.36z%20M20,27.36h-8c-1.301,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36h8c1.302,0,2.36,1.059,2.36,2.36S21.302,27.36,20,27.36z%20M12,23.36c-0.904,0-1.64,0.735-1.64,1.64%20s0.736,1.64,1.64,1.64h8c0.904,0,1.64-0.735,1.64-1.64s-0.735-1.64-1.64-1.64H12z%20M31,23.86h-2c-0.199,0-0.36-0.161-0.36-0.36V15%20c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5C31.36,23.699,31.199,23.86,31,23.86z%20M29.36,23.14h1.279v-7.78%20H29.36V23.14z%20M3,23.86H1c-0.199,0-0.36-0.161-0.36-0.36V15c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5%20C3.36,23.699,3.199,23.86,3,23.86z%20M1.36,23.14h1.28v-7.78H1.36V23.14z%20M20,20.36c-1.302,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36s2.36,1.059,2.36,2.36C22.36,19.302,21.302,20.36,20,20.36z%20M20,16.36c-0.904,0-1.64,0.736-1.64,1.64%20s0.735,1.64,1.64,1.64s1.64-0.735,1.64-1.64S20.904,16.36,20,16.36z%20M12,20.36c-1.301,0-2.36-1.059-2.36-2.36s1.059-2.36,2.36-2.36%20s2.36,1.059,2.36,2.36C14.36,19.302,13.301,20.36,12,20.36z%20M12,16.36c-0.904,0-1.64,0.736-1.64,1.64s0.736,1.64,1.64,1.64%20s1.64-0.735,1.64-1.64S12.904,16.36,12,16.36z'/%3e%3crect%20style='fill:none;'%20width='32'%20height='32'/%3e%3c/svg%3e", wn = "data:image/png;base64,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", Y = class Y {
|
392
392
|
static hide(e) {
|
393
393
|
var t;
|
@@ -491,7 +491,7 @@ const ce = class ce {
|
|
491
491
|
const a = ce.getLastElementsByClass(
|
492
492
|
t,
|
493
493
|
[ce.getRoleClass(s), o],
|
494
|
-
[
|
494
|
+
[ke.BUBBLE_CLASS]
|
495
495
|
), l = ce.getLastMessage(e, s, r);
|
496
496
|
return l && (l[r] = i), a;
|
497
497
|
}
|
@@ -566,7 +566,7 @@ const Cn = "deep-chat-temporary-message", Tn = "deep-chat-suggestion-button", Qi
|
|
566
566
|
}
|
567
567
|
}
|
568
568
|
}, As = Object.keys(Qi);
|
569
|
-
class
|
569
|
+
class Me {
|
570
570
|
static applySuggestionEvent(e, t) {
|
571
571
|
setTimeout(() => {
|
572
572
|
t.addEventListener("click", () => {
|
@@ -605,12 +605,12 @@ class Ae {
|
|
605
605
|
As.forEach((r) => {
|
606
606
|
const o = i.getElementsByClassName(r);
|
607
607
|
Array.from(o || []).forEach((a) => {
|
608
|
-
const l =
|
609
|
-
te.applyStylesToElement(a, l),
|
608
|
+
const l = Me.getProcessedStyles(t, a, r);
|
609
|
+
te.applyStylesToElement(a, l), Me.applyEvents(a, r);
|
610
610
|
});
|
611
611
|
});
|
612
612
|
const s = i.getElementsByClassName(Tn);
|
613
|
-
Array.from(s).forEach((r) =>
|
613
|
+
Array.from(s).forEach((r) => Me.applySuggestionEvent(e, r));
|
614
614
|
}
|
615
615
|
}
|
616
616
|
class te {
|
@@ -626,7 +626,7 @@ class te {
|
|
626
626
|
}
|
627
627
|
static applyClassUtilitiesToElement(e, t) {
|
628
628
|
const { events: i, styles: s } = t;
|
629
|
-
i && te.applyEventsToElement(e, i), s && !
|
629
|
+
i && te.applyEventsToElement(e, i), s && !Me.doesElementContainDeepChatClass(e) && te.applyStylesToElement(e, s);
|
630
630
|
}
|
631
631
|
static applyCustomClassUtilities(e, t) {
|
632
632
|
Object.keys(e).forEach((i) => {
|
@@ -637,7 +637,7 @@ class te {
|
|
637
637
|
});
|
638
638
|
}
|
639
639
|
static apply(e, t) {
|
640
|
-
|
640
|
+
Me.applyDeepChatUtilities(e, e.htmlClassUtilities, t), te.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
641
641
|
}
|
642
642
|
static traverseNodes(e, t) {
|
643
643
|
e.nodeType === Node.ELEMENT_NODE && t.push(e.outerHTML), e.childNodes.forEach((i) => {
|
@@ -651,7 +651,7 @@ class te {
|
|
651
651
|
}), s;
|
652
652
|
}
|
653
653
|
}
|
654
|
-
class
|
654
|
+
class De {
|
655
655
|
static addElement(e, t) {
|
656
656
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
657
657
|
}
|
@@ -671,8 +671,8 @@ class Ne {
|
|
671
671
|
if (c) return c;
|
672
672
|
r.status = !1;
|
673
673
|
}
|
674
|
-
const a =
|
675
|
-
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), ae.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o ||
|
674
|
+
const a = De.createElements(e, t, i, o);
|
675
|
+
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), ae.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o || De.addElement(e, a.outerContainer), a;
|
676
676
|
}
|
677
677
|
}
|
678
678
|
var Qt;
|
@@ -1538,7 +1538,7 @@ function sr(n, e) {
|
|
1538
1538
|
n.tokens[t].level === s && n.tokens[t].type === "paragraph_open" && (n.tokens[t + 2].tight = !0, n.tokens[t].tight = !0, t += 2);
|
1539
1539
|
}
|
1540
1540
|
function nr(n, e, t, i) {
|
1541
|
-
var s, r, o, a, l, c, d, h, u, f, m, p, y, x, j, V,
|
1541
|
+
var s, r, o, a, l, c, d, h, u, f, m, p, y, x, j, V, Le, R, X = !0, Z, D, Be, yt;
|
1542
1542
|
if ((h = Ps(n, e)) >= 0)
|
1543
1543
|
y = !0;
|
1544
1544
|
else if ((h = Ls(n, e)) >= 0)
|
@@ -1552,11 +1552,11 @@ function nr(n, e, t, i) {
|
|
1552
1552
|
for (j = n.tokens.length, y ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, h - d - 1)), n.tokens.push({
|
1553
1553
|
type: "ordered_list_open",
|
1554
1554
|
order: m,
|
1555
|
-
lines:
|
1555
|
+
lines: Le = [e, 0],
|
1556
1556
|
level: n.level++
|
1557
1557
|
})) : n.tokens.push({
|
1558
1558
|
type: "bullet_list_open",
|
1559
|
-
lines:
|
1559
|
+
lines: Le = [e, 0],
|
1560
1560
|
level: n.level++
|
1561
1561
|
}), s = e, V = !1, Z = n.parser.ruler.getRules("list"); s < t && (x = n.skipSpaces(h), u = n.eMarks[s], x >= u ? f = 1 : f = x - h, f > 4 && (f = 1), f < 1 && (f = 1), r = h - n.bMarks[s] + f, n.tokens.push({
|
1562
1562
|
type: "list_item_open",
|
@@ -1566,7 +1566,7 @@ function nr(n, e, t, i) {
|
|
1566
1566
|
type: "list_item_close",
|
1567
1567
|
level: --n.level
|
1568
1568
|
}), s = e = n.line, R[1] = s, x = n.bMarks[e], !(s >= t || n.isEmpty(s) || n.tShift[s] < n.blkIndent)); ) {
|
1569
|
-
for (yt = !1, D = 0,
|
1569
|
+
for (yt = !1, D = 0, Be = Z.length; D < Be; D++)
|
1570
1570
|
if (Z[D](n, s, t, !0)) {
|
1571
1571
|
yt = !0;
|
1572
1572
|
break;
|
@@ -1584,7 +1584,7 @@ function nr(n, e, t, i) {
|
|
1584
1584
|
return n.tokens.push({
|
1585
1585
|
type: y ? "ordered_list_close" : "bullet_list_close",
|
1586
1586
|
level: --n.level
|
1587
|
-
}),
|
1587
|
+
}), Le[1] = s, n.line = s, X && sr(n, j), !0;
|
1588
1588
|
}
|
1589
1589
|
function rr(n, e, t, i) {
|
1590
1590
|
var s, r, o, a, l, c = n.bMarks[e] + n.tShift[e], d = n.eMarks[e];
|
@@ -2685,7 +2685,7 @@ var no = {
|
|
2685
2685
|
function fn(n, e, t) {
|
2686
2686
|
this.src = e, this.env = t, this.options = n.options, this.tokens = [], this.inlineMode = !1, this.inline = n.inline, this.block = n.block, this.renderer = n.renderer, this.typographer = n.typographer;
|
2687
2687
|
}
|
2688
|
-
function
|
2688
|
+
function Re(n, e) {
|
2689
2689
|
typeof n != "string" && (e = n, n = "default"), e && e.linkify != null && console.warn(
|
2690
2690
|
`linkify option is removed. Use linkify plugin instead:
|
2691
2691
|
|
@@ -2695,10 +2695,10 @@ new Remarkable().use(linkify)
|
|
2695
2695
|
`
|
2696
2696
|
), this.inline = new ki(), this.block = new gs(), this.core = new hn(), this.renderer = new ms(), this.ruler = new se(), this.options = {}, this.configure(ao[n]), this.set(e || {});
|
2697
2697
|
}
|
2698
|
-
|
2698
|
+
Re.prototype.set = function(n) {
|
2699
2699
|
rn(this.options, n);
|
2700
2700
|
};
|
2701
|
-
|
2701
|
+
Re.prototype.configure = function(n) {
|
2702
2702
|
var e = this;
|
2703
2703
|
if (!n)
|
2704
2704
|
throw new Error("Wrong `remarkable` preset, check name/content");
|
@@ -2706,27 +2706,27 @@ ke.prototype.configure = function(n) {
|
|
2706
2706
|
n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
|
2707
2707
|
});
|
2708
2708
|
};
|
2709
|
-
|
2709
|
+
Re.prototype.use = function(n, e) {
|
2710
2710
|
return n(this, e), this;
|
2711
2711
|
};
|
2712
|
-
|
2712
|
+
Re.prototype.parse = function(n, e) {
|
2713
2713
|
var t = new fn(this, n, e);
|
2714
2714
|
return this.core.process(t), t.tokens;
|
2715
2715
|
};
|
2716
|
-
|
2716
|
+
Re.prototype.render = function(n, e) {
|
2717
2717
|
return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
|
2718
2718
|
};
|
2719
|
-
|
2719
|
+
Re.prototype.parseInline = function(n, e) {
|
2720
2720
|
var t = new fn(this, n, e);
|
2721
2721
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2722
2722
|
};
|
2723
|
-
|
2723
|
+
Re.prototype.renderInline = function(n, e) {
|
2724
2724
|
return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
|
2725
2725
|
};
|
2726
2726
|
class Dt {
|
2727
2727
|
static instantiate() {
|
2728
2728
|
const e = window.hljs;
|
2729
|
-
return e ? new
|
2729
|
+
return e ? new Re({
|
2730
2730
|
highlight: function(t, i) {
|
2731
2731
|
if (i && e.getLanguage(i))
|
2732
2732
|
try {
|
@@ -2753,7 +2753,7 @@ class Dt {
|
|
2753
2753
|
// set target to open in a new tab
|
2754
2754
|
typographer: !0
|
2755
2755
|
// Enable smartypants and other sweet transforms
|
2756
|
-
}) : new
|
2756
|
+
}) : new Re({
|
2757
2757
|
breaks: !0,
|
2758
2758
|
linkTarget: "_blank"
|
2759
2759
|
// set target to open in a new tab
|
@@ -2764,7 +2764,7 @@ class Dt {
|
|
2764
2764
|
return e.inline.validateLink = () => !0, e;
|
2765
2765
|
}
|
2766
2766
|
}
|
2767
|
-
const
|
2767
|
+
const xe = class xe {
|
2768
2768
|
// prettier-ignore
|
2769
2769
|
static addMessage(e, t, i, s, r) {
|
2770
2770
|
var o;
|
@@ -2772,13 +2772,13 @@ const Ee = class Ee {
|
|
2772
2772
|
}
|
2773
2773
|
static wrapInLink(e, t, i) {
|
2774
2774
|
const s = document.createElement("a");
|
2775
|
-
return s.href = t, s.download = i ||
|
2775
|
+
return s.href = t, s.download = i || xe.DEFAULT_FILE_NAME, s.target = "_blank", s.appendChild(e), s;
|
2776
2776
|
}
|
2777
2777
|
static isNonLinkableDataUrl(e, t) {
|
2778
2778
|
return !t.startsWith("data") || e === "image" ? !1 : e === "any" && t.startsWith("data:text/javascript") || !t.startsWith("data:image") && !t.startsWith("data:application");
|
2779
2779
|
}
|
2780
2780
|
static processContent(e, t, i, s) {
|
2781
|
-
return !i ||
|
2781
|
+
return !i || xe.isNonLinkableDataUrl(e, i) ? t : xe.wrapInLink(t, i, s);
|
2782
2782
|
}
|
2783
2783
|
static waitToLoadThenScroll(e) {
|
2784
2784
|
setTimeout(() => {
|
@@ -2787,12 +2787,12 @@ const Ee = class Ee {
|
|
2787
2787
|
}
|
2788
2788
|
static scrollDownOnImageLoad(e, t) {
|
2789
2789
|
if (e.startsWith("data"))
|
2790
|
-
|
2790
|
+
xe.waitToLoadThenScroll(t);
|
2791
2791
|
else
|
2792
2792
|
try {
|
2793
2793
|
fetch(e, { mode: "no-cors" }).catch(() => {
|
2794
2794
|
}).finally(() => {
|
2795
|
-
|
2795
|
+
xe.waitToLoadThenScroll(t);
|
2796
2796
|
});
|
2797
2797
|
} catch {
|
2798
2798
|
t.scrollTop = t.scrollHeight;
|
@@ -2819,14 +2819,14 @@ const Ee = class Ee {
|
|
2819
2819
|
}
|
2820
2820
|
static isImageFile(e) {
|
2821
2821
|
const { type: t, src: i } = e;
|
2822
|
-
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i &&
|
2822
|
+
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i && xe.isImageFileExtension(i);
|
2823
2823
|
}
|
2824
2824
|
static isImageFileExtension(e) {
|
2825
2825
|
return /\.(jpg|jpeg|png|gif|bmp)$/i.test(e);
|
2826
2826
|
}
|
2827
2827
|
};
|
2828
|
-
|
2829
|
-
let B =
|
2828
|
+
xe.DEFAULT_FILE_NAME = "file";
|
2829
|
+
let B = xe;
|
2830
2830
|
class ai {
|
2831
2831
|
static onMessage(e, t, i) {
|
2832
2832
|
var r;
|
@@ -2852,7 +2852,7 @@ const F = class F {
|
|
2852
2852
|
return e.classList.add("loading-history"), e.appendChild(document.createElement("div")), e.appendChild(document.createElement("div")), e.appendChild(document.createElement("div")), e.appendChild(document.createElement("div")), e;
|
2853
2853
|
}
|
2854
2854
|
static apply(e, t, i) {
|
2855
|
-
|
2855
|
+
ke.setRing(t.bubbleElement, i == null ? void 0 : i.bubble), i != null && i.bubble && (i = JSON.parse(JSON.stringify(i)), delete i.bubble), e.applyCustomStyles(t, "history", !1, i);
|
2856
2856
|
}
|
2857
2857
|
static addLoadHistoryMessage(e, t, i = !0) {
|
2858
2858
|
var o, a, l, c, d, h, u, f;
|
@@ -2868,7 +2868,7 @@ const F = class F {
|
|
2868
2868
|
}
|
2869
2869
|
static addMessage(e, t = !0) {
|
2870
2870
|
var r, o, a, l;
|
2871
|
-
const i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html, s = i ?
|
2871
|
+
const i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html, s = i ? De.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
|
2872
2872
|
return F.addLoadHistoryMessage(s, e, t), s;
|
2873
2873
|
}
|
2874
2874
|
static changeFullViewToSmall(e, t) {
|
@@ -2917,9 +2917,9 @@ class q {
|
|
2917
2917
|
}), s;
|
2918
2918
|
}
|
2919
2919
|
}
|
2920
|
-
class
|
2920
|
+
class Ne {
|
2921
2921
|
constructor(e) {
|
2922
|
-
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef =
|
2922
|
+
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = Ne.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = Dt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onMessage = ai.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(() => {
|
2923
2923
|
this.submitUserMessage = e.submitUserMessage;
|
2924
2924
|
});
|
2925
2925
|
}
|
@@ -2969,22 +2969,22 @@ class Oe {
|
|
2969
2969
|
var r;
|
2970
2970
|
(r = this._introPanel) == null || r.hide();
|
2971
2971
|
const s = this.messageElementRefs[this.messageElementRefs.length - 1];
|
2972
|
-
return Xe.changeFullViewToSmall(this, s),
|
2972
|
+
return Xe.changeFullViewToSmall(this, s), Ne.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
|
2973
2973
|
}
|
2974
2974
|
// this can be tested by having an ai message, then a temp ai message with html that submits new user message:
|
2975
2975
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/258
|
2976
2976
|
// prettier-ignore
|
2977
2977
|
revealRoleElementsIfTempRemoved(e, t) {
|
2978
|
-
if ((this._avatars || this._names) &&
|
2978
|
+
if ((this._avatars || this._names) && Me.isElementTemporary(e)) {
|
2979
2979
|
const i = this.messageElementRefs[this.messageElementRefs.length - 2];
|
2980
2980
|
i && this.messages[this.messages.length - 1] && !e.bubbleElement.classList.contains(b.getRoleClass(t)) && b.revealRoleElements(i.innerContainer, this._avatars, this._names);
|
2981
2981
|
}
|
2982
2982
|
}
|
2983
2983
|
static isTemporaryElement(e) {
|
2984
|
-
return
|
2984
|
+
return Ne.isLoadingMessage(e) || Me.isElementTemporary(e);
|
2985
2985
|
}
|
2986
2986
|
createMessageElements(e, t, i = !1) {
|
2987
|
-
const s =
|
2987
|
+
const s = Ne.createBaseElements(), { outerContainer: r, innerContainer: o, bubbleElement: a } = s;
|
2988
2988
|
return r.appendChild(o), this.addInnerContainerElements(a, e, t), b.updateRefArr(this.messageElementRefs, s, i), s;
|
2989
2989
|
}
|
2990
2990
|
static createBaseElements() {
|
@@ -3023,7 +3023,7 @@ class Oe {
|
|
3023
3023
|
return (e = b.getLastMessageBubbleElement(this.elementRef)) == null ? void 0 : e.classList.contains("error-message-text");
|
3024
3024
|
}
|
3025
3025
|
static isLoadingMessage(e) {
|
3026
|
-
return e == null ? void 0 : e.bubbleElement.classList.contains(
|
3026
|
+
return e == null ? void 0 : e.bubbleElement.classList.contains(ke.BUBBLE_CLASS);
|
3027
3027
|
}
|
3028
3028
|
sendClientUpdate(e, t = !1) {
|
3029
3029
|
var i;
|
@@ -3039,7 +3039,7 @@ class Oe {
|
|
3039
3039
|
});
|
3040
3040
|
}
|
3041
3041
|
}
|
3042
|
-
const
|
3042
|
+
const _e = class _e {
|
3043
3043
|
// used for extracting at end and for isStreaming
|
3044
3044
|
constructor(e) {
|
3045
3045
|
this._fileAdded = !1, this._streamedContent = "", this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
|
@@ -3060,7 +3060,7 @@ const Le = class Le {
|
|
3060
3060
|
i && J.scrollToBottom(this._messages.elementRef);
|
3061
3061
|
}
|
3062
3062
|
setInitialState(e, t, i) {
|
3063
|
-
this._streamType = e, i ?? (i = b.AI_ROLE), this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
3063
|
+
this._streamType = e, i ?? (i = b.AI_ROLE), this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : De.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(_e.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i, this._message = { role: this._activeMessageRole, [e]: this._streamedContent }, this._messages.messages.push(this._message);
|
3064
3064
|
}
|
3065
3065
|
updateBasedOnType(e, t, i, s = !1) {
|
3066
3066
|
b.unfillEmptyMessageElement(i, e), (t === "text" ? this.updateText : this.updateHTML).bind(this)(e, i, s);
|
@@ -3073,7 +3073,7 @@ const Le = class Le {
|
|
3073
3073
|
this._streamedContent = e, t.innerHTML = e;
|
3074
3074
|
else {
|
3075
3075
|
const s = document.createElement("span");
|
3076
|
-
s.innerHTML = e, t.appendChild(s), this._streamedContent =
|
3076
|
+
s.innerHTML = e, t.appendChild(s), this._streamedContent = _e.HTML_CONTENT_PLACEHOLDER;
|
3077
3077
|
}
|
3078
3078
|
}
|
3079
3079
|
finaliseStreamedMessage() {
|
@@ -3081,7 +3081,7 @@ const Le = class Le {
|
|
3081
3081
|
const { textElementsToText: e } = this._messages;
|
3082
3082
|
if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
|
3083
3083
|
if (!this._elements) throw Error(k.NO_VALID_STREAM_EVENTS_SENT);
|
3084
|
-
(t = this._elements.bubbleElement) != null && t.classList.contains(
|
3084
|
+
(t = this._elements.bubbleElement) != null && t.classList.contains(_e.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && ft.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === _e.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && te.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._elements.bubbleElement.classList.remove(_e.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(Ne.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
3085
3085
|
}
|
3086
3086
|
}
|
3087
3087
|
markFileAdded() {
|
@@ -3098,8 +3098,8 @@ const Le = class Le {
|
|
3098
3098
|
i && this.updateBasedOnType(i, "text", (r = this._elements) == null ? void 0 : r.bubbleElement, !0), this._endStreamAfterOperation = !1, this.finaliseStreamedMessage(), s && e.addNewMessage({ files: s });
|
3099
3099
|
}
|
3100
3100
|
};
|
3101
|
-
|
3102
|
-
let ge =
|
3101
|
+
_e.MESSAGE_CLASS = "streamed-message", _e.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3102
|
+
let ge = _e;
|
3103
3103
|
const Ge = class Ge {
|
3104
3104
|
// need to pass stringifyBody boolean separately as binding is throwing an error for some reason
|
3105
3105
|
// prettier-ignore
|
@@ -3242,13 +3242,13 @@ function mo(n, e) {
|
|
3242
3242
|
t == null || t.addEventListener("abort", () => {
|
3243
3243
|
j(), h();
|
3244
3244
|
});
|
3245
|
-
const V = c ?? window.fetch,
|
3245
|
+
const V = c ?? window.fetch, Le = s ?? go;
|
3246
3246
|
async function R() {
|
3247
3247
|
var X;
|
3248
3248
|
m = new AbortController();
|
3249
3249
|
try {
|
3250
3250
|
const Z = await V(n, Object.assign(Object.assign({}, d), { headers: f, signal: m.signal }));
|
3251
|
-
await
|
3251
|
+
await Le(Z), await lo(Z.body, co(ho((D) => {
|
3252
3252
|
D ? f[Bs] = D : delete f[Bs];
|
3253
3253
|
}, (D) => {
|
3254
3254
|
y = D;
|
@@ -3274,16 +3274,16 @@ function go(n) {
|
|
3274
3274
|
class T {
|
3275
3275
|
// prettier-ignore
|
3276
3276
|
static async request(e, t, i, s = !0, r = !1) {
|
3277
|
-
var p, y, x, j, V,
|
3277
|
+
var p, y, x, j, V, Le;
|
3278
3278
|
const o = { body: t, headers: (p = e.connectSettings) == null ? void 0 : p.headers }, { body: a, headers: l, error: c } = await v.processRequestInterceptor(e.deepChat, o), { onOpen: d, onClose: h, abortStream: u } = e.streamHandlers;
|
3279
3279
|
if (c) return v.onInterceptorError(i, c, h);
|
3280
|
-
if ((y = e.connectSettings) != null && y.handler) return
|
3280
|
+
if ((y = e.connectSettings) != null && y.handler) return Te.stream(e, a, i);
|
3281
3281
|
if (((x = e.connectSettings) == null ? void 0 : x.url) === be.URL) return be.requestStream(i, e.streamHandlers);
|
3282
3282
|
const f = new ge(i), m = v.fetch.bind(this, e, l, s);
|
3283
3283
|
return mo(((j = e.connectSettings) == null ? void 0 : j.url) || e.url || "", {
|
3284
3284
|
method: ((V = e.connectSettings) == null ? void 0 : V.method) || "POST",
|
3285
3285
|
headers: l,
|
3286
|
-
credentials: (
|
3286
|
+
credentials: (Le = e.connectSettings) == null ? void 0 : Le.credentials,
|
3287
3287
|
body: s ? JSON.stringify(a) : a,
|
3288
3288
|
openWhenHidden: !0,
|
3289
3289
|
// keep stream open when browser tab not open
|
@@ -3295,16 +3295,16 @@ class T {
|
|
3295
3295
|
async onmessage(R) {
|
3296
3296
|
var X, Z, D;
|
3297
3297
|
if (JSON.stringify(R.data) !== JSON.stringify("[DONE]")) {
|
3298
|
-
let
|
3298
|
+
let Be;
|
3299
3299
|
try {
|
3300
|
-
|
3300
|
+
Be = JSON.parse(R.data);
|
3301
3301
|
} catch {
|
3302
|
-
|
3302
|
+
Be = {};
|
3303
3303
|
}
|
3304
|
-
const yt = await ((Z = (X = e.deepChat).responseInterceptor) == null ? void 0 : Z.call(X,
|
3305
|
-
(D = e.extractResultData) == null || D.call(e, yt, m, a).then((
|
3306
|
-
e.asyncCallInProgress &&
|
3307
|
-
}).catch((
|
3304
|
+
const yt = await ((Z = (X = e.deepChat).responseInterceptor) == null ? void 0 : Z.call(X, Be)) || Be;
|
3305
|
+
(D = e.extractResultData) == null || D.call(e, yt, m, a).then((Ue) => {
|
3306
|
+
e.asyncCallInProgress && Ue && Ue.text !== "" ? (T.simulate(i, e.streamHandlers, Ue), h(), e.asyncCallInProgress = !1) : T.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, Ue);
|
3307
|
+
}).catch((Ue) => v.displayError(i, Ue));
|
3308
3308
|
}
|
3309
3309
|
},
|
3310
3310
|
onerror(R) {
|
@@ -3425,7 +3425,7 @@ class U {
|
|
3425
3425
|
if (!U.isElementPresentInDOM(e.deepChat)) return;
|
3426
3426
|
const i = e.connectSettings.websocket;
|
3427
3427
|
if (i) {
|
3428
|
-
if (e.connectSettings.handler) return
|
3428
|
+
if (e.connectSettings.handler) return Te.websocket(e, t);
|
3429
3429
|
try {
|
3430
3430
|
const s = typeof i != "boolean" ? i : void 0, r = new WebSocket(e.connectSettings.url || "", s);
|
3431
3431
|
e.websocket = r, e.websocket.onopen = () => {
|
@@ -3495,7 +3495,7 @@ class U {
|
|
3495
3495
|
T.simulate(t, e.streamHandlers, s);
|
3496
3496
|
}
|
3497
3497
|
}
|
3498
|
-
class
|
3498
|
+
class Te {
|
3499
3499
|
static async request(e, t, i) {
|
3500
3500
|
var a, l;
|
3501
3501
|
let s = !0;
|
@@ -3505,13 +3505,13 @@ class we {
|
|
3505
3505
|
s = !1;
|
3506
3506
|
const d = await ((u = (h = e.deepChat).responseInterceptor) == null ? void 0 : u.call(h, c)) || c;
|
3507
3507
|
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : T.isSimulatable(e.stream, d) ? T.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(k.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
3508
|
-
}, o =
|
3508
|
+
}, o = Te.generateOptionalSignals();
|
3509
3509
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, { ...o, onResponse: r });
|
3510
3510
|
}
|
3511
3511
|
static attemptToFinaliseStream(e, t) {
|
3512
3512
|
try {
|
3513
3513
|
const i = t.messageElementRefs[t.messageElementRefs.length - 1];
|
3514
|
-
|
3514
|
+
Ne.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
|
3515
3515
|
} catch (i) {
|
3516
3516
|
console.error(i), t.addNewErrorMessage("service", i);
|
3517
3517
|
}
|
@@ -3523,7 +3523,7 @@ class we {
|
|
3523
3523
|
const o = new ge(i), a = () => {
|
3524
3524
|
r || !s || (e.streamHandlers.onOpen(), r = !0);
|
3525
3525
|
}, l = () => {
|
3526
|
-
s && (
|
3526
|
+
s && (Te.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1);
|
3527
3527
|
}, c = async (f) => {
|
3528
3528
|
var p, y;
|
3529
3529
|
if (!s) return;
|
@@ -3531,9 +3531,9 @@ class we {
|
|
3531
3531
|
v.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), s = !1) : T.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(k.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
|
3532
3532
|
};
|
3533
3533
|
e.streamHandlers.abortStream.abort = () => {
|
3534
|
-
|
3534
|
+
Te.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1;
|
3535
3535
|
};
|
3536
|
-
const d =
|
3536
|
+
const d = Te.generateOptionalSignals();
|
3537
3537
|
(u = (h = e.connectSettings).handler) == null || u.call(
|
3538
3538
|
h,
|
3539
3539
|
t,
|
@@ -3563,7 +3563,7 @@ class we {
|
|
3563
3563
|
T.upsertWFiles(t, m, p, d);
|
3564
3564
|
} else
|
3565
3565
|
t.addNewMessage(h);
|
3566
|
-
}, a =
|
3566
|
+
}, a = Te.generateOptionalSignals();
|
3567
3567
|
(c = (l = e.connectSettings).handler) == null || c.call(
|
3568
3568
|
l,
|
3569
3569
|
void 0,
|
@@ -3584,7 +3584,7 @@ class C {
|
|
3584
3584
|
var u, f, m;
|
3585
3585
|
const r = { body: t, headers: (u = e.connectSettings) == null ? void 0 : u.headers }, { body: o, headers: a, error: l } = await v.processRequestInterceptor(e.deepChat, r), { onFinish: c } = e.completionsHandlers;
|
3586
3586
|
if (l) return v.onInterceptorError(i, l, c);
|
3587
|
-
if ((f = e.connectSettings) != null && f.handler) return
|
3587
|
+
if ((f = e.connectSettings) != null && f.handler) return Te.request(e, o, i);
|
3588
3588
|
if (((m = e.connectSettings) == null ? void 0 : m.url) === be.URL) return be.request(e, i);
|
3589
3589
|
let d = !0;
|
3590
3590
|
const h = v.fetch.bind(this, e, a, s);
|
@@ -3902,16 +3902,16 @@ class li {
|
|
3902
3902
|
e._propUpdated_ = !0, e._waitingToRender_ || (e._waitingToRender_ = !0, li.waitForPropertiesToBeUpdatedBeforeRender(e));
|
3903
3903
|
}
|
3904
3904
|
}
|
3905
|
-
const
|
3905
|
+
const Se = class Se extends HTMLElement {
|
3906
3906
|
// If this is not working, try using propertyName directly
|
3907
3907
|
constructor() {
|
3908
|
-
super(), this._waitingToRender_ = !1, this._propUpdated_ = !1, Object.keys(
|
3909
|
-
const t =
|
3908
|
+
super(), this._waitingToRender_ = !1, this._propUpdated_ = !1, Object.keys(Se._attributeToProperty_).forEach((e) => {
|
3909
|
+
const t = Se._attributeToProperty_[e];
|
3910
3910
|
this.constructPropertyAccessors(t), this.hasOwnProperty(e) || this.constructPropertyAccessors(t, e);
|
3911
3911
|
});
|
3912
3912
|
}
|
3913
3913
|
static get observedAttributes() {
|
3914
|
-
return Object.keys(
|
3914
|
+
return Object.keys(Se._attributes_) || [];
|
3915
3915
|
}
|
3916
3916
|
// need to be called here as accessors need to be set for the class instance
|
3917
3917
|
constructPropertyAccessors(e, t) {
|
@@ -3927,14 +3927,14 @@ const xe = class xe extends HTMLElement {
|
|
3927
3927
|
}
|
3928
3928
|
attributeChangedCallback(e, t, i) {
|
3929
3929
|
if (t === i) return;
|
3930
|
-
const s =
|
3930
|
+
const s = Se._attributes_[e](i), r = Se._attributeToProperty_[e];
|
3931
3931
|
this[r] = s;
|
3932
3932
|
}
|
3933
3933
|
onRender() {
|
3934
3934
|
}
|
3935
3935
|
};
|
3936
|
-
|
3937
|
-
let ss =
|
3936
|
+
Se._attributes_ = {}, Se._attributeToProperty_ = {};
|
3937
|
+
let ss = Se;
|
3938
3938
|
const bo = `<?xml version="1.0" standalone="no"?>
|
3939
3939
|
<svg version="1.1"
|
3940
3940
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
@@ -3977,10 +3977,10 @@ class ie {
|
|
3977
3977
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
3978
3978
|
}
|
3979
3979
|
}
|
3980
|
-
const
|
3980
|
+
const Oe = class Oe {
|
3981
3981
|
// prettier-ignore
|
3982
3982
|
static changeVisibility(e, t, i, s) {
|
3983
|
-
s.target.id ===
|
3983
|
+
s.target.id === Oe.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
|
3984
3984
|
}
|
3985
3985
|
static createIconElement(e, t) {
|
3986
3986
|
const i = ie.createSVGElement(e);
|
@@ -3990,10 +3990,10 @@ const Pe = class Pe {
|
|
3990
3990
|
static create(e) {
|
3991
3991
|
const t = document.createElement("div");
|
3992
3992
|
t.id = "visibility-icon-container";
|
3993
|
-
const i =
|
3993
|
+
const i = Oe.createIconElement(vo, Oe.VISIBLE_ICON_ID);
|
3994
3994
|
i.style.display = "none", t.appendChild(i);
|
3995
|
-
const s =
|
3996
|
-
return t.appendChild(s), t.onclick =
|
3995
|
+
const s = Oe.createIconElement(bo, "not-visible-icon");
|
3996
|
+
return t.appendChild(s), t.onclick = Oe.changeVisibility.bind(
|
3997
3997
|
this,
|
3998
3998
|
e,
|
3999
3999
|
i,
|
@@ -4001,8 +4001,8 @@ const Pe = class Pe {
|
|
4001
4001
|
), t;
|
4002
4002
|
}
|
4003
4003
|
};
|
4004
|
-
|
4005
|
-
let ns =
|
4004
|
+
Oe.VISIBLE_ICON_ID = "visible-icon";
|
4005
|
+
let ns = Oe;
|
4006
4006
|
class H {
|
4007
4007
|
static createCautionText() {
|
4008
4008
|
const e = document.createElement("a");
|
@@ -4527,8 +4527,8 @@ const Rt = class Rt extends z {
|
|
4527
4527
|
}
|
4528
4528
|
};
|
4529
4529
|
Rt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
4530
|
-
let
|
4531
|
-
class Gt extends
|
4530
|
+
let Ie = Rt;
|
4531
|
+
class Gt extends Ie {
|
4532
4532
|
// prettier-ignore
|
4533
4533
|
constructor(e, t, i, s, r, o) {
|
4534
4534
|
super(e, t, i, s, r, o), this.isTextInputDisabled = !0, this.canSendMessage = Gt.canSendFile;
|
@@ -4699,7 +4699,7 @@ class xo extends Gt {
|
|
4699
4699
|
return { text: e.text || "" };
|
4700
4700
|
}
|
4701
4701
|
}
|
4702
|
-
class _o extends
|
4702
|
+
class _o extends Ie {
|
4703
4703
|
constructor(e) {
|
4704
4704
|
var s, r, o;
|
4705
4705
|
const t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.textGeneration, i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
@@ -4711,7 +4711,7 @@ class _o extends Me {
|
|
4711
4711
|
return { text: ((t = e[0]) == null ? void 0 : t.generated_text) || "" };
|
4712
4712
|
}
|
4713
4713
|
}
|
4714
|
-
class So extends
|
4714
|
+
class So extends Ie {
|
4715
4715
|
constructor(e) {
|
4716
4716
|
var s, r, o;
|
4717
4717
|
const t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.questionAnswer, i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
@@ -4729,7 +4729,7 @@ class So extends Me {
|
|
4729
4729
|
return { text: e.answer || "" };
|
4730
4730
|
}
|
4731
4731
|
}
|
4732
|
-
class wo extends
|
4732
|
+
class wo extends Ie {
|
4733
4733
|
constructor(e) {
|
4734
4734
|
var s, r, o;
|
4735
4735
|
const t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.summarization, i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
@@ -4741,7 +4741,7 @@ class wo extends Me {
|
|
4741
4741
|
return { text: ((t = e[0]) == null ? void 0 : t.summary_text) || "" };
|
4742
4742
|
}
|
4743
4743
|
}
|
4744
|
-
class Co extends
|
4744
|
+
class Co extends Ie {
|
4745
4745
|
constructor(e) {
|
4746
4746
|
var s, r, o;
|
4747
4747
|
const t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.conversation, i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
@@ -4812,7 +4812,7 @@ class fi extends Mi {
|
|
4812
4812
|
return { files: e.artifacts.map((i) => ({ src: `${Wt}${i.base64}`, type: "image" })) };
|
4813
4813
|
}
|
4814
4814
|
}
|
4815
|
-
class To extends
|
4815
|
+
class To extends Ie {
|
4816
4816
|
constructor(e) {
|
4817
4817
|
var s, r, o;
|
4818
4818
|
const t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.translation, i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
@@ -4855,7 +4855,7 @@ class pi extends Mi {
|
|
4855
4855
|
return { files: e.artifacts.map((i) => ({ src: `${Wt}${i.base64}`, type: "image" })) };
|
4856
4856
|
}
|
4857
4857
|
}
|
4858
|
-
class Ao extends
|
4858
|
+
class Ao extends Ie {
|
4859
4859
|
constructor(e) {
|
4860
4860
|
var s, r, o;
|
4861
4861
|
const t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.fillMask, i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
@@ -6052,14 +6052,14 @@ const Fo = `<?xml version="1.0" encoding="iso-8859-1"?>
|
|
6052
6052
|
</g>
|
6053
6053
|
</g>
|
6054
6054
|
</svg>`;
|
6055
|
-
class
|
6055
|
+
class Pe {
|
6056
6056
|
static createImage(e, t, i) {
|
6057
6057
|
const s = new Image();
|
6058
6058
|
return s.src = e.src, i || B.scrollDownOnImageLoad(s.src, t), B.processContent("image", s, s.src, e.name);
|
6059
6059
|
}
|
6060
6060
|
// WORK - image still does not scroll down when loaded
|
6061
6061
|
static async addNewImageMessage(e, t, i, s) {
|
6062
|
-
const r =
|
6062
|
+
const r = Pe.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
|
6063
6063
|
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"), B.addMessage(e, o, "image", i, s);
|
6064
6064
|
}
|
6065
6065
|
static createAudioElement(e, t) {
|
@@ -6069,7 +6069,7 @@ class Ie {
|
|
6069
6069
|
)), i;
|
6070
6070
|
}
|
6071
6071
|
static addNewAudioMessage(e, t, i, s) {
|
6072
|
-
const r =
|
6072
|
+
const r = Pe.createAudioElement(t, i), o = e.createMessageElementsOnOrientation("", i, s);
|
6073
6073
|
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), B.addMessage(e, o, "audio", i, s);
|
6074
6074
|
}
|
6075
6075
|
static createAnyFile(e) {
|
@@ -6083,22 +6083,22 @@ class Ie {
|
|
6083
6083
|
return r.classList.add("any-file-message-text"), r.textContent = e.name || B.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), B.processContent("any", t, e.src, r.textContent);
|
6084
6084
|
}
|
6085
6085
|
static addNewAnyFileMessage(e, t, i, s) {
|
6086
|
-
const r = e.createMessageElementsOnOrientation("", i, s), o =
|
6086
|
+
const r = e.createMessageElementsOnOrientation("", i, s), o = Pe.createAnyFile(t);
|
6087
6087
|
r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o), B.addMessage(e, r, "file", i, s);
|
6088
6088
|
}
|
6089
6089
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
6090
6090
|
static addMessages(e, t, i, s) {
|
6091
6091
|
t.forEach((r) => {
|
6092
|
-
r.ref && (r = B.removeFileRef(r)), B.isAudioFile(r) ?
|
6092
|
+
r.ref && (r = B.removeFileRef(r)), B.isAudioFile(r) ? Pe.addNewAudioMessage(e, r, i, s) : B.isImageFile(r) ? Pe.addNewImageMessage(e, r, i, s) : Pe.addNewAnyFileMessage(e, r, i, s);
|
6093
6093
|
});
|
6094
6094
|
}
|
6095
6095
|
}
|
6096
|
-
class
|
6096
|
+
class Ee extends Ne {
|
6097
6097
|
constructor(e, t, i) {
|
6098
6098
|
var a, l;
|
6099
6099
|
super(e);
|
6100
6100
|
const { permittedErrorPrefixes: s, introPanelMarkUp: r, demo: o } = t;
|
6101
|
-
this._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, this._onClearMessages = ai.onClearMessages.bind(this, e), this._onError = ai.onError.bind(this, e), this._displayLoadingMessage =
|
6101
|
+
this._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, this._onClearMessages = ai.onClearMessages.bind(this, e), this._onError = ai.onError.bind(this, e), this._displayLoadingMessage = Ee.getDisplayLoadingMessage(e, t), this._permittedErrorPrefixes = s, this.addSetupMessageIfNeeded(e, t) || this.populateIntroPanel(i, r, e.introPanelStyle), this.addIntroductoryMessages(e, t), new Ft(e, this, t), this._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = () => JSON.parse(JSON.stringify(this.messages)), e.clearMessages = this.clearMessages.bind(this, t), e.refreshMessages = this.refreshTextMessages.bind(this), e.scrollToBottom = J.scrollToBottom.bind(this, this.elementRef), e.addMessage = (c, d) => {
|
6102
6102
|
this.addAnyMessage({ ...c, sendUpdate: !!d }, !d);
|
6103
6103
|
}, t.isWebModel() && t.setUpMessages(this), o && this.prepareDemo(o), e.textToSpeech && ft.processConfig(e.textToSpeech, (c) => {
|
6104
6104
|
this.textToSpeech = c;
|
@@ -6129,7 +6129,7 @@ class Ue extends Oe {
|
|
6129
6129
|
addIntroductoryMessage(e) {
|
6130
6130
|
var i;
|
6131
6131
|
let t;
|
6132
|
-
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t =
|
6132
|
+
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t = De.add(this, e.html, b.AI_ROLE, this.messageElementRefs)), t && (this.applyCustomStyles(t, b.AI_ROLE, !1, (i = this.messageStyles) == null ? void 0 : i.intro), t.outerContainer.classList.add("deep-chat-intro"));
|
6133
6133
|
}
|
6134
6134
|
removeIntroductoryMessage() {
|
6135
6135
|
const e = this.messageElementRefs[0];
|
@@ -6140,10 +6140,10 @@ class Ue extends Oe {
|
|
6140
6140
|
}
|
6141
6141
|
// this should not be activated by streamed messages
|
6142
6142
|
addNewMessage(e, t = !1, i = !1) {
|
6143
|
-
const s =
|
6144
|
-
if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && ft.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) &&
|
6145
|
-
const o =
|
6146
|
-
|
6143
|
+
const s = Ee.createMessageContent(e), r = { status: e.overwrite };
|
6144
|
+
if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && ft.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) && Pe.addMessages(this, s.files, s.role, i), s.html !== void 0 && s.html !== null) {
|
6145
|
+
const o = De.add(this, s.html, s.role, this.messageElementRefs, r, i);
|
6146
|
+
Me.isElementTemporary(o) && delete s.html;
|
6147
6147
|
}
|
6148
6148
|
return this.isValidMessageContent(s) && !i && this.updateStateOnMessage(s, e.overwrite, e.sendUpdate, t), s;
|
6149
6149
|
}
|
@@ -6156,7 +6156,7 @@ class Ue extends Oe {
|
|
6156
6156
|
// prettier-ignore
|
6157
6157
|
removeMessageOnError() {
|
6158
6158
|
const e = this.messageElementRefs[this.messageElementRefs.length - 1], t = e == null ? void 0 : e.bubbleElement;
|
6159
|
-
(t != null && t.classList.contains(ge.MESSAGE_CLASS) && t.textContent === "" ||
|
6159
|
+
(t != null && t.classList.contains(ge.MESSAGE_CLASS) && t.textContent === "" || Ee.isTemporaryElement(e)) && this.removeLastMessage();
|
6160
6160
|
}
|
6161
6161
|
// prettier-ignore
|
6162
6162
|
addNewErrorMessage(e, t, i = !1) {
|
@@ -6179,13 +6179,13 @@ class Ue extends Oe {
|
|
6179
6179
|
}
|
6180
6180
|
getPermittedMessage(e) {
|
6181
6181
|
if (e) {
|
6182
|
-
const t =
|
6182
|
+
const t = Ee.extractErrorMessages(e);
|
6183
6183
|
for (let i = 0; i < t.length; i += 1) {
|
6184
6184
|
const s = t[i];
|
6185
6185
|
if (typeof s == "string") {
|
6186
6186
|
if (this._displayServiceErrorMessages) return s;
|
6187
6187
|
if (this._permittedErrorPrefixes) {
|
6188
|
-
const r =
|
6188
|
+
const r = Ee.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, s);
|
6189
6189
|
if (r) return r;
|
6190
6190
|
}
|
6191
6191
|
}
|
@@ -6197,15 +6197,15 @@ class Ue extends Oe {
|
|
6197
6197
|
}
|
6198
6198
|
addDefaultLoadingMessage() {
|
6199
6199
|
const e = this.createMessageElements("", b.AI_ROLE), { bubbleElement: t } = e;
|
6200
|
-
e.bubbleElement.classList.add(
|
6200
|
+
e.bubbleElement.classList.add(ke.DOTS_CONTAINER_CLASS);
|
6201
6201
|
const i = document.createElement("div");
|
6202
|
-
return i.classList.add("loading-message-dots"), t.appendChild(i),
|
6202
|
+
return i.classList.add("loading-message-dots"), t.appendChild(i), ke.setDots(t, this.messageStyles), e;
|
6203
6203
|
}
|
6204
6204
|
addLoadingMessage() {
|
6205
6205
|
var i, s, r, o, a, l;
|
6206
6206
|
if (!this._displayLoadingMessage) return;
|
6207
|
-
const e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html, t = e ?
|
6208
|
-
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(
|
6207
|
+
const e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html, t = e ? De.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
6208
|
+
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(ke.BUBBLE_CLASS), this.applyCustomStyles(t, b.AI_ROLE, !1, (l = (a = (o = this.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.message) == null ? void 0 : l.styles), J.scrollToBottom(this.elementRef);
|
6209
6209
|
}
|
6210
6210
|
populateIntroPanel(e, t, i) {
|
6211
6211
|
(e || t) && (this._introPanel = new bi(e, t, i), this._introPanel._elementRef && (te.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
@@ -6225,18 +6225,24 @@ class Ue extends Oe {
|
|
6225
6225
|
}))
|
6226
6226
|
);
|
6227
6227
|
}
|
6228
|
+
static isActiveElement(e) {
|
6229
|
+
return e.contains(ke.BUBBLE_CLASS) || e.contains(Xe.CLASS) || e.contains(ge.MESSAGE_CLASS);
|
6230
|
+
}
|
6228
6231
|
// WORK - update all message classes to use deep-chat prefix
|
6229
6232
|
clearMessages(e, t) {
|
6230
|
-
var
|
6231
|
-
const i = [];
|
6232
|
-
this.messageElementRefs.forEach((
|
6233
|
-
const
|
6234
|
-
|
6235
|
-
}),
|
6236
|
-
|
6237
|
-
|
6238
|
-
|
6239
|
-
|
6233
|
+
var r, o;
|
6234
|
+
const i = [], s = [];
|
6235
|
+
this.messageElementRefs.forEach((a) => {
|
6236
|
+
const l = a.bubbleElement.classList;
|
6237
|
+
Ee.isActiveElement(l) ? i.push(a) : a.outerContainer.remove();
|
6238
|
+
}), this.textElementsToText.forEach((a) => {
|
6239
|
+
const l = a[0].bubbleElement.classList;
|
6240
|
+
Ee.isActiveElement(l) && s.push(a);
|
6241
|
+
}), Array.from(this.elementRef.children).forEach((a) => {
|
6242
|
+
var c;
|
6243
|
+
const l = (c = a.children[0]) == null ? void 0 : c.children[0];
|
6244
|
+
l != null && l.classList.contains("error-message-text") && a.remove();
|
6245
|
+
}), this.messageElementRefs = i, t !== !1 && ((r = this._introPanel) != null && r._elementRef && this._introPanel.display(), this.addIntroductoryMessages()), this.messages.splice(0, this.messages.length), this.textElementsToText = s, (o = this._onClearMessages) == null || o.call(this), delete e.sessionId;
|
6240
6246
|
}
|
6241
6247
|
}
|
6242
6248
|
const N = class N {
|
@@ -6677,12 +6683,12 @@ class jt extends $t {
|
|
6677
6683
|
var mn = {}, Ri = {}, Ii = {}, Kt = {}, st = {};
|
6678
6684
|
Object.defineProperty(st, "__esModule", { value: !0 });
|
6679
6685
|
st.Text = void 0;
|
6680
|
-
class
|
6686
|
+
class Fe {
|
6681
6687
|
static capitalize(e) {
|
6682
|
-
return e.replace(
|
6688
|
+
return e.replace(Fe.FIRST_CHAR_REGEX, (t) => t.toUpperCase());
|
6683
6689
|
}
|
6684
6690
|
static lineBreak(e) {
|
6685
|
-
return e.replace(
|
6691
|
+
return e.replace(Fe.DOUBLE_LINE, "<p></p>").replace(Fe.ONE_LINE, "<br>");
|
6686
6692
|
}
|
6687
6693
|
static isCharDefined(e) {
|
6688
6694
|
return e !== void 0 && e !== " " && e !== " " && e !== `
|
@@ -6693,10 +6699,10 @@ class De {
|
|
6693
6699
|
return e.split(/(\W+)/);
|
6694
6700
|
}
|
6695
6701
|
}
|
6696
|
-
st.Text =
|
6697
|
-
|
6698
|
-
|
6699
|
-
|
6702
|
+
st.Text = Fe;
|
6703
|
+
Fe.FIRST_CHAR_REGEX = /\S/;
|
6704
|
+
Fe.DOUBLE_LINE = /\n\n/g;
|
6705
|
+
Fe.ONE_LINE = /\n/g;
|
6700
6706
|
Object.defineProperty(Kt, "__esModule", { value: !0 });
|
6701
6707
|
Kt.Translate = void 0;
|
6702
6708
|
const Go = st;
|
@@ -7481,7 +7487,7 @@ const Lt = class Lt extends jt {
|
|
7481
7487
|
};
|
7482
7488
|
Lt.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
7483
7489
|
let qt = Lt;
|
7484
|
-
class
|
7490
|
+
class Ae {
|
7485
7491
|
// prettier-ignore
|
7486
7492
|
constructor(e, t, i, s) {
|
7487
7493
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = s, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(() => {
|
@@ -7489,7 +7495,7 @@ class Ce {
|
|
7489
7495
|
});
|
7490
7496
|
}
|
7491
7497
|
attemptAddFile(e, t) {
|
7492
|
-
return
|
7498
|
+
return Ae.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
7493
7499
|
}
|
7494
7500
|
static isFileTypeValid(e, t) {
|
7495
7501
|
if (t === "") return !0;
|
@@ -7516,15 +7522,15 @@ class Ce {
|
|
7516
7522
|
return t.startsWith("image") ? "image" : t.startsWith("audio") ? "audio" : "any";
|
7517
7523
|
}
|
7518
7524
|
addAttachmentBasedOnType(e, t, i) {
|
7519
|
-
const s =
|
7525
|
+
const s = Ae.getTypeFromBlob(e);
|
7520
7526
|
if (s === "image") {
|
7521
|
-
const r =
|
7527
|
+
const r = Ae.createImageAttachment(t);
|
7522
7528
|
this.addFileAttachment(e, "image", r, i);
|
7523
7529
|
} else if (s === "audio") {
|
7524
7530
|
const r = zt.createAudioAttachment(t);
|
7525
7531
|
this.addFileAttachment(e, "audio", r, i);
|
7526
7532
|
} else {
|
7527
|
-
const r =
|
7533
|
+
const r = Ae.createAnyFileAttachment(e.name);
|
7528
7534
|
this.addFileAttachment(e, "any", r, i);
|
7529
7535
|
}
|
7530
7536
|
}
|
@@ -7542,7 +7548,7 @@ class Ce {
|
|
7542
7548
|
}
|
7543
7549
|
addFileAttachment(e, t, i, s) {
|
7544
7550
|
var a;
|
7545
|
-
const r =
|
7551
|
+
const r = Ae.createContainer(i);
|
7546
7552
|
if (this._attachments.length >= this._fileCountLimit) {
|
7547
7553
|
const l = this._attachments[this._attachments.length - 1].removeButton;
|
7548
7554
|
l == null || l.click();
|
@@ -7588,7 +7594,7 @@ const da = `<?xml version="1.0" encoding="utf-8"?>
|
|
7588
7594
|
<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
7589
7595
|
<title>stop</title>
|
7590
7596
|
<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>
|
7591
|
-
</svg>`,
|
7597
|
+
</svg>`, we = class we extends Ae {
|
7592
7598
|
// prettier-ignore
|
7593
7599
|
constructor(e, t, i, s) {
|
7594
7600
|
super(e, t, i, s);
|
@@ -7614,12 +7620,12 @@ const da = `<?xml version="1.0" encoding="utf-8"?>
|
|
7614
7620
|
};
|
7615
7621
|
}
|
7616
7622
|
static createAudioAttachment(e) {
|
7617
|
-
const t =
|
7618
|
-
return
|
7623
|
+
const t = we.createAudioContainer();
|
7624
|
+
return we.addAudioElements(t, e), t;
|
7619
7625
|
}
|
7620
7626
|
createTimer(e, t) {
|
7621
7627
|
let i = 0;
|
7622
|
-
const s = t !== void 0 && t <
|
7628
|
+
const s = t !== void 0 && t < we.TIMER_LIMIT_S ? t : we.TIMER_LIMIT_S;
|
7623
7629
|
return setInterval(() => {
|
7624
7630
|
var a;
|
7625
7631
|
i += 1, i === s && ((a = this.stopPlaceholderCallback) == null || a.call(this), this.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -7628,7 +7634,7 @@ const da = `<?xml version="1.0" encoding="utf-8"?>
|
|
7628
7634
|
}, 1e3);
|
7629
7635
|
}
|
7630
7636
|
createPlaceholderAudioAttachment(e) {
|
7631
|
-
const t =
|
7637
|
+
const t = we.createAudioContainer(), i = document.createElement("div");
|
7632
7638
|
i.classList.add("audio-placeholder-text-3-digits");
|
7633
7639
|
const s = document.createElement("div");
|
7634
7640
|
s.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), s.appendChild(i);
|
@@ -7653,7 +7659,7 @@ const da = `<?xml version="1.0" encoding="utf-8"?>
|
|
7653
7659
|
// prettier-ignore
|
7654
7660
|
completePlaceholderAttachment(e, t) {
|
7655
7661
|
const i = this._activePlaceholderAttachment;
|
7656
|
-
i && (i.file = e,
|
7662
|
+
i && (i.file = e, we.addAudioElements(
|
7657
7663
|
i.attachmentContainerElement.children[0],
|
7658
7664
|
t
|
7659
7665
|
), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
@@ -7669,12 +7675,12 @@ const da = `<?xml version="1.0" encoding="utf-8"?>
|
|
7669
7675
|
(s = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
|
7670
7676
|
}
|
7671
7677
|
};
|
7672
|
-
|
7673
|
-
let zt =
|
7678
|
+
we.TIMER_LIMIT_S = 5999;
|
7679
|
+
let zt = we;
|
7674
7680
|
class ha {
|
7675
7681
|
// prettier-ignore
|
7676
7682
|
static create(e, t, i, s, r) {
|
7677
|
-
return r === "audio" ? new zt(e, t, i, s) : new
|
7683
|
+
return r === "audio" ? new zt(e, t, i, s) : new Ae(e, t, i, s);
|
7678
7684
|
}
|
7679
7685
|
}
|
7680
7686
|
class Yt {
|
@@ -7847,10 +7853,10 @@ class kt extends $t {
|
|
7847
7853
|
e && (this._openModalOnce === void 0 || this._openModalOnce === !0) ? (e(), this._openModalOnce === !0 && (this._openModalOnce = !1)) : this.triggerImportPrompt(this._inputElement);
|
7848
7854
|
}
|
7849
7855
|
}
|
7850
|
-
class
|
7856
|
+
class Ce {
|
7851
7857
|
static create(e, t, i) {
|
7852
|
-
const s =
|
7853
|
-
|
7858
|
+
const s = Ce.createElement(i);
|
7859
|
+
Ce.addEvents(s, e, t), e.appendChild(s);
|
7854
7860
|
}
|
7855
7861
|
static createElement(e) {
|
7856
7862
|
const t = document.createElement("div");
|
@@ -7858,13 +7864,13 @@ class Se {
|
|
7858
7864
|
}
|
7859
7865
|
static addEvents(e, t, i) {
|
7860
7866
|
t.ondragenter = (s) => {
|
7861
|
-
s.preventDefault(),
|
7867
|
+
s.preventDefault(), Ce.display(e);
|
7862
7868
|
}, e.ondragleave = (s) => {
|
7863
|
-
s.preventDefault(),
|
7869
|
+
s.preventDefault(), Ce.hide(e);
|
7864
7870
|
}, e.ondragover = (s) => {
|
7865
7871
|
s.preventDefault();
|
7866
7872
|
}, e.ondrop = (s) => {
|
7867
|
-
s.preventDefault(),
|
7873
|
+
s.preventDefault(), Ce.uploadFile(i, s), Ce.hide(e);
|
7868
7874
|
};
|
7869
7875
|
}
|
7870
7876
|
static uploadFile(e, t) {
|
@@ -8092,7 +8098,7 @@ const A = class A extends $t {
|
|
8092
8098
|
async programmaticSubmit(e) {
|
8093
8099
|
typeof e == "string" && (e = ae.processSubmitUserMessage(e));
|
8094
8100
|
const t = { text: e.text };
|
8095
|
-
e.files && (t.files = Array.from(e.files).map((i) => ({ file: i, type:
|
8101
|
+
e.files && (t.files = Array.from(e.files).map((i) => ({ file: i, type: Ae.getTypeFromBlob(i) }))), setTimeout(() => this.attemptSubmit(t, !0));
|
8096
8102
|
}
|
8097
8103
|
// TO-DO - should be disabled when loading history
|
8098
8104
|
async attemptSubmit(e, t = !1) {
|
@@ -8290,7 +8296,7 @@ class Mt {
|
|
8290
8296
|
const d = ((c = s.audio) == null ? void 0 : c.fileType) || r.addType(e, t.recordAudio.files, "audio");
|
8291
8297
|
s.microphone = { button: new ua(d, t.recordAudio) };
|
8292
8298
|
}
|
8293
|
-
return
|
8299
|
+
return Ce.isEnabled(r, e.dragAndDrop) && Ce.create(i, r, e.dragAndDrop), r;
|
8294
8300
|
}
|
8295
8301
|
// prettier-ignore
|
8296
8302
|
static createUploadButtons(e, t, i, s, r) {
|
@@ -8313,7 +8319,7 @@ class Ss {
|
|
8313
8319
|
static createElements(e, t, i) {
|
8314
8320
|
const s = document.createElement("div");
|
8315
8321
|
s.id = "chat-view";
|
8316
|
-
const r = new
|
8322
|
+
const r = new Ee(e, t, i);
|
8317
8323
|
t.websocket && U.createConnection(t, r);
|
8318
8324
|
const o = new Mt(e, r, t, s);
|
8319
8325
|
return J.addElements(s, r.elementRef, o.elementRef), s;
|