@epam/ai-dial-conversation-messages 1.0.0-rc.6 → 1.0.0
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/components/MessageActions/MessageActions.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +274 -259
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,kIAAkI;AAClI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA4LlD,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.
|
|
1
|
+
._activeRating_ygoee_1{color:var(--ma-active-rating-text,var(--text-accent,#1d4ed8))}._userBubble_qoxdz_1{border-color:var(--cm-bubble-user-border,var(--stroke-secondary,#d1dbea));background:var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7))}._collapsibleText_qoxdz_6{max-height:var(--cm-bubble-collapsed-height);transition:max-height .2s ease-out}._expandedText_qoxdz_11{max-height:var(--cm-bubble-expanded-height)}._collapsedText_qoxdz_15:after{content:"";pointer-events:none;background:linear-gradient(to bottom, var(--cm-bubble-fade-start,var(--shadow-xs-sm-2,#161b2d08)), var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7)));height:3rem;position:absolute;bottom:0;left:0;right:0}@media (prefers-reduced-motion:reduce){._collapsibleText_qoxdz_6{transition:none}}._startersDivider_qoxdz_26{border-color:var(--cm-starters-divider,var(--stroke-secondary,#d1dbea))}._text_qoxdz_30{color:var(--cm-bubble-text,var(--text-primary,#161b2d))}
|
|
2
2
|
/*$vite$:1*/
|
package/index.js
CHANGED
|
@@ -1,155 +1,155 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, CopyIconButton as n, DeploymentIcon as r, MDMessageViewer as i, MIME_TYPE_EXT_MAP as a, MessageRating as o, MessageRole as s, RequestStatus as c, ResponseFormat as l, buildCssVars as u, mergeClasses as d, useCollapsedText as f } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { DIAL_ICON_SIZE as p,
|
|
3
|
-
import { IconChevronDown as
|
|
2
|
+
import { DIAL_ICON_SIZE as p, DialSlider as m, ElementSize as h, GhostIconButton as g, Highlight as _, InfoMessageNotification as v, LinkButton as y, NeutralButton as b, Popup as x, PopupSize as S, PrimaryButton as C, RadioGroup as w, RadioGroupOrientation as T, Skeleton as E, SkeletonVariant as D, Spinner as O, StaticIconButton as k, Textarea as A, ToggleIconButton as j, Tooltip as M } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconChevronDown as N, IconChevronUp as P, IconClipboard as F, IconDownload as I, IconExternalLink as L, IconFile as R, IconFileTypeBmp as z, IconFileTypeCss as B, IconFileTypeCsv as V, IconFileTypeDoc as H, IconFileTypeDocx as ee, IconFileTypeHtml as te, IconFileTypeJpg as ne, IconFileTypeJs as U, IconFileTypeJsx as W, IconFileTypePdf as re, IconFileTypePhp as ie, IconFileTypePng as ae, IconFileTypePpt as oe, IconFileTypeRs as se, IconFileTypeSql as ce, IconFileTypeSvg as le, IconFileTypeTs as ue, IconFileTypeTsx as de, IconFileTypeTxt as fe, IconFileTypeVue as pe, IconFileTypeXls as me, IconFileTypeXml as he, IconFileTypeZip as ge, IconMarkdown as _e, IconMusic as ve, IconPaperclip as ye, IconPencilMinus as be, IconPhoto as G, IconRefresh as xe, IconReload as Se, IconTerminal2 as Ce, IconThumbDown as we, IconThumbDownFilled as Te, IconThumbUp as Ee, IconThumbUpFilled as De, IconTrashX as Oe, IconVideo as ke, IconX as Ae } from "@tabler/icons-react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
import { memo as
|
|
5
|
+
import { memo as je, useCallback as K, useEffect as Me, useId as Ne, useMemo as Pe, useRef as Fe, useState as q } from "react";
|
|
6
6
|
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
7
7
|
//#region ../attachment-input/dist/index.js
|
|
8
|
-
var
|
|
8
|
+
var Ie = (e) => {
|
|
9
9
|
if (e == null) return "";
|
|
10
10
|
let t = e.lastIndexOf(".");
|
|
11
11
|
return t > 0 ? e.slice(0, t) : e;
|
|
12
|
-
},
|
|
13
|
-
if (!e) return
|
|
12
|
+
}, Le = (e) => {
|
|
13
|
+
if (!e) return R;
|
|
14
14
|
if (e.startsWith("image/")) switch (e) {
|
|
15
15
|
case "image/jpeg":
|
|
16
|
-
case "image/jpg": return
|
|
17
|
-
case "image/png": return
|
|
18
|
-
case "image/svg+xml": return
|
|
19
|
-
case "image/bmp": return
|
|
16
|
+
case "image/jpg": return ne;
|
|
17
|
+
case "image/png": return ae;
|
|
18
|
+
case "image/svg+xml": return le;
|
|
19
|
+
case "image/bmp": return z;
|
|
20
20
|
default: return G;
|
|
21
21
|
}
|
|
22
|
-
if (e.startsWith("video/")) return
|
|
23
|
-
if (e.startsWith("audio/")) return
|
|
22
|
+
if (e.startsWith("video/")) return ke;
|
|
23
|
+
if (e.startsWith("audio/")) return ve;
|
|
24
24
|
switch (e) {
|
|
25
|
-
case "application/pdf": return
|
|
25
|
+
case "application/pdf": return re;
|
|
26
26
|
case "application/msword":
|
|
27
|
-
case "application/vnd.ms-word": return
|
|
28
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
29
|
-
case "application/vnd.ms-powerpoint": return
|
|
30
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return
|
|
31
|
-
case "application/vnd.ms-excel": return
|
|
32
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
27
|
+
case "application/vnd.ms-word": return H;
|
|
28
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return ee;
|
|
29
|
+
case "application/vnd.ms-powerpoint": return oe;
|
|
30
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return oe;
|
|
31
|
+
case "application/vnd.ms-excel": return me;
|
|
32
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return me;
|
|
33
33
|
case "application/zip":
|
|
34
34
|
case "application/x-zip-compressed":
|
|
35
35
|
case "application/x-rar-compressed":
|
|
36
36
|
case "application/x-7z-compressed":
|
|
37
37
|
case "application/gzip":
|
|
38
|
-
case "application/x-tar": return
|
|
39
|
-
case "text/csv": return
|
|
40
|
-
case "text/plain": return
|
|
38
|
+
case "application/x-tar": return ge;
|
|
39
|
+
case "text/csv": return V;
|
|
40
|
+
case "text/plain": return fe;
|
|
41
41
|
case "text/html":
|
|
42
|
-
case "application/xhtml+xml": return
|
|
42
|
+
case "application/xhtml+xml": return te;
|
|
43
43
|
case "text/xml":
|
|
44
|
-
case "application/xml": return
|
|
44
|
+
case "application/xml": return he;
|
|
45
45
|
case "application/sql":
|
|
46
|
-
case "text/x-sql": return
|
|
46
|
+
case "text/x-sql": return ce;
|
|
47
47
|
case "text/javascript":
|
|
48
|
-
case "application/javascript": return
|
|
49
|
-
case "text/jsx": return
|
|
48
|
+
case "application/javascript": return U;
|
|
49
|
+
case "text/jsx": return W;
|
|
50
50
|
case "application/typescript":
|
|
51
|
-
case "text/typescript": return
|
|
52
|
-
case "text/tsx": return
|
|
53
|
-
case "text/css": return
|
|
51
|
+
case "text/typescript": return ue;
|
|
52
|
+
case "text/tsx": return de;
|
|
53
|
+
case "text/css": return B;
|
|
54
54
|
case "text/x-php":
|
|
55
|
-
case "application/x-php": return
|
|
55
|
+
case "application/x-php": return ie;
|
|
56
56
|
case "text/x-rustsrc":
|
|
57
|
-
case "application/x-rust": return
|
|
58
|
-
case "text/x-vue": return
|
|
59
|
-
default: return
|
|
57
|
+
case "application/x-rust": return se;
|
|
58
|
+
case "text/x-vue": return pe;
|
|
59
|
+
default: return R;
|
|
60
60
|
}
|
|
61
|
-
},
|
|
61
|
+
}, Re = (e) => {
|
|
62
62
|
let { type: n, contentType: r } = e;
|
|
63
|
-
return n === t.Prompt ?
|
|
64
|
-
},
|
|
63
|
+
return n === t.Prompt ? Ce : n === t.Pasted ? F : n === t.Image ? G : Le(r ?? "");
|
|
64
|
+
}, ze = (e) => {
|
|
65
65
|
let t = e.toLowerCase().split(";")[0].trim(), n = a[t];
|
|
66
66
|
if (n) return n;
|
|
67
67
|
let r = t.split("/")[1];
|
|
68
68
|
if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
|
|
69
|
-
},
|
|
69
|
+
}, Be = (e, n) => {
|
|
70
70
|
let { type: r, name: i, contentType: a } = e;
|
|
71
71
|
if (r === t.Prompt) return n.promptLabel ?? "Prompt";
|
|
72
72
|
if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
|
|
73
73
|
if (r === t.Image) return n.imageLabel ?? "Image";
|
|
74
74
|
if (a) {
|
|
75
|
-
let e =
|
|
75
|
+
let e = ze(a);
|
|
76
76
|
if (e) return `.${e}`;
|
|
77
77
|
}
|
|
78
78
|
if (i == null) return "";
|
|
79
79
|
let o = i.lastIndexOf(".");
|
|
80
80
|
return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
|
|
81
|
-
},
|
|
81
|
+
}, Ve = (e, n = {}) => {
|
|
82
82
|
let { type: r, status: i, previewUrl: a, url: o } = e, s = i === c.Loading, l = i === c.Error, u = r === t.Image && !!(a ?? o) && !l, d = r === t.Link && !l;
|
|
83
83
|
return {
|
|
84
84
|
isLoading: s,
|
|
85
85
|
isError: l,
|
|
86
86
|
isImage: u,
|
|
87
87
|
isLink: d,
|
|
88
|
-
BottomIcon: d ? null :
|
|
89
|
-
typeLabel: d ? null :
|
|
88
|
+
BottomIcon: d ? null : Re(e),
|
|
89
|
+
typeLabel: d ? null : Be(e, n)
|
|
90
90
|
};
|
|
91
|
-
},
|
|
92
|
-
tile: "
|
|
93
|
-
hovered: "
|
|
94
|
-
selected: "
|
|
95
|
-
tileError: "
|
|
96
|
-
nameText: "
|
|
97
|
-
typeText: "
|
|
98
|
-
retryIcon: "
|
|
99
|
-
track: "
|
|
100
|
-
actionButton: "
|
|
101
|
-
imageActionButton: "
|
|
102
|
-
}, Q = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o }) => /* @__PURE__ */ Y(
|
|
91
|
+
}, He = "flex size-[84px] items-center justify-center rounded-xl border", Z = {
|
|
92
|
+
tile: "_tile_1whwz_1",
|
|
93
|
+
hovered: "_hovered_1whwz_5",
|
|
94
|
+
selected: "_selected_1whwz_15",
|
|
95
|
+
tileError: "_tileError_1whwz_20",
|
|
96
|
+
nameText: "_nameText_1whwz_25",
|
|
97
|
+
typeText: "_typeText_1whwz_29",
|
|
98
|
+
retryIcon: "_retryIcon_1whwz_33",
|
|
99
|
+
track: "_track_1whwz_37",
|
|
100
|
+
actionButton: "_actionButton_1whwz_43",
|
|
101
|
+
imageActionButton: "_imageActionButton_1whwz_47"
|
|
102
|
+
}, Q = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o }) => /* @__PURE__ */ Y(k, {
|
|
103
103
|
icon: a,
|
|
104
|
-
size:
|
|
104
|
+
size: h.Small,
|
|
105
105
|
className: d("absolute end-1 top-1 opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", Z.actionButton, o),
|
|
106
106
|
"aria-label": e,
|
|
107
107
|
"aria-describedby": t ? n : void 0,
|
|
108
108
|
onClick: (e) => {
|
|
109
109
|
e.stopPropagation(), r(i);
|
|
110
110
|
}
|
|
111
|
-
}),
|
|
112
|
-
icon: /* @__PURE__ */ Y(
|
|
111
|
+
}), Ue = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
112
|
+
icon: /* @__PURE__ */ Y(Se, {
|
|
113
113
|
size: p.SM,
|
|
114
114
|
"aria-hidden": !0
|
|
115
115
|
}),
|
|
116
116
|
className: Z.retryIcon,
|
|
117
117
|
...e
|
|
118
|
-
}),
|
|
119
|
-
icon: /* @__PURE__ */ Y(
|
|
118
|
+
}), We = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
119
|
+
icon: /* @__PURE__ */ Y(I, {
|
|
120
120
|
size: p.SM,
|
|
121
121
|
"aria-hidden": !0
|
|
122
122
|
}),
|
|
123
123
|
...e
|
|
124
|
-
}),
|
|
125
|
-
icon: /* @__PURE__ */ Y(
|
|
124
|
+
}), Ge = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
125
|
+
icon: /* @__PURE__ */ Y(L, {
|
|
126
126
|
size: p.SM,
|
|
127
127
|
"aria-hidden": !0
|
|
128
128
|
}),
|
|
129
129
|
...e
|
|
130
|
-
}),
|
|
131
|
-
icon: /* @__PURE__ */ Y(
|
|
130
|
+
}), Ke = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
131
|
+
icon: /* @__PURE__ */ Y(Ae, {
|
|
132
132
|
size: p.SM,
|
|
133
133
|
"aria-hidden": !0
|
|
134
134
|
}),
|
|
135
135
|
...e
|
|
136
|
-
}),
|
|
136
|
+
}), qe = {
|
|
137
137
|
[e.Network]: "Upload failed · network error",
|
|
138
138
|
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
139
|
-
},
|
|
140
|
-
let { clickLabel:
|
|
139
|
+
}, Je = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: a, styles: o, onDownload: s, isPasted: l, isLink: u, cssVars: f, onExpand: p, isExpandable: m, onRemove: h, isSelected: g }) => {
|
|
140
|
+
let { clickLabel: v = "Download attachment", retryLabel: y = "Retry upload", sizeLabel: b, uploadingLabel: x = "Uploading", errorReasonLabels: S, genericErrorLabel: C = "Upload failed" } = a ?? {}, { typography: w, className: T } = o ?? {}, { id: E, name: D, status: k, errorReason: A } = t, j = k === c.Loading, M = k === c.Error, N = Ne(), P = M ? A && (S?.[A] ?? qe[A]) || C : "", { BottomIcon: F, typeLabel: I } = Ve(t), L = !M && !j && s && !u, R = M && !!i && A !== e.UnsupportedType, z = L || R ? "pe-5" : void 0, B = (e) => {
|
|
141
141
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), r?.(t.id));
|
|
142
|
-
}, V =
|
|
142
|
+
}, V = Pe(() => l ? D : Ie(D), [l, D]), H = K(() => {
|
|
143
143
|
window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
|
|
144
|
-
}, [t]),
|
|
144
|
+
}, [t]), ee = d(He, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, !M && Z.hovered, g && Z.selected, M && Z.tileError), te = /* @__PURE__ */ Y("div", {
|
|
145
145
|
title: V,
|
|
146
146
|
className: d(w?.nameClassName ?? "dial-caption-text", "line-clamp-2 min-w-0 break-all", Z.nameText, !M && z),
|
|
147
|
-
children: n ? /* @__PURE__ */ Y(
|
|
147
|
+
children: n ? /* @__PURE__ */ Y(_, {
|
|
148
148
|
text: V,
|
|
149
149
|
query: n,
|
|
150
150
|
maxLines: 2
|
|
151
151
|
}) : V
|
|
152
|
-
}),
|
|
152
|
+
}), ne = F && /* @__PURE__ */ X("div", {
|
|
153
153
|
className: d("flex w-full items-center gap-1", M && z),
|
|
154
154
|
children: [/* @__PURE__ */ Y(F, {
|
|
155
155
|
size: 16,
|
|
@@ -159,41 +159,41 @@ var Ne = (e) => {
|
|
|
159
159
|
className: d(w?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", Z.typeText),
|
|
160
160
|
children: b ? `${I} · ${b}` : I
|
|
161
161
|
})]
|
|
162
|
-
}),
|
|
162
|
+
}), U = () => {
|
|
163
163
|
m && p ? p(E) : r && r(E);
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
}, W = /* @__PURE__ */ X(J, { children: [
|
|
165
|
+
te,
|
|
166
|
+
ne,
|
|
167
167
|
j && /* @__PURE__ */ Y("div", {
|
|
168
168
|
"aria-label": x,
|
|
169
169
|
className: d("absolute left-[-1px] top-[-1px] flex size-full items-center justify-center rounded", Z.track),
|
|
170
|
-
children: /* @__PURE__ */ Y(
|
|
170
|
+
children: /* @__PURE__ */ Y(O, { size: 32 })
|
|
171
171
|
}),
|
|
172
172
|
/* @__PURE__ */ X("div", {
|
|
173
173
|
className: d("absolute right-0 top-0 flex gap-1"),
|
|
174
174
|
children: [
|
|
175
|
-
L && /* @__PURE__ */ Y(
|
|
176
|
-
ariaLabel:
|
|
175
|
+
L && /* @__PURE__ */ Y(We, {
|
|
176
|
+
ariaLabel: v,
|
|
177
177
|
errorTitle: P,
|
|
178
178
|
errorDescId: N,
|
|
179
179
|
onClick: s,
|
|
180
180
|
id: E
|
|
181
181
|
}),
|
|
182
|
-
R && /* @__PURE__ */ Y(
|
|
183
|
-
ariaLabel:
|
|
182
|
+
R && /* @__PURE__ */ Y(Ue, {
|
|
183
|
+
ariaLabel: y,
|
|
184
184
|
errorTitle: P,
|
|
185
185
|
errorDescId: N,
|
|
186
186
|
onClick: i,
|
|
187
187
|
id: E
|
|
188
188
|
}),
|
|
189
|
-
u && /* @__PURE__ */ Y(
|
|
190
|
-
ariaLabel:
|
|
189
|
+
u && /* @__PURE__ */ Y(Ge, {
|
|
190
|
+
ariaLabel: y,
|
|
191
191
|
errorTitle: P,
|
|
192
192
|
errorDescId: N,
|
|
193
193
|
onClick: H
|
|
194
194
|
}),
|
|
195
|
-
h && /* @__PURE__ */ Y(
|
|
196
|
-
ariaLabel:
|
|
195
|
+
h && /* @__PURE__ */ Y(Ke, {
|
|
196
|
+
ariaLabel: y,
|
|
197
197
|
errorTitle: P,
|
|
198
198
|
errorDescId: N,
|
|
199
199
|
onClick: h,
|
|
@@ -215,21 +215,21 @@ var Ne = (e) => {
|
|
|
215
215
|
children: /* @__PURE__ */ Y("div", {
|
|
216
216
|
role: "button",
|
|
217
217
|
tabIndex: 0,
|
|
218
|
-
"aria-label":
|
|
219
|
-
onClick:
|
|
218
|
+
"aria-label": v,
|
|
219
|
+
onClick: U,
|
|
220
220
|
onKeyDown: B,
|
|
221
221
|
style: f,
|
|
222
|
-
className: d(
|
|
223
|
-
children:
|
|
222
|
+
className: d(ee, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
223
|
+
children: W
|
|
224
224
|
})
|
|
225
225
|
});
|
|
226
|
-
},
|
|
226
|
+
}, Ye = /* @__PURE__ */ function(e) {
|
|
227
227
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
228
|
-
}({}),
|
|
229
|
-
let n =
|
|
230
|
-
return
|
|
228
|
+
}({}), Xe = ({ enabled: e, src: t }) => {
|
|
229
|
+
let n = Fe(null), [r, i] = q("idle");
|
|
230
|
+
return Me(() => {
|
|
231
231
|
i(e && t ? "loading" : "idle");
|
|
232
|
-
}, [e, t]),
|
|
232
|
+
}, [e, t]), Me(() => {
|
|
233
233
|
let r = n.current;
|
|
234
234
|
if (!r || !e || !t) return;
|
|
235
235
|
let a = () => i("loaded"), o = () => i("error");
|
|
@@ -240,15 +240,15 @@ var Ne = (e) => {
|
|
|
240
240
|
imageRef: n,
|
|
241
241
|
imageLoadStatus: r
|
|
242
242
|
};
|
|
243
|
-
},
|
|
244
|
-
let { clickLabel: u = "Open attachment", expandLabel: f = "Expand pasted text" } = i ?? {}, { className: m } = c ?? {}, { id: h, name: g } = e, _ = e.previewUrl ?? e.url, v = e.type === t.Pasted && n !== void 0, { isLoading: y, isError: b, isImage: x } =
|
|
243
|
+
}, Ze = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: c, isSelected: l }) => {
|
|
244
|
+
let { clickLabel: u = "Open attachment", expandLabel: f = "Expand pasted text" } = i ?? {}, { className: m } = c ?? {}, { id: h, name: g } = e, _ = e.previewUrl ?? e.url, v = e.type === t.Pasted && n !== void 0, { isLoading: y, isError: b, isImage: x } = Pe(() => Ve(e), [e]), S = r !== void 0 && !v && !y && !b, { imageRef: C, imageLoadStatus: w } = Xe({
|
|
245
245
|
enabled: x,
|
|
246
246
|
src: _
|
|
247
247
|
}), T = () => {
|
|
248
248
|
v && n ? n(h) : S && r && r(h);
|
|
249
249
|
};
|
|
250
250
|
return /* @__PURE__ */ Y("div", {
|
|
251
|
-
className: d(
|
|
251
|
+
className: d(He, "group/attachment-tile", S && "cursor-pointer", Z.tile, l && Z.selected, m),
|
|
252
252
|
onClick: T,
|
|
253
253
|
onKeyDown: (e) => {
|
|
254
254
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), T());
|
|
@@ -260,21 +260,21 @@ var Ne = (e) => {
|
|
|
260
260
|
children: /* @__PURE__ */ X("div", {
|
|
261
261
|
className: "relative h-full w-full overflow-hidden",
|
|
262
262
|
children: [
|
|
263
|
-
a && /* @__PURE__ */ Y(
|
|
263
|
+
a && /* @__PURE__ */ Y(Ke, {
|
|
264
264
|
onClick: a,
|
|
265
265
|
id: h,
|
|
266
266
|
className: Z.imageActionButton
|
|
267
267
|
}),
|
|
268
|
-
s && /* @__PURE__ */ Y(
|
|
268
|
+
s && /* @__PURE__ */ Y(We, {
|
|
269
269
|
onClick: s,
|
|
270
270
|
id: h,
|
|
271
271
|
className: Z.imageActionButton
|
|
272
272
|
}),
|
|
273
|
-
w !==
|
|
274
|
-
variant:
|
|
273
|
+
w !== Ye.Loaded && /* @__PURE__ */ Y(E, {
|
|
274
|
+
variant: D.Rectangular,
|
|
275
275
|
width: "100%",
|
|
276
276
|
height: "100%",
|
|
277
|
-
active: w ===
|
|
277
|
+
active: w === Ye.Loading,
|
|
278
278
|
overlay: /* @__PURE__ */ Y(G, {
|
|
279
279
|
size: p.LG,
|
|
280
280
|
className: Z.typeText,
|
|
@@ -288,12 +288,12 @@ var Ne = (e) => {
|
|
|
288
288
|
alt: g,
|
|
289
289
|
loading: "lazy",
|
|
290
290
|
decoding: "async",
|
|
291
|
-
className: d("h-full w-full rounded-xl object-cover transition-opacity duration-200", w ===
|
|
291
|
+
className: d("h-full w-full rounded-xl object-cover transition-opacity duration-200", w === Ye.Loaded ? "opacity-100" : "opacity-0")
|
|
292
292
|
})
|
|
293
293
|
]
|
|
294
294
|
})
|
|
295
295
|
});
|
|
296
|
-
},
|
|
296
|
+
}, Qe = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: s, labels: c, styles: l, isSelected: d }) => {
|
|
297
297
|
let { colors: f } = l ?? {}, p = e.type === t.Pasted, m = p && a !== void 0, h = u({
|
|
298
298
|
"--ai-tile-bg": f?.background,
|
|
299
299
|
"--ai-tile-border": f?.border,
|
|
@@ -310,8 +310,8 @@ var Ne = (e) => {
|
|
|
310
310
|
"--ai-tile-hover-icon-bg": f?.hoverIconBackground,
|
|
311
311
|
"--ai-tile-hover-icon-color": f?.hoverIconColor,
|
|
312
312
|
"--ai-tile-progress-track": f?.trackBackground
|
|
313
|
-
}), { isImage: g, isLink: _ } =
|
|
314
|
-
return g ? /* @__PURE__ */ Y(
|
|
313
|
+
}), { isImage: g, isLink: _ } = Pe(() => Ve(e), [e]);
|
|
314
|
+
return g ? /* @__PURE__ */ Y(Ze, {
|
|
315
315
|
attachment: e,
|
|
316
316
|
labels: c,
|
|
317
317
|
onClick: o,
|
|
@@ -321,7 +321,7 @@ var Ne = (e) => {
|
|
|
321
321
|
cssVars: h,
|
|
322
322
|
onDownload: s,
|
|
323
323
|
isSelected: d
|
|
324
|
-
}) : /* @__PURE__ */ Y(
|
|
324
|
+
}) : /* @__PURE__ */ Y(Je, {
|
|
325
325
|
attachment: e,
|
|
326
326
|
searchQuery: n,
|
|
327
327
|
onClick: o,
|
|
@@ -337,13 +337,13 @@ var Ne = (e) => {
|
|
|
337
337
|
isExpandable: m,
|
|
338
338
|
isSelected: d
|
|
339
339
|
});
|
|
340
|
-
},
|
|
340
|
+
}, $e = {
|
|
341
341
|
headerIcon: "_headerIcon_1dmgi_1",
|
|
342
342
|
headerLabel: "_headerLabel_1dmgi_2"
|
|
343
|
-
},
|
|
344
|
-
let { ariaLabel: l = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel:
|
|
343
|
+
}, et = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, tt = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, labels: a, styles: o, selectedAttachmentId: s }) => {
|
|
344
|
+
let { ariaLabel: l = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: _ = "Download all", openInNewTabLabel: v, getHeaderLabel: y = (e) => et(e, "attachment"), promptLabel: b, pastedLabel: x, imageLabel: S } = a ?? {}, { typography: C, colors: w, className: T } = o ?? {}, E = u({ "--ai-group-text": w?.text });
|
|
345
345
|
if (e.length === 0) return null;
|
|
346
|
-
let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ?
|
|
346
|
+
let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ? ye : D ? G : R, M = y(e.length), N = () => {
|
|
347
347
|
let t = e.filter((e) => e.status === c.Idle);
|
|
348
348
|
r ? r(t) : t.forEach((e) => n?.(e.id));
|
|
349
349
|
}, P = (t) => {
|
|
@@ -354,26 +354,26 @@ var Ne = (e) => {
|
|
|
354
354
|
role: "group",
|
|
355
355
|
"aria-label": l,
|
|
356
356
|
style: E,
|
|
357
|
-
className: d("flex flex-col gap-1", A ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]",
|
|
357
|
+
className: d("flex flex-col gap-1", A ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", $e.container, T),
|
|
358
358
|
children: [/* @__PURE__ */ X("div", {
|
|
359
359
|
className: "flex items-center justify-between",
|
|
360
360
|
children: [/* @__PURE__ */ X("div", {
|
|
361
361
|
className: "flex items-center gap-1",
|
|
362
362
|
children: [/* @__PURE__ */ Y(j, {
|
|
363
363
|
size: p.SM,
|
|
364
|
-
className: d("shrink-0",
|
|
364
|
+
className: d("shrink-0", $e.headerIcon),
|
|
365
365
|
"aria-hidden": !0
|
|
366
366
|
}), /* @__PURE__ */ Y("span", {
|
|
367
|
-
className: d(C?.headerLabelClassName ?? "dial-tiny-semi-text",
|
|
367
|
+
className: d(C?.headerLabelClassName ?? "dial-tiny-semi-text", $e.headerLabel),
|
|
368
368
|
children: M
|
|
369
369
|
})]
|
|
370
|
-
}), e.length >= 2 && (r || n) && /* @__PURE__ */ Y(
|
|
371
|
-
icon: /* @__PURE__ */ Y(
|
|
370
|
+
}), e.length >= 2 && (r || n) && /* @__PURE__ */ Y(g, {
|
|
371
|
+
icon: /* @__PURE__ */ Y(I, {
|
|
372
372
|
size: p.SM,
|
|
373
373
|
"aria-hidden": !0
|
|
374
374
|
}),
|
|
375
|
-
size:
|
|
376
|
-
"aria-label":
|
|
375
|
+
size: h.Small,
|
|
376
|
+
"aria-label": _,
|
|
377
377
|
onClick: N
|
|
378
378
|
})]
|
|
379
379
|
}), /* @__PURE__ */ Y("div", {
|
|
@@ -382,7 +382,7 @@ var Ne = (e) => {
|
|
|
382
382
|
className: d("gap-3", A ? "grid grid-cols-[repeat(5,83px)]" : "flex flex-wrap"),
|
|
383
383
|
children: e.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
384
384
|
role: "listitem",
|
|
385
|
-
children: /* @__PURE__ */ Y(
|
|
385
|
+
children: /* @__PURE__ */ Y(Qe, {
|
|
386
386
|
attachment: e,
|
|
387
387
|
onClick: n,
|
|
388
388
|
onDownload: P,
|
|
@@ -393,16 +393,16 @@ var Ne = (e) => {
|
|
|
393
393
|
promptLabel: b,
|
|
394
394
|
pastedLabel: x,
|
|
395
395
|
imageLabel: S,
|
|
396
|
-
openInNewTabLabel:
|
|
396
|
+
openInNewTabLabel: v
|
|
397
397
|
},
|
|
398
398
|
isSelected: e.id === s
|
|
399
399
|
})
|
|
400
400
|
}, `${e.id}-${t}`))
|
|
401
401
|
})]
|
|
402
402
|
});
|
|
403
|
-
},
|
|
404
|
-
let [s, c] = q(t), [l, u] = q(n), [d, f] = q(r), p =
|
|
405
|
-
|
|
403
|
+
}, nt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
404
|
+
let [s, c] = q(t), [l, u] = q(n), [d, f] = q(r), p = Fe(o);
|
|
405
|
+
Me(() => {
|
|
406
406
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
407
407
|
}, [
|
|
408
408
|
o,
|
|
@@ -433,62 +433,63 @@ var Ne = (e) => {
|
|
|
433
433
|
a
|
|
434
434
|
])
|
|
435
435
|
};
|
|
436
|
-
},
|
|
436
|
+
}, rt = { label: "_label_14i7c_1" }, it = ({ 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: f = "Markdown", responseFormatPlainTextLabel: p = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
|
|
437
437
|
"Precise",
|
|
438
438
|
"Neutral",
|
|
439
439
|
"Creative"
|
|
440
|
-
], temperatureHint:
|
|
441
|
-
let
|
|
440
|
+
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
441
|
+
let S = u({ "--csf-label-text": x?.labelText }), C = d(b, rt.label, "gap-1");
|
|
442
442
|
return /* @__PURE__ */ X("div", {
|
|
443
443
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
444
|
-
style:
|
|
444
|
+
style: S,
|
|
445
445
|
children: [
|
|
446
|
-
e.responseFormat && /* @__PURE__ */ Y(
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
446
|
+
e.responseFormat && /* @__PURE__ */ Y(w, {
|
|
447
|
+
id: "response-format",
|
|
448
|
+
labelProps: {
|
|
449
|
+
label: s,
|
|
450
|
+
className: C,
|
|
451
|
+
caption: c
|
|
452
|
+
},
|
|
453
|
+
optionsClassName: "mb-2",
|
|
454
|
+
orientation: T.Column,
|
|
455
|
+
value: t ?? l.Markdown,
|
|
456
|
+
items: [{
|
|
457
|
+
value: l.Markdown,
|
|
458
|
+
label: f
|
|
458
459
|
}, {
|
|
459
|
-
|
|
460
|
-
|
|
460
|
+
value: l.PlainText,
|
|
461
|
+
label: p
|
|
461
462
|
}],
|
|
462
463
|
onChange: (e) => i(e)
|
|
463
464
|
}),
|
|
464
|
-
e.systemPrompt && /* @__PURE__ */ Y(
|
|
465
|
+
e.systemPrompt && /* @__PURE__ */ Y(A, {
|
|
465
466
|
value: n,
|
|
466
|
-
placeholder:
|
|
467
|
+
placeholder: g,
|
|
467
468
|
resize: !0,
|
|
468
469
|
labelProps: {
|
|
469
|
-
className:
|
|
470
|
-
label:
|
|
470
|
+
className: C,
|
|
471
|
+
label: h
|
|
471
472
|
},
|
|
472
473
|
onChange: (e) => a(e ?? "")
|
|
473
474
|
}),
|
|
474
|
-
e.temperature && /* @__PURE__ */ Y(
|
|
475
|
+
e.temperature && /* @__PURE__ */ Y(m, {
|
|
475
476
|
labelProps: {
|
|
476
|
-
label:
|
|
477
|
-
className:
|
|
478
|
-
caption:
|
|
477
|
+
label: _,
|
|
478
|
+
className: C,
|
|
479
|
+
caption: y
|
|
479
480
|
},
|
|
480
481
|
value: r,
|
|
481
482
|
min: 0,
|
|
482
483
|
max: 1,
|
|
483
484
|
step: .1,
|
|
484
|
-
labels:
|
|
485
|
+
labels: v,
|
|
485
486
|
onChange: o
|
|
486
487
|
})
|
|
487
488
|
]
|
|
488
489
|
});
|
|
489
|
-
},
|
|
490
|
-
|
|
491
|
-
let { responseFormat:
|
|
490
|
+
}, at = { modal: "_modal_kl0h0_1" };
|
|
491
|
+
je(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: h, temperatureHint: g, saveLabel: _ = "Apply changes", saveDisabledTooltip: v, backgroundClassName: y = at.modal }) => {
|
|
492
|
+
let { responseFormat: b, systemPrompt: w, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: A } = nt({
|
|
492
493
|
features: e,
|
|
493
494
|
initialResponseFormat: t,
|
|
494
495
|
initialSystemPrompt: n,
|
|
@@ -496,33 +497,33 @@ Oe(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
496
497
|
onSave: i,
|
|
497
498
|
onClose: a
|
|
498
499
|
});
|
|
499
|
-
return /* @__PURE__ */ Y(
|
|
500
|
+
return /* @__PURE__ */ Y(x, {
|
|
500
501
|
open: !0,
|
|
501
502
|
header: o,
|
|
502
503
|
titleClassName: s,
|
|
503
|
-
size:
|
|
504
|
+
size: S.Sm,
|
|
504
505
|
onClose: a,
|
|
505
|
-
className:
|
|
506
|
+
className: y,
|
|
506
507
|
footer: /* @__PURE__ */ Y("div", {
|
|
507
508
|
className: "flex justify-end px-6 py-4",
|
|
508
|
-
children: /* @__PURE__ */ Y(
|
|
509
|
-
tooltip:
|
|
510
|
-
hideTooltip:
|
|
511
|
-
children: /* @__PURE__ */ Y(
|
|
512
|
-
label:
|
|
513
|
-
onClick:
|
|
514
|
-
disabled: !
|
|
509
|
+
children: /* @__PURE__ */ Y(M, {
|
|
510
|
+
tooltip: v,
|
|
511
|
+
hideTooltip: E || !v,
|
|
512
|
+
children: /* @__PURE__ */ Y(C, {
|
|
513
|
+
label: _,
|
|
514
|
+
onClick: A,
|
|
515
|
+
disabled: !E
|
|
515
516
|
})
|
|
516
517
|
})
|
|
517
518
|
}),
|
|
518
|
-
children: /* @__PURE__ */ Y(
|
|
519
|
+
children: /* @__PURE__ */ Y(it, {
|
|
519
520
|
features: e,
|
|
520
|
-
responseFormat:
|
|
521
|
-
systemPrompt:
|
|
522
|
-
temperature:
|
|
523
|
-
onResponseFormatChange:
|
|
524
|
-
onSystemPromptChange:
|
|
525
|
-
onTemperatureChange:
|
|
521
|
+
responseFormat: b,
|
|
522
|
+
systemPrompt: w,
|
|
523
|
+
temperature: T,
|
|
524
|
+
onResponseFormatChange: D,
|
|
525
|
+
onSystemPromptChange: O,
|
|
526
|
+
onTemperatureChange: k,
|
|
526
527
|
responseFormatLabel: c,
|
|
527
528
|
responseFormatHint: l,
|
|
528
529
|
responseFormatMarkdownLabel: u,
|
|
@@ -531,113 +532,127 @@ Oe(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
531
532
|
systemPromptTooltip: p,
|
|
532
533
|
temperatureLabel: m,
|
|
533
534
|
temperatureLabels: h,
|
|
534
|
-
temperatureHint:
|
|
535
|
+
temperatureHint: g
|
|
535
536
|
})
|
|
536
537
|
});
|
|
537
538
|
});
|
|
538
|
-
var
|
|
539
|
-
let { tooltips:
|
|
540
|
-
c?.(),
|
|
541
|
-
}, [c,
|
|
542
|
-
l?.(),
|
|
543
|
-
}, [l,
|
|
539
|
+
var ot = { activeRating: "_activeRating_ygoee_1" }, st = 2e3, ct = ({ role: e = s.User, onEdit: t, onEditHover: r, onDelete: i, onRegenerate: a, onCopy: c, onCopyMarkdown: l, onLike: f, onDislike: m, activeRating: g, isAlwaysVisible: _, className: v, labels: y, colors: b }) => {
|
|
540
|
+
let { tooltips: x, ariaLabels: S } = y ?? {}, [C, w] = q(null), [T, E] = q(""), D = u({ "--ma-active-rating-text": b?.activeRatingText }), O = K(() => {
|
|
541
|
+
c?.(), w("copy"), E(S?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => w(null), st);
|
|
542
|
+
}, [c, S?.copiedStatus]), k = K(() => {
|
|
543
|
+
l?.(), w("markdown"), E(S?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => w(null), st);
|
|
544
|
+
}, [l, S?.copiedMarkdownStatus]);
|
|
544
545
|
return /* @__PURE__ */ X("div", {
|
|
545
546
|
role: "toolbar",
|
|
546
|
-
"aria-label":
|
|
547
|
-
style:
|
|
548
|
-
className: d("flex gap-1", !
|
|
547
|
+
"aria-label": S?.actionsGroup ?? "Message actions",
|
|
548
|
+
style: D,
|
|
549
|
+
className: d("flex gap-1", !_ && "opacity-0 group-hover:opacity-100", v),
|
|
549
550
|
children: [/* @__PURE__ */ Y("span", {
|
|
550
551
|
role: "status",
|
|
551
552
|
"aria-live": "polite",
|
|
552
553
|
className: "sr-only",
|
|
553
|
-
children:
|
|
554
|
-
}), e === s.User ? /* @__PURE__ */ X(J, { children: [t && /* @__PURE__ */ Y(
|
|
555
|
-
icon: /* @__PURE__ */ Y(
|
|
554
|
+
children: T
|
|
555
|
+
}), e === s.User ? /* @__PURE__ */ X(J, { children: [t && /* @__PURE__ */ Y(j, {
|
|
556
|
+
icon: /* @__PURE__ */ Y(be, {
|
|
556
557
|
size: p.SM,
|
|
557
|
-
"aria-hidden": !0
|
|
558
|
+
"aria-hidden": !0,
|
|
559
|
+
stroke: 1.5
|
|
558
560
|
}),
|
|
559
|
-
size:
|
|
560
|
-
"aria-label":
|
|
561
|
-
tooltipProps: { tooltip:
|
|
561
|
+
size: h.Small,
|
|
562
|
+
"aria-label": S?.editMessage ?? "Edit message",
|
|
563
|
+
tooltipProps: { tooltip: x?.edit ?? "Edit" },
|
|
562
564
|
onClick: t,
|
|
563
565
|
onMouseEnter: r,
|
|
564
566
|
onFocus: r
|
|
565
|
-
}), i && /* @__PURE__ */ Y(
|
|
566
|
-
icon: /* @__PURE__ */ Y(
|
|
567
|
+
}), i && /* @__PURE__ */ Y(j, {
|
|
568
|
+
icon: /* @__PURE__ */ Y(Oe, {
|
|
567
569
|
size: p.SM,
|
|
568
|
-
"aria-hidden": !0
|
|
570
|
+
"aria-hidden": !0,
|
|
571
|
+
stroke: 1.5
|
|
569
572
|
}),
|
|
570
|
-
size:
|
|
571
|
-
"aria-label":
|
|
572
|
-
tooltipProps: { tooltip:
|
|
573
|
+
size: h.Small,
|
|
574
|
+
"aria-label": S?.deleteMessage ?? "Delete message",
|
|
575
|
+
tooltipProps: { tooltip: x?.delete ?? "Delete" },
|
|
573
576
|
onClick: i
|
|
574
577
|
})] }) : /* @__PURE__ */ X(J, { children: [
|
|
575
|
-
a && /* @__PURE__ */ Y(
|
|
576
|
-
icon: /* @__PURE__ */ Y(
|
|
578
|
+
a && /* @__PURE__ */ Y(j, {
|
|
579
|
+
icon: /* @__PURE__ */ Y(xe, {
|
|
577
580
|
size: p.SM,
|
|
578
|
-
"aria-hidden": !0
|
|
581
|
+
"aria-hidden": !0,
|
|
582
|
+
stroke: 1.5
|
|
579
583
|
}),
|
|
580
|
-
size:
|
|
581
|
-
"aria-label":
|
|
582
|
-
tooltipProps: { tooltip:
|
|
584
|
+
size: h.Small,
|
|
585
|
+
"aria-label": S?.regenerateResponse ?? "Regenerate response",
|
|
586
|
+
tooltipProps: { tooltip: x?.regenerate ?? "Regenerate" },
|
|
583
587
|
onClick: a
|
|
584
588
|
}),
|
|
585
589
|
c && /* @__PURE__ */ Y(n, {
|
|
586
590
|
iconSize: p.SM,
|
|
587
|
-
onClick:
|
|
588
|
-
size:
|
|
589
|
-
isCopied:
|
|
590
|
-
copyLabel:
|
|
591
|
-
copiedLabel:
|
|
592
|
-
ariaLabel:
|
|
591
|
+
onClick: O,
|
|
592
|
+
size: h.Small,
|
|
593
|
+
isCopied: C === "copy",
|
|
594
|
+
copyLabel: x?.copy ?? "Copy",
|
|
595
|
+
copiedLabel: x?.copied ?? "Copied!",
|
|
596
|
+
ariaLabel: S?.copyResponse ?? "Copy response"
|
|
593
597
|
}),
|
|
594
598
|
l && /* @__PURE__ */ Y(n, {
|
|
595
599
|
iconSize: p.SM,
|
|
596
|
-
onClick:
|
|
597
|
-
size:
|
|
598
|
-
isCopied:
|
|
599
|
-
iconCopy: /* @__PURE__ */ Y(
|
|
600
|
+
onClick: k,
|
|
601
|
+
size: h.Small,
|
|
602
|
+
isCopied: C === "markdown",
|
|
603
|
+
iconCopy: /* @__PURE__ */ Y(_e, {
|
|
600
604
|
size: p.SM,
|
|
601
|
-
"aria-hidden": !0
|
|
605
|
+
"aria-hidden": !0,
|
|
606
|
+
stroke: 1.5
|
|
602
607
|
}),
|
|
603
|
-
copyLabel:
|
|
604
|
-
copiedLabel:
|
|
605
|
-
ariaLabel:
|
|
608
|
+
copyLabel: x?.copyMarkdown ?? "Copy as Markdown",
|
|
609
|
+
copiedLabel: x?.copiedMarkdown ?? "Copied!",
|
|
610
|
+
ariaLabel: S?.copyAsMarkdown ?? "Copy as markdown"
|
|
606
611
|
}),
|
|
607
|
-
f && /* @__PURE__ */ Y(
|
|
608
|
-
icon: /* @__PURE__ */ Y(
|
|
612
|
+
f && /* @__PURE__ */ Y(j, {
|
|
613
|
+
icon: g === o.Like ? /* @__PURE__ */ Y(De, {
|
|
614
|
+
className: ot.activeRating,
|
|
609
615
|
size: p.SM,
|
|
616
|
+
stroke: 1.5,
|
|
610
617
|
"aria-hidden": !0
|
|
618
|
+
}) : /* @__PURE__ */ Y(Ee, {
|
|
619
|
+
size: p.SM,
|
|
620
|
+
"aria-hidden": !0,
|
|
621
|
+
stroke: 1.5
|
|
611
622
|
}),
|
|
612
|
-
size:
|
|
613
|
-
"aria-label":
|
|
614
|
-
"aria-pressed":
|
|
615
|
-
|
|
616
|
-
tooltipProps: { tooltip: S?.like ?? "Like" },
|
|
623
|
+
size: h.Small,
|
|
624
|
+
"aria-label": S?.likeResponse ?? "Like response",
|
|
625
|
+
"aria-pressed": g === o.Like,
|
|
626
|
+
tooltipProps: { tooltip: x?.like ?? "Like" },
|
|
617
627
|
onClick: f
|
|
618
628
|
}),
|
|
619
|
-
m && /* @__PURE__ */ Y(
|
|
620
|
-
icon: /* @__PURE__ */ Y(
|
|
629
|
+
m && /* @__PURE__ */ Y(j, {
|
|
630
|
+
icon: g === o.Dislike ? /* @__PURE__ */ Y(Te, {
|
|
631
|
+
className: ot.activeRating,
|
|
621
632
|
size: p.SM,
|
|
622
|
-
"aria-hidden": !0
|
|
633
|
+
"aria-hidden": !0,
|
|
634
|
+
stroke: 1.5
|
|
635
|
+
}) : /* @__PURE__ */ Y(we, {
|
|
636
|
+
size: p.SM,
|
|
637
|
+
"aria-hidden": !0,
|
|
638
|
+
stroke: 1.5
|
|
623
639
|
}),
|
|
624
|
-
size:
|
|
625
|
-
"aria-label":
|
|
626
|
-
"aria-pressed":
|
|
627
|
-
|
|
628
|
-
tooltipProps: { tooltip: S?.dislike ?? "Dislike" },
|
|
640
|
+
size: h.Small,
|
|
641
|
+
"aria-label": S?.dislikeResponse ?? "Dislike response",
|
|
642
|
+
"aria-pressed": g === o.Dislike,
|
|
643
|
+
tooltipProps: { tooltip: x?.dislike ?? "Dislike" },
|
|
629
644
|
onClick: m
|
|
630
645
|
})
|
|
631
646
|
] })]
|
|
632
647
|
});
|
|
633
648
|
}, $ = {
|
|
634
|
-
userBubble: "
|
|
635
|
-
collapsibleText: "
|
|
636
|
-
expandedText: "
|
|
637
|
-
collapsedText: "
|
|
638
|
-
startersDivider: "
|
|
639
|
-
text: "
|
|
640
|
-
},
|
|
649
|
+
userBubble: "_userBubble_qoxdz_1",
|
|
650
|
+
collapsibleText: "_collapsibleText_qoxdz_6",
|
|
651
|
+
expandedText: "_expandedText_qoxdz_11",
|
|
652
|
+
collapsedText: "_collapsedText_qoxdz_15",
|
|
653
|
+
startersDivider: "_startersDivider_qoxdz_26",
|
|
654
|
+
text: "_text_qoxdz_30"
|
|
655
|
+
}, lt = ({ text: e, styles: n, actions: a, hasAlwaysVisibleActions: o, isStreaming: c, attachments: l, afterContent: f, starters: p, onSelectStarter: m, deploymentIconUrl: h, deploymentDisplayName: g, markdownComponents: _, markdownClassNames: v, onAttachmentClick: y, onDownloadAll: x, onAttachmentRetry: S, codeBlockTheme: C, labels: w, selectedAttachmentId: T }) => {
|
|
641
656
|
let { colors: E, typography: D, className: O, bubbleClassName: k } = n ?? {}, { attachmentClickLabel: A, attachmentRetryLabel: j, attachmentOpenInNewTabLabel: M, startersAriaLabel: N = "Quick reply buttons", thinkingLabel: P, codeBlockCopyLabel: F, codeBlockCopiedLabel: I, assistantMessageAriaLabel: L = "Assistant message", deploymentIconFallbackLabel: R = "AI" } = w ?? {}, z = c ? (l ?? []).filter((e) => e.type !== t.Audio) : l ?? [], B = u({
|
|
642
657
|
"--cm-bubble-text": E?.text,
|
|
643
658
|
"--cm-starters-divider": E?.startersDivider
|
|
@@ -672,11 +687,11 @@ var rt = { activeRating: "_activeRating_7jito_1" }, it = 2e3, at = ({ role: e =
|
|
|
672
687
|
codeBlockTheme: C
|
|
673
688
|
})
|
|
674
689
|
}),
|
|
675
|
-
/* @__PURE__ */ Y(
|
|
690
|
+
/* @__PURE__ */ Y(tt, {
|
|
676
691
|
attachments: z,
|
|
677
692
|
onAttachmentClick: (e) => y?.(l?.find((t) => t.id === e)),
|
|
678
|
-
onDownloadAll:
|
|
679
|
-
onRetry:
|
|
693
|
+
onDownloadAll: x,
|
|
694
|
+
onRetry: S,
|
|
680
695
|
labels: {
|
|
681
696
|
clickLabel: A,
|
|
682
697
|
retryLabel: j,
|
|
@@ -685,7 +700,7 @@ var rt = { activeRating: "_activeRating_7jito_1" }, it = 2e3, at = ({ role: e =
|
|
|
685
700
|
selectedAttachmentId: T
|
|
686
701
|
}),
|
|
687
702
|
f,
|
|
688
|
-
/* @__PURE__ */ Y(
|
|
703
|
+
/* @__PURE__ */ Y(ct, {
|
|
689
704
|
...a,
|
|
690
705
|
isAlwaysVisible: o,
|
|
691
706
|
role: s.Assistant
|
|
@@ -698,7 +713,7 @@ var rt = { activeRating: "_activeRating_7jito_1" }, it = 2e3, at = ({ role: e =
|
|
|
698
713
|
children: p.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
699
714
|
role: "listitem",
|
|
700
715
|
className: "min-w-[40px]",
|
|
701
|
-
children: /* @__PURE__ */ Y(
|
|
716
|
+
children: /* @__PURE__ */ Y(b, {
|
|
702
717
|
label: e.title,
|
|
703
718
|
className: "min-w-[40px]",
|
|
704
719
|
onClick: () => m(e)
|
|
@@ -707,18 +722,18 @@ var rt = { activeRating: "_activeRating_7jito_1" }, it = 2e3, at = ({ role: e =
|
|
|
707
722
|
})]
|
|
708
723
|
})]
|
|
709
724
|
});
|
|
710
|
-
},
|
|
725
|
+
}, ut = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ Y("div", {
|
|
711
726
|
role: "status",
|
|
712
727
|
"aria-live": "polite",
|
|
713
|
-
children: /* @__PURE__ */ Y(
|
|
728
|
+
children: /* @__PURE__ */ Y(v, {
|
|
714
729
|
title: e,
|
|
715
730
|
message: t,
|
|
716
731
|
textClassName: "flex-row flex-wrap gap-1"
|
|
717
732
|
})
|
|
718
|
-
}),
|
|
733
|
+
}), dt = /* @__PURE__ */ function(e) {
|
|
719
734
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
720
|
-
}({}),
|
|
721
|
-
let { colors: v, typography:
|
|
735
|
+
}({}), ft = 10, pt = ({ text: e, position: t = dt.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: a, collapsedLineCount: o = ft, labels: c, onAttachmentClick: l, onDownloadAll: m, onAttachmentRetry: g, selectedAttachmentId: _ }) => {
|
|
736
|
+
let { colors: v, typography: b, className: x, bubbleClassName: S } = n ?? {}, { showMoreLabel: C = "Show more", showLessLabel: w = "Show less", showMoreAriaLabel: T, showLessAriaLabel: E, attachmentClickLabel: D, attachmentRetryLabel: O, attachmentOpenInNewTabLabel: k, userMessageAriaLabel: A = "User message" } = c ?? {}, { textRef: j, isTextCollapsed: M, isOverflowing: F, collapsedMaxHeight: I, expandedMaxHeight: L, isCollapsed: R, toggleCollapsed: z } = f({
|
|
722
737
|
text: e,
|
|
723
738
|
collapsedLineCount: o
|
|
724
739
|
}), B = u({
|
|
@@ -728,27 +743,27 @@ var rt = { activeRating: "_activeRating_7jito_1" }, it = 2e3, at = ({ role: e =
|
|
|
728
743
|
"--cm-bubble-text": v?.text,
|
|
729
744
|
"--cm-bubble-collapsed-height": F ? `${I}px` : void 0,
|
|
730
745
|
"--cm-bubble-expanded-height": F ? `${L}px` : void 0
|
|
731
|
-
}), V = t ===
|
|
746
|
+
}), V = t === dt.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", H = d($.text, b?.fontClassName), ee = T ?? C, te = E ?? w, ne = R ? C : w, U = R ? ee : te, W = R ? N : P, re = Ne();
|
|
732
747
|
return /* @__PURE__ */ Y("div", {
|
|
733
748
|
role: "group",
|
|
734
749
|
"aria-label": A,
|
|
735
750
|
style: B,
|
|
736
|
-
className: d("flex w-full",
|
|
751
|
+
className: d("flex w-full", x),
|
|
737
752
|
children: /* @__PURE__ */ X("div", {
|
|
738
753
|
className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
|
|
739
754
|
children: [
|
|
740
|
-
/* @__PURE__ */ Y(
|
|
755
|
+
/* @__PURE__ */ Y(tt, {
|
|
741
756
|
attachments: a ?? [],
|
|
742
757
|
onAttachmentClick: (e) => l?.(a?.find((t) => t.id === e)),
|
|
743
758
|
onDownloadAll: m,
|
|
744
|
-
onRetry:
|
|
759
|
+
onRetry: g,
|
|
745
760
|
labels: {
|
|
746
761
|
clickLabel: D,
|
|
747
762
|
retryLabel: O,
|
|
748
763
|
openInNewTabLabel: k
|
|
749
764
|
},
|
|
750
765
|
styles: { className: "max-w-[640px]" },
|
|
751
|
-
selectedAttachmentId:
|
|
766
|
+
selectedAttachmentId: _
|
|
752
767
|
}),
|
|
753
768
|
e && /* @__PURE__ */ Y("div", {
|
|
754
769
|
className: d($.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", V, S),
|
|
@@ -756,28 +771,28 @@ var rt = { activeRating: "_activeRating_7jito_1" }, it = 2e3, at = ({ role: e =
|
|
|
756
771
|
className: "flex min-w-0 flex-col items-start",
|
|
757
772
|
children: [/* @__PURE__ */ Y("div", {
|
|
758
773
|
id: re,
|
|
759
|
-
className: d("relative overflow-hidden", F && $.collapsibleText, F && !R && $.expandedText,
|
|
774
|
+
className: d("relative overflow-hidden", F && $.collapsibleText, F && !R && $.expandedText, M && $.collapsedText),
|
|
760
775
|
children: /* @__PURE__ */ Y("p", {
|
|
761
776
|
ref: j,
|
|
762
777
|
className: d(H, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
|
|
763
778
|
children: e
|
|
764
779
|
})
|
|
765
|
-
}), F && /* @__PURE__ */ Y(
|
|
766
|
-
label: /* @__PURE__ */ Y(J, { children:
|
|
767
|
-
iconBefore: /* @__PURE__ */ Y(
|
|
780
|
+
}), F && /* @__PURE__ */ Y(y, {
|
|
781
|
+
label: /* @__PURE__ */ Y(J, { children: ne }),
|
|
782
|
+
iconBefore: /* @__PURE__ */ Y(W, {
|
|
768
783
|
size: p.SM,
|
|
769
784
|
"aria-hidden": "true"
|
|
770
785
|
}),
|
|
771
|
-
"aria-label":
|
|
786
|
+
"aria-label": U,
|
|
772
787
|
"aria-expanded": !R,
|
|
773
788
|
"aria-controls": re,
|
|
774
789
|
className: "mt-3",
|
|
775
790
|
onClick: z,
|
|
776
|
-
size:
|
|
791
|
+
size: h.Small
|
|
777
792
|
})]
|
|
778
793
|
})
|
|
779
794
|
}),
|
|
780
|
-
/* @__PURE__ */ Y(
|
|
795
|
+
/* @__PURE__ */ Y(ct, {
|
|
781
796
|
...r,
|
|
782
797
|
isAlwaysVisible: i,
|
|
783
798
|
role: s.User
|
|
@@ -785,16 +800,16 @@ var rt = { activeRating: "_activeRating_7jito_1" }, it = 2e3, at = ({ role: e =
|
|
|
785
800
|
]
|
|
786
801
|
})
|
|
787
802
|
});
|
|
788
|
-
},
|
|
803
|
+
}, mt = ({ role: e, onAttachmentClick: t, markdownComponents: n, ...r }) => e === s.Status ? /* @__PURE__ */ Y(ut, { labels: {
|
|
789
804
|
titleText: r.labels?.statusTitleText,
|
|
790
805
|
bodyText: r.labels?.statusBodyText ?? ""
|
|
791
|
-
} }) : e === s.User ? /* @__PURE__ */ Y(
|
|
806
|
+
} }) : e === s.User ? /* @__PURE__ */ Y(pt, {
|
|
792
807
|
...r,
|
|
793
808
|
onAttachmentClick: t
|
|
794
|
-
}) : /* @__PURE__ */ Y(
|
|
809
|
+
}) : /* @__PURE__ */ Y(lt, {
|
|
795
810
|
...r,
|
|
796
811
|
markdownComponents: n,
|
|
797
812
|
onAttachmentClick: t
|
|
798
813
|
});
|
|
799
814
|
//#endregion
|
|
800
|
-
export {
|
|
815
|
+
export { lt as AssistantMessageBubble, dt as BubblePosition, ct as MessageActions, mt as MessageBubble, ut as StatusMessageBubble, pt 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
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "^19.0.0",
|
|
21
21
|
"@tabler/icons-react": "^3.0.0",
|
|
22
|
-
"@epam/ai-dial-chat-shared": "1.0.0
|
|
23
|
-
"@epam/ai-dial-conversation-input": "1.0.0
|
|
22
|
+
"@epam/ai-dial-chat-shared": "1.0.0",
|
|
23
|
+
"@epam/ai-dial-conversation-input": "1.0.0",
|
|
24
24
|
"react-markdown": "^10.1.0",
|
|
25
|
-
"@epam/ai-dial-ui-kit": "^0.
|
|
25
|
+
"@epam/ai-dial-ui-kit": "^0.14.0-dev.6"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|