@epam/ai-dial-conversation-messages 1.3.0-dev.331 → 1.3.0-dev.342
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/AssistantMessageBubble.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAGpC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAc/E,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"AssistantMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/AssistantMessageBubble.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAGpC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAc/E,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAmRlE,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, ResponseFormat as o, buildCssVars as s, buildInlineSegmentSource as c, createInlineSegmentComponents as l, createRehypeInlineSegments as u, mergeClasses as d, useCollapsedText as f } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { AttachmentGroup as p } from "@epam/ai-dial-attachment-input";
|
|
3
|
-
import { Button as m, ButtonVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, ElementSize as v, GhostIconButton as y, InfoMessageNotification as b, LinkButton as x, LiveRegion as S, LiveRegionElement as C, NeutralButton as w, Popup as T, PopupSize as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { IconArrowBackUp as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { createPortal as
|
|
3
|
+
import { Button as m, ButtonVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, ElementSize as v, GhostIconButton as y, InfoMessageNotification as b, LinkButton as x, LiveRegion as S, LiveRegionElement as C, NeutralButton as w, Popup as T, PopupSize as ee, Select as te, Textarea as E, Tooltip as D } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { memo as O, useCallback as k, useEffect as A, useId as j, useLayoutEffect as M, useMemo as N, useRef as ne, useState as P } from "react";
|
|
5
|
+
import { IconArrowBackUp as F, IconChevronDown as I, IconChevronUp as re, IconMarkdown as ie, IconPencilMinus as ae, IconRefresh as L, IconThumbDown as oe, IconThumbDownFilled as se, IconThumbUp as ce, IconThumbUpFilled as le, IconTrashX as ue } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as V } from "react-dom";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var H = {
|
|
10
10
|
userBubble: "dial-cm-user-bubble",
|
|
11
11
|
assistantContent: "dial-cm-assistant-content"
|
|
12
|
-
},
|
|
13
|
-
let t =
|
|
14
|
-
return
|
|
12
|
+
}, de = 4, fe = (e) => {
|
|
13
|
+
let t = ne(null), [n, r] = P(0);
|
|
14
|
+
return A(() => {
|
|
15
15
|
if (!e) return;
|
|
16
16
|
let n = t.current;
|
|
17
17
|
if (n == null) return;
|
|
@@ -22,201 +22,201 @@ var U = {
|
|
|
22
22
|
return i.observe(n), () => i.disconnect();
|
|
23
23
|
}, [e]), {
|
|
24
24
|
slotRef: t,
|
|
25
|
-
firstLineIndent: e ? `calc(${n}px + ${
|
|
25
|
+
firstLineIndent: e ? `calc(${n}px + ${de}px)` : void 0
|
|
26
26
|
};
|
|
27
|
-
},
|
|
27
|
+
}, pe = [
|
|
28
28
|
"href",
|
|
29
29
|
"src",
|
|
30
30
|
"alt",
|
|
31
31
|
"colspan",
|
|
32
32
|
"rowspan",
|
|
33
33
|
"start"
|
|
34
|
-
],
|
|
34
|
+
], me = /* @__PURE__ */ new Set([
|
|
35
35
|
"pre",
|
|
36
36
|
"pre-wrap",
|
|
37
37
|
"pre-line",
|
|
38
38
|
"break-spaces"
|
|
39
|
-
]),
|
|
39
|
+
]), U = (e) => {
|
|
40
40
|
let t = document.createElement(e.tagName.toLowerCase());
|
|
41
|
-
|
|
41
|
+
pe.forEach((n) => {
|
|
42
42
|
let r = e.getAttribute(n);
|
|
43
43
|
r !== null && t.setAttribute(n, r);
|
|
44
44
|
});
|
|
45
45
|
let { whiteSpace: n } = window.getComputedStyle(e);
|
|
46
|
-
return
|
|
47
|
-
},
|
|
46
|
+
return me.has(n) && (t.style.whiteSpace = "pre-wrap"), t;
|
|
47
|
+
}, W = (e) => e instanceof SVGElement || window.getComputedStyle(e).display === "none", G = (e, t) => {
|
|
48
48
|
if (!t.intersectsNode(e)) return null;
|
|
49
49
|
if (e.nodeType === Node.TEXT_NODE) {
|
|
50
50
|
let n = e.data, r = e === t.startContainer ? t.startOffset : 0, i = e === t.endContainer ? t.endOffset : n.length;
|
|
51
51
|
return document.createTextNode(n.slice(r, i));
|
|
52
52
|
}
|
|
53
|
-
if (!(e instanceof Element) ||
|
|
54
|
-
let n =
|
|
53
|
+
if (!(e instanceof Element) || W(e)) return null;
|
|
54
|
+
let n = U(e);
|
|
55
55
|
return e.childNodes.forEach((e) => {
|
|
56
|
-
let r =
|
|
56
|
+
let r = G(e, t);
|
|
57
57
|
r && n.appendChild(r);
|
|
58
58
|
}), n;
|
|
59
|
-
},
|
|
59
|
+
}, K = (e, t, n) => {
|
|
60
60
|
let r = e, i = t;
|
|
61
61
|
for (; i && i !== n && n.contains(i);) {
|
|
62
|
-
let e =
|
|
62
|
+
let e = U(i);
|
|
63
63
|
e.appendChild(r), r = e, i = i.parentElement;
|
|
64
64
|
}
|
|
65
65
|
return r;
|
|
66
|
-
},
|
|
66
|
+
}, he = (e, t) => {
|
|
67
67
|
let n = e.commonAncestorContainer, r = n instanceof Element ? n : n.parentElement;
|
|
68
68
|
if (!r) return null;
|
|
69
|
-
let i =
|
|
70
|
-
return i ?
|
|
71
|
-
},
|
|
69
|
+
let i = G(r, e);
|
|
70
|
+
return i ? K(i, r.parentElement, t) : null;
|
|
71
|
+
}, ge = (e) => {
|
|
72
72
|
let t = window.getSelection();
|
|
73
73
|
if (!t || t.isCollapsed || t.rangeCount === 0 || !e.clipboardData) return;
|
|
74
74
|
let n = t.toString();
|
|
75
75
|
if (!n) return;
|
|
76
76
|
let r = document.createElement("div");
|
|
77
77
|
for (let n = 0; n < t.rangeCount; n++) {
|
|
78
|
-
let i =
|
|
78
|
+
let i = he(t.getRangeAt(n), e.currentTarget);
|
|
79
79
|
i && r.appendChild(i);
|
|
80
80
|
}
|
|
81
81
|
e.clipboardData.setData("text/html", r.innerHTML), e.clipboardData.setData("text/plain", n), e.preventDefault();
|
|
82
|
-
},
|
|
83
|
-
let { tooltips:
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
clearTimeout(
|
|
87
|
-
}, []),
|
|
88
|
-
l?.(),
|
|
82
|
+
}, _e = { activeRating: "_activeRating_ygoee_1" }, ve = 2e3, ye = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: o, onRegenerate: c, onCopy: l, onCopyMarkdown: u, onLike: f, onDislike: p, activeRating: m, isAlwaysVisible: h, leadingContent: b, trailingContent: x, isDisabled: w = !1, className: T, labels: ee, colors: te }) => {
|
|
83
|
+
let { tooltips: E, ariaLabels: D } = ee ?? {}, [O, j] = P(null), [M, N] = P(""), F = ne(void 0);
|
|
84
|
+
A(() => () => clearTimeout(F.current), []);
|
|
85
|
+
let I = k(() => {
|
|
86
|
+
clearTimeout(F.current), F.current = setTimeout(() => j(null), ve);
|
|
87
|
+
}, []), re = n != null || o != null || c != null || l != null || u != null || f != null || p != null || b != null || x != null, V = s({ "--ma-active-rating-text": te?.activeRatingText }), H = k(() => {
|
|
88
|
+
l?.(), j("copy"), N(e === a.User ? D?.copiedMessageStatus ?? "Message copied to clipboard" : D?.copiedStatus ?? "Copied to clipboard"), I();
|
|
89
89
|
}, [
|
|
90
90
|
l,
|
|
91
91
|
e,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
]),
|
|
96
|
-
u?.(),
|
|
92
|
+
D?.copiedStatus,
|
|
93
|
+
D?.copiedMessageStatus,
|
|
94
|
+
I
|
|
95
|
+
]), de = k(() => {
|
|
96
|
+
u?.(), j("markdown"), N(D?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), I();
|
|
97
97
|
}, [
|
|
98
98
|
u,
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
D?.copiedMarkdownStatus,
|
|
100
|
+
I
|
|
101
101
|
]);
|
|
102
|
-
return
|
|
102
|
+
return re ? /* @__PURE__ */ B("div", {
|
|
103
103
|
role: "toolbar",
|
|
104
|
-
"aria-label":
|
|
105
|
-
style:
|
|
104
|
+
"aria-label": D?.actionsGroup ?? "Message actions",
|
|
105
|
+
style: V,
|
|
106
106
|
className: d("flex items-center gap-1", !h && "opacity-0 group-hover:opacity-100", T),
|
|
107
107
|
children: [
|
|
108
108
|
b,
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ z(S, {
|
|
110
110
|
visuallyHidden: !0,
|
|
111
111
|
as: C.Span,
|
|
112
|
-
children:
|
|
112
|
+
children: M
|
|
113
113
|
}),
|
|
114
|
-
e === a.User ? /* @__PURE__ */
|
|
115
|
-
l && /* @__PURE__ */
|
|
114
|
+
e === a.User ? /* @__PURE__ */ B(R, { children: [
|
|
115
|
+
l && /* @__PURE__ */ z(t, {
|
|
116
116
|
iconSize: g.SM,
|
|
117
|
-
onClick:
|
|
117
|
+
onClick: H,
|
|
118
118
|
size: v.Small,
|
|
119
|
-
isCopied:
|
|
120
|
-
copyLabel:
|
|
121
|
-
copiedLabel:
|
|
122
|
-
ariaLabel:
|
|
119
|
+
isCopied: O === "copy",
|
|
120
|
+
copyLabel: E?.copyMessage ?? "Copy message",
|
|
121
|
+
copiedLabel: E?.copied ?? "Copied!",
|
|
122
|
+
ariaLabel: D?.copyMessage ?? "Copy message",
|
|
123
123
|
isDisabled: w
|
|
124
124
|
}),
|
|
125
|
-
n && /* @__PURE__ */
|
|
126
|
-
icon: /* @__PURE__ */
|
|
125
|
+
n && /* @__PURE__ */ z(y, {
|
|
126
|
+
icon: /* @__PURE__ */ z(ae, {
|
|
127
127
|
size: g.SM,
|
|
128
128
|
"aria-hidden": !0,
|
|
129
129
|
stroke: _
|
|
130
130
|
}),
|
|
131
131
|
size: v.Small,
|
|
132
|
-
"aria-label":
|
|
133
|
-
tooltipProps: { tooltip:
|
|
132
|
+
"aria-label": D?.editMessage ?? "Edit message",
|
|
133
|
+
tooltipProps: { tooltip: E?.edit ?? "Edit" },
|
|
134
134
|
onClick: n,
|
|
135
135
|
onMouseEnter: r,
|
|
136
136
|
onFocus: r,
|
|
137
137
|
disabled: w
|
|
138
138
|
}),
|
|
139
|
-
o && /* @__PURE__ */
|
|
140
|
-
icon: /* @__PURE__ */
|
|
139
|
+
o && /* @__PURE__ */ z(y, {
|
|
140
|
+
icon: /* @__PURE__ */ z(ue, {
|
|
141
141
|
size: g.SM,
|
|
142
142
|
"aria-hidden": !0,
|
|
143
143
|
stroke: _
|
|
144
144
|
}),
|
|
145
145
|
size: v.Small,
|
|
146
|
-
"aria-label":
|
|
147
|
-
tooltipProps: { tooltip:
|
|
146
|
+
"aria-label": D?.deleteMessage ?? "Delete message",
|
|
147
|
+
tooltipProps: { tooltip: E?.delete ?? "Delete" },
|
|
148
148
|
onClick: o,
|
|
149
149
|
disabled: w
|
|
150
150
|
})
|
|
151
|
-
] }) : /* @__PURE__ */
|
|
152
|
-
c && /* @__PURE__ */
|
|
153
|
-
icon: /* @__PURE__ */
|
|
151
|
+
] }) : /* @__PURE__ */ B(R, { children: [
|
|
152
|
+
c && /* @__PURE__ */ z(y, {
|
|
153
|
+
icon: /* @__PURE__ */ z(L, {
|
|
154
154
|
size: g.SM,
|
|
155
155
|
"aria-hidden": !0,
|
|
156
156
|
stroke: _
|
|
157
157
|
}),
|
|
158
158
|
size: v.Small,
|
|
159
|
-
"aria-label":
|
|
160
|
-
tooltipProps: { tooltip:
|
|
159
|
+
"aria-label": D?.regenerateResponse ?? "Regenerate response",
|
|
160
|
+
tooltipProps: { tooltip: E?.regenerate ?? "Regenerate" },
|
|
161
161
|
onClick: c,
|
|
162
162
|
disabled: w
|
|
163
163
|
}),
|
|
164
|
-
l && /* @__PURE__ */
|
|
164
|
+
l && /* @__PURE__ */ z(t, {
|
|
165
165
|
iconSize: g.SM,
|
|
166
|
-
onClick:
|
|
166
|
+
onClick: H,
|
|
167
167
|
size: v.Small,
|
|
168
|
-
isCopied:
|
|
169
|
-
copyLabel:
|
|
170
|
-
copiedLabel:
|
|
171
|
-
ariaLabel:
|
|
168
|
+
isCopied: O === "copy",
|
|
169
|
+
copyLabel: E?.copy ?? "Copy",
|
|
170
|
+
copiedLabel: E?.copied ?? "Copied!",
|
|
171
|
+
ariaLabel: D?.copyResponse ?? "Copy response",
|
|
172
172
|
isDisabled: w
|
|
173
173
|
}),
|
|
174
|
-
u && /* @__PURE__ */
|
|
174
|
+
u && /* @__PURE__ */ z(t, {
|
|
175
175
|
iconSize: g.SM,
|
|
176
|
-
onClick:
|
|
176
|
+
onClick: de,
|
|
177
177
|
size: v.Small,
|
|
178
|
-
isCopied:
|
|
179
|
-
iconCopy: /* @__PURE__ */
|
|
178
|
+
isCopied: O === "markdown",
|
|
179
|
+
iconCopy: /* @__PURE__ */ z(ie, {
|
|
180
180
|
size: g.SM,
|
|
181
181
|
"aria-hidden": !0,
|
|
182
182
|
stroke: _
|
|
183
183
|
}),
|
|
184
|
-
copyLabel:
|
|
185
|
-
copiedLabel:
|
|
186
|
-
ariaLabel:
|
|
184
|
+
copyLabel: E?.copyMarkdown ?? "Copy as Markdown",
|
|
185
|
+
copiedLabel: E?.copiedMarkdown ?? "Copied!",
|
|
186
|
+
ariaLabel: D?.copyAsMarkdown ?? "Copy as markdown",
|
|
187
187
|
isDisabled: w
|
|
188
188
|
}),
|
|
189
|
-
f && /* @__PURE__ */
|
|
190
|
-
icon: m === i.Like ? /* @__PURE__ */
|
|
191
|
-
className:
|
|
189
|
+
f && /* @__PURE__ */ z(y, {
|
|
190
|
+
icon: m === i.Like ? /* @__PURE__ */ z(le, {
|
|
191
|
+
className: _e.activeRating,
|
|
192
192
|
size: g.SM,
|
|
193
193
|
"aria-hidden": !0
|
|
194
|
-
}) : /* @__PURE__ */
|
|
194
|
+
}) : /* @__PURE__ */ z(ce, {
|
|
195
195
|
size: g.SM,
|
|
196
196
|
"aria-hidden": !0,
|
|
197
197
|
stroke: _
|
|
198
198
|
}),
|
|
199
199
|
size: v.Small,
|
|
200
|
-
"aria-label":
|
|
200
|
+
"aria-label": D?.likeResponse ?? "Like response",
|
|
201
201
|
"aria-pressed": m === i.Like,
|
|
202
|
-
tooltipProps: { tooltip:
|
|
202
|
+
tooltipProps: { tooltip: E?.like ?? "Like" },
|
|
203
203
|
onClick: f,
|
|
204
204
|
disabled: w
|
|
205
205
|
}),
|
|
206
|
-
p && /* @__PURE__ */
|
|
207
|
-
icon: m === i.Dislike ? /* @__PURE__ */
|
|
208
|
-
className:
|
|
206
|
+
p && /* @__PURE__ */ z(y, {
|
|
207
|
+
icon: m === i.Dislike ? /* @__PURE__ */ z(se, {
|
|
208
|
+
className: _e.activeRating,
|
|
209
209
|
size: g.SM,
|
|
210
210
|
"aria-hidden": !0
|
|
211
|
-
}) : /* @__PURE__ */
|
|
211
|
+
}) : /* @__PURE__ */ z(oe, {
|
|
212
212
|
size: g.SM,
|
|
213
213
|
"aria-hidden": !0,
|
|
214
214
|
stroke: _
|
|
215
215
|
}),
|
|
216
216
|
size: v.Small,
|
|
217
|
-
"aria-label":
|
|
217
|
+
"aria-label": D?.dislikeResponse ?? "Dislike response",
|
|
218
218
|
"aria-pressed": m === i.Dislike,
|
|
219
|
-
tooltipProps: { tooltip:
|
|
219
|
+
tooltipProps: { tooltip: E?.dislike ?? "Dislike" },
|
|
220
220
|
onClick: p,
|
|
221
221
|
disabled: w
|
|
222
222
|
})
|
|
@@ -224,43 +224,43 @@ var U = {
|
|
|
224
224
|
x
|
|
225
225
|
]
|
|
226
226
|
}) : null;
|
|
227
|
-
},
|
|
228
|
-
let [t, n] =
|
|
229
|
-
return
|
|
227
|
+
}, be = (e) => {
|
|
228
|
+
let [t, n] = P(() => /* @__PURE__ */ new Date());
|
|
229
|
+
return A(() => {
|
|
230
230
|
let t = setInterval(() => n(/* @__PURE__ */ new Date()), e);
|
|
231
231
|
return () => clearInterval(t);
|
|
232
232
|
}, [e]), t;
|
|
233
|
-
},
|
|
233
|
+
}, q = /* @__PURE__ */ function(e) {
|
|
234
234
|
return e.Today = "today", e.Yesterday = "yesterday", e.Absolute = "absolute", e;
|
|
235
|
-
}({}),
|
|
235
|
+
}({}), J = {
|
|
236
236
|
hour: "numeric",
|
|
237
237
|
minute: "2-digit"
|
|
238
|
-
},
|
|
238
|
+
}, xe = {
|
|
239
239
|
year: "numeric",
|
|
240
240
|
month: "short",
|
|
241
241
|
day: "numeric",
|
|
242
|
-
...
|
|
243
|
-
},
|
|
242
|
+
...J
|
|
243
|
+
}, Y = 60, X = 3600, Z = 24 * X, Q = [
|
|
244
244
|
["year", 365 * Z],
|
|
245
245
|
["month", 30 * Z],
|
|
246
246
|
["week", 7 * Z],
|
|
247
247
|
["day", Z],
|
|
248
|
-
["hour",
|
|
249
|
-
["minute",
|
|
248
|
+
["hour", X],
|
|
249
|
+
["minute", Y]
|
|
250
250
|
], Se = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), Ce = (e) => {
|
|
251
251
|
if (!e) return null;
|
|
252
252
|
let t = new Date(e);
|
|
253
253
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
254
|
-
}, we = (e, t) => new Intl.DateTimeFormat(t,
|
|
254
|
+
}, we = (e, t) => new Intl.DateTimeFormat(t, xe).format(e), Te = (e, t, n) => {
|
|
255
255
|
let r = new Date(t.getFullYear(), t.getMonth(), t.getDate() - 1);
|
|
256
256
|
return Se(e, t) ? {
|
|
257
|
-
kind:
|
|
258
|
-
text: new Intl.DateTimeFormat(n,
|
|
257
|
+
kind: q.Today,
|
|
258
|
+
text: new Intl.DateTimeFormat(n, J).format(e)
|
|
259
259
|
} : Se(e, r) ? {
|
|
260
|
-
kind:
|
|
261
|
-
text: new Intl.DateTimeFormat(n,
|
|
260
|
+
kind: q.Yesterday,
|
|
261
|
+
text: new Intl.DateTimeFormat(n, J).format(e)
|
|
262
262
|
} : {
|
|
263
|
-
kind:
|
|
263
|
+
kind: q.Absolute,
|
|
264
264
|
text: we(e, n)
|
|
265
265
|
};
|
|
266
266
|
}, Ee = (e, t, n) => {
|
|
@@ -271,11 +271,11 @@ var U = {
|
|
|
271
271
|
}
|
|
272
272
|
return r.format(0, "second");
|
|
273
273
|
}, De = { time: "_time_16pwx_2" }, Oe = 6e4, ke = "opacity-0 transition-opacity group-hover/message:opacity-100 group-focus-within/message:opacity-100 [@media(hover:none)]:opacity-100", Ae = ({ timestamp: e, locale: t, className: n = "dial-small-text" }) => {
|
|
274
|
-
let r =
|
|
275
|
-
return i == null ? null : /* @__PURE__ */
|
|
274
|
+
let r = be(Oe), i = Ce(e);
|
|
275
|
+
return i == null ? null : /* @__PURE__ */ z(D, {
|
|
276
276
|
tooltip: we(i, t),
|
|
277
277
|
asChild: !0,
|
|
278
|
-
children: /* @__PURE__ */
|
|
278
|
+
children: /* @__PURE__ */ z("time", {
|
|
279
279
|
dateTime: e,
|
|
280
280
|
tabIndex: 0,
|
|
281
281
|
className: d("px-1 whitespace-nowrap", De.time, n, ke),
|
|
@@ -289,111 +289,111 @@ var U = {
|
|
|
289
289
|
collapsedText: "_collapsedText_17fln_15",
|
|
290
290
|
startersDivider: "_startersDivider_17fln_31",
|
|
291
291
|
text: "_text_17fln_35"
|
|
292
|
-
}, je = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", Me = ({ text: t, contentRef: i, styles: c, actions: l, hasAlwaysVisibleActions: u, timestamp: f, locale: m, isStreaming: h, attachments: g, beforeContent: _, responseFormat: v, afterContent: y, hasThinkingPlaceholder: b = !0, starters: x, onSelectStarter: S, deploymentIconUrl: C, deploymentDisplayName: T, markdownComponents:
|
|
293
|
-
let { colors:
|
|
292
|
+
}, je = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", Me = ({ text: t, contentRef: i, styles: c, actions: l, hasAlwaysVisibleActions: u, timestamp: f, locale: m, isStreaming: h, attachments: g, beforeContent: _, responseFormat: v, afterContent: y, hasThinkingPlaceholder: b = !0, starters: x, onSelectStarter: S, deploymentIconUrl: C, deploymentDisplayName: T, markdownComponents: ee, markdownClassNames: te, markdownUrlTransform: E, onAttachmentClick: D, onDownloadAll: O, isAttachmentDownloadable: k, onAttachmentRetry: A, codeBlockTheme: j, tableOnOpenInCanvas: M, labels: ne, selectedAttachmentId: P }) => {
|
|
293
|
+
let { colors: F, typography: I, className: re, bubbleClassName: ie, timestampClassName: ae } = c ?? {}, L = f == null ? void 0 : /* @__PURE__ */ z(Ae, {
|
|
294
294
|
timestamp: f,
|
|
295
295
|
locale: m,
|
|
296
|
-
className:
|
|
297
|
-
}), { attachmentClickLabel:
|
|
298
|
-
copyLabel:
|
|
299
|
-
copiedLabel:
|
|
300
|
-
downloadCsvLabel:
|
|
301
|
-
openInCanvasLabel:
|
|
296
|
+
className: ae
|
|
297
|
+
}), { attachmentClickLabel: oe, attachmentDownloadLabel: se, attachmentRetryLabel: ce, attachmentOpenInNewTabLabel: le, startersAriaLabel: ue = "Quick reply buttons", thinkingLabel: V, codeBlockCopyLabel: de, codeBlockCopiedLabel: pe, codeBlockDownloadLabel: me, tableCopyLabel: U, tableCopiedLabel: W, tableDownloadCsvLabel: G, tableOpenInCanvasLabel: K, tableDownloadFilename: he, tableScrollRegionAriaLabel: _e, mathScrollRegionAriaLabel: ve, assistantMessageAriaLabel: be = "Assistant message", deploymentIconFallbackLabel: q = "AI" } = ne ?? {}, J = N(() => ({
|
|
298
|
+
copyLabel: U,
|
|
299
|
+
copiedLabel: W,
|
|
300
|
+
downloadCsvLabel: G,
|
|
301
|
+
openInCanvasLabel: K
|
|
302
302
|
}), [
|
|
303
|
+
U,
|
|
303
304
|
W,
|
|
304
305
|
G,
|
|
305
|
-
K
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
"--cm-
|
|
309
|
-
"--cm-
|
|
310
|
-
"--cm-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return /* @__PURE__ */ H("div", {
|
|
306
|
+
K
|
|
307
|
+
]), xe = h ? (g ?? []).filter((t) => t.type !== e.Audio) : g ?? [], Y = !!t?.trim(), X = !Y && !b, { slotRef: Z, firstLineIndent: Q } = fe(_ != null && Y), Se = s({
|
|
308
|
+
"--cm-bubble-text": F?.text,
|
|
309
|
+
"--cm-starters-divider": F?.startersDivider,
|
|
310
|
+
"--cm-timestamp-text": F?.timestampText,
|
|
311
|
+
"--cm-bubble-first-line-indent": Q
|
|
312
|
+
}), Ce = d($.text, I?.fontClassName), we = !!(C || T);
|
|
313
|
+
return /* @__PURE__ */ B("div", {
|
|
314
314
|
role: "group",
|
|
315
|
-
"aria-label":
|
|
316
|
-
style:
|
|
317
|
-
onCopy:
|
|
318
|
-
className: d("group/message flex w-full items-start gap-3",
|
|
319
|
-
children: [
|
|
315
|
+
"aria-label": be,
|
|
316
|
+
style: Se,
|
|
317
|
+
onCopy: ge,
|
|
318
|
+
className: d("group/message flex w-full items-start gap-3", re),
|
|
319
|
+
children: [we && /* @__PURE__ */ z(n, {
|
|
320
320
|
src: C,
|
|
321
321
|
size: 28,
|
|
322
|
-
initialsName: T ||
|
|
323
|
-
labels: { tooltip: T ??
|
|
324
|
-
}), /* @__PURE__ */
|
|
322
|
+
initialsName: T || q,
|
|
323
|
+
labels: { tooltip: T ?? q }
|
|
324
|
+
}), /* @__PURE__ */ B("div", {
|
|
325
325
|
className: "flex w-full max-w-full min-w-0 flex-col items-start gap-5",
|
|
326
|
-
children: [/* @__PURE__ */
|
|
327
|
-
className: d("flex w-full max-w-full min-w-0 flex-col items-start gap-4",
|
|
326
|
+
children: [/* @__PURE__ */ B("div", {
|
|
327
|
+
className: d("flex w-full max-w-full min-w-0 flex-col items-start gap-4", ie),
|
|
328
328
|
children: [
|
|
329
|
-
_ != null && !
|
|
329
|
+
_ != null && !Y && /* @__PURE__ */ z("div", {
|
|
330
330
|
className: "min-w-0",
|
|
331
331
|
children: _
|
|
332
332
|
}),
|
|
333
|
-
(
|
|
333
|
+
(Y || h) && /* @__PURE__ */ B("div", {
|
|
334
334
|
"aria-live": "polite",
|
|
335
335
|
"aria-atomic": "false",
|
|
336
|
-
className: d(
|
|
337
|
-
children: [_ != null &&
|
|
338
|
-
ref:
|
|
336
|
+
className: d(Ce, X ? "absolute" : "relative", "max-w-full min-w-0 text-start", _ != null && Y && je, H.assistantContent),
|
|
337
|
+
children: [_ != null && Y && /* @__PURE__ */ z("div", {
|
|
338
|
+
ref: Z,
|
|
339
339
|
className: "absolute inset-s-0 top-0",
|
|
340
340
|
children: _
|
|
341
|
-
}), /* @__PURE__ */
|
|
341
|
+
}), !X && /* @__PURE__ */ z("div", {
|
|
342
342
|
ref: i,
|
|
343
343
|
className: "cm-bubble-markdown max-w-full min-w-0 wrap-anywhere",
|
|
344
|
-
children: /* @__PURE__ */
|
|
344
|
+
children: /* @__PURE__ */ z(r, {
|
|
345
345
|
content: t ?? "",
|
|
346
346
|
isPlainText: v === o.PlainText,
|
|
347
347
|
isStreaming: h,
|
|
348
|
-
thinkingLabel:
|
|
349
|
-
components:
|
|
350
|
-
classNames:
|
|
351
|
-
urlTransform:
|
|
352
|
-
codeBlockCopyLabel:
|
|
353
|
-
codeBlockCopiedLabel:
|
|
354
|
-
codeBlockDownloadLabel:
|
|
355
|
-
codeBlockTheme:
|
|
356
|
-
tableActionLabels:
|
|
357
|
-
tableDownloadFilename:
|
|
358
|
-
tableOnOpenInCanvas:
|
|
359
|
-
tableScrollRegionAriaLabel:
|
|
360
|
-
mathScrollRegionAriaLabel:
|
|
348
|
+
thinkingLabel: V,
|
|
349
|
+
components: ee,
|
|
350
|
+
classNames: te,
|
|
351
|
+
urlTransform: E,
|
|
352
|
+
codeBlockCopyLabel: de,
|
|
353
|
+
codeBlockCopiedLabel: pe,
|
|
354
|
+
codeBlockDownloadLabel: me,
|
|
355
|
+
codeBlockTheme: j,
|
|
356
|
+
tableActionLabels: J,
|
|
357
|
+
tableDownloadFilename: he,
|
|
358
|
+
tableOnOpenInCanvas: M,
|
|
359
|
+
tableScrollRegionAriaLabel: _e,
|
|
360
|
+
mathScrollRegionAriaLabel: ve
|
|
361
361
|
})
|
|
362
362
|
})]
|
|
363
363
|
}),
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
attachments:
|
|
366
|
-
onAttachmentClick:
|
|
364
|
+
/* @__PURE__ */ z(p, {
|
|
365
|
+
attachments: xe,
|
|
366
|
+
onAttachmentClick: D ? (e) => {
|
|
367
367
|
let t = g?.find((t) => t.id === e);
|
|
368
|
-
t &&
|
|
368
|
+
t && D(t);
|
|
369
369
|
} : void 0,
|
|
370
|
-
onDownloadAll:
|
|
371
|
-
isAttachmentDownloadable:
|
|
372
|
-
onRetry:
|
|
370
|
+
onDownloadAll: O,
|
|
371
|
+
isAttachmentDownloadable: k,
|
|
372
|
+
onRetry: A,
|
|
373
373
|
labels: {
|
|
374
|
-
clickLabel:
|
|
375
|
-
downloadLabel:
|
|
376
|
-
retryLabel:
|
|
377
|
-
openInNewTabLabel:
|
|
374
|
+
clickLabel: oe,
|
|
375
|
+
downloadLabel: se,
|
|
376
|
+
retryLabel: ce,
|
|
377
|
+
openInNewTabLabel: le
|
|
378
378
|
},
|
|
379
|
-
selectedAttachmentId:
|
|
379
|
+
selectedAttachmentId: P
|
|
380
380
|
}),
|
|
381
381
|
y,
|
|
382
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ z(ye, {
|
|
383
383
|
...l,
|
|
384
384
|
isAlwaysVisible: u,
|
|
385
|
-
trailingContent:
|
|
385
|
+
trailingContent: L == null ? l?.trailingContent : /* @__PURE__ */ B(R, { children: [l?.trailingContent, L] }),
|
|
386
386
|
role: a.Assistant
|
|
387
387
|
})
|
|
388
388
|
]
|
|
389
|
-
}), x && x.length > 0 && S && /* @__PURE__ */
|
|
389
|
+
}), x && x.length > 0 && S && /* @__PURE__ */ z("div", {
|
|
390
390
|
role: "list",
|
|
391
|
-
"aria-label":
|
|
391
|
+
"aria-label": ue,
|
|
392
392
|
className: d("flex w-full flex-wrap gap-2 border-t pt-5", $.startersDivider),
|
|
393
|
-
children: x.map((e, t) => /* @__PURE__ */
|
|
393
|
+
children: x.map((e, t) => /* @__PURE__ */ z("div", {
|
|
394
394
|
role: "listitem",
|
|
395
395
|
className: "min-w-[40px]",
|
|
396
|
-
children: /* @__PURE__ */
|
|
396
|
+
children: /* @__PURE__ */ z(w, {
|
|
397
397
|
label: e.title,
|
|
398
398
|
className: "min-w-[40px]",
|
|
399
399
|
onClick: () => S(e)
|
|
@@ -402,39 +402,39 @@ var U = {
|
|
|
402
402
|
})]
|
|
403
403
|
})]
|
|
404
404
|
});
|
|
405
|
-
}, Ne = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */
|
|
405
|
+
}, Ne = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ z(b, {
|
|
406
406
|
title: e,
|
|
407
407
|
message: t,
|
|
408
408
|
textClassName: "flex-row flex-wrap gap-1"
|
|
409
409
|
}), Pe = /* @__PURE__ */ function(e) {
|
|
410
410
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
411
|
-
}({}), Fe = 10, Ie = "[&>div>*:first-child]:mt-0 [&>div>*:last-child]:mb-0", Le = [], Re = ({ text: e, contentRef: t, position: n = Pe.Bottom, styles: i, actions: o, hasAlwaysVisibleActions: m, timestamp: h, locale: _, attachments: y, collapsedLineCount: b = Fe, labels: S, textSegments: C, onAttachmentClick: w, onDownloadAll: T, isAttachmentDownloadable:
|
|
412
|
-
let { colors:
|
|
411
|
+
}({}), Fe = 10, Ie = "[&>div>*:first-child]:mt-0 [&>div>*:last-child]:mb-0", Le = [], Re = ({ text: e, contentRef: t, position: n = Pe.Bottom, styles: i, actions: o, hasAlwaysVisibleActions: m, timestamp: h, locale: _, attachments: y, collapsedLineCount: b = Fe, labels: S, textSegments: C, onAttachmentClick: w, onDownloadAll: T, isAttachmentDownloadable: ee, onAttachmentRetry: te, selectedAttachmentId: E, markdownClassNames: D, markdownUrlTransform: O, codeBlockTheme: k, tableOnOpenInCanvas: A }) => {
|
|
412
|
+
let { colors: M, typography: ne, className: P, bubbleClassName: F, timestampClassName: ie } = i ?? {}, ae = h == null ? void 0 : /* @__PURE__ */ z(Ae, {
|
|
413
413
|
timestamp: h,
|
|
414
414
|
locale: _,
|
|
415
|
-
className:
|
|
416
|
-
}), { showMoreLabel:
|
|
417
|
-
copyLabel:
|
|
418
|
-
copiedLabel:
|
|
419
|
-
downloadCsvLabel:
|
|
420
|
-
openInCanvasLabel:
|
|
415
|
+
className: ie
|
|
416
|
+
}), { showMoreLabel: L = "Show more", showLessLabel: oe = "Show less", showMoreAriaLabel: se, showLessAriaLabel: ce, attachmentClickLabel: le, attachmentDownloadLabel: ue, attachmentRetryLabel: V, attachmentOpenInNewTabLabel: de, userMessageAriaLabel: fe = "User message", codeBlockCopyLabel: pe, codeBlockCopiedLabel: me, codeBlockDownloadLabel: U, tableCopyLabel: W, tableCopiedLabel: G, tableDownloadCsvLabel: K, tableOpenInCanvasLabel: he, tableDownloadFilename: _e, tableScrollRegionAriaLabel: ve, mathScrollRegionAriaLabel: be } = S ?? {}, q = N(() => ({
|
|
417
|
+
copyLabel: W,
|
|
418
|
+
copiedLabel: G,
|
|
419
|
+
downloadCsvLabel: K,
|
|
420
|
+
openInCanvasLabel: he
|
|
421
421
|
}), [
|
|
422
|
+
W,
|
|
422
423
|
G,
|
|
423
424
|
K,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
]), { textRef: Y, isTextCollapsed: be, isOverflowing: X, collapsedMaxHeight: xe, expandedMaxHeight: Z, isCollapsed: Q, toggleCollapsed: Se } = f({
|
|
425
|
+
he
|
|
426
|
+
]), { textRef: J, isTextCollapsed: xe, isOverflowing: Y, collapsedMaxHeight: X, expandedMaxHeight: Z, isCollapsed: Q, toggleCollapsed: Se } = f({
|
|
427
427
|
text: e ?? "",
|
|
428
428
|
collapsedLineCount: b
|
|
429
429
|
}), Ce = s({
|
|
430
|
-
"--cm-bubble-user-bg":
|
|
431
|
-
"--cm-bubble-user-border":
|
|
432
|
-
"--cm-bubble-fade-start":
|
|
433
|
-
"--cm-bubble-text":
|
|
434
|
-
"--cm-timestamp-text":
|
|
435
|
-
"--cm-bubble-collapsed-height":
|
|
436
|
-
"--cm-bubble-expanded-height":
|
|
437
|
-
}), we = n === Pe.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", Te = d($.text,
|
|
430
|
+
"--cm-bubble-user-bg": M?.userBackground,
|
|
431
|
+
"--cm-bubble-user-border": M?.userBorder,
|
|
432
|
+
"--cm-bubble-fade-start": M?.fadeStart,
|
|
433
|
+
"--cm-bubble-text": M?.text,
|
|
434
|
+
"--cm-timestamp-text": M?.timestampText,
|
|
435
|
+
"--cm-bubble-collapsed-height": Y ? `${X}px` : void 0,
|
|
436
|
+
"--cm-bubble-expanded-height": Y ? `${Z}px` : void 0
|
|
437
|
+
}), we = n === Pe.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", Te = d($.text, ne?.fontClassName), { markdownSource: Ee, segmentRehypePlugins: De, segmentComponents: Oe } = N(() => {
|
|
438
438
|
if (C == null) return {
|
|
439
439
|
markdownSource: e ?? "",
|
|
440
440
|
segmentRehypePlugins: Le,
|
|
@@ -446,66 +446,66 @@ var U = {
|
|
|
446
446
|
segmentRehypePlugins: [u(n)],
|
|
447
447
|
segmentComponents: l(n)
|
|
448
448
|
};
|
|
449
|
-
}, [e, C]), ke =
|
|
450
|
-
return /* @__PURE__ */
|
|
449
|
+
}, [e, C]), ke = se ?? L, je = ce ?? oe, Me = Q ? L : oe, Ne = Q ? ke : je, Re = Q ? I : re, ze = j();
|
|
450
|
+
return /* @__PURE__ */ z("div", {
|
|
451
451
|
role: "group",
|
|
452
|
-
"aria-label":
|
|
452
|
+
"aria-label": fe,
|
|
453
453
|
style: Ce,
|
|
454
|
-
onCopy:
|
|
455
|
-
className: d("group/message flex w-full",
|
|
456
|
-
children: /* @__PURE__ */
|
|
454
|
+
onCopy: ge,
|
|
455
|
+
className: d("group/message flex w-full", P),
|
|
456
|
+
children: /* @__PURE__ */ B("div", {
|
|
457
457
|
className: "ms-auto flex w-fit max-w-full min-w-0 flex-col items-end gap-4",
|
|
458
458
|
children: [
|
|
459
|
-
/* @__PURE__ */
|
|
459
|
+
/* @__PURE__ */ z(p, {
|
|
460
460
|
attachments: y ?? [],
|
|
461
461
|
onAttachmentClick: w ? (e) => {
|
|
462
462
|
let t = y?.find((t) => t.id === e);
|
|
463
463
|
t && w(t);
|
|
464
464
|
} : void 0,
|
|
465
465
|
onDownloadAll: T,
|
|
466
|
-
isAttachmentDownloadable:
|
|
467
|
-
onRetry:
|
|
466
|
+
isAttachmentDownloadable: ee,
|
|
467
|
+
onRetry: te,
|
|
468
468
|
labels: {
|
|
469
|
-
clickLabel:
|
|
470
|
-
downloadLabel:
|
|
471
|
-
retryLabel:
|
|
472
|
-
openInNewTabLabel:
|
|
469
|
+
clickLabel: le,
|
|
470
|
+
downloadLabel: ue,
|
|
471
|
+
retryLabel: V,
|
|
472
|
+
openInNewTabLabel: de
|
|
473
473
|
},
|
|
474
474
|
styles: { className: "max-w-[640px]" },
|
|
475
|
-
selectedAttachmentId:
|
|
475
|
+
selectedAttachmentId: E
|
|
476
476
|
}),
|
|
477
|
-
e && /* @__PURE__ */
|
|
478
|
-
className: d($.userBubble, "flex w-fit max-w-full min-w-0 items-center justify-end rounded-ss-2xl rounded-es-2xl border px-6 py-4 wrap-anywhere", we,
|
|
479
|
-
children: /* @__PURE__ */
|
|
477
|
+
e && /* @__PURE__ */ z("div", {
|
|
478
|
+
className: d($.userBubble, "flex w-fit max-w-full min-w-0 items-center justify-end rounded-ss-2xl rounded-es-2xl border px-6 py-4 wrap-anywhere", we, F, H.userBubble),
|
|
479
|
+
children: /* @__PURE__ */ B("div", {
|
|
480
480
|
className: "flex min-w-0 flex-col items-start",
|
|
481
|
-
children: [/* @__PURE__ */
|
|
481
|
+
children: [/* @__PURE__ */ z("div", {
|
|
482
482
|
id: ze,
|
|
483
483
|
ref: t,
|
|
484
|
-
className: d("relative -ms-1 -me-1 w-[calc(100%+8px)] overflow-hidden ps-1 pe-1",
|
|
485
|
-
children: /* @__PURE__ */
|
|
486
|
-
ref:
|
|
484
|
+
className: d("relative -ms-1 -me-1 w-[calc(100%+8px)] overflow-hidden ps-1 pe-1", Y && $.collapsibleText, Y && !Q && $.expandedText, xe && $.collapsedText),
|
|
485
|
+
children: /* @__PURE__ */ z("div", {
|
|
486
|
+
ref: J,
|
|
487
487
|
className: d(Te, "max-w-full min-w-0 text-start", Ie),
|
|
488
|
-
children: /* @__PURE__ */
|
|
488
|
+
children: /* @__PURE__ */ z(r, {
|
|
489
489
|
content: Ee,
|
|
490
490
|
isRawHtmlEnabled: !1,
|
|
491
491
|
rehypePlugins: De,
|
|
492
492
|
components: Oe,
|
|
493
|
-
classNames:
|
|
494
|
-
urlTransform:
|
|
495
|
-
codeBlockCopyLabel:
|
|
496
|
-
codeBlockCopiedLabel:
|
|
497
|
-
codeBlockDownloadLabel:
|
|
498
|
-
codeBlockTheme:
|
|
499
|
-
tableActionLabels:
|
|
500
|
-
tableDownloadFilename:
|
|
501
|
-
tableOnOpenInCanvas:
|
|
502
|
-
tableScrollRegionAriaLabel:
|
|
503
|
-
mathScrollRegionAriaLabel:
|
|
493
|
+
classNames: D,
|
|
494
|
+
urlTransform: O,
|
|
495
|
+
codeBlockCopyLabel: pe,
|
|
496
|
+
codeBlockCopiedLabel: me,
|
|
497
|
+
codeBlockDownloadLabel: U,
|
|
498
|
+
codeBlockTheme: k,
|
|
499
|
+
tableActionLabels: q,
|
|
500
|
+
tableDownloadFilename: _e,
|
|
501
|
+
tableOnOpenInCanvas: A,
|
|
502
|
+
tableScrollRegionAriaLabel: ve,
|
|
503
|
+
mathScrollRegionAriaLabel: be
|
|
504
504
|
})
|
|
505
505
|
})
|
|
506
|
-
}),
|
|
507
|
-
label: /* @__PURE__ */
|
|
508
|
-
iconBefore: /* @__PURE__ */
|
|
506
|
+
}), Y && /* @__PURE__ */ z(x, {
|
|
507
|
+
label: /* @__PURE__ */ z(R, { children: Me }),
|
|
508
|
+
iconBefore: /* @__PURE__ */ z(Re, {
|
|
509
509
|
size: g.SM,
|
|
510
510
|
"aria-hidden": "true"
|
|
511
511
|
}),
|
|
@@ -518,24 +518,24 @@ var U = {
|
|
|
518
518
|
})]
|
|
519
519
|
})
|
|
520
520
|
}),
|
|
521
|
-
/* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ z(ye, {
|
|
522
522
|
...o,
|
|
523
523
|
isAlwaysVisible: m,
|
|
524
|
-
leadingContent:
|
|
524
|
+
leadingContent: ae == null ? o?.leadingContent : /* @__PURE__ */ B(R, { children: [ae, o?.leadingContent] }),
|
|
525
525
|
role: a.User
|
|
526
526
|
})
|
|
527
527
|
]
|
|
528
528
|
})
|
|
529
529
|
});
|
|
530
|
-
}, ze = ({ role: e, beforeContent: t, textSegments: n, onAttachmentClick: r, responseFormat: i, markdownComponents: o, markdownUrlTransform: s, ...c }) => e === a.Status ? /* @__PURE__ */
|
|
530
|
+
}, ze = ({ role: e, beforeContent: t, textSegments: n, onAttachmentClick: r, responseFormat: i, markdownComponents: o, markdownUrlTransform: s, ...c }) => e === a.Status ? /* @__PURE__ */ z(Ne, { labels: {
|
|
531
531
|
titleText: c.labels?.statusTitleText,
|
|
532
532
|
bodyText: c.labels?.statusBodyText ?? ""
|
|
533
|
-
} }) : e === a.User ? /* @__PURE__ */
|
|
533
|
+
} }) : e === a.User ? /* @__PURE__ */ z(Re, {
|
|
534
534
|
...c,
|
|
535
535
|
textSegments: n,
|
|
536
536
|
markdownUrlTransform: s,
|
|
537
537
|
onAttachmentClick: r
|
|
538
|
-
}) : /* @__PURE__ */
|
|
538
|
+
}) : /* @__PURE__ */ z(Me, {
|
|
539
539
|
...c,
|
|
540
540
|
beforeContent: t,
|
|
541
541
|
responseFormat: i,
|
|
@@ -547,11 +547,11 @@ var U = {
|
|
|
547
547
|
"--cm-reply-background": c?.background,
|
|
548
548
|
"--cm-reply-hover-background": c?.hoverBackground,
|
|
549
549
|
"--cm-reply-text": c?.text
|
|
550
|
-
}), [b, x] =
|
|
550
|
+
}), [b, x] = P({
|
|
551
551
|
x: 0,
|
|
552
552
|
y: 0
|
|
553
553
|
});
|
|
554
|
-
return
|
|
554
|
+
return M(() => {
|
|
555
555
|
if (!e || !t.current) return;
|
|
556
556
|
let n = t.current.getBoundingClientRect(), r = window.visualViewport, i = r?.offsetLeft ?? 0, a = r?.offsetTop ?? 0, o = r?.width ?? document.documentElement.clientWidth, s = r?.height ?? document.documentElement.clientHeight, c = e.top - n.height - 8 >= a + 8 ? e.top - n.height - 8 : e.bottom + 8;
|
|
557
557
|
x({
|
|
@@ -566,36 +566,36 @@ var U = {
|
|
|
566
566
|
f,
|
|
567
567
|
p,
|
|
568
568
|
i.reply
|
|
569
|
-
]), g ?
|
|
569
|
+
]), g ? V(/* @__PURE__ */ B(R, { children: [e && /* @__PURE__ */ z("div", {
|
|
570
570
|
ref: t,
|
|
571
571
|
className: d("fixed top-0 left-0 z-50 max-w-[calc(100vw-16px)]", u),
|
|
572
572
|
style: {
|
|
573
573
|
...y,
|
|
574
574
|
transform: `translate(${b.x}px, ${b.y}px)`
|
|
575
575
|
},
|
|
576
|
-
children: /* @__PURE__ */
|
|
576
|
+
children: /* @__PURE__ */ z(m, {
|
|
577
577
|
variant: h.Neutral,
|
|
578
578
|
size: v.Small,
|
|
579
579
|
label: i.reply,
|
|
580
580
|
onClick: n,
|
|
581
581
|
textClassName: p,
|
|
582
582
|
className: d(Be.button, "h-8 min-h-8 min-w-11 px-2 shadow-lg mobile:h-11 mobile:min-h-11", f),
|
|
583
|
-
iconAfter: /* @__PURE__ */
|
|
583
|
+
iconAfter: /* @__PURE__ */ z(F, {
|
|
584
584
|
size: 16,
|
|
585
585
|
stroke: _,
|
|
586
586
|
"aria-hidden": "true",
|
|
587
587
|
className: "rtl:scale-x-[-1]"
|
|
588
588
|
})
|
|
589
589
|
})
|
|
590
|
-
}), /* @__PURE__ */
|
|
590
|
+
}), /* @__PURE__ */ z(S, {
|
|
591
591
|
visuallyHidden: !0,
|
|
592
|
-
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */
|
|
592
|
+
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */ z("span", { children: i.attachmentAdded }, r) : null
|
|
593
593
|
})] }), g) : null;
|
|
594
594
|
}, He = { label: "_label_1nohb_1" }, Ue = (e) => `Today ${e}`, We = (e) => `Yesterday ${e}`, Ge = ({ timestamp: e, locale: t, labels: n, className: r = "dial-small-text", colors: i }) => {
|
|
595
595
|
let a = Ce(e);
|
|
596
596
|
if (a == null) return null;
|
|
597
597
|
let { kind: o, text: c } = Te(a, /* @__PURE__ */ new Date(), t), l = c;
|
|
598
|
-
return o ===
|
|
598
|
+
return o === q.Today ? l = (n?.today ?? Ue)(c) : o === q.Yesterday && (l = (n?.yesterday ?? We)(c)), /* @__PURE__ */ z("time", {
|
|
599
599
|
dateTime: e,
|
|
600
600
|
className: d("self-center text-center", He.label, r),
|
|
601
601
|
style: s({ "--cst-text": i?.text }),
|
|
@@ -603,17 +603,17 @@ var U = {
|
|
|
603
603
|
});
|
|
604
604
|
}, Ke = /* @__PURE__ */ function(e) {
|
|
605
605
|
return e.UiBug = "UI bug", e.OveractiveRefusal = "Overactive refusal", e.IncompleteResponse = "Incomplete response", e.ShouldHaveTriggeredThinking = "Should have triggered thinking", e.ShouldHaveSearchedTheWeb = "Should have searched the web", e;
|
|
606
|
-
}({}), qe =
|
|
607
|
-
let { title: i = "Send negative feedback", feedbackTypeLabel: a = "What type of feedback you want to give?", selectPlaceholder: o = "Select", commentPlaceholder: s = "Type an optional comment to your feedback", sendLabel: c = "Send", categoryLabels: l } = r ?? {}, [u, d] =
|
|
606
|
+
}({}), qe = O(({ onClose: e, onSubmit: t, isCommentEnabled: n = !0, labels: r }) => {
|
|
607
|
+
let { title: i = "Send negative feedback", feedbackTypeLabel: a = "What type of feedback you want to give?", selectPlaceholder: o = "Select", commentPlaceholder: s = "Type an optional comment to your feedback", sendLabel: c = "Send", categoryLabels: l } = r ?? {}, [u, d] = P(""), [f, p] = P(""), m = N(() => Object.values(Ke).map((e) => ({
|
|
608
608
|
value: e,
|
|
609
609
|
label: l?.[e] ?? e
|
|
610
|
-
})), [l]), g =
|
|
610
|
+
})), [l]), g = k(() => {
|
|
611
611
|
t(f.trim() ? `${u}: ${f.trim()}` : u);
|
|
612
612
|
}, [
|
|
613
613
|
u,
|
|
614
614
|
f,
|
|
615
615
|
t
|
|
616
|
-
]), _ =
|
|
616
|
+
]), _ = N(() => [{
|
|
617
617
|
label: c,
|
|
618
618
|
variant: h.Primary,
|
|
619
619
|
disabled: !u,
|
|
@@ -623,16 +623,16 @@ var U = {
|
|
|
623
623
|
g,
|
|
624
624
|
c
|
|
625
625
|
]);
|
|
626
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ z(T, {
|
|
627
627
|
open: !0,
|
|
628
628
|
header: i,
|
|
629
629
|
onClose: e,
|
|
630
|
-
size:
|
|
630
|
+
size: ee.Sm,
|
|
631
631
|
className: "h-[422px]!",
|
|
632
632
|
mainButtons: _,
|
|
633
|
-
children: /* @__PURE__ */
|
|
633
|
+
children: /* @__PURE__ */ B("div", {
|
|
634
634
|
className: "flex h-full flex-col gap-4 px-6 py-4",
|
|
635
|
-
children: [/* @__PURE__ */
|
|
635
|
+
children: [/* @__PURE__ */ z(te, {
|
|
636
636
|
labelProps: {
|
|
637
637
|
label: a,
|
|
638
638
|
required: !0
|
|
@@ -641,7 +641,7 @@ var U = {
|
|
|
641
641
|
value: u,
|
|
642
642
|
placeholder: o,
|
|
643
643
|
onChange: (e) => d(e)
|
|
644
|
-
}), n && /* @__PURE__ */
|
|
644
|
+
}), n && /* @__PURE__ */ z(E, {
|
|
645
645
|
value: f,
|
|
646
646
|
placeholder: s,
|
|
647
647
|
onChange: (e) => p(e ?? ""),
|
|
@@ -652,4 +652,4 @@ var U = {
|
|
|
652
652
|
});
|
|
653
653
|
});
|
|
654
654
|
//#endregion
|
|
655
|
-
export { Me as AssistantMessageBubble, Pe as BubblePosition,
|
|
655
|
+
export { Me as AssistantMessageBubble, Pe as BubblePosition, H as CONVERSATION_MESSAGES_CLASS, Ge as ConversationStartTimestamp, ye as MessageActions, ze as MessageBubble, Ve as MessageSelectionReply, Ke as NegativeFeedbackCategory, qe as NegativeFeedbackModal, Ne as StatusMessageBubble, Re as UserMessageBubble };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-conversation-messages",
|
|
3
3
|
"description": "Message bubble components for rendering conversation history with actions and source citations",
|
|
4
|
-
"version": "1.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.342",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.50.0",
|
|
21
21
|
"react-markdown": "^10.1.0",
|
|
22
|
-
"@epam/ai-dial-attachment-input": "1.3.0-dev.
|
|
22
|
+
"@epam/ai-dial-attachment-input": "1.3.0-dev.342"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
26
|
"react-dom": "^19.2.8",
|
|
27
|
-
"@epam/ai-dial-chat-shared": "1.3.0-dev.
|
|
28
|
-
"@epam/ai-dial-ui-kit": "^0.16.0
|
|
27
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.342",
|
|
28
|
+
"@epam/ai-dial-ui-kit": "^0.16.0"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|