You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/components/messageSpace/messageSpace.stories.tsx
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ function getProfileIconAndName(message: Message) {
65
65
}
66
66
67
67
meta.argTypes={
68
-
messages: {
68
+
receivedMessages: {
69
69
table: {
70
70
type: {
71
71
summary: 'Array of Message.\n',
@@ -86,6 +86,8 @@ meta.argTypes = {
86
86
},
87
87
},
88
88
ws: {
89
+
description:
90
+
'WebSocket connection to send and receive messages to and from a backend. The onReceive prop will override the default handler once it is set. If you need to use the WebSocket for purposes other than chat, you will need to create a separate WebSocket connection.',
// Check if sender is the same for update messages
47
+
if(
48
+
message.format.includes('update')&&
49
+
originalMessage&&
50
+
originalMessage.sender.id!==message.sender.id
51
+
){
52
+
key=message.id
53
+
}
54
+
55
+
if(!newMessages[key]){
56
+
newMessages[key]=[]
44
57
}
58
+
59
+
newMessages[key]=newMessages[key].concat(message)
60
+
45
61
returnnewMessages
46
62
}else{
47
63
returnmessages
@@ -51,7 +67,7 @@ function getCombinedMessages(
51
67
/**
52
68
The `MessageSpace` component uses `MessageCanvas` and `ElementRenderer` to render a list of messages. It serves as a container for individual message items, each encapsulated within a `MessageCanvas` for consistent styling and layout. It can receive and process messages to dynamically update the displayed content.
53
69
54
-
The `MessageSpace` component can combine update messages with the original message and render them as a single message. For this to work, the `threadId` of the update message must match the `id` of the original message, and the format of the update message must include 'update'.
70
+
The `MessageSpace` component can combine update messages with the original message and render them as a single message. For this to work, the `threadId` of the update message must match the `id` of the original message, and the format of the update message should be prefixed with 'update'. For example, if the original message format is 'streamingText', the update message format should be 'updateStreamingText'.
55
71
56
72
Note: For more information about the `getActionsComponent` and `getProfileComponent` fields, refer to the [MessageCanvas' docs](http://localhost:6006/?path=/docs/rustic-ui-message-canvas-message-canvas--docs).
57
73
*/
@@ -82,14 +98,6 @@ export default function MessageSpace(props: MessageSpaceProps) {
0 commit comments