@progress/kendo-react-conversational-ui 16.3.0-develop.9 → 16.3.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/NOTICE.txt +19 -19
- package/chat/components/AttachmentGroup.d.ts +1 -0
- package/chat/components/AttachmentGroup.js +1 -1
- package/chat/components/AttachmentGroup.mjs +48 -48
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +62 -60
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/llm-kit/defaults/DefaultCitationBody.js +1 -1
- package/llm-kit/defaults/DefaultCitationBody.mjs +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +14 -14
- package/prompt-box/PromptBoxActionButton.d.ts +3 -1
- package/prompt-box/utils.d.ts +2 -1
- package/prompt-box/utils.js +1 -1
- package/prompt-box/utils.mjs +7 -7
package/chat/components/Chat.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { useWebMcpRegister as Ot, validatePackage as Ut, getLicenseMessage as Pt, Keys as
|
|
8
|
+
import { useWebMcpRegister as Ot, validatePackage as Ut, getLicenseMessage as Pt, Keys as F, sanitizeUrl as jt, classNames as He, WatermarkOverlay as Vt } from "@progress/kendo-react-common";
|
|
9
9
|
import o from "prop-types";
|
|
10
10
|
import * as t from "react";
|
|
11
11
|
import { FloatingActionButton as qt } from "@progress/kendo-react-buttons";
|
|
@@ -22,24 +22,24 @@ import Xt from "./Notification.mjs";
|
|
|
22
22
|
import Yt from "./ChatContext.mjs";
|
|
23
23
|
import { ChatMessage as Zt } from "./ChatMessage.mjs";
|
|
24
24
|
import { packageMetadata as Ke } from "../../package-metadata.mjs";
|
|
25
|
-
import { ariaLabelMessageList as $e, messages as
|
|
25
|
+
import { ariaLabelMessageList as $e, messages as L, scrollToBottom as I, chatCopyNotification as _e } from "../../messages/index.mjs";
|
|
26
26
|
import { useLocalization as es } from "@progress/kendo-react-intl";
|
|
27
27
|
import { isStandardMessageFormat as ts, mapDataArrayToMessages as ss } from "../utils/fieldMapping.mjs";
|
|
28
28
|
import { useMessageAutoScroll as os, useHasScrollbar as ns } from "../utils/scroll.mjs";
|
|
29
29
|
import { resolveMessageSettings as as } from "../utils/messageSettings.mjs";
|
|
30
30
|
import { useEndlessScroll as rs } from "../hooks/useEndlessScroll.mjs";
|
|
31
|
-
const Je = t.forwardRef((
|
|
31
|
+
const Je = t.forwardRef((B, v) => {
|
|
32
32
|
const {
|
|
33
33
|
messages: p = [],
|
|
34
34
|
messageTemplate: G,
|
|
35
35
|
messageContentTemplate: H,
|
|
36
|
-
attachmentTemplate:
|
|
36
|
+
attachmentTemplate: N,
|
|
37
37
|
width: Qe,
|
|
38
38
|
height: Xe,
|
|
39
39
|
onSendMessage: C,
|
|
40
40
|
onSuggestionClick: K,
|
|
41
41
|
onInputValueChange: $,
|
|
42
|
-
onActionExecute:
|
|
42
|
+
onActionExecute: D,
|
|
43
43
|
dir: h,
|
|
44
44
|
messageBox: Ye,
|
|
45
45
|
placeholder: Ze,
|
|
@@ -60,7 +60,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
60
60
|
allowMessageCollapse: ee,
|
|
61
61
|
messageToolbarActions: te,
|
|
62
62
|
messageContextMenuActions: se,
|
|
63
|
-
fileActions:
|
|
63
|
+
fileActions: E,
|
|
64
64
|
onUnpin: at,
|
|
65
65
|
messageWidthMode: oe,
|
|
66
66
|
showAvatar: ne,
|
|
@@ -76,7 +76,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
76
76
|
uploadConfig: fe,
|
|
77
77
|
sendButtonConfig: rt,
|
|
78
78
|
messageFilesLayout: pe,
|
|
79
|
-
scrollToBottomButton:
|
|
79
|
+
scrollToBottomButton: O = !0,
|
|
80
80
|
autoScrollThreshold: lt,
|
|
81
81
|
textField: he,
|
|
82
82
|
statusField: Me,
|
|
@@ -103,13 +103,13 @@ const Je = t.forwardRef((I, k) => {
|
|
|
103
103
|
startIndex: gt,
|
|
104
104
|
endIndex: ft,
|
|
105
105
|
onLoadMoreMessages: pt,
|
|
106
|
-
pinnedMessages:
|
|
106
|
+
pinnedMessages: U,
|
|
107
107
|
repliedToMessages: Be,
|
|
108
108
|
onReferencedMessageClick: ht,
|
|
109
109
|
...Mt
|
|
110
|
-
} =
|
|
111
|
-
Ot("chat", yt,
|
|
112
|
-
const [m,
|
|
110
|
+
} = B, yt = t.useRef(null);
|
|
111
|
+
Ot("chat", yt, B, B.webMcp);
|
|
112
|
+
const [m, P] = t.useState(null), [S, Ct] = t.useState(!1), [St, Ne] = t.useState(!1), [De, Oe] = t.useState(null), [d, Ue] = t.useState(null), [Tt, Pe] = t.useState(!1), j = t.useRef(null), je = t.useRef(null), c = t.useRef(null), Ve = t.useRef(null), V = t.useRef(void 0), q = t.useRef(!1), z = t.useRef(null), qe = t.useRef(""), u = t.useMemo(() => {
|
|
113
113
|
if (!p || p.length === 0)
|
|
114
114
|
return [];
|
|
115
115
|
const s = {
|
|
@@ -184,12 +184,12 @@ const Je = t.forwardRef((I, k) => {
|
|
|
184
184
|
viewItemsWrapperRef: c,
|
|
185
185
|
authorId: a
|
|
186
186
|
}), f = t.useMemo(() => g.length > 0 ? Wt(g) : [], [g]), Et = t.useMemo(() => !Ut(Ke, { component: "Chat" }), []), Rt = Pt(Ke), We = t.useMemo(() => {
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
187
|
+
if (U)
|
|
188
|
+
return U.find((e) => e.isPinned);
|
|
189
189
|
const s = u.find((e) => e.isPinned);
|
|
190
190
|
if (s)
|
|
191
191
|
return s;
|
|
192
|
-
}, [u,
|
|
192
|
+
}, [u, U]), R = es();
|
|
193
193
|
os({
|
|
194
194
|
viewItemsWrapperRef: c,
|
|
195
195
|
isKeyboardNavigationActiveRef: q,
|
|
@@ -204,21 +204,21 @@ const Je = t.forwardRef((I, k) => {
|
|
|
204
204
|
clearTimeout(V.current);
|
|
205
205
|
}, []), wt = t.useCallback(() => {
|
|
206
206
|
V.current = window.setTimeout(() => {
|
|
207
|
-
|
|
207
|
+
P(null);
|
|
208
208
|
}, 0);
|
|
209
|
-
}, []),
|
|
210
|
-
|
|
209
|
+
}, []), x = t.useCallback((s) => {
|
|
210
|
+
P(s);
|
|
211
211
|
}, []), Ft = t.useCallback(
|
|
212
212
|
(s) => {
|
|
213
213
|
let e = null;
|
|
214
214
|
const n = m !== null ? m : f.lastSelectionIndex;
|
|
215
|
-
s.keyCode ===
|
|
215
|
+
s.keyCode === F.up ? n === null ? e = 0 : n > 0 && (e = n - 1) : s.keyCode === F.down ? n === null ? e = 0 : n < f.lastSelectionIndex && (e = n + 1) : s.keyCode === F.home ? e = 0 : s.keyCode === F.end && (e = f.lastSelectionIndex), e !== null && (P(e), q.current = !0, s.preventDefault());
|
|
216
216
|
},
|
|
217
217
|
[m, f]
|
|
218
218
|
), Ge = t.useCallback(
|
|
219
219
|
(s, e, n) => {
|
|
220
220
|
var l;
|
|
221
|
-
if (
|
|
221
|
+
if (D && D({
|
|
222
222
|
action: { value: s.value, title: s.title, type: s.type },
|
|
223
223
|
syntheticEvent: e,
|
|
224
224
|
nativeEvent: e.nativeEvent,
|
|
@@ -250,15 +250,15 @@ const Je = t.forwardRef((I, k) => {
|
|
|
250
250
|
(l = Ve.current) == null || l.focusInput();
|
|
251
251
|
}
|
|
252
252
|
},
|
|
253
|
-
[
|
|
254
|
-
), Lt = t.useCallback(() => He("k-chat", _, { "k-rtl":
|
|
253
|
+
[D, C, d]
|
|
254
|
+
), Lt = t.useCallback(() => He("k-chat", _, { "k-rtl": S }), [_, S]), It = t.useCallback(() => {
|
|
255
255
|
const s = f.length - 1;
|
|
256
256
|
return f.map((e, n) => {
|
|
257
|
-
var l, i,
|
|
257
|
+
var l, i, T, b, k, A;
|
|
258
258
|
if (e.type === "date-marker")
|
|
259
259
|
return /* @__PURE__ */ t.createElement(Kt, { item: e, key: e.trackBy, timestampTemplate: X });
|
|
260
260
|
if (e.type === "message-group") {
|
|
261
|
-
const
|
|
261
|
+
const w = {
|
|
262
262
|
allowMessageCollapse: ee,
|
|
263
263
|
messageWidthMode: oe,
|
|
264
264
|
showAvatar: ne,
|
|
@@ -267,11 +267,11 @@ const Je = t.forwardRef((I, k) => {
|
|
|
267
267
|
messageContentTemplate: H,
|
|
268
268
|
messageToolbarActions: te,
|
|
269
269
|
messageContextMenuActions: se,
|
|
270
|
-
fileActions:
|
|
270
|
+
fileActions: E
|
|
271
271
|
}, r = as(
|
|
272
272
|
(l = e.messages) == null ? void 0 : l[0],
|
|
273
273
|
a,
|
|
274
|
-
|
|
274
|
+
w,
|
|
275
275
|
le,
|
|
276
276
|
ie
|
|
277
277
|
);
|
|
@@ -281,10 +281,10 @@ const Je = t.forwardRef((I, k) => {
|
|
|
281
281
|
group: e,
|
|
282
282
|
itemTemplate: r.messageTemplate,
|
|
283
283
|
contentTemplate: r.messageContentTemplate,
|
|
284
|
-
attachmentTemplate:
|
|
284
|
+
attachmentTemplate: N,
|
|
285
285
|
user: d,
|
|
286
286
|
selectedItemIndex: m,
|
|
287
|
-
onRequestSelection:
|
|
287
|
+
onRequestSelection: x,
|
|
288
288
|
isLastGroup: n === s,
|
|
289
289
|
key: (i = e.messages[0].id) != null ? i : e.messages[0].selectionIndex,
|
|
290
290
|
message: J,
|
|
@@ -303,11 +303,12 @@ const Je = t.forwardRef((I, k) => {
|
|
|
303
303
|
Ht,
|
|
304
304
|
{
|
|
305
305
|
group: e,
|
|
306
|
-
itemTemplate:
|
|
307
|
-
onRequestSelection:
|
|
306
|
+
itemTemplate: N,
|
|
307
|
+
onRequestSelection: x,
|
|
308
308
|
selected: e.selectionIndex === m,
|
|
309
309
|
isLastGroup: n === s,
|
|
310
|
-
|
|
310
|
+
dir: S ? "rtl" : "ltr",
|
|
311
|
+
key: `att-${(b = (T = e.trackBy) == null ? void 0 : T.id) != null ? b : e.selectionIndex}`
|
|
311
312
|
}
|
|
312
313
|
);
|
|
313
314
|
if (e.type === "action-group")
|
|
@@ -316,9 +317,9 @@ const Je = t.forwardRef((I, k) => {
|
|
|
316
317
|
{
|
|
317
318
|
group: e,
|
|
318
319
|
onActionExecute: Ge,
|
|
319
|
-
onRequestSelection:
|
|
320
|
+
onRequestSelection: x,
|
|
320
321
|
selected: e.selectionIndex === m,
|
|
321
|
-
key: `act-${(
|
|
322
|
+
key: `act-${(A = (k = e.trackBy) == null ? void 0 : k.id) != null ? A : e.selectionIndex}`,
|
|
322
323
|
quickActionsLayout: Q,
|
|
323
324
|
dir: h
|
|
324
325
|
}
|
|
@@ -331,15 +332,15 @@ const Je = t.forwardRef((I, k) => {
|
|
|
331
332
|
X,
|
|
332
333
|
G,
|
|
333
334
|
H,
|
|
334
|
-
|
|
335
|
+
N,
|
|
335
336
|
d,
|
|
336
337
|
m,
|
|
337
|
-
|
|
338
|
+
x,
|
|
338
339
|
J,
|
|
339
340
|
ee,
|
|
340
341
|
te,
|
|
341
342
|
se,
|
|
342
|
-
|
|
343
|
+
E,
|
|
343
344
|
oe,
|
|
344
345
|
ne,
|
|
345
346
|
ae,
|
|
@@ -348,7 +349,8 @@ const Je = t.forwardRef((I, k) => {
|
|
|
348
349
|
ie,
|
|
349
350
|
Ge,
|
|
350
351
|
Q,
|
|
351
|
-
h
|
|
352
|
+
h,
|
|
353
|
+
S
|
|
352
354
|
]), Bt = t.useCallback(() => M ? typeof M == "function" ? M() : M : null, [M]), Nt = t.useCallback(() => y ? typeof y == "function" ? y() : y : null, [y]);
|
|
353
355
|
t.useEffect(() => {
|
|
354
356
|
const s = h !== void 0 ? h === "rtl" : j.current && getComputedStyle(j.current).direction === "rtl";
|
|
@@ -356,27 +358,27 @@ const Je = t.forwardRef((I, k) => {
|
|
|
356
358
|
}, [h]), t.useEffect(() => () => {
|
|
357
359
|
clearTimeout(V.current);
|
|
358
360
|
}, []), t.useEffect(() => {
|
|
359
|
-
if (!
|
|
361
|
+
if (!O || !c.current)
|
|
360
362
|
return;
|
|
361
363
|
let s, e;
|
|
362
364
|
const n = () => {
|
|
363
365
|
s = void 0;
|
|
364
|
-
const
|
|
365
|
-
if (!
|
|
366
|
+
const b = c.current;
|
|
367
|
+
if (!b)
|
|
366
368
|
return;
|
|
367
|
-
const { scrollHeight:
|
|
368
|
-
!(
|
|
369
|
+
const { scrollHeight: k, scrollTop: A, clientHeight: w } = b;
|
|
370
|
+
!(k > w) || k - A - w <= 100 ? (e !== void 0 && (clearTimeout(e), e = void 0), Pe(!1)) : e != null || (e = setTimeout(() => {
|
|
369
371
|
e = void 0, Pe(!0);
|
|
370
372
|
}, 300));
|
|
371
373
|
}, l = () => {
|
|
372
374
|
s === void 0 && (s = requestAnimationFrame(n));
|
|
373
375
|
}, i = c.current;
|
|
374
376
|
i.addEventListener("scroll", l, { passive: !0 });
|
|
375
|
-
const
|
|
376
|
-
return
|
|
377
|
-
i.removeEventListener("scroll", l),
|
|
377
|
+
const T = new MutationObserver(l);
|
|
378
|
+
return T.observe(i, { childList: !0, subtree: !0, characterData: !0 }), () => {
|
|
379
|
+
i.removeEventListener("scroll", l), T.disconnect(), s !== void 0 && cancelAnimationFrame(s), e !== void 0 && clearTimeout(e);
|
|
378
380
|
};
|
|
379
|
-
}, [
|
|
381
|
+
}, [O]);
|
|
380
382
|
const Dt = t.useMemo(() => ({
|
|
381
383
|
replyToMessage: De,
|
|
382
384
|
setReplyToMessage: Oe,
|
|
@@ -391,7 +393,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
391
393
|
setShowCopyNotification: Ne,
|
|
392
394
|
onDownload: de,
|
|
393
395
|
onResendMessage: Ie,
|
|
394
|
-
fileActions:
|
|
396
|
+
fileActions: E,
|
|
395
397
|
speechToTextConfig: ge,
|
|
396
398
|
uploadConfig: fe,
|
|
397
399
|
statusTemplate: Y,
|
|
@@ -411,7 +413,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
411
413
|
Ne,
|
|
412
414
|
de,
|
|
413
415
|
Ie,
|
|
414
|
-
|
|
416
|
+
E,
|
|
415
417
|
ge,
|
|
416
418
|
fe,
|
|
417
419
|
Y,
|
|
@@ -433,7 +435,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
433
435
|
onKeyDown: Ft,
|
|
434
436
|
className: Lt(),
|
|
435
437
|
ref: (s) => {
|
|
436
|
-
j.current = s, je.current = s, typeof
|
|
438
|
+
j.current = s, je.current = s, typeof v == "function" ? v(s) : v && (v.current = s);
|
|
437
439
|
},
|
|
438
440
|
...Mt
|
|
439
441
|
},
|
|
@@ -445,9 +447,9 @@ const Je = t.forwardRef((I, k) => {
|
|
|
445
447
|
onBlur: wt,
|
|
446
448
|
onFocus: At,
|
|
447
449
|
role: "log",
|
|
448
|
-
"aria-label":
|
|
450
|
+
"aria-label": R.toLanguageString(
|
|
449
451
|
$e,
|
|
450
|
-
|
|
452
|
+
L[$e]
|
|
451
453
|
),
|
|
452
454
|
"aria-live": "polite",
|
|
453
455
|
ref: c,
|
|
@@ -474,7 +476,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
474
476
|
g.length === 0 && y !== void 0 && Nt(),
|
|
475
477
|
g.length > 0 && It()
|
|
476
478
|
),
|
|
477
|
-
|
|
479
|
+
O && (Tt || !ze) && /* @__PURE__ */ t.createElement("div", { className: "k-chat-scroll-to-bottom-container" }, /* @__PURE__ */ t.createElement(
|
|
478
480
|
qt,
|
|
479
481
|
{
|
|
480
482
|
svgIcon: zt,
|
|
@@ -482,13 +484,13 @@ const Je = t.forwardRef((I, k) => {
|
|
|
482
484
|
themeColor: "base",
|
|
483
485
|
rounded: "full",
|
|
484
486
|
onClick: bt,
|
|
485
|
-
"aria-label":
|
|
486
|
-
|
|
487
|
-
|
|
487
|
+
"aria-label": R.toLanguageString(
|
|
488
|
+
I,
|
|
489
|
+
L[I]
|
|
488
490
|
),
|
|
489
|
-
title:
|
|
490
|
-
|
|
491
|
-
|
|
491
|
+
title: R.toLanguageString(
|
|
492
|
+
I,
|
|
493
|
+
L[I]
|
|
492
494
|
)
|
|
493
495
|
}
|
|
494
496
|
))
|
|
@@ -508,7 +510,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
508
510
|
onSuggestionClick: (s) => {
|
|
509
511
|
K && K(s);
|
|
510
512
|
},
|
|
511
|
-
isDirectionRightToLeft:
|
|
513
|
+
isDirectionRightToLeft: S,
|
|
512
514
|
ref: Ve,
|
|
513
515
|
placeholder: Ze,
|
|
514
516
|
MessageBox: Ye,
|
|
@@ -532,9 +534,9 @@ const Je = t.forwardRef((I, k) => {
|
|
|
532
534
|
Xt,
|
|
533
535
|
{
|
|
534
536
|
show: St,
|
|
535
|
-
text:
|
|
537
|
+
text: R.toLanguageString(
|
|
536
538
|
_e,
|
|
537
|
-
|
|
539
|
+
L[_e]
|
|
538
540
|
)
|
|
539
541
|
}
|
|
540
542
|
),
|