@micha.bigler/ui-core-micha 4.28.0 → 4.29.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/CHANGELOG.md +19 -0
- package/dist/chat/ChatComposer.js +2 -1
- package/dist/chat/ChatThread.js +23 -5
- package/dist/chat/ChatWorkspace.js +47 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.29.0 - UCM-CHAT-16
|
|
4
|
+
|
|
5
|
+
Chat opens at its end, no empty chat entries, usable thread on phones. Found in the Maana staging acceptance of 2026-11-03.
|
|
6
|
+
|
|
7
|
+
- **Opening position.** The thread's bottom pin could be lost on open: the scroll event of the first move to the (still estimated)
|
|
8
|
+
bottom arrives a frame later, when off-screen turns (`content-visibility`) have taken their real height, and was read as the
|
|
9
|
+
reader leaving the bottom. The thread now remembers the position it set itself and ignores that event; only the reader moving
|
|
10
|
+
away unpins, being near the bottom pins again. The scroll region sets `overflow-anchor: none` (browser scroll anchoring would
|
|
11
|
+
move it a second time). Position-on-prepend and follow-only-at-bottom are unchanged.
|
|
12
|
+
- **Empty chats.** `ChatWorkspace` does not list a chat that has no turn. "New chat" creates the chat as before but lists it only
|
|
13
|
+
from its first message on; pressing it while an empty chat is open (or exists) shows that chat instead of creating another.
|
|
14
|
+
Chats that still carry the server's default title ("New chat", not named by the person) are read once (first page of turns) and
|
|
15
|
+
hidden when empty; a failed read keeps the chat listed, a chat with a streaming or failed first turn is listed from the send.
|
|
16
|
+
- **Narrow screens (the workspace's narrow layout).** The thread keeps at least 45 % of the screen height, the header is 44 px, and
|
|
17
|
+
the composer notice (long-conversation banner) wraps below the small breakpoint instead of being cut mid-word; its action stays
|
|
18
|
+
beside it. From the small breakpoint up the notice is the one-line ellipsis as before.
|
|
19
|
+
|
|
20
|
+
No new props, no API change.
|
|
21
|
+
|
|
3
22
|
## 4.28.0 - UCM-CHAT-15
|
|
4
23
|
|
|
5
24
|
New optional `ChatWorkspace` prop `onComposeStart({ chatId })`: called when the composer of a shown chat gains focus
|
|
@@ -25,7 +25,8 @@ export const CHAT_COMPOSER_ACTION_SX = { width: 36, height: 36, flex: '0 0 36px'
|
|
|
25
25
|
// Send is the filled primary action of the input row, as in the prototype; Stop keeps the plain icon button.
|
|
26
26
|
export const CHAT_COMPOSER_SEND_SX = Object.assign(Object.assign({}, CHAT_COMPOSER_ACTION_SX), { bgcolor: 'primary.main', color: 'primary.contrastText', '&:hover': { bgcolor: 'primary.dark' }, '&.Mui-disabled': { bgcolor: 'action.disabledBackground', color: 'action.disabled' } });
|
|
27
27
|
export const CHAT_COMPOSER_NOTICE_SX = { display: 'flex', alignItems: 'center', gap: 0.75, minWidth: 0, minHeight: 32, px: 1, color: 'text.secondary', bgcolor: 'action.hover', borderRadius: 1 };
|
|
28
|
-
|
|
28
|
+
// One line from the small breakpoint up; on a phone the text wraps instead of being cut mid-word, and its action stays beside it.
|
|
29
|
+
export const CHAT_COMPOSER_NOTICE_TEXT_SX = { minWidth: 0, flex: '1 1 auto', overflow: { xs: 'visible', sm: 'hidden' }, whiteSpace: { xs: 'normal', sm: 'nowrap' }, overflowWrap: 'anywhere', textOverflow: 'ellipsis', fontSize: { xs: '0.8125rem', sm: 'inherit' }, lineHeight: 1.3, py: { xs: 0.5, sm: 0 } };
|
|
29
30
|
export const CHAT_COMPOSER_NOTICE_ACTION_SX = { flex: '0 0 auto', minWidth: 0, p: 0.25, whiteSpace: 'nowrap' };
|
|
30
31
|
export const CHAT_COMPOSER_NOTICE_CLOSE_SX = { width: 28, height: 28, flex: '0 0 28px' };
|
|
31
32
|
export const CHAT_COMPOSER_USAGE_METER_SX = { height: 3 };
|
package/dist/chat/ChatThread.js
CHANGED
|
@@ -3,7 +3,9 @@ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import { Alert, Box, Button, Chip, Stack, Tooltip, Typography } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import MarkdownReply from './MarkdownReply';
|
|
6
|
-
|
|
6
|
+
// overflowAnchor: the thread keeps its own position (bottom, or the reader's place after older turns are prepended); the browser's scroll anchoring
|
|
7
|
+
// would move it a second time whenever an off-screen turn takes its real height.
|
|
8
|
+
export const CHAT_THREAD_SCROLL_SX = { minHeight: 0, flex: 1, overflowY: 'auto', p: { xs: 1.5, md: 2.5 }, contain: 'strict', overflowAnchor: 'none' };
|
|
7
9
|
export const CHAT_THREAD_TURN_SX = { mb: 3, contentVisibility: 'auto', containIntrinsicSize: 'auto 320px' };
|
|
8
10
|
export const CHAT_THREAD_TOOL_CHIP_SX = { alignSelf: 'flex-start' };
|
|
9
11
|
export const CHAT_THREAD_NOTICE_SX = { mb: 2 };
|
|
@@ -47,10 +49,21 @@ export function ChatThread({ turns = [], tool = null, notice = null, hasOlder =
|
|
|
47
49
|
const scroller = useRef(null);
|
|
48
50
|
const heightBeforeOlder = useRef(null);
|
|
49
51
|
const pinned = useRef(true); // follow the stream only while the reader is at the bottom
|
|
52
|
+
// The scroll position this component set itself. The scroll event of such a move arrives a frame later, when off-screen turns may have
|
|
53
|
+
// taken their real height and the bottom moved away: that event must not be read as the reader leaving the bottom (UCM-CHAT-16).
|
|
54
|
+
const ownTop = useRef(null);
|
|
55
|
+
const scrollToEnd = () => { const el = scroller.current; if (!el)
|
|
56
|
+
return; el.scrollTop = el.scrollHeight; ownTop.current = el.scrollTop; };
|
|
50
57
|
const last = turns[turns.length - 1];
|
|
51
58
|
// Follow the stream, but only when new content arrives at the end (not when older turns are prepended).
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
if (!pinned.current)
|
|
62
|
+
return;
|
|
63
|
+
(_b = (_a = end.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { block: 'end' });
|
|
64
|
+
if (scroller.current)
|
|
65
|
+
ownTop.current = scroller.current.scrollTop;
|
|
66
|
+
}, [last === null || last === void 0 ? void 0 : last.id, last === null || last === void 0 ? void 0 : last.assistant_text, last === null || last === void 0 ? void 0 : last.state]);
|
|
54
67
|
// Turns skip layout off-screen (content-visibility, UCM-CHAT-14) and take their real height only once rendered, so the
|
|
55
68
|
// content can still grow after the scroll above. While pinned, follow that growth to stay at the bottom. The scroll
|
|
56
69
|
// region itself is observed too: a thread mounted in a hidden host panel gets its real size only when shown.
|
|
@@ -60,7 +73,7 @@ export function ChatThread({ turns = [], tool = null, notice = null, hasOlder =
|
|
|
60
73
|
if (!el || !content.current || typeof ResizeObserver === 'undefined')
|
|
61
74
|
return undefined;
|
|
62
75
|
const observer = new ResizeObserver(() => { if (pinned.current)
|
|
63
|
-
|
|
76
|
+
scrollToEnd(); });
|
|
64
77
|
observer.observe(content.current);
|
|
65
78
|
observer.observe(el);
|
|
66
79
|
return () => observer.disconnect();
|
|
@@ -97,7 +110,12 @@ export function ChatThread({ turns = [], tool = null, notice = null, hasOlder =
|
|
|
97
110
|
let summaryRendered = false;
|
|
98
111
|
return (_jsx(Box, { ref: scroller, onScroll: (event) => {
|
|
99
112
|
const el = event.currentTarget;
|
|
100
|
-
|
|
113
|
+
const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 80;
|
|
114
|
+
const own = ownTop.current !== null && Math.abs(el.scrollTop - ownTop.current) < 1;
|
|
115
|
+
if (atBottom)
|
|
116
|
+
pinned.current = true;
|
|
117
|
+
else if (!own)
|
|
118
|
+
pinned.current = false; // only the reader moving away leaves the bottom, not content growing under a move of ours
|
|
101
119
|
if (hasOlder && !olderBusy && el.scrollTop <= 40)
|
|
102
120
|
loadOlder();
|
|
103
121
|
}, role: "log", "aria-live": "polite", "aria-label": t('Chat.thread'), sx: Object.assign(Object.assign({}, CHAT_THREAD_SCROLL_SX), sx), children: _jsxs("div", { ref: content, children: [hasOlder ? (_jsx(Box, { sx: { textAlign: 'center', mb: 2 }, children: _jsx(Button, { size: "small", onClick: loadOlder, disabled: olderBusy, children: t('Chat.loadOlder') }) })) : null, turns.length === 0 ? (_jsx(Typography, { variant: "h6", color: "text.secondary", align: "center", sx: { mt: 6 }, children: t('Chat.emptyTitle') })) : null, turns.map((turn, index) => {
|
|
@@ -64,6 +64,8 @@ const appendDelta = (turns, text) => {
|
|
|
64
64
|
* `preloadedChats` (optional active-list response `{ scope, results, next }` already loaded for that exact scope), `sx`,
|
|
65
65
|
* `renderTurnError({ turn, chat, retry })` (optional failed-turn message; return `null` to show the default alert).
|
|
66
66
|
*/
|
|
67
|
+
// On a phone the thread keeps at least half the screen: composer, notice and header take what is left (UCM-CHAT-16).
|
|
68
|
+
const CHAT_WORKSPACE_NARROW_THREAD_SX = { minHeight: '50vh' };
|
|
67
69
|
export const CHAT_WORKSPACE_SIDE_PANEL_SX = { borderLeft: 1, borderColor: 'divider', minHeight: 0, overflow: 'auto', contain: 'strict' };
|
|
68
70
|
export function ChatWorkspace({ apiBase, wsUrl, api: apiOverrides, scope, preloadedChats, sx, unavailableReasonText, sidePanel, sidePanelLabel, renderAnswerExtra, renderTurnError, renderComposerExtra, composerLayout = 'standard', renderComposerContext, onAppFrame, onNavigate, activeChatId, onActiveChatChange, onComposeStart, composerPrefill, getSendContext, sendRequest, onSendRequestHandled, layout = 'viewport', compactBelow = 720, tokenBalance = null, usageToTokens, longChatTokens = 40000 }) {
|
|
69
71
|
var _a;
|
|
@@ -99,6 +101,15 @@ export function ChatWorkspace({ apiBase, wsUrl, api: apiOverrides, scope, preloa
|
|
|
99
101
|
// The chat the current catalogue was requested for: a general catalogue must never drive the stored selection of a chat.
|
|
100
102
|
const [catalogueChatId, setCatalogueChatId] = useState(null);
|
|
101
103
|
const [chats, setChats] = useState([]);
|
|
104
|
+
// Chats without a message are not listed (UCM-CHAT-16): the server creates the chat when "New chat" is pressed, the list shows it from its
|
|
105
|
+
// first message on. emptyIds are the chats known to be empty; emptyChecks remembers what was found per chat so each is read once.
|
|
106
|
+
const [emptyIds, setEmptyIds] = useState(() => new Set());
|
|
107
|
+
const emptyChecks = useRef(new Map()); // id -> 'pending' | 'empty' | 'used'
|
|
108
|
+
const markUsed = (id) => {
|
|
109
|
+
emptyChecks.current.set(id, 'used');
|
|
110
|
+
setEmptyIds((current) => { if (!current.has(id))
|
|
111
|
+
return current; const next = new Set(current); next.delete(id); return next; });
|
|
112
|
+
};
|
|
102
113
|
const [archived, setArchived] = useState([]);
|
|
103
114
|
const [nextChats, setNextChats] = useState(null);
|
|
104
115
|
const [chat, setChat] = useState(null);
|
|
@@ -360,6 +371,27 @@ export function ChatWorkspace({ apiBase, wsUrl, api: apiOverrides, scope, preloa
|
|
|
360
371
|
setProblem('load_error'); });
|
|
361
372
|
return () => { live = false; };
|
|
362
373
|
}, [api, chat === null || chat === void 0 ? void 0 : chat.id]);
|
|
374
|
+
// Chats that still carry the server's default title may be empty ones left behind by earlier "New chat" presses: read their first
|
|
375
|
+
// page once and keep the empty ones out of the list. A failed read keeps the chat listed (never hide what might hold a conversation).
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
const untitled = (item) => !item.title || (item.title === 'New chat' && item.title_source !== 'user');
|
|
378
|
+
[...chats, ...archived].filter(untitled).forEach((item) => {
|
|
379
|
+
if (emptyChecks.current.has(item.id))
|
|
380
|
+
return;
|
|
381
|
+
emptyChecks.current.set(item.id, 'pending');
|
|
382
|
+
api.listTurns(item.id)
|
|
383
|
+
.then((page) => {
|
|
384
|
+
if (emptyChecks.current.get(item.id) !== 'pending')
|
|
385
|
+
return; // a first message was sent meanwhile
|
|
386
|
+
const empty = !((page === null || page === void 0 ? void 0 : page.results) || []).length && !(page === null || page === void 0 ? void 0 : page.next);
|
|
387
|
+
emptyChecks.current.set(item.id, empty ? 'empty' : 'used');
|
|
388
|
+
if (empty)
|
|
389
|
+
setEmptyIds((current) => new Set(current).add(item.id));
|
|
390
|
+
})
|
|
391
|
+
.catch(() => { if (emptyChecks.current.get(item.id) === 'pending')
|
|
392
|
+
emptyChecks.current.set(item.id, 'used'); });
|
|
393
|
+
});
|
|
394
|
+
}, [api, chats, archived]);
|
|
363
395
|
const onFrame = useCallback((frame, chatId) => {
|
|
364
396
|
var _a;
|
|
365
397
|
if (chatId !== (chat === null || chat === void 0 ? void 0 : chat.id))
|
|
@@ -493,8 +525,19 @@ export function ChatWorkspace({ apiBase, wsUrl, api: apiOverrides, scope, preloa
|
|
|
493
525
|
}
|
|
494
526
|
};
|
|
495
527
|
const selectChat = (next) => { setChat(next); setListOpen(false); };
|
|
528
|
+
// "New chat" while an empty chat is open (or exists) shows that one instead of creating another.
|
|
496
529
|
const createChat = guarded(async () => {
|
|
530
|
+
// Only a list of the current scope may offer a chat: after a scope change the old list stays until the new one has loaded.
|
|
531
|
+
const reusable = chat && emptyIds.has(chat.id) && !running ? chat : (listsLoaded ? chats.find((item) => emptyIds.has(item.id)) : undefined);
|
|
532
|
+
if (reusable) {
|
|
533
|
+
selectChat(reusable);
|
|
534
|
+
focusPending.current = true;
|
|
535
|
+
setFocusRequest((count) => count + 1);
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
497
538
|
const created = await api.createChat(scope !== undefined ? { scope } : {});
|
|
539
|
+
emptyChecks.current.set(created.id, 'empty');
|
|
540
|
+
setEmptyIds((current) => new Set(current).add(created.id));
|
|
498
541
|
setChats((current) => [created, ...current]);
|
|
499
542
|
selectChat(created);
|
|
500
543
|
});
|
|
@@ -551,6 +594,8 @@ export function ChatWorkspace({ apiBase, wsUrl, api: apiOverrides, scope, preloa
|
|
|
551
594
|
if (!socket.send(built.frame))
|
|
552
595
|
return false;
|
|
553
596
|
setProblem(null);
|
|
597
|
+
if (chat)
|
|
598
|
+
markUsed(chat.id);
|
|
554
599
|
setTurns((current) => [...current, {
|
|
555
600
|
id: PENDING_ID, user_text: message, assistant_text: '', state: 'generating', sources: [],
|
|
556
601
|
driver: activeEntry === null || activeEntry === void 0 ? void 0 : activeEntry.driver, model: (activeEntry === null || activeEntry === void 0 ? void 0 : activeEntry.label) || (activeEntry === null || activeEntry === void 0 ? void 0 : activeEntry.model), effort: selection === null || selection === void 0 ? void 0 : selection.effort,
|
|
@@ -595,7 +640,7 @@ export function ChatWorkspace({ apiBase, wsUrl, api: apiOverrides, scope, preloa
|
|
|
595
640
|
return { text: t(texts[problem]), severity: 'warning' };
|
|
596
641
|
return null;
|
|
597
642
|
};
|
|
598
|
-
const list = (_jsx(ChatList, { chats: chats, archivedChats: archived, activeId: chat === null || chat === void 0 ? void 0 : chat.id, hasMore: Boolean(nextChats), onSelect: selectChat, onNew: createChat, onRename: (target, title) => updateChat(target, { title }), onArchive: (target) => updateChat(target, { archived: true }), onRestore: (target) => updateChat(target, { archived: false }), onDelete: deleteChat, onLoadMore: loadMoreChats }));
|
|
643
|
+
const list = (_jsx(ChatList, { chats: chats.filter((item) => !emptyIds.has(item.id)), archivedChats: archived.filter((item) => !emptyIds.has(item.id)), activeId: chat === null || chat === void 0 ? void 0 : chat.id, hasMore: Boolean(nextChats), onSelect: selectChat, onNew: createChat, onRename: (target, title) => updateChat(target, { title }), onArchive: (target) => updateChat(target, { archived: true }), onRestore: (target) => updateChat(target, { archived: false }), onDelete: deleteChat, onLoadMore: loadMoreChats }));
|
|
599
644
|
const notConfigured = status === 'not_configured' || problem === 'not_configured';
|
|
600
645
|
const unavailable = status === 'unavailable' || problem === 'unavailable';
|
|
601
646
|
const unavailableText = typeof unavailableReasonText === 'function' ? unavailableReasonText(unavailableReason) : unavailableReasonText === null || unavailableReasonText === void 0 ? void 0 : unavailableReasonText[unavailableReason];
|
|
@@ -609,7 +654,7 @@ export function ChatWorkspace({ apiBase, wsUrl, api: apiOverrides, scope, preloa
|
|
|
609
654
|
if (unavailable) {
|
|
610
655
|
return (_jsx(Stack, { alignItems: "center", justifyContent: "center", spacing: 1, sx: Object.assign({ minHeight: 320, p: 3, textAlign: 'center' }, sx), children: _jsx(Typography, { color: "text.secondary", children: unavailableText || t('Chat.notAvailableHere') }) }));
|
|
611
656
|
}
|
|
612
|
-
return (_jsxs(Box, { ref: rootRef, sx: Object.assign({ display: 'grid', gridTemplateColumns: narrow ? 'minmax(0, 1fr)' : `minmax(240px, 320px) minmax(0, 1fr)${chat && sidePanel ? ' minmax(240px, 320px)' : ''}`, height: '100%', minHeight: 480, border: 1, borderColor: 'divider', borderRadius: 1, overflow: 'hidden', bgcolor: 'background.paper' }, sx), children: [narrow ? null : _jsx(Box, { sx: { borderRight: 1, borderColor: 'divider', minHeight: 0 }, children: list }), _jsxs(Stack, { sx: { minWidth: 0, minHeight: 0 }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, sx: { px: 1.5, py: 0.5, borderBottom: 1, borderColor: 'divider', minHeight: 56 }, children: [narrow ? _jsx(Button, { color: "inherit", onClick: () => setListOpen(true), children: t('Chat.chats') }) : null, _jsx(Typography, { noWrap: true, sx: { flex: 1, fontWeight: 600 }, children: chat ? (chat.title || t('Chat.untitled')) : '' }), socket.status === 'connecting' && openedOnce ? _jsx(Chip, { size: "small", color: "warning", variant: "outlined", label: t('Chat.reconnecting') }) : null, isArchived ? _jsx(Chip, { size: "small", label: t('Chat.archived') }) : null, isArchived ? _jsx(Button, { size: "small", onClick: () => updateChat(chat, { archived: false }), children: t('Chat.restore') }) : null, chat && sidePanel && narrow ? _jsx(Button, { color: "inherit", onClick: () => setSidePanelOpen(true), children: sidePanelLabel || t('Chat.sidePanel') }) : null] }), chat ? (_jsxs(_Fragment, { children: [_jsx(ChatThread, { turns: turns, chat: chat, renderAnswerExtra: answerExtra, renderTurnError: renderTurnError, tool: tool, notice: noticeFor(), hasOlder: Boolean(olderCursor), olderBusy: olderBusy, onLoadOlder: loadOlder, onRetry: retry, readOnly: isArchived, summary: summary, usageToTokens: usageToTokens, onNavigate: onNavigate }), isArchived ? _jsx(Typography, { variant: "caption", color: "text.secondary", sx: { px: 2, pb: 1 }, children: t('Chat.archivedReadOnly') }) : null, renderComposerExtra ? _jsx(Box, { children: renderComposerExtra({ chat }) }, chat.id) : null, composerLayout !== 'compact' && longChat ? _jsx(Alert, { severity: "info", action: _jsx(Button, { color: "inherit", size: "small", onClick: createChat, children: t('Chat.newConversation') }), children: t('Chat.longChat') }) : null, _jsx(ChatComposer, { layout: composerLayout, onComposeStart: composeStart, context: composerLayout === 'compact' ? renderComposerContext === null || renderComposerContext === void 0 ? void 0 : renderComposerContext({ chat }) : undefined, notice: composerLayout === 'compact' && longChat && !dismissedComposerNotices.has(`${chat.id}:long-chat`) ? {
|
|
657
|
+
return (_jsxs(Box, { ref: rootRef, sx: Object.assign({ display: 'grid', gridTemplateColumns: narrow ? 'minmax(0, 1fr)' : `minmax(240px, 320px) minmax(0, 1fr)${chat && sidePanel ? ' minmax(240px, 320px)' : ''}`, height: '100%', minHeight: 480, border: 1, borderColor: 'divider', borderRadius: 1, overflow: 'hidden', bgcolor: 'background.paper' }, sx), children: [narrow ? null : _jsx(Box, { sx: { borderRight: 1, borderColor: 'divider', minHeight: 0 }, children: list }), _jsxs(Stack, { sx: { minWidth: 0, minHeight: 0 }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, sx: { px: 1.5, py: 0.5, borderBottom: 1, borderColor: 'divider', minHeight: narrow ? 44 : 56 }, children: [narrow ? _jsx(Button, { color: "inherit", onClick: () => setListOpen(true), children: t('Chat.chats') }) : null, _jsx(Typography, { noWrap: true, sx: { flex: 1, fontWeight: 600 }, children: chat ? (chat.title || t('Chat.untitled')) : '' }), socket.status === 'connecting' && openedOnce ? _jsx(Chip, { size: "small", color: "warning", variant: "outlined", label: t('Chat.reconnecting') }) : null, isArchived ? _jsx(Chip, { size: "small", label: t('Chat.archived') }) : null, isArchived ? _jsx(Button, { size: "small", onClick: () => updateChat(chat, { archived: false }), children: t('Chat.restore') }) : null, chat && sidePanel && narrow ? _jsx(Button, { color: "inherit", onClick: () => setSidePanelOpen(true), children: sidePanelLabel || t('Chat.sidePanel') }) : null] }), chat ? (_jsxs(_Fragment, { children: [_jsx(ChatThread, { sx: narrow ? CHAT_WORKSPACE_NARROW_THREAD_SX : undefined, turns: turns, chat: chat, renderAnswerExtra: answerExtra, renderTurnError: renderTurnError, tool: tool, notice: noticeFor(), hasOlder: Boolean(olderCursor), olderBusy: olderBusy, onLoadOlder: loadOlder, onRetry: retry, readOnly: isArchived, summary: summary, usageToTokens: usageToTokens, onNavigate: onNavigate }), isArchived ? _jsx(Typography, { variant: "caption", color: "text.secondary", sx: { px: 2, pb: 1 }, children: t('Chat.archivedReadOnly') }) : null, renderComposerExtra ? _jsx(Box, { children: renderComposerExtra({ chat }) }, chat.id) : null, composerLayout !== 'compact' && longChat ? _jsx(Alert, { severity: "info", action: _jsx(Button, { color: "inherit", size: "small", onClick: createChat, children: t('Chat.newConversation') }), children: t('Chat.longChat') }) : null, _jsx(ChatComposer, { layout: composerLayout, onComposeStart: composeStart, context: composerLayout === 'compact' ? renderComposerContext === null || renderComposerContext === void 0 ? void 0 : renderComposerContext({ chat }) : undefined, notice: composerLayout === 'compact' && longChat && !dismissedComposerNotices.has(`${chat.id}:long-chat`) ? {
|
|
613
658
|
id: 'long-chat', text: t('Chat.longChatShort'), action: t('Chat.newChat'), onAction: createChat,
|
|
614
659
|
onDismiss: () => setDismissedComposerNotices((current) => new Set(current).add(`${chat.id}:long-chat`)),
|
|
615
660
|
} : null, draftRequest: (draftRequest === null || draftRequest === void 0 ? void 0 : draftRequest.chatId) === chat.id ? draftRequest : null, onDraftRequestApplied: onDraftRequestApplied, onSend: (text) => startTurn(text), onStop: () => socket.send({ type: 'stop' }), running: running, archived: isArchived, connected: socket.connected, inputRef: composerInputRef, usageLimit: usageLimit, actions: _jsx(ModelPicker, { entries: catalogue.entries, selection: selection, disabled: isArchived || running || (catalogueLoading && catalogueChatId !== chat.id), open: pickerOpen, onOpenChange: setPickerOpen, onChange: (next) => updateChat(chat, { selection: next }), balance: tokenBalance, shortLabel: composerLayout === 'compact' }) }, `composer-${chat.id}`)] })) : (_jsxs(Stack, { alignItems: "center", justifyContent: "center", spacing: 2, sx: { flex: 1, p: 3 }, children: [_jsx(Typography, { color: "text.secondary", align: "center", children: t('Chat.selectChat') }), _jsx(Button, { variant: "contained", onClick: createChat, children: t('Chat.newChat') })] }))] }), chat && sidePanel && !narrow ? _jsx(Box, { sx: CHAT_WORKSPACE_SIDE_PANEL_SX, children: sidePanel(chat) }, chat.id) : null, narrow && chat && sidePanel ? _jsx(Drawer, { anchor: "right", open: sidePanelOpen, onClose: () => setSidePanelOpen(false), slotProps: { paper: { 'aria-label': sidePanelLabel || t('Chat.sidePanel') } }, children: _jsx(Box, { children: sidePanel(chat) }, chat.id) }) : null, narrow ? _jsx(Drawer, { open: listOpen, onClose: () => setListOpen(false), slotProps: { paper: { sx: { width: 'min(320px, 86vw)' } } }, children: list }) : null] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micha.bigler/ui-core-micha",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"@mui/x-charts": "^8.29.3",
|
|
72
72
|
"@testing-library/react": "^16.3.3",
|
|
73
73
|
"@vitejs/plugin-react": "^6.1.2",
|
|
74
|
-
"i18next": "^26.
|
|
75
|
-
"jsdom": "^30.1.
|
|
76
|
-
"react-i18next": "^17.
|
|
74
|
+
"i18next": "^26.5.11",
|
|
75
|
+
"jsdom": "^30.1.3",
|
|
76
|
+
"react-i18next": "^17.1.9",
|
|
77
77
|
"react-markdown": "^10.1.0",
|
|
78
78
|
"remark-gfm": "^4.0.1",
|
|
79
79
|
"typescript": "^7.0.2",
|
|
80
|
-
"vite": "^8.3.
|
|
81
|
-
"vitest": "^5.0.
|
|
80
|
+
"vite": "^8.3.5",
|
|
81
|
+
"vitest": "^5.0.5"
|
|
82
82
|
}
|
|
83
83
|
}
|