@gravity-ui/aikit 0.4.0 → 0.4.2
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/components/organisms/MessageList/MessageList.js +3 -1
- package/dist/components/organisms/PromptInput/PromptInputFull.js +1 -0
- package/dist/components/organisms/PromptInput/PromptInputSimple.js +1 -0
- package/dist/components/pages/ChatContainer/useChatContainer.js +2 -2
- package/dist/components/templates/ChatContent/ChatContent.js +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import './MessageList.scss';
|
|
|
12
12
|
const b = block('message-list');
|
|
13
13
|
export function MessageList({ messages, messageRendererRegistry, transformOptions, showActionsOnHover, showTimestamp, showAvatar, userActions, assistantActions, loaderStatuses = ['submitted'], className, qa, status, errorMessage, onRetry, hasPreviousMessages = false, onLoadPreviousMessages, }) {
|
|
14
14
|
const isStreaming = status === 'streaming';
|
|
15
|
+
const isSubmitted = status === 'submitted';
|
|
15
16
|
const messagesCount = messages.length;
|
|
16
17
|
const showLoader = status && loaderStatuses.includes(status);
|
|
17
18
|
const { containerRef, endRef, scrollToBottom } = useSmartScroll(isStreaming, messagesCount);
|
|
@@ -27,7 +28,8 @@ export function MessageList({ messages, messageRendererRegistry, transformOption
|
|
|
27
28
|
}
|
|
28
29
|
if (isAssistantMessage(message)) {
|
|
29
30
|
const isLastMessage = index === messages.length - 1;
|
|
30
|
-
const
|
|
31
|
+
const isNotCompleted = isSubmitted || isStreaming;
|
|
32
|
+
const showActions = !(isLastMessage && isNotCompleted);
|
|
31
33
|
const actions = showActions
|
|
32
34
|
? resolveMessageActions(message, assistantActions)
|
|
33
35
|
: undefined;
|
|
@@ -23,5 +23,6 @@ export function PromptInputFull(props) {
|
|
|
23
23
|
state: submitButtonState,
|
|
24
24
|
tooltipSend: submitButtonTooltipSend,
|
|
25
25
|
tooltipCancel: submitButtonTooltipCancel,
|
|
26
|
+
qa: 'submit-button-full',
|
|
26
27
|
}, showSettings: showSettings, onSettingsClick: onSettingsClick, showAttachment: showAttachment, onAttachmentClick: onAttachmentClick, showMicrophone: showMicrophone, onMicrophoneClick: onMicrophoneClick, children: bottomContent }))] }));
|
|
27
28
|
}
|
|
@@ -19,5 +19,6 @@ export function PromptInputSimple(props) {
|
|
|
19
19
|
state: submitButtonState,
|
|
20
20
|
tooltipSend: submitButtonTooltipSend,
|
|
21
21
|
tooltipCancel: submitButtonTooltipCancel,
|
|
22
|
+
qa: 'submit-button-simple',
|
|
22
23
|
}, showAttachment: showAttachment, onAttachmentClick: onAttachmentClick, showMicrophone: showMicrophone, onMicrophoneClick: onMicrophoneClick, buttonSize: "l", children: bottomContent })] }) }));
|
|
23
24
|
}
|
|
@@ -47,7 +47,7 @@ export function useChatContainer(props) {
|
|
|
47
47
|
// Build baseActions for Header
|
|
48
48
|
const baseActions = useMemo(() => {
|
|
49
49
|
const actions = [];
|
|
50
|
-
if (showNewChat) {
|
|
50
|
+
if (showNewChat && chatContentView !== 'empty') {
|
|
51
51
|
actions.push(HeaderAction.NewChat);
|
|
52
52
|
}
|
|
53
53
|
if (showHistory) {
|
|
@@ -57,7 +57,7 @@ export function useChatContainer(props) {
|
|
|
57
57
|
actions.push(HeaderAction.Close);
|
|
58
58
|
}
|
|
59
59
|
return actions;
|
|
60
|
-
}, [showNewChat, showHistory, showClose]);
|
|
60
|
+
}, [showNewChat, showHistory, showClose, chatContentView]);
|
|
61
61
|
return {
|
|
62
62
|
// State
|
|
63
63
|
chatContentView,
|
|
@@ -15,5 +15,5 @@ export function ChatContent(props) {
|
|
|
15
15
|
const isEmptyView = view === 'empty';
|
|
16
16
|
return (_jsx("div", { className: b(null, className), "data-qa": qa, children: isEmptyView
|
|
17
17
|
? emptyContainerProps && _jsx(EmptyContainer, Object.assign({}, emptyContainerProps))
|
|
18
|
-
: messageListProps && (_jsx("div", { className: b('message-list-container'), children: _jsx(MessageList, Object.assign({}, messageListProps, { className: b('message-list', messageListProps.className) })) })) }));
|
|
18
|
+
: messageListProps && (_jsx("div", { className: b('message-list-container'), children: _jsx(MessageList, Object.assign({}, messageListProps, { className: b('message-list', messageListProps.className), qa: `message-list${qa ? `-${qa}` : ''}` })) })) }));
|
|
19
19
|
}
|