@epam/ai-dial-conversation-messages 1.2.0-dev.99 → 1.3.0-dev.5
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 +1 -1
- package/components/MessageActions/MessageActions.d.ts.map +1 -1
- package/components/MessageBubble/AssistantMessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/MessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/UserMessageBubble.d.ts.map +1 -1
- package/components/MessageSelectionReply/MessageSelectionReply.d.ts +55 -0
- package/components/MessageSelectionReply/MessageSelectionReply.d.ts.map +1 -0
- package/index.css +2 -2
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +367 -233
- package/models/message-actions.d.ts +10 -4
- package/models/message-actions.d.ts.map +1 -1
- package/models/message-bubble.d.ts +42 -14
- package/models/message-bubble.d.ts.map +1 -1
- package/package.json +5 -4
- package/utils/clipboard.d.ts +11 -0
- package/utils/clipboard.d.ts.map +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { MessageActionsProps } from '../../models/message-actions';
|
|
3
|
-
/** Context-sensitive action bar — shows edit/delete for user messages and regenerate/copy/like/dislike for assistant messages. */
|
|
3
|
+
/** Context-sensitive action bar — shows copy/edit/delete for user messages and regenerate/copy/like/dislike for assistant messages. */
|
|
4
4
|
export declare const MessageActions: FC<MessageActionsProps>;
|
|
5
5
|
//# sourceMappingURL=MessageActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,
|
|
1
|
+
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,uIAAuI;AACvI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAuOlD,CAAC"}
|
|
@@ -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;
|
|
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;AAa/E,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAiOlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/MessageBubble.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAKtE,wGAAwG;AACxG,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/MessageBubble.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAKtE,wGAAwG;AACxG,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAyChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAQ1E,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAqKxD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC, RefObject } from 'react';
|
|
2
|
+
/** Color overrides for the Reply action. */
|
|
3
|
+
export interface MessageSelectionReplyColors {
|
|
4
|
+
/** Button background. Falls back to `--bg-layer-raised`. */
|
|
5
|
+
background?: string;
|
|
6
|
+
/** Hover background. Falls back to `--bg-layer-base`. */
|
|
7
|
+
hoverBackground?: string;
|
|
8
|
+
/** Label and icon color. Falls back to `--text-primary`. */
|
|
9
|
+
text?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Typography overrides for the Reply action. */
|
|
12
|
+
export interface MessageSelectionReplyTypography {
|
|
13
|
+
/** Button label class. Defaults to `'dial-small-text'`. */
|
|
14
|
+
fontClassName?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Appearance overrides for the Reply action. */
|
|
17
|
+
export interface MessageSelectionReplyStyles {
|
|
18
|
+
/** Button colors, applied as CSS custom properties. */
|
|
19
|
+
colors?: MessageSelectionReplyColors;
|
|
20
|
+
/** Button label typography. */
|
|
21
|
+
typography?: MessageSelectionReplyTypography;
|
|
22
|
+
/** Extra classes on the floating root, for example a host stacking level. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Extra classes on the button. */
|
|
25
|
+
buttonClassName?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Localized strings rendered by {@link MessageSelectionReply}. */
|
|
28
|
+
export interface MessageSelectionReplyLabels {
|
|
29
|
+
/** Visible and accessible Reply action label. */
|
|
30
|
+
reply: string;
|
|
31
|
+
/** Polite announcement when a selection becomes actionable. */
|
|
32
|
+
selectionAvailable: string;
|
|
33
|
+
/** Polite announcement after the composer accepts a Reply attachment. */
|
|
34
|
+
attachmentAdded: string;
|
|
35
|
+
}
|
|
36
|
+
/** Props accepted by {@link MessageSelectionReply}. */
|
|
37
|
+
export interface MessageSelectionReplyProps {
|
|
38
|
+
/** Visible selection rectangle. Omit to unmount the action. */
|
|
39
|
+
rect: DOMRect | undefined;
|
|
40
|
+
/** Receives the floating action root. */
|
|
41
|
+
actionRef: RefObject<HTMLDivElement | null>;
|
|
42
|
+
/** Creates an attachment from the captured selection. */
|
|
43
|
+
onReply: () => void;
|
|
44
|
+
/** Increments after the composer accepts a Reply attachment. */
|
|
45
|
+
addedRevision: number;
|
|
46
|
+
/** Localized button and announcement strings. */
|
|
47
|
+
labels: MessageSelectionReplyLabels;
|
|
48
|
+
/** Appearance overrides for the floating action. */
|
|
49
|
+
styles?: MessageSelectionReplyStyles;
|
|
50
|
+
/** Same-document portal destination. Defaults to `document.body`; null defers rendering. */
|
|
51
|
+
portalContainer?: HTMLElement | null;
|
|
52
|
+
}
|
|
53
|
+
/** Offers Reply beside a native selection while leaving browser selection controls intact. */
|
|
54
|
+
export declare const MessageSelectionReply: FC<MessageSelectionReplyProps>;
|
|
55
|
+
//# sourceMappingURL=MessageSelectionReply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageSelectionReply.d.ts","sourceRoot":"","sources":["../../../src/components/MessageSelectionReply/MessageSelectionReply.tsx"],"names":[],"mappings":"AA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AAG,IAAI,CAAC;CACtC;AAED,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAmGhE,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
._activeRating_ygoee_1{color:var(--ma-active-rating-text,var(--text-accent,#1d4ed8))}._userBubble_cq829_1{border-color:var(--cm-bubble-user-border,var(--stroke-secondary,#d1dbea));background:var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7))}._collapsibleText_cq829_6{max-height:var(--cm-bubble-collapsed-height);transition:max-height .2s ease-out}._expandedText_cq829_11{max-height:var(--cm-bubble-expanded-height)}._collapsedText_cq829_15:after{content:"";pointer-events:none;background:linear-gradient(to bottom, var(--cm-bubble-fade-start,var(--shadow-xs-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_cq829_6{transition:none}}._startersDivider_cq829_26{border-color:var(--cm-starters-divider,var(--stroke-secondary,#d1dbea))}._text_cq829_30{color:var(--cm-bubble-text,var(--text-primary,#161b2d))}
|
|
2
|
-
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.collapse{visibility:collapse}.static{position:static}.absolute{position:absolute}.relative{position:relative}.start-0{inset-inline-start:0}.top-0{top:0}.me-1{margin-inline-end
|
|
1
|
+
._activeRating_ygoee_1{color:var(--ma-active-rating-text,var(--text-accent,#1d4ed8))}._userBubble_cq829_1{border-color:var(--cm-bubble-user-border,var(--stroke-secondary,#d1dbea));background:var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7))}._collapsibleText_cq829_6{max-height:var(--cm-bubble-collapsed-height);transition:max-height .2s ease-out}._expandedText_cq829_11{max-height:var(--cm-bubble-expanded-height)}._collapsedText_cq829_15:after{content:"";pointer-events:none;background:linear-gradient(to bottom, var(--cm-bubble-fade-start,var(--shadow-xs-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_cq829_6{transition:none}}._startersDivider_cq829_26{border-color:var(--cm-starters-divider,var(--stroke-secondary,#d1dbea))}._text_cq829_30{color:var(--cm-bubble-text,var(--text-primary,#161b2d))}._button_tqo4d_3._button_tqo4d_3{color:var(--cm-reply-text,var(--text-primary,#161b2d));background:var(--cm-reply-background,var(--bg-layer-raised,#fcfcfc))!important}._button_tqo4d_3._button_tqo4d_3:hover{color:var(--cm-reply-text,var(--text-primary,#161b2d));background:var(--cm-reply-hover-background,var(--bg-layer-base,#f5f7fa))!important}
|
|
2
|
+
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.start-0{inset-inline-start:0}.top-0{top:0}.z-50{z-index:50}.-me-1{margin-inline-end:-.25rem}.-ms-1{margin-inline-start:-.25rem}.ms-auto{margin-inline-start:auto}.mt-3{margin-top:.75rem}.block{display:block}.inline{display:inline}.flex{display:flex}.table{display:table}.h-8{height:2rem}.min-h-8{min-height:2rem}.w-\[calc\(100\%\+8px\)\]{width:calc(100% + 8px)}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-11{min-width:2.75rem}.min-w-\[40px\]{min-width:40px}.max-w-\[640px\]{max-width:640px}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-full{max-width:100%}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.overflow-hidden{overflow:hidden}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-ee-2xl{border-end-end-radius:1rem}.rounded-ee-md{border-end-end-radius:.375rem}.rounded-es-2xl{border-end-start-radius:1rem}.rounded-se-2xl{border-start-end-radius:1rem}.rounded-se-md{border-start-end-radius:.375rem}.rounded-ss-2xl{border-start-start-radius:1rem}.border{border-width:1px}.border-t{border-top-width:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-4{padding-bottom:1rem;padding-top:1rem}.pe-1{padding-inline-end:.25rem}.ps-1{padding-inline-start:.25rem}.pt-5{padding-top:1.25rem}.text-start{text-align:start}.opacity-0{opacity:0}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.group:hover .group-hover\:opacity-100{opacity:1}@media (max-width:1279px){.mobile\:h-11{height:2.75rem}.mobile\:min-h-11{min-height:2.75rem}}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>\.cm-bubble-markdown\>div\>\*\:first-child\]\:indent-\[var\(--cm-bubble-first-line-indent\2c 0px\)\]>.cm-bubble-markdown>div>:first-child{text-indent:var(--cm-bubble-first-line-indent,0)}
|
package/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export { UserMessageBubble } from './components/MessageBubble/UserMessageBubble'
|
|
|
4
4
|
export { AssistantMessageBubble } from './components/MessageBubble/AssistantMessageBubble';
|
|
5
5
|
export { StatusMessageBubble } from './components/MessageBubble/StatusMessageBubble';
|
|
6
6
|
export { MessageActions } from './components/MessageActions/MessageActions';
|
|
7
|
+
export { MessageSelectionReply } from './components/MessageSelectionReply/MessageSelectionReply';
|
|
7
8
|
export { BubblePosition } from './types/bubble-position';
|
|
8
9
|
export type { MessageBubbleProps, UserMessageBubbleProps, AssistantMessageBubbleProps, MessageBubbleStyles, MessageBubbleColors, MessageBubbleTypography, MessageBubbleLabels, AssistantMessageBubbleLabels, } from './models/message-bubble';
|
|
10
|
+
export type { MessageSelectionReplyColors, MessageSelectionReplyLabels, MessageSelectionReplyProps, MessageSelectionReplyStyles, MessageSelectionReplyTypography, } from './components/MessageSelectionReply/MessageSelectionReply';
|
|
9
11
|
export type { StatusMessageBubbleLabels, StatusMessageBubbleProps, } from './components/MessageBubble/StatusMessageBubble';
|
|
10
12
|
export type { MessageActionsProps, MessageActionColors, MessageActionLabels, MessageActionTooltips, MessageActionAriaLabels, } from './models/message-actions';
|
|
11
13
|
export type { MessageSourceProps, MessageSourceLabels, MessageSourceStyles, MessageSourceColors, MessageSourceTypography, } from './models/message-source';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM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AAkB,EAClB,sBAAsB,EACtB,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,0DAA0D,CAAC;AAClE,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gDAAgD,CAAC;AACxD,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a,
|
|
2
|
-
import { AttachmentGroup as
|
|
3
|
-
import { DIAL_ICON_SIZE as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { IconChevronDown as
|
|
6
|
-
import { Fragment as
|
|
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, mergeClasses as c, useCollapsedText as l } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { AttachmentGroup as u } from "@epam/ai-dial-attachment-input";
|
|
3
|
+
import { Button as d, ButtonVariant as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, ElementSize as h, GhostIconButton as g, InfoMessageNotification as _, LinkButton as v, NeutralButton as y } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { useCallback as b, useEffect as x, useId as S, useLayoutEffect as C, useMemo as ee, useRef as w, useState as T } from "react";
|
|
5
|
+
import { IconArrowBackUp as E, IconChevronDown as D, IconChevronUp as O, IconMarkdown as k, IconPencilMinus as A, IconRefresh as j, IconThumbDown as M, IconThumbDownFilled as N, IconThumbUp as P, IconThumbUpFilled as te, IconTrashX as ne } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as R } from "react-dom";
|
|
7
8
|
//#region src/constants/public-class-names.ts
|
|
8
|
-
var
|
|
9
|
+
var z = {
|
|
9
10
|
userBubble: "dial-cm-user-bubble",
|
|
10
11
|
assistantContent: "dial-cm-assistant-content"
|
|
11
|
-
},
|
|
12
|
-
let t =
|
|
13
|
-
return
|
|
12
|
+
}, B = 4, V = (e) => {
|
|
13
|
+
let t = w(null), [n, r] = T(0);
|
|
14
|
+
return x(() => {
|
|
14
15
|
if (!e) return;
|
|
15
16
|
let n = t.current;
|
|
16
17
|
if (n == null) return;
|
|
@@ -21,324 +22,457 @@ var I = {
|
|
|
21
22
|
return i.observe(n), () => i.disconnect();
|
|
22
23
|
}, [e]), {
|
|
23
24
|
slotRef: t,
|
|
24
|
-
firstLineIndent: e ? `calc(${n}px + ${
|
|
25
|
+
firstLineIndent: e ? `calc(${n}px + ${B}px)` : void 0
|
|
25
26
|
};
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
}, H = [
|
|
28
|
+
"href",
|
|
29
|
+
"src",
|
|
30
|
+
"alt",
|
|
31
|
+
"colspan",
|
|
32
|
+
"rowspan",
|
|
33
|
+
"start"
|
|
34
|
+
], U = new Set([
|
|
35
|
+
"pre",
|
|
36
|
+
"pre-wrap",
|
|
37
|
+
"pre-line",
|
|
38
|
+
"break-spaces"
|
|
39
|
+
]), W = (e) => {
|
|
40
|
+
let t = document.createElement(e.tagName.toLowerCase());
|
|
41
|
+
H.forEach((n) => {
|
|
42
|
+
let r = e.getAttribute(n);
|
|
43
|
+
r !== null && t.setAttribute(n, r);
|
|
44
|
+
});
|
|
45
|
+
let { whiteSpace: n } = window.getComputedStyle(e);
|
|
46
|
+
return U.has(n) && (t.style.whiteSpace = "pre-wrap"), t;
|
|
47
|
+
}, G = (e) => e instanceof SVGElement || window.getComputedStyle(e).display === "none", K = (e, t) => {
|
|
48
|
+
if (!t.intersectsNode(e)) return null;
|
|
49
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
50
|
+
let n = e.data, r = e === t.startContainer ? t.startOffset : 0, i = e === t.endContainer ? t.endOffset : n.length;
|
|
51
|
+
return document.createTextNode(n.slice(r, i));
|
|
52
|
+
}
|
|
53
|
+
if (!(e instanceof Element) || G(e)) return null;
|
|
54
|
+
let n = W(e);
|
|
55
|
+
return e.childNodes.forEach((e) => {
|
|
56
|
+
let r = K(e, t);
|
|
57
|
+
r && n.appendChild(r);
|
|
58
|
+
}), n;
|
|
59
|
+
}, re = (e, t, n) => {
|
|
60
|
+
let r = e, i = t;
|
|
61
|
+
for (; i && i !== n && n.contains(i);) {
|
|
62
|
+
let e = W(i);
|
|
63
|
+
e.appendChild(r), r = e, i = i.parentElement;
|
|
64
|
+
}
|
|
65
|
+
return r;
|
|
66
|
+
}, ie = (e, t) => {
|
|
67
|
+
let n = e.commonAncestorContainer, r = n instanceof Element ? n : n.parentElement;
|
|
68
|
+
if (!r) return null;
|
|
69
|
+
let i = K(r, e);
|
|
70
|
+
return i ? re(i, r.parentElement, t) : null;
|
|
71
|
+
}, ae = (e) => {
|
|
72
|
+
let t = window.getSelection();
|
|
73
|
+
if (!t || t.isCollapsed || t.rangeCount === 0 || !e.clipboardData) return;
|
|
74
|
+
let n = t.toString();
|
|
75
|
+
if (!n) return;
|
|
76
|
+
let r = document.createElement("div");
|
|
77
|
+
for (let n = 0; n < t.rangeCount; n++) {
|
|
78
|
+
let i = ie(t.getRangeAt(n), e.currentTarget);
|
|
79
|
+
i && r.appendChild(i);
|
|
80
|
+
}
|
|
81
|
+
e.clipboardData.setData("text/html", r.innerHTML), e.clipboardData.setData("text/plain", n), e.preventDefault();
|
|
82
|
+
}, q = { activeRating: "_activeRating_ygoee_1" }, J = 2e3, oe = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: o, onRegenerate: l, onCopy: u, onCopyMarkdown: d, onLike: f, onDislike: _, activeRating: v, isAlwaysVisible: y, isDisabled: x = !1, className: S, labels: C, colors: ee }) => {
|
|
83
|
+
let { tooltips: w, ariaLabels: E } = C ?? {}, [D, O] = T(null), [R, z] = T(""), B = n != null || o != null || l != null || u != null || d != null || f != null || _ != null, V = s({ "--ma-active-rating-text": ee?.activeRatingText }), H = b(() => {
|
|
84
|
+
u?.(), O("copy"), z(e === a.User ? E?.copiedMessageStatus ?? "Message copied to clipboard" : E?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => O(null), J);
|
|
85
|
+
}, [
|
|
86
|
+
u,
|
|
87
|
+
e,
|
|
88
|
+
E?.copiedStatus,
|
|
89
|
+
E?.copiedMessageStatus
|
|
90
|
+
]), U = b(() => {
|
|
91
|
+
d?.(), O("markdown"), z(E?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => O(null), J);
|
|
92
|
+
}, [d, E?.copiedMarkdownStatus]);
|
|
93
|
+
return B ? /* @__PURE__ */ L("div", {
|
|
33
94
|
role: "toolbar",
|
|
34
|
-
"aria-label":
|
|
35
|
-
style:
|
|
36
|
-
className:
|
|
37
|
-
children: [/* @__PURE__ */
|
|
95
|
+
"aria-label": E?.actionsGroup ?? "Message actions",
|
|
96
|
+
style: V,
|
|
97
|
+
className: c("flex gap-1", !y && "opacity-0 group-hover:opacity-100", S),
|
|
98
|
+
children: [/* @__PURE__ */ I("span", {
|
|
38
99
|
role: "status",
|
|
39
100
|
"aria-live": "polite",
|
|
40
101
|
className: "sr-only",
|
|
41
|
-
children:
|
|
42
|
-
}), e === a.User ? /* @__PURE__ */ F
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
102
|
+
children: R
|
|
103
|
+
}), e === a.User ? /* @__PURE__ */ L(F, { children: [
|
|
104
|
+
u && /* @__PURE__ */ I(t, {
|
|
105
|
+
iconSize: p.SM,
|
|
106
|
+
onClick: H,
|
|
107
|
+
size: h.Small,
|
|
108
|
+
isCopied: D === "copy",
|
|
109
|
+
copyLabel: w?.copyMessage ?? "Copy message",
|
|
110
|
+
copiedLabel: w?.copied ?? "Copied!",
|
|
111
|
+
ariaLabel: E?.copyMessage ?? "Copy message",
|
|
112
|
+
isDisabled: x
|
|
47
113
|
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
114
|
+
n && /* @__PURE__ */ I(g, {
|
|
115
|
+
icon: /* @__PURE__ */ I(A, {
|
|
116
|
+
size: p.SM,
|
|
117
|
+
"aria-hidden": !0,
|
|
118
|
+
stroke: m
|
|
119
|
+
}),
|
|
120
|
+
size: h.Small,
|
|
121
|
+
"aria-label": E?.editMessage ?? "Edit message",
|
|
122
|
+
tooltipProps: { tooltip: w?.edit ?? "Edit" },
|
|
123
|
+
onClick: n,
|
|
124
|
+
onMouseEnter: r,
|
|
125
|
+
onFocus: r,
|
|
126
|
+
disabled: x
|
|
60
127
|
}),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
128
|
+
o && /* @__PURE__ */ I(g, {
|
|
129
|
+
icon: /* @__PURE__ */ I(ne, {
|
|
130
|
+
size: p.SM,
|
|
131
|
+
"aria-hidden": !0,
|
|
132
|
+
stroke: m
|
|
133
|
+
}),
|
|
134
|
+
size: h.Small,
|
|
135
|
+
"aria-label": E?.deleteMessage ?? "Delete message",
|
|
136
|
+
tooltipProps: { tooltip: w?.delete ?? "Delete" },
|
|
137
|
+
onClick: o,
|
|
138
|
+
disabled: x
|
|
139
|
+
})
|
|
140
|
+
] }) : /* @__PURE__ */ L(F, { children: [
|
|
141
|
+
l && /* @__PURE__ */ I(g, {
|
|
142
|
+
icon: /* @__PURE__ */ I(j, {
|
|
143
|
+
size: p.SM,
|
|
70
144
|
"aria-hidden": !0,
|
|
71
|
-
stroke:
|
|
145
|
+
stroke: m
|
|
72
146
|
}),
|
|
73
|
-
size:
|
|
74
|
-
"aria-label":
|
|
75
|
-
tooltipProps: { tooltip:
|
|
147
|
+
size: h.Small,
|
|
148
|
+
"aria-label": E?.regenerateResponse ?? "Regenerate response",
|
|
149
|
+
tooltipProps: { tooltip: w?.regenerate ?? "Regenerate" },
|
|
76
150
|
onClick: l,
|
|
77
151
|
disabled: x
|
|
78
152
|
}),
|
|
79
|
-
|
|
80
|
-
iconSize:
|
|
81
|
-
onClick:
|
|
82
|
-
size:
|
|
83
|
-
isCopied:
|
|
84
|
-
copyLabel:
|
|
85
|
-
copiedLabel:
|
|
86
|
-
ariaLabel:
|
|
153
|
+
u && /* @__PURE__ */ I(t, {
|
|
154
|
+
iconSize: p.SM,
|
|
155
|
+
onClick: H,
|
|
156
|
+
size: h.Small,
|
|
157
|
+
isCopied: D === "copy",
|
|
158
|
+
copyLabel: w?.copy ?? "Copy",
|
|
159
|
+
copiedLabel: w?.copied ?? "Copied!",
|
|
160
|
+
ariaLabel: E?.copyResponse ?? "Copy response",
|
|
87
161
|
isDisabled: x
|
|
88
162
|
}),
|
|
89
|
-
|
|
90
|
-
iconSize:
|
|
91
|
-
onClick:
|
|
92
|
-
size:
|
|
93
|
-
isCopied:
|
|
94
|
-
iconCopy: /* @__PURE__ */
|
|
95
|
-
size:
|
|
163
|
+
d && /* @__PURE__ */ I(t, {
|
|
164
|
+
iconSize: p.SM,
|
|
165
|
+
onClick: U,
|
|
166
|
+
size: h.Small,
|
|
167
|
+
isCopied: D === "markdown",
|
|
168
|
+
iconCopy: /* @__PURE__ */ I(k, {
|
|
169
|
+
size: p.SM,
|
|
96
170
|
"aria-hidden": !0,
|
|
97
|
-
stroke:
|
|
171
|
+
stroke: m
|
|
98
172
|
}),
|
|
99
|
-
copyLabel:
|
|
100
|
-
copiedLabel:
|
|
101
|
-
ariaLabel:
|
|
173
|
+
copyLabel: w?.copyMarkdown ?? "Copy as Markdown",
|
|
174
|
+
copiedLabel: w?.copiedMarkdown ?? "Copied!",
|
|
175
|
+
ariaLabel: E?.copyAsMarkdown ?? "Copy as markdown",
|
|
102
176
|
isDisabled: x
|
|
103
177
|
}),
|
|
104
|
-
|
|
105
|
-
icon:
|
|
106
|
-
className:
|
|
107
|
-
size:
|
|
178
|
+
f && /* @__PURE__ */ I(g, {
|
|
179
|
+
icon: v === i.Like ? /* @__PURE__ */ I(te, {
|
|
180
|
+
className: q.activeRating,
|
|
181
|
+
size: p.SM,
|
|
108
182
|
"aria-hidden": !0
|
|
109
|
-
}) : /* @__PURE__ */ P
|
|
110
|
-
size:
|
|
183
|
+
}) : /* @__PURE__ */ I(P, {
|
|
184
|
+
size: p.SM,
|
|
111
185
|
"aria-hidden": !0,
|
|
112
|
-
stroke:
|
|
186
|
+
stroke: m
|
|
113
187
|
}),
|
|
114
|
-
size:
|
|
115
|
-
"aria-label":
|
|
116
|
-
"aria-pressed":
|
|
117
|
-
tooltipProps: { tooltip:
|
|
118
|
-
onClick:
|
|
188
|
+
size: h.Small,
|
|
189
|
+
"aria-label": E?.likeResponse ?? "Like response",
|
|
190
|
+
"aria-pressed": v === i.Like,
|
|
191
|
+
tooltipProps: { tooltip: w?.like ?? "Like" },
|
|
192
|
+
onClick: f,
|
|
119
193
|
disabled: x
|
|
120
194
|
}),
|
|
121
|
-
|
|
122
|
-
icon:
|
|
123
|
-
className:
|
|
124
|
-
size:
|
|
195
|
+
_ && /* @__PURE__ */ I(g, {
|
|
196
|
+
icon: v === i.Dislike ? /* @__PURE__ */ I(N, {
|
|
197
|
+
className: q.activeRating,
|
|
198
|
+
size: p.SM,
|
|
125
199
|
"aria-hidden": !0
|
|
126
|
-
}) : /* @__PURE__ */
|
|
127
|
-
size:
|
|
200
|
+
}) : /* @__PURE__ */ I(M, {
|
|
201
|
+
size: p.SM,
|
|
128
202
|
"aria-hidden": !0,
|
|
129
|
-
stroke:
|
|
203
|
+
stroke: m
|
|
130
204
|
}),
|
|
131
|
-
size:
|
|
132
|
-
"aria-label":
|
|
133
|
-
"aria-pressed":
|
|
134
|
-
tooltipProps: { tooltip:
|
|
135
|
-
onClick:
|
|
205
|
+
size: h.Small,
|
|
206
|
+
"aria-label": E?.dislikeResponse ?? "Dislike response",
|
|
207
|
+
"aria-pressed": v === i.Dislike,
|
|
208
|
+
tooltipProps: { tooltip: w?.dislike ?? "Dislike" },
|
|
209
|
+
onClick: _,
|
|
136
210
|
disabled: x
|
|
137
211
|
})
|
|
138
212
|
] })]
|
|
139
213
|
}) : null;
|
|
140
|
-
},
|
|
214
|
+
}, Y = {
|
|
141
215
|
userBubble: "_userBubble_cq829_1",
|
|
142
216
|
collapsibleText: "_collapsibleText_cq829_6",
|
|
143
217
|
expandedText: "_expandedText_cq829_11",
|
|
144
218
|
collapsedText: "_collapsedText_cq829_15",
|
|
145
219
|
startersDivider: "_startersDivider_cq829_26",
|
|
146
220
|
text: "_text_cq829_30"
|
|
147
|
-
},
|
|
148
|
-
let { colors:
|
|
149
|
-
copyLabel:
|
|
150
|
-
copiedLabel:
|
|
151
|
-
downloadCsvLabel:
|
|
152
|
-
openInCanvasLabel:
|
|
221
|
+
}, se = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", X = ({ text: t, contentRef: i, styles: l, actions: d, hasAlwaysVisibleActions: f, isStreaming: p, attachments: m, beforeContent: h, responseFormat: g, afterContent: _, hasThinkingPlaceholder: v = !0, starters: b, onSelectStarter: x, deploymentIconUrl: S, deploymentDisplayName: C, markdownComponents: w, markdownClassNames: T, markdownUrlTransform: E, onAttachmentClick: D, onDownloadAll: O, onAttachmentRetry: k, codeBlockTheme: A, tableOnOpenInCanvas: j, labels: M, selectedAttachmentId: N }) => {
|
|
222
|
+
let { colors: P, typography: te, className: ne, bubbleClassName: F } = l ?? {}, { attachmentClickLabel: R, attachmentDownloadLabel: B, attachmentRetryLabel: H, attachmentOpenInNewTabLabel: U, startersAriaLabel: W = "Quick reply buttons", thinkingLabel: G, codeBlockCopyLabel: K, codeBlockCopiedLabel: re, codeBlockDownloadLabel: ie, tableCopyLabel: q, tableCopiedLabel: J, tableDownloadCsvLabel: X, tableOpenInCanvasLabel: Z, tableDownloadFilename: Q, tableScrollRegionAriaLabel: ce, mathScrollRegionAriaLabel: $, assistantMessageAriaLabel: le = "Assistant message", deploymentIconFallbackLabel: ue = "AI" } = M ?? {}, de = ee(() => ({
|
|
223
|
+
copyLabel: q,
|
|
224
|
+
copiedLabel: J,
|
|
225
|
+
downloadCsvLabel: X,
|
|
226
|
+
openInCanvasLabel: Z
|
|
153
227
|
}), [
|
|
154
|
-
|
|
228
|
+
q,
|
|
229
|
+
J,
|
|
155
230
|
X,
|
|
156
|
-
Z
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"--cm-
|
|
160
|
-
"--cm-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return /* @__PURE__ */ F("div", {
|
|
231
|
+
Z
|
|
232
|
+
]), fe = p ? (m ?? []).filter((t) => t.type !== e.Audio) : m ?? [], { slotRef: pe, firstLineIndent: me } = V(h != null && !!t), he = s({
|
|
233
|
+
"--cm-bubble-text": P?.text,
|
|
234
|
+
"--cm-starters-divider": P?.startersDivider,
|
|
235
|
+
"--cm-bubble-first-line-indent": me
|
|
236
|
+
}), ge = c(Y.text, te?.fontClassName), _e = !!(S || C);
|
|
237
|
+
return /* @__PURE__ */ L("div", {
|
|
164
238
|
role: "group",
|
|
165
|
-
"aria-label":
|
|
166
|
-
style:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
239
|
+
"aria-label": le,
|
|
240
|
+
style: he,
|
|
241
|
+
onCopy: ae,
|
|
242
|
+
className: c("flex w-full items-start gap-3", ne),
|
|
243
|
+
children: [_e && /* @__PURE__ */ I(n, {
|
|
244
|
+
src: S,
|
|
170
245
|
size: 28,
|
|
171
|
-
initialsName:
|
|
172
|
-
labels: { tooltip:
|
|
173
|
-
}), /* @__PURE__ */
|
|
246
|
+
initialsName: C || ue,
|
|
247
|
+
labels: { tooltip: C ?? ue }
|
|
248
|
+
}), /* @__PURE__ */ L("div", {
|
|
174
249
|
className: "flex w-full min-w-0 max-w-full flex-col items-start gap-5",
|
|
175
|
-
children: [/* @__PURE__ */
|
|
176
|
-
className:
|
|
250
|
+
children: [/* @__PURE__ */ L("div", {
|
|
251
|
+
className: c("flex w-full min-w-0 max-w-full flex-col items-start gap-4", F),
|
|
177
252
|
children: [
|
|
178
|
-
|
|
253
|
+
h != null && !t && /* @__PURE__ */ I("div", {
|
|
179
254
|
className: "min-w-0",
|
|
180
|
-
children:
|
|
255
|
+
children: h
|
|
181
256
|
}),
|
|
182
|
-
(t ||
|
|
257
|
+
(t || p && v) && /* @__PURE__ */ L("div", {
|
|
183
258
|
"aria-live": "polite",
|
|
184
259
|
"aria-atomic": "false",
|
|
185
|
-
className:
|
|
186
|
-
children: [
|
|
187
|
-
ref:
|
|
260
|
+
className: c(ge, "relative min-w-0 max-w-full text-start", h != null && t && se, z.assistantContent),
|
|
261
|
+
children: [h != null && t && /* @__PURE__ */ I("div", {
|
|
262
|
+
ref: pe,
|
|
188
263
|
className: "absolute start-0 top-0",
|
|
189
|
-
children:
|
|
190
|
-
}), /* @__PURE__ */
|
|
264
|
+
children: h
|
|
265
|
+
}), /* @__PURE__ */ I("div", {
|
|
266
|
+
ref: i,
|
|
191
267
|
className: "cm-bubble-markdown min-w-0 max-w-full",
|
|
192
|
-
children: /* @__PURE__ */
|
|
268
|
+
children: /* @__PURE__ */ I(r, {
|
|
193
269
|
content: t ?? "",
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
270
|
+
isPlainText: g === o.PlainText,
|
|
271
|
+
isStreaming: p,
|
|
272
|
+
thinkingLabel: G,
|
|
273
|
+
components: w,
|
|
274
|
+
classNames: T,
|
|
275
|
+
urlTransform: E,
|
|
276
|
+
codeBlockCopyLabel: K,
|
|
277
|
+
codeBlockCopiedLabel: re,
|
|
278
|
+
codeBlockDownloadLabel: ie,
|
|
279
|
+
codeBlockTheme: A,
|
|
280
|
+
tableActionLabels: de,
|
|
281
|
+
tableDownloadFilename: Q,
|
|
282
|
+
tableOnOpenInCanvas: j,
|
|
283
|
+
tableScrollRegionAriaLabel: ce,
|
|
284
|
+
mathScrollRegionAriaLabel: $
|
|
206
285
|
})
|
|
207
286
|
})]
|
|
208
287
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
attachments:
|
|
211
|
-
onAttachmentClick:
|
|
212
|
-
|
|
213
|
-
|
|
288
|
+
/* @__PURE__ */ I(u, {
|
|
289
|
+
attachments: fe,
|
|
290
|
+
onAttachmentClick: D ? (e) => {
|
|
291
|
+
let t = m?.find((t) => t.id === e);
|
|
292
|
+
t && D(t);
|
|
293
|
+
} : void 0,
|
|
294
|
+
onDownloadAll: O,
|
|
295
|
+
onRetry: k,
|
|
214
296
|
labels: {
|
|
215
|
-
clickLabel:
|
|
216
|
-
|
|
217
|
-
|
|
297
|
+
clickLabel: R,
|
|
298
|
+
downloadLabel: B,
|
|
299
|
+
retryLabel: H,
|
|
300
|
+
openInNewTabLabel: U
|
|
218
301
|
},
|
|
219
|
-
selectedAttachmentId:
|
|
302
|
+
selectedAttachmentId: N
|
|
220
303
|
}),
|
|
221
|
-
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
...
|
|
224
|
-
isAlwaysVisible:
|
|
304
|
+
_,
|
|
305
|
+
/* @__PURE__ */ I(oe, {
|
|
306
|
+
...d,
|
|
307
|
+
isAlwaysVisible: f,
|
|
225
308
|
role: a.Assistant
|
|
226
309
|
})
|
|
227
310
|
]
|
|
228
|
-
}),
|
|
311
|
+
}), b && b.length > 0 && x && /* @__PURE__ */ I("div", {
|
|
229
312
|
role: "list",
|
|
230
|
-
"aria-label":
|
|
231
|
-
className:
|
|
232
|
-
children:
|
|
313
|
+
"aria-label": W,
|
|
314
|
+
className: c("flex w-full flex-wrap gap-2 border-t pt-5", Y.startersDivider),
|
|
315
|
+
children: b.map((e, t) => /* @__PURE__ */ I("div", {
|
|
233
316
|
role: "listitem",
|
|
234
317
|
className: "min-w-[40px]",
|
|
235
|
-
children: /* @__PURE__ */
|
|
318
|
+
children: /* @__PURE__ */ I(y, {
|
|
236
319
|
label: e.title,
|
|
237
320
|
className: "min-w-[40px]",
|
|
238
|
-
onClick: () =>
|
|
321
|
+
onClick: () => x(e)
|
|
239
322
|
})
|
|
240
323
|
}, t))
|
|
241
324
|
})]
|
|
242
325
|
})]
|
|
243
326
|
});
|
|
244
|
-
},
|
|
327
|
+
}, Z = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ I("div", {
|
|
245
328
|
role: "status",
|
|
246
329
|
"aria-live": "polite",
|
|
247
|
-
children: /* @__PURE__ */
|
|
330
|
+
children: /* @__PURE__ */ I(_, {
|
|
248
331
|
title: e,
|
|
249
332
|
message: t,
|
|
250
333
|
textClassName: "flex-row flex-wrap gap-1"
|
|
251
334
|
})
|
|
252
|
-
}),
|
|
335
|
+
}), Q = /* @__PURE__ */ function(e) {
|
|
253
336
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
254
|
-
}({}),
|
|
255
|
-
let { colors:
|
|
337
|
+
}({}), ce = 10, $ = ({ text: e, contentRef: t, position: n = Q.Bottom, styles: r, actions: i, hasAlwaysVisibleActions: o, attachments: d, collapsedLineCount: f = ce, labels: m, textSegments: g, onAttachmentClick: _, onDownloadAll: y, onAttachmentRetry: b, selectedAttachmentId: x }) => {
|
|
338
|
+
let { colors: C, typography: ee, className: w, bubbleClassName: T } = r ?? {}, { showMoreLabel: E = "Show more", showLessLabel: k = "Show less", showMoreAriaLabel: A, showLessAriaLabel: j, attachmentClickLabel: M, attachmentDownloadLabel: N, attachmentRetryLabel: P, attachmentOpenInNewTabLabel: te, userMessageAriaLabel: ne = "User message" } = m ?? {}, { textRef: R, isTextCollapsed: B, isOverflowing: V, collapsedMaxHeight: H, expandedMaxHeight: U, isCollapsed: W, toggleCollapsed: G } = l({
|
|
256
339
|
text: e ?? "",
|
|
257
|
-
collapsedLineCount:
|
|
258
|
-
}),
|
|
259
|
-
"--cm-bubble-user-bg":
|
|
260
|
-
"--cm-bubble-user-border":
|
|
261
|
-
"--cm-bubble-fade-start":
|
|
262
|
-
"--cm-bubble-text":
|
|
263
|
-
"--cm-bubble-collapsed-height":
|
|
264
|
-
"--cm-bubble-expanded-height":
|
|
265
|
-
}),
|
|
266
|
-
return /* @__PURE__ */
|
|
340
|
+
collapsedLineCount: f
|
|
341
|
+
}), K = s({
|
|
342
|
+
"--cm-bubble-user-bg": C?.userBackground,
|
|
343
|
+
"--cm-bubble-user-border": C?.userBorder,
|
|
344
|
+
"--cm-bubble-fade-start": C?.fadeStart,
|
|
345
|
+
"--cm-bubble-text": C?.text,
|
|
346
|
+
"--cm-bubble-collapsed-height": V ? `${H}px` : void 0,
|
|
347
|
+
"--cm-bubble-expanded-height": V ? `${U}px` : void 0
|
|
348
|
+
}), re = n === Q.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", ie = c(Y.text, ee?.fontClassName), q = A ?? E, J = j ?? k, se = W ? E : k, X = W ? q : J, Z = W ? D : O, $ = S();
|
|
349
|
+
return /* @__PURE__ */ I("div", {
|
|
267
350
|
role: "group",
|
|
268
|
-
"aria-label":
|
|
269
|
-
style:
|
|
270
|
-
|
|
271
|
-
|
|
351
|
+
"aria-label": ne,
|
|
352
|
+
style: K,
|
|
353
|
+
onCopy: ae,
|
|
354
|
+
className: c("flex w-full", w),
|
|
355
|
+
children: /* @__PURE__ */ L("div", {
|
|
272
356
|
className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
|
|
273
357
|
children: [
|
|
274
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ I(u, {
|
|
275
359
|
attachments: d ?? [],
|
|
276
|
-
onAttachmentClick:
|
|
277
|
-
|
|
360
|
+
onAttachmentClick: _ ? (e) => {
|
|
361
|
+
let t = d?.find((t) => t.id === e);
|
|
362
|
+
t && _(t);
|
|
363
|
+
} : void 0,
|
|
364
|
+
onDownloadAll: y,
|
|
278
365
|
onRetry: b,
|
|
279
366
|
labels: {
|
|
280
367
|
clickLabel: M,
|
|
281
|
-
|
|
282
|
-
|
|
368
|
+
downloadLabel: N,
|
|
369
|
+
retryLabel: P,
|
|
370
|
+
openInNewTabLabel: te
|
|
283
371
|
},
|
|
284
372
|
styles: { className: "max-w-[640px]" },
|
|
285
373
|
selectedAttachmentId: x
|
|
286
374
|
}),
|
|
287
|
-
|
|
288
|
-
className:
|
|
289
|
-
children: /* @__PURE__ */
|
|
375
|
+
e && /* @__PURE__ */ I("div", {
|
|
376
|
+
className: c(Y.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", re, T, z.userBubble),
|
|
377
|
+
children: /* @__PURE__ */ L("div", {
|
|
290
378
|
className: "flex min-w-0 flex-col items-start",
|
|
291
|
-
children: [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
className: "me-1",
|
|
300
|
-
children: g
|
|
301
|
-
}), e]
|
|
302
|
-
})
|
|
303
|
-
}),
|
|
304
|
-
g != null && !e && /* @__PURE__ */ P("div", { children: g }),
|
|
305
|
-
W && /* @__PURE__ */ P(m, {
|
|
306
|
-
label: /* @__PURE__ */ P(N, { children: $ }),
|
|
307
|
-
iconBefore: /* @__PURE__ */ P(ie, {
|
|
308
|
-
size: u.SM,
|
|
309
|
-
"aria-hidden": "true"
|
|
310
|
-
}),
|
|
311
|
-
"aria-label": re,
|
|
312
|
-
"aria-expanded": !Y,
|
|
313
|
-
"aria-controls": ae,
|
|
314
|
-
className: "mt-3",
|
|
315
|
-
onClick: X,
|
|
316
|
-
size: f.Small
|
|
379
|
+
children: [/* @__PURE__ */ I("div", {
|
|
380
|
+
id: $,
|
|
381
|
+
ref: t,
|
|
382
|
+
className: c("relative -me-1 -ms-1 w-[calc(100%+8px)] overflow-hidden pe-1 ps-1", V && Y.collapsibleText, V && !W && Y.expandedText, B && Y.collapsedText),
|
|
383
|
+
children: /* @__PURE__ */ I("p", {
|
|
384
|
+
ref: R,
|
|
385
|
+
className: c(ie, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
|
|
386
|
+
children: g ?? e
|
|
317
387
|
})
|
|
318
|
-
|
|
388
|
+
}), V && /* @__PURE__ */ I(v, {
|
|
389
|
+
label: /* @__PURE__ */ I(F, { children: se }),
|
|
390
|
+
iconBefore: /* @__PURE__ */ I(Z, {
|
|
391
|
+
size: p.SM,
|
|
392
|
+
"aria-hidden": "true"
|
|
393
|
+
}),
|
|
394
|
+
"aria-label": X,
|
|
395
|
+
"aria-expanded": !W,
|
|
396
|
+
"aria-controls": $,
|
|
397
|
+
className: "mt-3",
|
|
398
|
+
onClick: G,
|
|
399
|
+
size: h.Small
|
|
400
|
+
})]
|
|
319
401
|
})
|
|
320
402
|
}),
|
|
321
|
-
/* @__PURE__ */
|
|
322
|
-
...
|
|
323
|
-
isAlwaysVisible:
|
|
403
|
+
/* @__PURE__ */ I(oe, {
|
|
404
|
+
...i,
|
|
405
|
+
isAlwaysVisible: o,
|
|
324
406
|
role: a.User
|
|
325
407
|
})
|
|
326
408
|
]
|
|
327
409
|
})
|
|
328
410
|
});
|
|
329
|
-
},
|
|
330
|
-
titleText:
|
|
331
|
-
bodyText:
|
|
332
|
-
} }) : e === a.User ? /* @__PURE__ */
|
|
333
|
-
...
|
|
334
|
-
|
|
335
|
-
onAttachmentClick:
|
|
336
|
-
}) : /* @__PURE__ */
|
|
337
|
-
...
|
|
411
|
+
}, le = ({ role: e, beforeContent: t, textSegments: n, onAttachmentClick: r, responseFormat: i, markdownComponents: o, markdownUrlTransform: s, ...c }) => e === a.Status ? /* @__PURE__ */ I(Z, { labels: {
|
|
412
|
+
titleText: c.labels?.statusTitleText,
|
|
413
|
+
bodyText: c.labels?.statusBodyText ?? ""
|
|
414
|
+
} }) : e === a.User ? /* @__PURE__ */ I($, {
|
|
415
|
+
...c,
|
|
416
|
+
textSegments: n,
|
|
417
|
+
onAttachmentClick: r
|
|
418
|
+
}) : /* @__PURE__ */ I(X, {
|
|
419
|
+
...c,
|
|
338
420
|
beforeContent: t,
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
421
|
+
responseFormat: i,
|
|
422
|
+
markdownComponents: o,
|
|
423
|
+
markdownUrlTransform: s,
|
|
424
|
+
onAttachmentClick: r
|
|
425
|
+
}), ue = { button: "_button_tqo4d_3" }, de = ({ rect: e, actionRef: t, onReply: n, addedRevision: r, labels: i, styles: a, portalContainer: o }) => {
|
|
426
|
+
let { colors: l, typography: u, className: p, buttonClassName: g } = a ?? {}, _ = u?.fontClassName ?? "dial-small-text", v = o === void 0 ? typeof document > "u" ? null : document.body : o, y = s({
|
|
427
|
+
"--cm-reply-background": l?.background,
|
|
428
|
+
"--cm-reply-hover-background": l?.hoverBackground,
|
|
429
|
+
"--cm-reply-text": l?.text
|
|
430
|
+
}), [b, x] = T({
|
|
431
|
+
x: 0,
|
|
432
|
+
y: 0
|
|
433
|
+
});
|
|
434
|
+
return C(() => {
|
|
435
|
+
if (!e || !t.current) return;
|
|
436
|
+
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;
|
|
437
|
+
x({
|
|
438
|
+
x: Math.max(i + 8, Math.min(e.left, i + o - n.width - 8)),
|
|
439
|
+
y: Math.max(a + 8, Math.min(c, a + s - n.height - 8))
|
|
440
|
+
});
|
|
441
|
+
}, [
|
|
442
|
+
e,
|
|
443
|
+
t,
|
|
444
|
+
v,
|
|
445
|
+
p,
|
|
446
|
+
g,
|
|
447
|
+
_,
|
|
448
|
+
i.reply
|
|
449
|
+
]), v ? R(/* @__PURE__ */ L(F, { children: [e && /* @__PURE__ */ I("div", {
|
|
450
|
+
ref: t,
|
|
451
|
+
className: c("fixed left-0 top-0 z-50 max-w-[calc(100vw-16px)]", p),
|
|
452
|
+
style: {
|
|
453
|
+
...y,
|
|
454
|
+
transform: `translate(${b.x}px, ${b.y}px)`
|
|
455
|
+
},
|
|
456
|
+
children: /* @__PURE__ */ I(d, {
|
|
457
|
+
variant: f.Neutral,
|
|
458
|
+
size: h.Small,
|
|
459
|
+
label: i.reply,
|
|
460
|
+
onClick: n,
|
|
461
|
+
textClassName: _,
|
|
462
|
+
className: c(ue.button, "h-8 min-h-8 min-w-11 px-2 shadow-lg mobile:h-11 mobile:min-h-11", g),
|
|
463
|
+
iconAfter: /* @__PURE__ */ I(E, {
|
|
464
|
+
size: 16,
|
|
465
|
+
stroke: m,
|
|
466
|
+
"aria-hidden": "true",
|
|
467
|
+
className: "rtl:scale-x-[-1]"
|
|
468
|
+
})
|
|
469
|
+
})
|
|
470
|
+
}), /* @__PURE__ */ I("div", {
|
|
471
|
+
role: "status",
|
|
472
|
+
"aria-live": "polite",
|
|
473
|
+
className: "sr-only",
|
|
474
|
+
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */ I("span", { children: i.attachmentAdded }, r) : null
|
|
475
|
+
})] }), v) : null;
|
|
476
|
+
};
|
|
343
477
|
//#endregion
|
|
344
|
-
export {
|
|
478
|
+
export { X as AssistantMessageBubble, Q as BubblePosition, z as CONVERSATION_MESSAGES_CLASS, oe as MessageActions, le as MessageBubble, de as MessageSelectionReply, Z as StatusMessageBubble, $ as UserMessageBubble };
|
|
@@ -7,8 +7,10 @@ export interface MessageActionTooltips {
|
|
|
7
7
|
delete?: string;
|
|
8
8
|
/** Tooltip for the Regenerate button. */
|
|
9
9
|
regenerate?: string;
|
|
10
|
-
/** Tooltip for the Copy button in its default state. */
|
|
10
|
+
/** Tooltip for the assistant Copy button in its default state. */
|
|
11
11
|
copy?: string;
|
|
12
|
+
/** Tooltip for the user-message Copy button in its default state. */
|
|
13
|
+
copyMessage?: string;
|
|
12
14
|
/** Tooltip shown on the Copy button immediately after copying. */
|
|
13
15
|
copied?: string;
|
|
14
16
|
/** Tooltip for the Copy as Markdown button in its default state. */
|
|
@@ -28,8 +30,10 @@ export interface MessageActionAriaLabels {
|
|
|
28
30
|
deleteMessage?: string;
|
|
29
31
|
/** aria-label for the Regenerate button. */
|
|
30
32
|
regenerateResponse?: string;
|
|
31
|
-
/** aria-label for the Copy button. */
|
|
33
|
+
/** aria-label for the assistant Copy button. */
|
|
32
34
|
copyResponse?: string;
|
|
35
|
+
/** aria-label for the user-message Copy button. */
|
|
36
|
+
copyMessage?: string;
|
|
33
37
|
/** aria-label for the Copy as Markdown button. */
|
|
34
38
|
copyAsMarkdown?: string;
|
|
35
39
|
/** aria-label for the Like button. */
|
|
@@ -40,6 +44,8 @@ export interface MessageActionAriaLabels {
|
|
|
40
44
|
actionsGroup?: string;
|
|
41
45
|
/** Announced after copying the response text. */
|
|
42
46
|
copiedStatus?: string;
|
|
47
|
+
/** Announced after copying a user message. */
|
|
48
|
+
copiedMessageStatus?: string;
|
|
43
49
|
/** Announced after copying the response as Markdown. */
|
|
44
50
|
copiedMarkdownStatus?: string;
|
|
45
51
|
}
|
|
@@ -57,7 +63,7 @@ export interface MessageActionColors {
|
|
|
57
63
|
}
|
|
58
64
|
/** Props for the `MessageActions` component. */
|
|
59
65
|
export interface MessageActionsProps {
|
|
60
|
-
/** Which actions are shown. `'User'` = Edit/Delete; `'Agent'` = Regenerate/Copy/Like/Dislike. Defaults to `'User'`. */
|
|
66
|
+
/** Which actions are shown. `'User'` = Copy/Edit/Delete; `'Agent'` = Regenerate/Copy/Like/Dislike. Defaults to `'User'`. */
|
|
61
67
|
role?: MessageRole;
|
|
62
68
|
/** Extra class(es) on the root element. */
|
|
63
69
|
className?: string;
|
|
@@ -75,7 +81,7 @@ export interface MessageActionsProps {
|
|
|
75
81
|
onDelete?: () => void;
|
|
76
82
|
/** Fires on Regenerate click. Agent role only. */
|
|
77
83
|
onRegenerate?: () => void;
|
|
78
|
-
/** Fires on Copy click.
|
|
84
|
+
/** Fires on Copy click. Both roles; the label set depends on `role`. */
|
|
79
85
|
onCopy?: () => void;
|
|
80
86
|
/** Fires on Copy Markdown click. Agent role only. */
|
|
81
87
|
onCopyMarkdown?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-actions.d.ts","sourceRoot":"","sources":["../../src/models/message-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"message-actions.d.ts","sourceRoot":"","sources":["../../src/models/message-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,C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tC;AAED,uGAAuG;AACvG,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,4HAA4H;IAC5H,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wEAAwE;IACxE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,uBAAuB;IACvB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBlockTheme, DisplayAttachment, MarkdownRendererClassNames, MessageRole, StarterOption } from '@epam/ai-dial-chat-shared';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { CodeBlockTheme, DisplayAttachment, MarkdownRendererClassNames, MessageRole, ResponseFormat, StarterOption } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { ReactNode, Ref } from 'react';
|
|
3
3
|
import { Components } from 'react-markdown';
|
|
4
4
|
import { BubblePosition } from '../types/bubble-position';
|
|
5
5
|
import { MessageActionsProps } from './message-actions';
|
|
@@ -48,6 +48,8 @@ export interface MessageBubbleLabels {
|
|
|
48
48
|
assistantMessageAriaLabel?: string;
|
|
49
49
|
/** aria-label for interactive attachment tiles. */
|
|
50
50
|
attachmentClickLabel?: string;
|
|
51
|
+
/** aria-label for each file tile's own download button (rendered when `onDownloadAll` is given). Defaults to `'Download attachment'`. */
|
|
52
|
+
attachmentDownloadLabel?: string;
|
|
51
53
|
/** aria-label for the attachment retry button. */
|
|
52
54
|
attachmentRetryLabel?: string;
|
|
53
55
|
/** aria-label for the attachment open-in-new-tab button. */
|
|
@@ -67,6 +69,8 @@ export interface AssistantMessageBubbleLabels extends MessageBubbleLabels {
|
|
|
67
69
|
codeBlockCopyLabel?: string;
|
|
68
70
|
/** aria-label for the code block copy button after copying. */
|
|
69
71
|
codeBlockCopiedLabel?: string;
|
|
72
|
+
/** aria-label for the code block download button. */
|
|
73
|
+
codeBlockDownloadLabel?: string;
|
|
70
74
|
/** Label for the copy action on a Markdown table (copies as Markdown format). */
|
|
71
75
|
tableCopyLabel?: string;
|
|
72
76
|
/** Status announced after a Markdown table has been copied. */
|
|
@@ -79,11 +83,15 @@ export interface AssistantMessageBubbleLabels extends MessageBubbleLabels {
|
|
|
79
83
|
tableDownloadFilename?: string;
|
|
80
84
|
/** Accessible label for a Markdown table's scrollable region. */
|
|
81
85
|
tableScrollRegionAriaLabel?: string;
|
|
86
|
+
/** Accessible label for a block formula's scrollable region. */
|
|
87
|
+
mathScrollRegionAriaLabel?: string;
|
|
82
88
|
/** Fallback aria-label for the deployment icon. Defaults to `'AI'`. */
|
|
83
89
|
deploymentIconFallbackLabel?: string;
|
|
84
90
|
}
|
|
85
91
|
/** Shared props for user and assistant message bubble components. */
|
|
86
92
|
interface BaseMessageBubbleProps {
|
|
93
|
+
/** Ref to the text body, excluding attachment trays, actions and host slots. */
|
|
94
|
+
contentRef?: Ref<HTMLDivElement>;
|
|
87
95
|
/** Plain-text (or Markdown) content of the message. When absent, the bubble renders for `beforeContent` alone. */
|
|
88
96
|
text?: string;
|
|
89
97
|
/** Color and typography overrides applied as CSS custom properties. */
|
|
@@ -106,17 +114,6 @@ interface BaseMessageBubbleProps {
|
|
|
106
114
|
onAttachmentRetry?: (id: string) => void;
|
|
107
115
|
/** ID of the attachment currently open in the canvas panel, if any. Renders that tile's selected visual state. */
|
|
108
116
|
selectedAttachmentId?: string;
|
|
109
|
-
/**
|
|
110
|
-
* Content rendered at the inline-start of the message's first text line,
|
|
111
|
-
* which word-flows after it (e.g. a used-skill chip — inline-level content
|
|
112
|
-
* no taller than a text line). The user bubble renders it inline within
|
|
113
|
-
* the text; the assistant bubble overlays it on the first markdown block's
|
|
114
|
-
* first line, which indents past it. The user bubble renders for the slot
|
|
115
|
-
* alone even when `text` is empty; an assistant message with no text
|
|
116
|
-
* renders the slot on its own line — above the streaming placeholder while
|
|
117
|
-
* the first token has not arrived yet.
|
|
118
|
-
*/
|
|
119
|
-
beforeContent?: ReactNode;
|
|
120
117
|
}
|
|
121
118
|
/** Props for `UserMessageBubble`. */
|
|
122
119
|
export interface UserMessageBubbleProps extends BaseMessageBubbleProps {
|
|
@@ -124,9 +121,38 @@ export interface UserMessageBubbleProps extends BaseMessageBubbleProps {
|
|
|
124
121
|
position?: BubblePosition;
|
|
125
122
|
/** Maximum number of text lines shown while a long user message is collapsed. Defaults to `10`. */
|
|
126
123
|
collapsedLineCount?: number;
|
|
124
|
+
/**
|
|
125
|
+
* Ordered content replacing the plain-text render when present —
|
|
126
|
+
* interleaved plain-text runs and inline elements (e.g. skill-mention
|
|
127
|
+
* chips at their text position), rendered in place of `text` inside the
|
|
128
|
+
* same paragraph. `text` is still required alongside this: it remains the
|
|
129
|
+
* identity/measurement input for the collapse-height calculation
|
|
130
|
+
* (`useCollapsedText`), even though `textSegments` is what's visually
|
|
131
|
+
* rendered. Absent renders `text` directly, byte-identical to today.
|
|
132
|
+
*/
|
|
133
|
+
textSegments?: ReactNode[];
|
|
127
134
|
}
|
|
128
135
|
/** Props for `AssistantMessageBubble`. */
|
|
129
136
|
export interface AssistantMessageBubbleProps extends BaseMessageBubbleProps {
|
|
137
|
+
/**
|
|
138
|
+
* Conversation response format. `ResponseFormat.PlainText` renders the
|
|
139
|
+
* message body verbatim — no Markdown pipeline, so a table, a heading, or
|
|
140
|
+
* `**bold**` reaches the reader exactly as the model wrote it — and the
|
|
141
|
+
* markdown-only props below stop applying. Defaults to
|
|
142
|
+
* `ResponseFormat.Markdown`.
|
|
143
|
+
*/
|
|
144
|
+
responseFormat?: ResponseFormat;
|
|
145
|
+
/**
|
|
146
|
+
* Content rendered at the inline-start of the message's first markdown
|
|
147
|
+
* block's first line, which word-flows after it (e.g. used-skill chips —
|
|
148
|
+
* inline-level content no taller than a text line). Overlaid on the first
|
|
149
|
+
* line, which indents past it; an assistant message with no text renders
|
|
150
|
+
* the slot on its own line — above the streaming placeholder while the
|
|
151
|
+
* first token has not arrived yet. May itself be an array of elements
|
|
152
|
+
* (e.g. one `ChatSkill` per mention) — React renders `ReactNode[]` as a
|
|
153
|
+
* sibling sequence with no extra wrapper needed.
|
|
154
|
+
*/
|
|
155
|
+
beforeContent?: ReactNode;
|
|
130
156
|
/** react-markdown component overrides. Use to inject custom renderers (e.g. citation markers) into markdown elements. */
|
|
131
157
|
markdownComponents?: Components;
|
|
132
158
|
/** Per-element markdown typography classes. Defaults to the renderer's full-size scale; pass `COMPACT_MARKDOWN_CLASS_NAMES` for the smaller body scale. */
|
|
@@ -143,6 +169,8 @@ export interface AssistantMessageBubbleProps extends BaseMessageBubbleProps {
|
|
|
143
169
|
onSelectStarter?: (starter: StarterOption) => void;
|
|
144
170
|
/** Content rendered between the message body and the actions bar (e.g. a stages panel). */
|
|
145
171
|
afterContent?: ReactNode;
|
|
172
|
+
/** When `false`, no thinking placeholder renders while streaming before the first token, so `afterContent` starts level with the avatar. Defaults to `true`. */
|
|
173
|
+
hasThinkingPlaceholder?: boolean;
|
|
146
174
|
/** Deployment icon URL. When absent, no icon is rendered. */
|
|
147
175
|
deploymentIconUrl?: string;
|
|
148
176
|
/** Deployment name used as the icon's accessible label. */
|
|
@@ -155,7 +183,7 @@ export interface AssistantMessageBubbleProps extends BaseMessageBubbleProps {
|
|
|
155
183
|
labels?: AssistantMessageBubbleLabels;
|
|
156
184
|
}
|
|
157
185
|
/** Props for `MessageBubble` — `AssistantMessageBubbleProps` plus user-only fields and `role`. */
|
|
158
|
-
export type MessageBubbleProps = AssistantMessageBubbleProps & Pick<UserMessageBubbleProps, 'position' | 'collapsedLineCount'> & {
|
|
186
|
+
export type MessageBubbleProps = AssistantMessageBubbleProps & Pick<UserMessageBubbleProps, 'position' | 'collapsedLineCount' | 'textSegments'> & {
|
|
159
187
|
/** Message author/type: user, assistant, or status banner. */
|
|
160
188
|
role: MessageRole;
|
|
161
189
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-bubble.d.ts","sourceRoot":"","sources":["../../src/models/message-bubble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"message-bubble.d.ts","sourceRoot":"","sources":["../../src/models/message-bubble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,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AO,EAAE,aAAa,KAAK,IAAI,CAAC;IACnD,2FAA2F;IAC3F,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,gKAAgK;IAChK,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oEAAoE;IACpE,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,+FAA+F;IAC/F,MAAM,CAAC,EAAE,4BAA4B,CAAC;CACvC;AAED,kGAAkG;AAClG,MAAM,MAAM,kBAAkB,GAAG,2BAA2B,GAC1D,IAAI,CACF,sBAAsB,EACtB,UAAU,GAAG,oBAAoB,GAAG,cAAc,CACnD,GAAG;IACF,8DAA8D;IAC9D,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
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.
|
|
4
|
+
"version": "1.3.0-dev.5",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
21
|
"react-markdown": "^10.1.0",
|
|
22
|
-
"@epam/ai-dial-attachment-input": "1.
|
|
22
|
+
"@epam/ai-dial-attachment-input": "1.3.0-dev.5"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
|
-
"
|
|
27
|
-
"@epam/ai-dial-
|
|
26
|
+
"react-dom": "^19.2.8",
|
|
27
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.5",
|
|
28
|
+
"@epam/ai-dial-ui-kit": "^0.15.0"
|
|
28
29
|
},
|
|
29
30
|
"repository": {
|
|
30
31
|
"type": "git",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClipboardEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `onCopy` handler that writes the current selection to the clipboard without
|
|
4
|
+
* the app's colors and fonts. Left to itself, the browser inlines every
|
|
5
|
+
* computed style of the selected markup into `text/html`, so pasting into a
|
|
6
|
+
* rich-text target (Teams, Outlook, Word) brings along the message's
|
|
7
|
+
* background band. This keeps the structure (paragraphs, lists, tables, code,
|
|
8
|
+
* links, line breaks) and lets the target document style it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const copySelectionWithoutStyles: (event: ClipboardEvent<HTMLElement>) => void;
|
|
11
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAwG5C;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,OAAO,cAAc,CAAC,WAAW,CAAC,KACjC,IA0BF,CAAC"}
|