@djangocfg/ui-tools 2.1.371 → 2.1.373
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/dist/ChatRoot-3LA3DSNY.cjs +14 -0
- package/dist/{ChatRoot-DYMCNGOB.mjs.map → ChatRoot-3LA3DSNY.cjs.map} +1 -1
- package/dist/ChatRoot-RIETBE55.mjs +5 -0
- package/dist/{ChatRoot-HOQ37WRE.cjs.map → ChatRoot-RIETBE55.mjs.map} +1 -1
- package/dist/{chunk-MVAT6OPZ.mjs → chunk-PSM3DUTC.mjs} +20 -8
- package/dist/chunk-PSM3DUTC.mjs.map +1 -0
- package/dist/{chunk-2SKR4U5S.cjs → chunk-TAEHNX4W.cjs} +19 -7
- package/dist/chunk-TAEHNX4W.cjs.map +1 -0
- package/dist/index.cjs +47 -47
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.mjs +3 -3
- package/package.json +6 -6
- package/src/tools/Chat/Chat.story.tsx +171 -0
- package/src/tools/Chat/components/MessageList.tsx +57 -19
- package/dist/ChatRoot-DYMCNGOB.mjs +0 -5
- package/dist/ChatRoot-HOQ37WRE.cjs +0 -14
- package/dist/chunk-2SKR4U5S.cjs.map +0 -1
- package/dist/chunk-MVAT6OPZ.mjs.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTAEHNX4W_cjs = require('./chunk-TAEHNX4W.cjs');
|
|
4
|
+
require('./chunk-XACCHZH2.cjs');
|
|
5
|
+
require('./chunk-OLISEQHS.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "ChatRoot", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkTAEHNX4W_cjs.ChatRoot; }
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=ChatRoot-3LA3DSNY.cjs.map
|
|
14
|
+
//# sourceMappingURL=ChatRoot-3LA3DSNY.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-3LA3DSNY.cjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-RIETBE55.mjs"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarkdownMessage } from './chunk-NWUT327A.mjs';
|
|
2
2
|
import { __name } from './chunk-N2XQF2OL.mjs';
|
|
3
|
-
import { createContext, forwardRef, memo, useRef, useImperativeHandle, useCallback, useMemo, useReducer,
|
|
3
|
+
import { createContext, forwardRef, memo, useRef, useImperativeHandle, useCallback, useEffect, useMemo, useReducer, useState, useSyncExternalStore, useContext } from 'react';
|
|
4
4
|
import { cn, isDev } from '@djangocfg/ui-core/lib';
|
|
5
5
|
import { consola } from 'consola';
|
|
6
6
|
import { useCopy, useLocalStorage, useMediaQuery } from '@djangocfg/ui-core/hooks';
|
|
@@ -2148,7 +2148,7 @@ var MessageList = forwardRef(/* @__PURE__ */ __name(function MessageList2({
|
|
|
2148
2148
|
className,
|
|
2149
2149
|
itemClassName,
|
|
2150
2150
|
noVirtualize = false,
|
|
2151
|
-
defaultItemHeight
|
|
2151
|
+
defaultItemHeight: _deprecatedDefaultItemHeight,
|
|
2152
2152
|
onAtBottomChange
|
|
2153
2153
|
}, ref) {
|
|
2154
2154
|
const ctx = useChatContextOptional();
|
|
@@ -2156,6 +2156,7 @@ var MessageList = forwardRef(/* @__PURE__ */ __name(function MessageList2({
|
|
|
2156
2156
|
const isLoadingMore = isLoadingMoreProp ?? ctx?.isLoadingMore ?? false;
|
|
2157
2157
|
const { copyToClipboard } = useCopy();
|
|
2158
2158
|
const virtuosoRef = useRef(null);
|
|
2159
|
+
const didInitialScrollRef = useRef(false);
|
|
2159
2160
|
useImperativeHandle(
|
|
2160
2161
|
ref,
|
|
2161
2162
|
() => ({
|
|
@@ -2188,6 +2189,19 @@ var MessageList = forwardRef(/* @__PURE__ */ __name(function MessageList2({
|
|
|
2188
2189
|
[itemClassName, ctx, copyToClipboard]
|
|
2189
2190
|
);
|
|
2190
2191
|
const itemRenderer = renderItem ?? defaultRenderItem;
|
|
2192
|
+
useEffect(() => {
|
|
2193
|
+
if (didInitialScrollRef.current) return;
|
|
2194
|
+
if (messages.length === 0) return;
|
|
2195
|
+
didInitialScrollRef.current = true;
|
|
2196
|
+
const id = requestAnimationFrame(() => {
|
|
2197
|
+
virtuosoRef.current?.scrollToIndex({
|
|
2198
|
+
index: "LAST",
|
|
2199
|
+
align: "end",
|
|
2200
|
+
behavior: "auto"
|
|
2201
|
+
});
|
|
2202
|
+
});
|
|
2203
|
+
return () => cancelAnimationFrame(id);
|
|
2204
|
+
}, [messages.length]);
|
|
2191
2205
|
const computeItemKey = useCallback(
|
|
2192
2206
|
(index, m) => m?.id ?? index,
|
|
2193
2207
|
[]
|
|
@@ -2245,15 +2259,13 @@ var MessageList = forwardRef(/* @__PURE__ */ __name(function MessageList2({
|
|
|
2245
2259
|
data: messages,
|
|
2246
2260
|
computeItemKey,
|
|
2247
2261
|
itemContent: (index, m) => m ? itemRenderer(m, index) : null,
|
|
2248
|
-
|
|
2262
|
+
initialTopMostItemIndex: messages.length > 0 ? messages.length - 1 : 0,
|
|
2249
2263
|
followOutput: (isAtBottom) => isAtBottom ? "auto" : false,
|
|
2250
2264
|
atBottomStateChange: onAtBottomChange,
|
|
2251
|
-
alignToBottom: true,
|
|
2252
2265
|
startReached: startReachedHandler,
|
|
2253
2266
|
components: isLoadingMore ? {
|
|
2254
2267
|
Header: /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "flex justify-center py-2", children: /* @__PURE__ */ jsx(Spinner, { className: "size-4 text-muted-foreground" }) }), "Header")
|
|
2255
|
-
} : EMPTY_COMPONENTS
|
|
2256
|
-
increaseViewportBy: { top: 200, bottom: 400 }
|
|
2268
|
+
} : EMPTY_COMPONENTS
|
|
2257
2269
|
}
|
|
2258
2270
|
);
|
|
2259
2271
|
}, "MessageList"));
|
|
@@ -2369,5 +2381,5 @@ function copy(text) {
|
|
|
2369
2381
|
__name(copy, "copy");
|
|
2370
2382
|
|
|
2371
2383
|
export { Attachments, AttachmentsGrid, AttachmentsList, CHAT_EVENT_NAME, CSS_VARS, ChatProvider, ChatRoot, Composer, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, EmptyState, ErrorBanner, HOTKEYS, JumpToLatest, LIMITS, MessageActions, MessageBubble, MessageList, STORAGE_KEYS, Sources, StreamingIndicator, ToolCalls, createId, createTokenBuffer, deriveInitials, getChatLogger, initialState, reducer, resolvePersona, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatLayout };
|
|
2372
|
-
//# sourceMappingURL=chunk-
|
|
2373
|
-
//# sourceMappingURL=chunk-
|
|
2384
|
+
//# sourceMappingURL=chunk-PSM3DUTC.mjs.map
|
|
2385
|
+
//# sourceMappingURL=chunk-PSM3DUTC.mjs.map
|