Skip to content

Conversation

@lyjeileen
Copy link
Collaborator

@lyjeileen lyjeileen commented Jul 30, 2024

Changes

  • Handle receiving and processing messages in MessageSpace
    • props.messages is used to pass unprocessed messages from the page level. props.ws.onReceive is used to receive and handle incoming messages from websocket. Original message and its update messages are combined into a single array and stored in the chatMessages ({[messageId: string]: Message[]})) for quick data retrieval.
  • Make relevant changes to ElementRenderer
    • Message[] which contains original message and update messages is passed to ElementRenderer. ElementRenderer renders component with original message as well as updated data from update messages.
  • Change the type for ws.onReceive from (handler: (event: MessageEvent) => void) => void to onReceive?: (handler: (message: Message) => void) => void. This enables parsing and transforming event data at the application level, reducing code repetition.
  • PromptBuilder is updated since it uses elementRenderer.
  • Remove ThreadableMessage
  • Update tests and stories

Screenshots

Before

Screenshot 2024-07-31 at 4 48 42 PM

After

Screenshot 2024-08-01 at 10 39 05 AM Screenshot 2024-08-01 at 10 39 49 AM

})

setChatMessages(messageDict)
}, [props.messages])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}, [props.messages])
}, [props.messages.length])

@lyjeileen lyjeileen changed the title [WIP] fix: update message handling fix: update message handling Aug 1, 2024
@lyjeileen lyjeileen marked this pull request as ready for review August 1, 2024 00:20
}

useEffect(() => {
if (props.ws.onReceive) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (props.ws.onReceive) {
if (props.ws) {

@lyjeileen lyjeileen requested review from Shiti and kaseyvee August 1, 2024 17:44
@Shiti Shiti merged commit 3b2c7f7 into rustic-ai:main Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants