Skip to content

Commit 5429fd5

Browse files
authored
fix: scroll to bottom button didnt show during streaming (carbon-design-system#1007)
1 parent 3f78178 commit 5429fd5

30 files changed

+2267
-905
lines changed

packages/ai-chat-components/src/components/chat-shell/src/workspace-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export class WorkspaceManager {
8181
this.throttledHandleHostResize = throttle(
8282
(inlineSize: number) => this.handleHostResize(inlineSize),
8383
100,
84+
{ leading: true, trailing: true },
8485
);
8586
}
8687

packages/ai-chat-components/src/components/markdown/src/markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class CDSAIChatMarkdown extends LitElement {
326326
return trackedTask;
327327
},
328328
100,
329-
{ leading: true },
329+
{ leading: true, trailing: true },
330330
);
331331

332332
protected async getUpdateComplete(): Promise<boolean> {

packages/ai-chat/src/aiChatEntry.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export {
5353
WriteableElementName,
5454
WriteableElements,
5555
} from "./types/instance/ChatInstance";
56+
export { AutoScrollOptions } from "./types/utilities/HasDoAutoScroll";
5657
export { LayoutCustomProperties } from "./types/config/LayoutCustomProperties";
5758

5859
export { CornersType } from "./types/config/CornersType";

packages/ai-chat/src/chat/components-legacy/MessageComponent.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import { HasServiceManager } from "../hocs/withServiceManager";
6060
import actions from "../store/actions";
6161
import { AppConfig } from "../../types/state/AppConfig";
6262
import { HasClassName } from "../../types/utilities/HasClassName";
63-
import { HasDoAutoScroll } from "../../types/utilities/HasDoAutoScroll";
6463
import HasIntl from "../../types/utilities/HasIntl";
6564
import HasLanguagePack from "../../types/utilities/HasLanguagePack";
6665
import {
@@ -136,8 +135,7 @@ interface MessageProps
136135
HasServiceManager,
137136
HasLanguagePack,
138137
HasClassName,
139-
HasAriaAnnouncer,
140-
HasDoAutoScroll {
138+
HasAriaAnnouncer {
141139
/**
142140
* The local message item that is part of the original message.
143141
*/
@@ -1042,7 +1040,6 @@ class MessageComponent extends PureComponent<MessageProps, MessageState> {
10421040
disableUserInputs,
10431041
showAvatarLine,
10441042
className,
1045-
doAutoScroll,
10461043
isMessageForInput,
10471044
scrollElementIntoView,
10481045
isFirstMessageItem,
@@ -1075,7 +1072,6 @@ class MessageComponent extends PureComponent<MessageProps, MessageState> {
10751072
disableUserInputs={disableUserInputs}
10761073
isMessageForInput={isMessageForInput}
10771074
config={config}
1078-
doAutoScroll={doAutoScroll}
10791075
scrollElementIntoView={scrollElementIntoView}
10801076
showChainOfThought={isLastMessageItem}
10811077
hideFeedback={hideFeedback}

packages/ai-chat/src/chat/components-legacy/MessageTypeComponent.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ function MessageTypeComponent(props: MessageTypeComponentProps) {
376376
MessageErrorState.FAILED_WHILE_STREAMING
377377
}
378378
removeHTML={removeHTML}
379-
doAutoScroll={props.doAutoScroll}
380379
/>
381380
);
382381
}
@@ -483,17 +482,15 @@ function MessageTypeComponent(props: MessageTypeComponentProps) {
483482
message: LocalMessageItem,
484483
originalMessage: MessageResponse,
485484
) {
486-
const { serviceManager, doAutoScroll } = props;
485+
const { serviceManager } = props;
487486
return (
488487
<UserDefinedResponse
489-
streamingState={message.ui_state.streamingState}
490488
isStreamingError={
491489
originalMessage?.history?.error_state ===
492490
MessageErrorState.FAILED_WHILE_STREAMING
493491
}
494492
localMessageID={message.ui_state.id}
495493
serviceManager={serviceManager}
496-
doAutoScroll={doAutoScroll}
497494
/>
498495
);
499496
}
@@ -560,7 +557,7 @@ function MessageTypeComponent(props: MessageTypeComponentProps) {
560557
localMessageItem: LocalMessageItem<ConversationalSearchItem>,
561558
fullMessage: MessageResponse,
562559
) {
563-
const { scrollElementIntoView, doAutoScroll } = props;
560+
const { scrollElementIntoView } = props;
564561
return (
565562
<ConversationalSearch
566563
localMessageItem={localMessageItem}
@@ -569,7 +566,6 @@ function MessageTypeComponent(props: MessageTypeComponentProps) {
569566
fullMessage?.history?.error_state ===
570567
MessageErrorState.FAILED_WHILE_STREAMING
571568
}
572-
doAutoScroll={doAutoScroll}
573569
/>
574570
);
575571
}

packages/ai-chat/src/chat/components-legacy/MessagesComponent.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
@use "@carbon/styles/scss/components/button/tokens";
1414
@use "../styles/chat-theme";
1515

16+
.cds-aichat--typing-indicator--hidden {
17+
visibility: hidden;
18+
}
19+
1620
.cds-aichat--messages--holder {
1721
display: flex;
1822
overflow: hidden;

0 commit comments

Comments
 (0)