@epam/ai-dial-conversation-messages 1.0.0-dev.484 → 1.0.0-dev.486
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":"AAUA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/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":"AAUA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/E,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAgIlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAO1E,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAO1E,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAwIxD,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, CodeBlockTheme as n, DeploymentIcon as r, Highlight as i, MDMessageViewer as a, MIME_TYPE_EXT_MAP as o, MessageRating as s, MessageRole as c, RequestStatus as l, ResponseFormat as u, buildCssVars as d, mergeClasses as f, useCollapsedText as p } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { DIAL_ICON_SIZE as m, DialGhostIconButton as h, DialInput as g, DialLinkButton as _, DialNotification as v, DialPopup as y, DialPrimaryButton as b, DialRadioGroup as x, DialRoundedButton as S, DialSkeleton as C, DialSkeletonVariant as w, DialSlider as T, DialSpinner as E, DialTag as D, DialTooltip as O, ElementSize as k, PopupSize as A, RadioGroupOrientation as j } from "@epam/ai-dial-ui-kit";
|
|
3
|
-
import { IconCheck as M, IconChevronDown as N, IconChevronUp as P, IconClipboard as F, IconCopy as I, IconDownload as L, IconFile as R, IconFileTypeBmp as z, IconFileTypeCss as
|
|
3
|
+
import { IconCheck as M, IconChevronDown as N, IconChevronUp as P, IconClipboard as F, IconCopy as I, IconDownload as L, IconFile as R, IconFileTypeBmp as z, IconFileTypeCss as ee, IconFileTypeCsv as te, IconFileTypeDoc as ne, IconFileTypeDocx as B, IconFileTypeHtml as V, IconFileTypeJpg as H, IconFileTypeJs as U, IconFileTypeJsx as W, IconFileTypePdf as G, IconFileTypePhp as re, IconFileTypePng as ie, IconFileTypePpt as ae, IconFileTypeRs as oe, IconFileTypeSql as se, IconFileTypeSvg as ce, IconFileTypeTs as le, IconFileTypeTsx as ue, IconFileTypeTxt as de, IconFileTypeVue as fe, IconFileTypeXls as pe, IconFileTypeXml as me, IconFileTypeZip as he, IconMarkdown as ge, IconMusic as _e, IconPaperclip as ve, IconPencilMinus as ye, IconPhoto as be, IconRefresh as xe, IconReload as Se, IconTerminal2 as Ce, IconThumbDown as we, IconThumbUp as Te, IconTrashX as Ee, IconVideo as De, IconX as Oe } from "@tabler/icons-react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
import { memo as ke, useCallback as Ae, useEffect as je, useId as Me, useMemo as Ne, useRef as Pe, useState as K } from "react";
|
|
6
6
|
import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
@@ -23,22 +23,27 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
23
23
|
imageLoadStatus: r
|
|
24
24
|
};
|
|
25
25
|
}, X = {
|
|
26
|
-
card: "
|
|
27
|
-
cardError: "
|
|
28
|
-
cardSelected: "
|
|
29
|
-
cardPrompt: "
|
|
30
|
-
cardPasted: "
|
|
31
|
-
name: "
|
|
32
|
-
meta: "
|
|
33
|
-
loadingOverlay: "
|
|
34
|
-
actionBtn: "
|
|
35
|
-
removeBtnImage: "
|
|
36
|
-
hoverDownloadIcon: "
|
|
37
|
-
}, Le = (e)
|
|
26
|
+
card: "_card_ywrb5_1",
|
|
27
|
+
cardError: "_cardError_ywrb5_6",
|
|
28
|
+
cardSelected: "_cardSelected_ywrb5_10",
|
|
29
|
+
cardPrompt: "_cardPrompt_ywrb5_15",
|
|
30
|
+
cardPasted: "_cardPasted_ywrb5_16",
|
|
31
|
+
name: "_name_ywrb5_20",
|
|
32
|
+
meta: "_meta_ywrb5_24",
|
|
33
|
+
loadingOverlay: "_loadingOverlay_ywrb5_28",
|
|
34
|
+
actionBtn: "_actionBtn_ywrb5_32",
|
|
35
|
+
removeBtnImage: "_removeBtnImage_ywrb5_43",
|
|
36
|
+
hoverDownloadIcon: "_hoverDownloadIcon_ywrb5_51"
|
|
37
|
+
}, Le = /* @__PURE__ */ function(e) {
|
|
38
|
+
return e.None = "none", e.AllVisible = "all-visible", e.Collapsed = "collapsed", e;
|
|
39
|
+
}({}), Re = (e) => {
|
|
40
|
+
let t = e.lastIndexOf(".");
|
|
41
|
+
return t > 0 ? e.slice(0, t) : e;
|
|
42
|
+
}, ze = (e) => {
|
|
38
43
|
if (!e) return R;
|
|
39
44
|
if (e.startsWith("image/")) switch (e) {
|
|
40
45
|
case "image/jpeg":
|
|
41
|
-
case "image/jpg": return
|
|
46
|
+
case "image/jpg": return H;
|
|
42
47
|
case "image/png": return ie;
|
|
43
48
|
case "image/svg+xml": return ce;
|
|
44
49
|
case "image/bmp": return z;
|
|
@@ -49,8 +54,8 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
49
54
|
switch (e) {
|
|
50
55
|
case "application/pdf": return G;
|
|
51
56
|
case "application/msword":
|
|
52
|
-
case "application/vnd.ms-word": return
|
|
53
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
57
|
+
case "application/vnd.ms-word": return ne;
|
|
58
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return B;
|
|
54
59
|
case "application/vnd.ms-powerpoint": return ae;
|
|
55
60
|
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return ae;
|
|
56
61
|
case "application/vnd.ms-excel": return pe;
|
|
@@ -61,21 +66,21 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
61
66
|
case "application/x-7z-compressed":
|
|
62
67
|
case "application/gzip":
|
|
63
68
|
case "application/x-tar": return he;
|
|
64
|
-
case "text/csv": return
|
|
69
|
+
case "text/csv": return te;
|
|
65
70
|
case "text/plain": return de;
|
|
66
71
|
case "text/html":
|
|
67
|
-
case "application/xhtml+xml": return
|
|
72
|
+
case "application/xhtml+xml": return V;
|
|
68
73
|
case "text/xml":
|
|
69
74
|
case "application/xml": return me;
|
|
70
75
|
case "application/sql":
|
|
71
76
|
case "text/x-sql": return se;
|
|
72
77
|
case "text/javascript":
|
|
73
|
-
case "application/javascript": return
|
|
78
|
+
case "application/javascript": return U;
|
|
74
79
|
case "text/jsx": return W;
|
|
75
80
|
case "application/typescript":
|
|
76
81
|
case "text/typescript": return le;
|
|
77
82
|
case "text/tsx": return ue;
|
|
78
|
-
case "text/css": return
|
|
83
|
+
case "text/css": return ee;
|
|
79
84
|
case "text/x-php":
|
|
80
85
|
case "application/x-php": return re;
|
|
81
86
|
case "text/x-rustsrc":
|
|
@@ -83,26 +88,26 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
83
88
|
case "text/x-vue": return fe;
|
|
84
89
|
default: return R;
|
|
85
90
|
}
|
|
86
|
-
},
|
|
91
|
+
}, Be = (e) => {
|
|
87
92
|
let { type: n, contentType: r } = e;
|
|
88
|
-
return n === t.Prompt ? Ce : n === t.Pasted ? F : n === t.Image ? be :
|
|
89
|
-
},
|
|
93
|
+
return n === t.Prompt ? Ce : n === t.Pasted ? F : n === t.Image ? be : ze(r ?? "");
|
|
94
|
+
}, Ve = (e) => {
|
|
90
95
|
let t = e.toLowerCase().split(";")[0].trim(), n = o[t];
|
|
91
96
|
if (n) return n;
|
|
92
97
|
let r = t.split("/")[1];
|
|
93
98
|
if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
|
|
94
|
-
},
|
|
99
|
+
}, He = (e) => {
|
|
95
100
|
let { type: n, name: r, contentType: i } = e;
|
|
96
101
|
if (n === t.Prompt) return "Prompt";
|
|
97
102
|
if (n === t.Pasted) return "Pasted";
|
|
98
103
|
if (n === t.Image) return "Image";
|
|
99
104
|
if (i) {
|
|
100
|
-
let e =
|
|
105
|
+
let e = Ve(i);
|
|
101
106
|
if (e) return `.${e}`;
|
|
102
107
|
}
|
|
103
108
|
let a = r.lastIndexOf(".");
|
|
104
109
|
return a > 0 && a < r.length - 1 ? `.${r.slice(a + 1).toLowerCase()}` : r;
|
|
105
|
-
},
|
|
110
|
+
}, Ue = (e, n, r) => {
|
|
106
111
|
let { type: i, status: a, previewUrl: o, url: s } = e, c = a === l.Loading, u = a === l.Error, d = i === t.Image && !!(o ?? s) && !u, p = i === t.Audio && !u, m = f(X.card, u && X.cardError, n && X.cardSelected, !u && !n && i === t.Prompt && X.cardPrompt, !u && !n && i === t.Pasted && X.cardPasted);
|
|
107
112
|
return {
|
|
108
113
|
isLoading: c,
|
|
@@ -110,40 +115,49 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
110
115
|
isImage: d,
|
|
111
116
|
isAudio: p,
|
|
112
117
|
areActionsVisible: u || r,
|
|
113
|
-
BottomIcon:
|
|
114
|
-
typeLabel:
|
|
118
|
+
BottomIcon: Be(e),
|
|
119
|
+
typeLabel: He(e),
|
|
115
120
|
cardColorClass: m,
|
|
116
121
|
removeBtnClass: d ? X.removeBtnImage : X.actionBtn
|
|
117
122
|
};
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
}, We = (e, t) => e <= 0 ? {
|
|
124
|
+
layout: Le.None,
|
|
125
|
+
visibleCount: 0,
|
|
126
|
+
hiddenCount: 0
|
|
127
|
+
} : e < 5 || t ? {
|
|
128
|
+
layout: Le.AllVisible,
|
|
129
|
+
visibleCount: e,
|
|
130
|
+
hiddenCount: 0
|
|
131
|
+
} : {
|
|
132
|
+
layout: Le.Collapsed,
|
|
133
|
+
visibleCount: 4,
|
|
134
|
+
hiddenCount: e - 4
|
|
135
|
+
}, Ge = ({ attachment: n, searchQuery: r = "", onRemove: a, onRetry: o, onExpand: s, onClick: c, isSelected: l, shouldAlwaysShowActions: u, labels: p, styles: g, showHoverDownloadIcon: _ = !1, className: v }) => {
|
|
136
|
+
let { removeLabel: y = "Remove attachment", retryLabel: b = "Retry upload", clickLabel: x = "Open attachment" } = p ?? {}, { colors: S, typography: T, roundedClassName: D = "rounded-xl" } = g ?? {}, { id: O, name: A } = n, j = n.previewUrl ?? n.url, M = n.type === t.Pasted, N = M && s !== void 0, P = Ne(() => M ? A : Re(A), [M, A]), F = d({
|
|
137
|
+
"--ci-card-border": S?.border,
|
|
138
|
+
"--ci-card-bg": S?.background,
|
|
139
|
+
"--ci-card-name": S?.nameText,
|
|
140
|
+
"--ci-card-meta": S?.metaText
|
|
141
|
+
}), { isLoading: I, isError: R, isImage: z, isAudio: ee, areActionsVisible: te, BottomIcon: ne, typeLabel: B, cardColorClass: V, removeBtnClass: H } = Ne(() => Ue(n, l ?? !1, u ?? !1), [
|
|
128
142
|
n,
|
|
129
143
|
l,
|
|
130
144
|
u
|
|
131
|
-
]), U = c !== void 0 && !
|
|
132
|
-
enabled:
|
|
133
|
-
src:
|
|
134
|
-
}),
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
145
|
+
]), U = c !== void 0 && !N && !I && !R, W = N || U, { imageRef: G, imageLoadStatus: re } = Ie({
|
|
146
|
+
enabled: z,
|
|
147
|
+
src: j
|
|
148
|
+
}), ie = () => {
|
|
149
|
+
N && s ? s(O) : U && c && c(O);
|
|
150
|
+
}, ae = (e) => {
|
|
151
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), ie());
|
|
138
152
|
};
|
|
139
|
-
if (
|
|
140
|
-
style:
|
|
141
|
-
className: f("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 border p-3",
|
|
153
|
+
if (ee) return /* @__PURE__ */ Y("div", {
|
|
154
|
+
style: F,
|
|
155
|
+
className: f("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 border p-3", D, V, v),
|
|
142
156
|
children: [/* @__PURE__ */ Y("div", {
|
|
143
157
|
className: "flex items-center justify-between gap-2",
|
|
144
158
|
children: [/* @__PURE__ */ J("span", {
|
|
145
159
|
title: n.name,
|
|
146
|
-
className: f(
|
|
160
|
+
className: f(T?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.name),
|
|
147
161
|
children: r ? /* @__PURE__ */ J(i, {
|
|
148
162
|
text: n.name,
|
|
149
163
|
query: r,
|
|
@@ -156,9 +170,9 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
156
170
|
}),
|
|
157
171
|
size: k.Small,
|
|
158
172
|
className: f("h-6 w-6 shrink-0 rounded", H),
|
|
159
|
-
"aria-label":
|
|
173
|
+
"aria-label": x,
|
|
160
174
|
onClick: (e) => {
|
|
161
|
-
e.stopPropagation(), c(
|
|
175
|
+
e.stopPropagation(), c(O);
|
|
162
176
|
}
|
|
163
177
|
})]
|
|
164
178
|
}), n.playUrl && /* @__PURE__ */ J("audio", {
|
|
@@ -168,94 +182,94 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
168
182
|
preload: "metadata"
|
|
169
183
|
})]
|
|
170
184
|
});
|
|
171
|
-
let
|
|
172
|
-
|
|
185
|
+
let oe = f("group relative flex h-[100px] w-[100px] flex-shrink-0 border focus-within:outline focus-within:outline-1 focus-within:outline-offset-1", D, V, !z && "flex-col gap-3 p-3", W && "cursor-pointer", v), se = /* @__PURE__ */ Y(q, { children: [
|
|
186
|
+
z ? /* @__PURE__ */ Y("div", {
|
|
173
187
|
className: "relative h-full w-full overflow-hidden",
|
|
174
|
-
children: [
|
|
188
|
+
children: [re !== Fe.Loaded && /* @__PURE__ */ J(C, {
|
|
175
189
|
variant: w.Rectangular,
|
|
176
190
|
width: "100%",
|
|
177
191
|
height: "100%",
|
|
178
|
-
active:
|
|
192
|
+
active: re === Fe.Loading,
|
|
179
193
|
overlay: /* @__PURE__ */ J(be, {
|
|
180
194
|
size: m.LG,
|
|
181
|
-
className:
|
|
195
|
+
className: T?.placeholderIconClassName ?? "text-secondary",
|
|
182
196
|
"aria-hidden": !0
|
|
183
197
|
}),
|
|
184
|
-
className: f("absolute inset-0",
|
|
198
|
+
className: f("absolute inset-0", D)
|
|
185
199
|
}), /* @__PURE__ */ J("img", {
|
|
186
|
-
ref:
|
|
187
|
-
src:
|
|
188
|
-
alt:
|
|
200
|
+
ref: G,
|
|
201
|
+
src: j,
|
|
202
|
+
alt: A,
|
|
189
203
|
loading: "lazy",
|
|
190
204
|
decoding: "async",
|
|
191
|
-
className: f("h-full w-full object-cover transition-opacity duration-200",
|
|
205
|
+
className: f("h-full w-full object-cover transition-opacity duration-200", re === Fe.Loaded ? "opacity-100" : "opacity-0", D)
|
|
192
206
|
})]
|
|
193
|
-
}) :
|
|
207
|
+
}) : R ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y("div", {
|
|
194
208
|
className: "flex flex-row items-center gap-1 overflow-hidden",
|
|
195
|
-
children: [/* @__PURE__ */ J(
|
|
209
|
+
children: [/* @__PURE__ */ J(ne, {
|
|
196
210
|
size: m.SM,
|
|
197
211
|
className: f("shrink-0", X.meta),
|
|
198
212
|
"aria-hidden": !0
|
|
199
213
|
}), /* @__PURE__ */ J("span", {
|
|
200
|
-
title:
|
|
201
|
-
className: f(
|
|
202
|
-
children:
|
|
214
|
+
title: B,
|
|
215
|
+
className: f(T?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", X.meta),
|
|
216
|
+
children: B
|
|
203
217
|
})]
|
|
204
218
|
}), /* @__PURE__ */ J("div", {
|
|
205
219
|
className: "min-w-0 flex-1",
|
|
206
220
|
children: /* @__PURE__ */ J("div", {
|
|
207
|
-
title:
|
|
208
|
-
className: f(
|
|
221
|
+
title: P,
|
|
222
|
+
className: f(T?.fontClassName ?? "dial-tiny-text", "line-clamp-3 break-words", X.name),
|
|
209
223
|
children: r ? /* @__PURE__ */ J(i, {
|
|
210
|
-
text:
|
|
224
|
+
text: P,
|
|
211
225
|
query: r,
|
|
212
226
|
maxLines: 3
|
|
213
|
-
}) :
|
|
227
|
+
}) : P
|
|
214
228
|
})
|
|
215
229
|
})] }) : /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("div", {
|
|
216
230
|
className: "min-w-0 flex-1",
|
|
217
231
|
children: /* @__PURE__ */ J("div", {
|
|
218
|
-
title:
|
|
219
|
-
className: f(
|
|
232
|
+
title: P,
|
|
233
|
+
className: f(T?.fontClassName ?? "dial-tiny-text", "line-clamp-3 break-words", X.name),
|
|
220
234
|
children: r ? /* @__PURE__ */ J(i, {
|
|
221
|
-
text:
|
|
235
|
+
text: P,
|
|
222
236
|
query: r,
|
|
223
237
|
maxLines: 3
|
|
224
|
-
}) :
|
|
238
|
+
}) : P
|
|
225
239
|
})
|
|
226
240
|
}), /* @__PURE__ */ Y("div", {
|
|
227
241
|
className: "flex flex-row items-center gap-1 overflow-hidden",
|
|
228
|
-
children: [/* @__PURE__ */ J(
|
|
242
|
+
children: [/* @__PURE__ */ J(ne, {
|
|
229
243
|
size: m.SM,
|
|
230
244
|
className: f("shrink-0", X.meta),
|
|
231
245
|
"aria-hidden": !0
|
|
232
246
|
}), /* @__PURE__ */ J("span", {
|
|
233
|
-
title:
|
|
234
|
-
className: f(
|
|
235
|
-
children:
|
|
247
|
+
title: B,
|
|
248
|
+
className: f(T?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", X.meta),
|
|
249
|
+
children: B
|
|
236
250
|
})]
|
|
237
251
|
})] }),
|
|
238
|
-
|
|
239
|
-
className: f("absolute inset-0 flex items-center justify-center",
|
|
252
|
+
I && /* @__PURE__ */ J("span", {
|
|
253
|
+
className: f("absolute inset-0 flex items-center justify-center", D, X.loadingOverlay),
|
|
240
254
|
children: /* @__PURE__ */ J(E, {
|
|
241
255
|
size: 40,
|
|
242
256
|
ariaLabel: "Loading attachment",
|
|
243
257
|
className: "z-50"
|
|
244
258
|
})
|
|
245
259
|
}),
|
|
246
|
-
!
|
|
247
|
-
className: f("absolute end-1 top-1 flex gap-1 transition-opacity",
|
|
260
|
+
!I && /* @__PURE__ */ Y("div", {
|
|
261
|
+
className: f("absolute end-1 top-1 flex gap-1 transition-opacity", te ? "opacity-100" : "opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 mobile:opacity-100"),
|
|
248
262
|
children: [
|
|
249
|
-
|
|
263
|
+
R && o && n.errorReason !== e.UnsupportedType && /* @__PURE__ */ J(h, {
|
|
250
264
|
icon: /* @__PURE__ */ J(Se, {
|
|
251
265
|
size: m.SM,
|
|
252
266
|
"aria-hidden": !0
|
|
253
267
|
}),
|
|
254
268
|
size: k.Small,
|
|
255
269
|
className: f("h-6 w-6 rounded", H),
|
|
256
|
-
"aria-label":
|
|
270
|
+
"aria-label": b,
|
|
257
271
|
onClick: (e) => {
|
|
258
|
-
e.stopPropagation(), o(
|
|
272
|
+
e.stopPropagation(), o(O);
|
|
259
273
|
}
|
|
260
274
|
}),
|
|
261
275
|
a && /* @__PURE__ */ J(h, {
|
|
@@ -265,12 +279,12 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
265
279
|
}),
|
|
266
280
|
size: k.Small,
|
|
267
281
|
className: f("h-6 w-6 rounded", H),
|
|
268
|
-
"aria-label":
|
|
282
|
+
"aria-label": y,
|
|
269
283
|
onClick: (e) => {
|
|
270
|
-
e.stopPropagation(), a?.(
|
|
284
|
+
e.stopPropagation(), a?.(O);
|
|
271
285
|
}
|
|
272
286
|
}),
|
|
273
|
-
|
|
287
|
+
_ && !a && !R && /* @__PURE__ */ J(L, {
|
|
274
288
|
size: m.SM,
|
|
275
289
|
"aria-hidden": !0,
|
|
276
290
|
className: f("h-6 w-6 rounded-lg p-1", X.hoverDownloadIcon)
|
|
@@ -278,143 +292,129 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
278
292
|
]
|
|
279
293
|
})
|
|
280
294
|
] });
|
|
281
|
-
return
|
|
282
|
-
style:
|
|
283
|
-
className:
|
|
284
|
-
onClick:
|
|
285
|
-
onKeyDown:
|
|
295
|
+
return W ? /* @__PURE__ */ J("div", {
|
|
296
|
+
style: F,
|
|
297
|
+
className: oe,
|
|
298
|
+
onClick: ie,
|
|
299
|
+
onKeyDown: ae,
|
|
286
300
|
tabIndex: 0,
|
|
287
301
|
role: "button",
|
|
288
|
-
"aria-label": U ?
|
|
289
|
-
children:
|
|
302
|
+
"aria-label": U ? x : void 0,
|
|
303
|
+
children: se
|
|
290
304
|
}) : /* @__PURE__ */ J("div", {
|
|
291
|
-
style:
|
|
292
|
-
className:
|
|
293
|
-
children:
|
|
305
|
+
style: F,
|
|
306
|
+
className: oe,
|
|
307
|
+
children: se
|
|
294
308
|
});
|
|
295
|
-
}, We = /* @__PURE__ */ function(e) {
|
|
296
|
-
return e.None = "none", e.AllVisible = "all-visible", e.Collapsed = "collapsed", e;
|
|
297
|
-
}({}), Ge = (e, t) => e <= 0 ? {
|
|
298
|
-
layout: "none",
|
|
299
|
-
visibleCount: 0,
|
|
300
|
-
hiddenCount: 0
|
|
301
|
-
} : e < 5 || t ? {
|
|
302
|
-
layout: "all-visible",
|
|
303
|
-
visibleCount: e,
|
|
304
|
-
hiddenCount: 0
|
|
305
|
-
} : {
|
|
306
|
-
layout: "collapsed",
|
|
307
|
-
visibleCount: 4,
|
|
308
|
-
hiddenCount: e - 4
|
|
309
309
|
}, Z = {
|
|
310
|
-
tile: "
|
|
311
|
-
tileLight: "
|
|
312
|
-
tileError: "
|
|
313
|
-
nameText: "
|
|
314
|
-
typeText: "
|
|
315
|
-
retryIcon: "
|
|
316
|
-
hoverIcon: "
|
|
317
|
-
track: "
|
|
318
|
-
indeterminateFill: "
|
|
319
|
-
"attachment-tile-indeterminate": "_attachment-tile-
|
|
310
|
+
tile: "_tile_488nu_1",
|
|
311
|
+
tileLight: "_tileLight_488nu_12",
|
|
312
|
+
tileError: "_tileError_488nu_16",
|
|
313
|
+
nameText: "_nameText_488nu_23",
|
|
314
|
+
typeText: "_typeText_488nu_24",
|
|
315
|
+
retryIcon: "_retryIcon_488nu_36",
|
|
316
|
+
hoverIcon: "_hoverIcon_488nu_40",
|
|
317
|
+
track: "_track_488nu_45",
|
|
318
|
+
indeterminateFill: "_indeterminateFill_488nu_49",
|
|
319
|
+
"attachment-tile-indeterminate": "_attachment-tile-indeterminate_488nu_1"
|
|
320
320
|
}, Ke = {
|
|
321
321
|
[e.Network]: "Upload failed · network error",
|
|
322
322
|
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
323
|
-
}, qe = ({ attachment: t, onClick: r, onRetry: i,
|
|
324
|
-
let {
|
|
325
|
-
|
|
326
|
-
},
|
|
327
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
328
|
-
},
|
|
329
|
-
title:
|
|
330
|
-
className: f("
|
|
331
|
-
children:
|
|
332
|
-
}),
|
|
333
|
-
className: f("flex items-center gap-1 overflow-hidden",
|
|
334
|
-
children: [/* @__PURE__ */ J(
|
|
323
|
+
}, qe = ({ attachment: t, onClick: r, onRetry: i, labels: a, styles: o, theme: s = n.Dark, className: c }) => {
|
|
324
|
+
let { clickLabel: u = "Download attachment", retryLabel: d = "Retry upload", sizeLabel: p } = a ?? {}, { nameClassName: g = "dial-caption-text", metaClassName: _ = "dial-caption-text" } = o ?? {}, { id: v, name: y, status: b, errorReason: x } = t, S = b === l.Loading, C = b === l.Error, w = C && (x && Ke[x] || "Upload failed"), { BottomIcon: T, typeLabel: E } = Ue(t, !1, !1), D = !C && !S && r !== void 0, O = C && !!i && x !== e.UnsupportedType, A = D || O ? "pe-5" : void 0, j = () => {
|
|
325
|
+
D && r?.(t);
|
|
326
|
+
}, M = (e) => {
|
|
327
|
+
(e.key === "Enter" || e.key === " ") && D && (e.preventDefault(), j());
|
|
328
|
+
}, N = f("group relative flex size-[84px] flex-col justify-between gap-1 overflow-hidden rounded-xl border p-1.5", Z.tile, !C && s === n.Light && Z.tileLight, C && Z.tileError), P = /* @__PURE__ */ J("div", {
|
|
329
|
+
title: y,
|
|
330
|
+
className: f(g, "line-clamp-2 min-w-0 break-words", Z.nameText, !C && A),
|
|
331
|
+
children: y
|
|
332
|
+
}), F = /* @__PURE__ */ Y("div", {
|
|
333
|
+
className: f("flex items-center gap-1 overflow-hidden", C && A),
|
|
334
|
+
children: [/* @__PURE__ */ J(T, {
|
|
335
335
|
size: 16,
|
|
336
336
|
className: Z.typeText,
|
|
337
337
|
"aria-hidden": !0
|
|
338
338
|
}), /* @__PURE__ */ J("span", {
|
|
339
|
-
className: f("
|
|
340
|
-
children:
|
|
339
|
+
className: f(_, "truncate", Z.typeText),
|
|
340
|
+
children: p ? `${E} · ${p}` : E
|
|
341
341
|
})]
|
|
342
|
-
}),
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
}), I = /* @__PURE__ */ Y(q, { children: [
|
|
343
|
+
C ? /* @__PURE__ */ Y(q, { children: [F, P] }) : /* @__PURE__ */ Y(q, { children: [P, F] }),
|
|
344
|
+
S && /* @__PURE__ */ J("div", {
|
|
345
345
|
role: "progressbar",
|
|
346
346
|
"aria-label": "Uploading",
|
|
347
347
|
className: f("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", Z.track),
|
|
348
348
|
children: /* @__PURE__ */ J("div", { className: f("h-full w-1/3 rounded-full", Z.indeterminateFill) })
|
|
349
349
|
}),
|
|
350
|
-
|
|
350
|
+
D && /* @__PURE__ */ J(L, {
|
|
351
351
|
size: m.SM,
|
|
352
352
|
"aria-hidden": !0,
|
|
353
353
|
className: f("absolute end-1 top-1 h-6 w-6 rounded-lg p-1 opacity-0 transition-opacity group-hover:opacity-100 mobile:opacity-100", Z.hoverIcon)
|
|
354
354
|
}),
|
|
355
|
-
|
|
355
|
+
O && /* @__PURE__ */ J(h, {
|
|
356
356
|
icon: /* @__PURE__ */ J(Se, {
|
|
357
357
|
size: m.SM,
|
|
358
358
|
"aria-hidden": !0
|
|
359
359
|
}),
|
|
360
360
|
size: k.Small,
|
|
361
361
|
className: f("absolute end-1 top-1 h-6 w-6 rounded-lg", Z.retryIcon),
|
|
362
|
-
"aria-label":
|
|
362
|
+
"aria-label": d,
|
|
363
363
|
onClick: (e) => {
|
|
364
|
-
e.stopPropagation(), i(
|
|
364
|
+
e.stopPropagation(), i(v);
|
|
365
365
|
}
|
|
366
366
|
})
|
|
367
367
|
] });
|
|
368
368
|
return /* @__PURE__ */ J("div", {
|
|
369
369
|
className: f("inline-flex", c),
|
|
370
|
-
children:
|
|
370
|
+
children: D ? /* @__PURE__ */ J("div", {
|
|
371
371
|
role: "button",
|
|
372
372
|
tabIndex: 0,
|
|
373
|
-
"aria-label":
|
|
374
|
-
onClick:
|
|
375
|
-
onKeyDown:
|
|
376
|
-
className: f(
|
|
377
|
-
children:
|
|
373
|
+
"aria-label": u,
|
|
374
|
+
onClick: j,
|
|
375
|
+
onKeyDown: M,
|
|
376
|
+
className: f(N, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
377
|
+
children: I
|
|
378
378
|
}) : /* @__PURE__ */ J("div", {
|
|
379
|
-
className:
|
|
380
|
-
title:
|
|
381
|
-
children:
|
|
379
|
+
className: N,
|
|
380
|
+
title: w || void 0,
|
|
381
|
+
children: I
|
|
382
382
|
})
|
|
383
383
|
});
|
|
384
|
-
}, Je = { tile: "
|
|
384
|
+
}, Je = { tile: "_tile_1s4d7_1" }, Ye = ({ count: e, onClick: t, ariaLabel: n, children: r, fontClassName: i = "dial-small-semi-text", className: a }) => /* @__PURE__ */ J("button", {
|
|
385
385
|
type: "button",
|
|
386
386
|
onClick: t,
|
|
387
387
|
"aria-label": n ?? `Show ${e} more attachments`,
|
|
388
|
-
className: f("
|
|
388
|
+
className: f("flex size-[84px] items-center justify-center rounded-xl border", i, Je.tile, a),
|
|
389
389
|
children: r ?? /* @__PURE__ */ J("bdi", {
|
|
390
390
|
dir: "ltr",
|
|
391
391
|
children: `+${e}`
|
|
392
392
|
})
|
|
393
393
|
}), Q = {
|
|
394
|
-
container: "
|
|
395
|
-
headerIcon: "
|
|
396
|
-
headerLabel: "
|
|
397
|
-
downloadAllButton: "
|
|
398
|
-
imageTile: "
|
|
399
|
-
}, Xe = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Ze = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, getSizeLabel: a,
|
|
400
|
-
let
|
|
394
|
+
container: "_container_7fktb_1",
|
|
395
|
+
headerIcon: "_headerIcon_7fktb_6",
|
|
396
|
+
headerLabel: "_headerLabel_7fktb_7",
|
|
397
|
+
downloadAllButton: "_downloadAllButton_7fktb_8",
|
|
398
|
+
imageTile: "_imageTile_7fktb_12"
|
|
399
|
+
}, Xe = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Ze = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, getSizeLabel: a, labels: o, styles: s, theme: c, className: u }) => {
|
|
400
|
+
let { ariaLabel: d = "Attachments", clickLabel: p = "Download attachment", retryLabel: g = "Retry upload", showLessLabel: _ = "Show less", downloadAllLabel: v = "Download all" } = o ?? {}, { headerLabelClassName: y = "dial-tiny-semi-text" } = s ?? {}, [b, x] = K(!1), S = Ne(() => We(e.length, b), [e.length, b]);
|
|
401
401
|
if (e.length === 0) return null;
|
|
402
|
-
let
|
|
402
|
+
let C = e.some((e) => e.type === t.Image), w = e.some((e) => e.type !== t.Image), T = C && w, E = e.length >= 5, D = T ? ve : C ? be : R, O = Xe(e.length, "attachment"), k = e.slice(0, S.visibleCount);
|
|
403
403
|
return /* @__PURE__ */ Y("div", {
|
|
404
404
|
role: "group",
|
|
405
|
-
"aria-label":
|
|
406
|
-
className: f("rounded-2xl border p-3",
|
|
405
|
+
"aria-label": d,
|
|
406
|
+
className: f("rounded-2xl border p-3", E ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", Q.container, u),
|
|
407
407
|
children: [/* @__PURE__ */ Y("div", {
|
|
408
408
|
className: "mb-3 flex min-h-6 items-center gap-2",
|
|
409
409
|
children: [
|
|
410
|
-
/* @__PURE__ */ J(
|
|
410
|
+
/* @__PURE__ */ J(D, {
|
|
411
411
|
size: m.SM,
|
|
412
412
|
className: f("shrink-0", Q.headerIcon),
|
|
413
413
|
"aria-hidden": !0
|
|
414
414
|
}),
|
|
415
415
|
/* @__PURE__ */ J("span", {
|
|
416
|
-
className: f(
|
|
417
|
-
children:
|
|
416
|
+
className: f(y, Q.headerLabel),
|
|
417
|
+
children: O
|
|
418
418
|
}),
|
|
419
419
|
e.length >= 2 && (r || n) && /* @__PURE__ */ J(h, {
|
|
420
420
|
icon: /* @__PURE__ */ J(L, {
|
|
@@ -422,7 +422,7 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
422
422
|
"aria-hidden": !0
|
|
423
423
|
}),
|
|
424
424
|
className: f("ms-auto h-6 w-6 rounded-lg", Q.downloadAllButton),
|
|
425
|
-
"aria-label":
|
|
425
|
+
"aria-label": v,
|
|
426
426
|
onClick: () => {
|
|
427
427
|
let t = e.filter((e) => e.status === l.Idle);
|
|
428
428
|
r ? r(t) : t.forEach((e) => n?.(e));
|
|
@@ -431,43 +431,47 @@ var Fe = /* @__PURE__ */ function(e) {
|
|
|
431
431
|
]
|
|
432
432
|
}), /* @__PURE__ */ Y("div", {
|
|
433
433
|
role: "list",
|
|
434
|
-
"aria-label":
|
|
435
|
-
className: f("gap-3",
|
|
434
|
+
"aria-label": O,
|
|
435
|
+
className: f("gap-3", E ? "grid grid-cols-[repeat(5,84px)] overflow-x-auto" : "flex flex-wrap"),
|
|
436
436
|
children: [
|
|
437
|
-
|
|
437
|
+
k.map((e) => /* @__PURE__ */ J("div", {
|
|
438
438
|
role: "listitem",
|
|
439
|
-
children: e.type === t.Image ? /* @__PURE__ */ J(
|
|
439
|
+
children: e.type === t.Image ? /* @__PURE__ */ J(Ge, {
|
|
440
440
|
attachment: e,
|
|
441
441
|
onClick: n ? () => n(e) : void 0,
|
|
442
442
|
onRetry: i,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
443
|
+
labels: {
|
|
444
|
+
clickLabel: p,
|
|
445
|
+
retryLabel: g
|
|
446
|
+
},
|
|
447
|
+
styles: { roundedClassName: "rounded-xl" },
|
|
446
448
|
showHoverDownloadIcon: !0,
|
|
447
449
|
className: f("size-[84px]", Q.imageTile)
|
|
448
450
|
}) : /* @__PURE__ */ J(qe, {
|
|
449
451
|
attachment: e,
|
|
450
|
-
sizeLabel: a?.(e),
|
|
451
452
|
onClick: n,
|
|
452
453
|
onRetry: i,
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
labels: {
|
|
455
|
+
clickLabel: p,
|
|
456
|
+
retryLabel: g,
|
|
457
|
+
sizeLabel: a?.(e)
|
|
458
|
+
},
|
|
459
|
+
theme: c
|
|
456
460
|
})
|
|
457
461
|
}, e.id)),
|
|
458
|
-
|
|
462
|
+
S.layout === Le.Collapsed && /* @__PURE__ */ J("div", {
|
|
459
463
|
role: "listitem",
|
|
460
464
|
children: /* @__PURE__ */ J(Ye, {
|
|
461
|
-
count:
|
|
462
|
-
onClick: () =>
|
|
465
|
+
count: S.hiddenCount,
|
|
466
|
+
onClick: () => x(!0)
|
|
463
467
|
})
|
|
464
468
|
}),
|
|
465
|
-
|
|
469
|
+
E && b && /* @__PURE__ */ J("div", {
|
|
466
470
|
role: "listitem",
|
|
467
471
|
children: /* @__PURE__ */ J(Ye, {
|
|
468
472
|
count: 0,
|
|
469
|
-
onClick: () =>
|
|
470
|
-
ariaLabel:
|
|
473
|
+
onClick: () => x(!1),
|
|
474
|
+
ariaLabel: _,
|
|
471
475
|
children: /* @__PURE__ */ J(P, {
|
|
472
476
|
size: m.MD,
|
|
473
477
|
"aria-hidden": !0
|
|
@@ -526,7 +530,7 @@ var $e = (e) => /* @__PURE__ */ J(b, { ...e }), et = ({ features: e, initialResp
|
|
|
526
530
|
a
|
|
527
531
|
])
|
|
528
532
|
};
|
|
529
|
-
}, tt = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: i, onSystemPromptChange: a, onTemperatureChange: o, responseFormatLabel: s = "Response format", responseFormatHint: c = "Applies to new and existing messages", responseFormatMarkdownLabel: l = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
|
|
533
|
+
}, tt = "!text-[14px] !leading-[20px] font-semibold !text-primary gap-1", nt = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: i, onSystemPromptChange: a, onTemperatureChange: o, responseFormatLabel: s = "Response format", responseFormatHint: c = "Applies to new and existing messages", responseFormatMarkdownLabel: l = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
|
|
530
534
|
"Precise",
|
|
531
535
|
"Neutral",
|
|
532
536
|
"Creative"
|
|
@@ -535,6 +539,7 @@ var $e = (e) => /* @__PURE__ */ J(b, { ...e }), et = ({ features: e, initialResp
|
|
|
535
539
|
children: [
|
|
536
540
|
e.responseFormat && /* @__PURE__ */ J(x, {
|
|
537
541
|
fieldTitle: s,
|
|
542
|
+
labelClassName: tt,
|
|
538
543
|
elementId: "response-format",
|
|
539
544
|
orientation: j.Column,
|
|
540
545
|
activeRadioButton: t ?? u.Markdown,
|
|
@@ -551,12 +556,16 @@ var $e = (e) => /* @__PURE__ */ J(b, { ...e }), et = ({ features: e, initialResp
|
|
|
551
556
|
e.systemPrompt && /* @__PURE__ */ J(g, {
|
|
552
557
|
value: n,
|
|
553
558
|
placeholder: p,
|
|
554
|
-
labelProps: {
|
|
559
|
+
labelProps: {
|
|
560
|
+
className: tt,
|
|
561
|
+
label: f
|
|
562
|
+
},
|
|
555
563
|
onChange: (e) => a(e ?? "")
|
|
556
564
|
}),
|
|
557
565
|
e.temperature && /* @__PURE__ */ J(T, {
|
|
558
566
|
labelProps: {
|
|
559
567
|
label: m,
|
|
568
|
+
className: tt,
|
|
560
569
|
caption: _
|
|
561
570
|
},
|
|
562
571
|
value: r,
|
|
@@ -595,7 +604,7 @@ ke(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
595
604
|
})
|
|
596
605
|
})
|
|
597
606
|
}),
|
|
598
|
-
children: /* @__PURE__ */ J(
|
|
607
|
+
children: /* @__PURE__ */ J(nt, {
|
|
599
608
|
features: e,
|
|
600
609
|
responseFormat: v,
|
|
601
610
|
systemPrompt: b,
|
|
@@ -617,11 +626,11 @@ ke(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
617
626
|
});
|
|
618
627
|
//#endregion
|
|
619
628
|
//#region src/components/MessageActions/MessageActions.tsx
|
|
620
|
-
var
|
|
629
|
+
var rt = 2e3, it = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r, onRegenerate: i, onCopy: a, onCopyMarkdown: o, onLike: l, onDislike: u, activeRating: d, isAlwaysVisible: p, className: g, labels: _ }) => {
|
|
621
630
|
let { tooltips: v, ariaLabels: y } = _ ?? {}, [b, x] = K(null), [S, C] = K(""), w = Ae(() => {
|
|
622
|
-
a?.(), x("copy"), C(y?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => x(null),
|
|
631
|
+
a?.(), x("copy"), C(y?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => x(null), rt);
|
|
623
632
|
}, [a, y?.copiedStatus]), T = Ae(() => {
|
|
624
|
-
o?.(), x("markdown"), C(y?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => x(null),
|
|
633
|
+
o?.(), x("markdown"), C(y?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => x(null), rt);
|
|
625
634
|
}, [o, y?.copiedMarkdownStatus]);
|
|
626
635
|
return /* @__PURE__ */ Y("div", {
|
|
627
636
|
role: "toolbar",
|
|
@@ -716,17 +725,17 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
716
725
|
collapsedText: "_collapsedText_1exhl_15",
|
|
717
726
|
startersDivider: "_startersDivider_1exhl_26",
|
|
718
727
|
text: "_text_1exhl_30"
|
|
719
|
-
},
|
|
728
|
+
}, at = ({ text: e, styles: n, actions: i, hasAlwaysVisibleActions: o, isStreaming: s, attachments: l, afterContent: u, starters: p, onSelectStarter: m, deploymentIconUrl: h, deploymentDisplayName: g, markdownComponents: _, onAttachmentClick: v, onDownloadAll: y, onAttachmentRetry: b, getAttachmentSizeLabel: x, attachmentTheme: C, codeBlockTheme: w, labels: T }) => {
|
|
720
729
|
let { colors: E, typography: D, className: O, bubbleClassName: k } = n ?? {}, { attachmentClickLabel: A, attachmentRetryLabel: j, startersAriaLabel: M = "Quick reply buttons", thinkingLabel: N, codeBlockCopyLabel: P, codeBlockCopiedLabel: F, assistantMessageAriaLabel: I = "Assistant message", deploymentIconFallbackLabel: L = "AI" } = T ?? {}, R = s ? (l ?? []).filter((e) => e.type !== t.Audio) : l ?? [], z = d({
|
|
721
730
|
"--cm-bubble-text": E?.text,
|
|
722
731
|
"--cm-starters-divider": E?.startersDivider
|
|
723
|
-
}),
|
|
732
|
+
}), ee = f($.text, D?.fontClassName), te = !!(h || g);
|
|
724
733
|
return /* @__PURE__ */ Y("div", {
|
|
725
734
|
role: "group",
|
|
726
735
|
"aria-label": I,
|
|
727
736
|
style: z,
|
|
728
737
|
className: f("flex w-full items-start gap-3", O),
|
|
729
|
-
children: [
|
|
738
|
+
children: [te && /* @__PURE__ */ J(r, {
|
|
730
739
|
src: h,
|
|
731
740
|
size: 28,
|
|
732
741
|
initialsName: g || L,
|
|
@@ -739,7 +748,7 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
739
748
|
(e || s) && /* @__PURE__ */ J("div", {
|
|
740
749
|
"aria-live": "polite",
|
|
741
750
|
"aria-atomic": "false",
|
|
742
|
-
className: f(
|
|
751
|
+
className: f(ee, "min-w-0 max-w-full text-start"),
|
|
743
752
|
children: /* @__PURE__ */ J(a, {
|
|
744
753
|
content: e,
|
|
745
754
|
isStreaming: s,
|
|
@@ -755,13 +764,15 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
755
764
|
onAttachmentClick: v,
|
|
756
765
|
onDownloadAll: y,
|
|
757
766
|
onRetry: b,
|
|
758
|
-
|
|
759
|
-
|
|
767
|
+
labels: {
|
|
768
|
+
clickLabel: A,
|
|
769
|
+
retryLabel: j
|
|
770
|
+
},
|
|
760
771
|
getSizeLabel: x,
|
|
761
772
|
theme: C
|
|
762
773
|
}),
|
|
763
774
|
u,
|
|
764
|
-
/* @__PURE__ */ J(
|
|
775
|
+
/* @__PURE__ */ J(it, {
|
|
765
776
|
...i,
|
|
766
777
|
isAlwaysVisible: o,
|
|
767
778
|
role: c.Assistant
|
|
@@ -783,7 +794,7 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
783
794
|
})]
|
|
784
795
|
})]
|
|
785
796
|
});
|
|
786
|
-
},
|
|
797
|
+
}, ot = ({ titleText: e = "Model switched.", bodyText: t }) => /* @__PURE__ */ J("div", {
|
|
787
798
|
role: "status",
|
|
788
799
|
"aria-live": "polite",
|
|
789
800
|
children: /* @__PURE__ */ J(v, {
|
|
@@ -791,24 +802,24 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
791
802
|
message: t,
|
|
792
803
|
textClassName: "flex-row flex-wrap gap-1"
|
|
793
804
|
})
|
|
794
|
-
}),
|
|
805
|
+
}), st = /* @__PURE__ */ function(e) {
|
|
795
806
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
796
|
-
}({}),
|
|
807
|
+
}({}), ct = 10, lt = ({ text: e, position: t = st.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: a, collapsedLineCount: o = ct, labels: s, onAttachmentClick: l, onDownloadAll: u, onAttachmentRetry: h, getAttachmentSizeLabel: g, attachmentTheme: v }) => {
|
|
797
808
|
let { colors: y, typography: b, className: x, bubbleClassName: S } = n ?? {}, { showMoreLabel: C = "Show more", showLessLabel: w = "Show less", showMoreAriaLabel: T, showLessAriaLabel: E, attachmentClickLabel: D, attachmentRetryLabel: O, userMessageAriaLabel: A = "User message" } = s ?? {}, { textRef: j, isTextCollapsed: M, isOverflowing: F, collapsedMaxHeight: I, expandedMaxHeight: L, isCollapsed: R, toggleCollapsed: z } = p({
|
|
798
809
|
text: e,
|
|
799
810
|
collapsedLineCount: o
|
|
800
|
-
}),
|
|
811
|
+
}), ee = d({
|
|
801
812
|
"--cm-bubble-user-bg": y?.userBackground,
|
|
802
813
|
"--cm-bubble-user-border": y?.userBorder,
|
|
803
814
|
"--cm-bubble-fade-start": y?.fadeStart,
|
|
804
815
|
"--cm-bubble-text": y?.text,
|
|
805
816
|
"--cm-bubble-collapsed-height": F ? `${I}px` : void 0,
|
|
806
817
|
"--cm-bubble-expanded-height": F ? `${L}px` : void 0
|
|
807
|
-
}),
|
|
818
|
+
}), te = t === st.Top ? "rounded-ee-[6px] rounded-se-[16px]" : "rounded-se-[6px] rounded-ee-[16px]", ne = f($.text, b?.fontClassName), B = T ?? C, V = E ?? w, H = R ? C : w, U = R ? B : V, W = R ? N : P, G = Me();
|
|
808
819
|
return /* @__PURE__ */ J("div", {
|
|
809
820
|
role: "group",
|
|
810
821
|
"aria-label": A,
|
|
811
|
-
style:
|
|
822
|
+
style: ee,
|
|
812
823
|
className: f("flex w-full", x),
|
|
813
824
|
children: /* @__PURE__ */ Y("div", {
|
|
814
825
|
className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
|
|
@@ -818,14 +829,16 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
818
829
|
onAttachmentClick: l,
|
|
819
830
|
onDownloadAll: u,
|
|
820
831
|
onRetry: h,
|
|
821
|
-
|
|
822
|
-
|
|
832
|
+
labels: {
|
|
833
|
+
clickLabel: D,
|
|
834
|
+
retryLabel: O
|
|
835
|
+
},
|
|
823
836
|
getSizeLabel: g,
|
|
824
837
|
theme: v,
|
|
825
838
|
className: "max-w-[640px]"
|
|
826
839
|
}),
|
|
827
840
|
e && /* @__PURE__ */ J("div", {
|
|
828
|
-
className: f($.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4",
|
|
841
|
+
className: f($.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", te, S),
|
|
829
842
|
children: /* @__PURE__ */ Y("div", {
|
|
830
843
|
className: "flex min-w-0 flex-col items-start",
|
|
831
844
|
children: [/* @__PURE__ */ J("div", {
|
|
@@ -833,16 +846,16 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
833
846
|
className: f("relative overflow-hidden", F && $.collapsibleText, F && !R && $.expandedText, M && $.collapsedText),
|
|
834
847
|
children: /* @__PURE__ */ J("p", {
|
|
835
848
|
ref: j,
|
|
836
|
-
className: f(
|
|
849
|
+
className: f(ne, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
|
|
837
850
|
children: e
|
|
838
851
|
})
|
|
839
852
|
}), F && /* @__PURE__ */ J(_, {
|
|
840
|
-
label: /* @__PURE__ */ J(q, { children:
|
|
853
|
+
label: /* @__PURE__ */ J(q, { children: H }),
|
|
841
854
|
iconBefore: /* @__PURE__ */ J(W, {
|
|
842
855
|
size: m.SM,
|
|
843
856
|
"aria-hidden": "true"
|
|
844
857
|
}),
|
|
845
|
-
"aria-label":
|
|
858
|
+
"aria-label": U,
|
|
846
859
|
"aria-expanded": !R,
|
|
847
860
|
"aria-controls": G,
|
|
848
861
|
className: "mt-3",
|
|
@@ -851,7 +864,7 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
851
864
|
})]
|
|
852
865
|
})
|
|
853
866
|
}),
|
|
854
|
-
/* @__PURE__ */ J(
|
|
867
|
+
/* @__PURE__ */ J(it, {
|
|
855
868
|
...r,
|
|
856
869
|
isAlwaysVisible: i,
|
|
857
870
|
role: c.User
|
|
@@ -859,17 +872,17 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
859
872
|
]
|
|
860
873
|
})
|
|
861
874
|
});
|
|
862
|
-
},
|
|
875
|
+
}, ut = ({ role: e, onAttachmentClick: t, markdownComponents: n, ...r }) => e === c.Status ? /* @__PURE__ */ J(ot, {
|
|
863
876
|
titleText: r.labels?.statusTitleText,
|
|
864
877
|
bodyText: r.labels?.statusBodyText ?? ""
|
|
865
|
-
}) : e === c.User ? /* @__PURE__ */ J(
|
|
878
|
+
}) : e === c.User ? /* @__PURE__ */ J(lt, {
|
|
866
879
|
...r,
|
|
867
880
|
onAttachmentClick: t
|
|
868
|
-
}) : /* @__PURE__ */ J(
|
|
881
|
+
}) : /* @__PURE__ */ J(at, {
|
|
869
882
|
...r,
|
|
870
883
|
markdownComponents: n,
|
|
871
884
|
onAttachmentClick: t
|
|
872
|
-
}),
|
|
885
|
+
}), dt = { button: "_button_15boc_1" }, ft = ({ label: e, onClick: t, styles: n }) => {
|
|
873
886
|
let { colors: r, typography: i, className: a } = n ?? {};
|
|
874
887
|
return /* @__PURE__ */ J("button", {
|
|
875
888
|
type: "button",
|
|
@@ -881,9 +894,9 @@ var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r,
|
|
|
881
894
|
"--cm-source-bg-hover": r?.backgroundHover,
|
|
882
895
|
"--cm-source-border-hover": r?.borderHover
|
|
883
896
|
}),
|
|
884
|
-
className: f(
|
|
897
|
+
className: f(dt.button, "relative flex h-6 items-center justify-center px-2", "border border-solid", "outline-none focus-visible:outline focus-visible:outline-1", "focus-visible:outline-offset-[3px]", "cursor-pointer whitespace-nowrap", i?.fontClassName, a),
|
|
885
898
|
children: e
|
|
886
899
|
});
|
|
887
900
|
};
|
|
888
901
|
//#endregion
|
|
889
|
-
export {
|
|
902
|
+
export { at as AssistantMessageBubble, st as BubblePosition, it as MessageActions, ut as MessageBubble, ft as MessageSource, ot as StatusMessageBubble, lt 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.0.0-dev.
|
|
4
|
+
"version": "1.0.0-dev.486",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"react": "^19.0.0",
|
|
21
21
|
"@tabler/icons-react": "^3.0.0",
|
|
22
22
|
"@epam/ai-dial-ui-kit": "0.12.0-dev.28",
|
|
23
|
-
"@epam/ai-dial-chat-shared": "1.0.0-dev.
|
|
24
|
-
"@epam/ai-dial-conversation-input": "1.0.0-dev.
|
|
23
|
+
"@epam/ai-dial-chat-shared": "1.0.0-dev.486",
|
|
24
|
+
"@epam/ai-dial-conversation-input": "1.0.0-dev.486",
|
|
25
25
|
"react-markdown": "^10.1.0"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|