-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Studio: Add animation when we receive a message UI #267
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the changes and worked as expected. However, I'm not approving the PR due to the React warning I shared below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the animation.
I updated the description of https://github.com/Automattic/dotcom-forge/issues/7679 , let's make the animation from bottom to up, for AI and also User messages.
I think for AI the animation could be in the three dots only, and then replace the text inside.
Current implementation:
message-animation.mp4
@sejas , I tried implementing it with tailwind, but I couldn't make it. Please, take a look. NOTE: All the logic we have ( except the CodeBlock part ), is pretty much a ripoff big-sky UI. I'm wondering if it make sense to switch to that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that we are using like a slide-up animation when the message appears. I'm not sure if it combines well with the animation of scrolling down the content. What do you think about using horizontal animations?
Left-to-right for AI assistant messagesRight-to-left for user messages
UPDATE: As shared here, the goal is to present messages from bottom to top, so they should be animated vertically.
Additionally, I wonder if we could space out the animations of the user message and the ...
(i.e. thinking) message. This way it will mimic a conversation. Currently, both messages show up at the same time.
ai-assistant-animation.mp4
Following https://github.com/Automattic/dotcom-forge/issues/7679 and the animation example, I think we need to tweak the scroll and animations a bit to imitate the bottom-to-top flow. The scroll should always remain at the bottom. |
Agree 👍 When the assistant comes back with a response, is it possible to display the message in the same bubble as the thinking animation? At the moment, the thinking bubble is removed and a new bubble is added below. This leads to a weird transition where the height of the chat is initially reduced as the thinking bubble is removed, but then it jumps up again once the new message is added. It would be smoother if we could replace the thinking dots with the new message. Screen.Recording.2024-06-24.at.10.04.33.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the following items when testing the latest changes:
Scroll is animated when navigating to the assistant tab
From my side, I think this isn't necessary. I'd expect that the chat starts in the last message without any animation. Additionally, it doesn't scroll completely to the bottom.
ai-animate-scroll-upon-navigation.mp4
Messages are animated when switching sites
Not sure if this effect is on purpose but it might be confusing as it feels like it's removing messages.
ai-message-animated-when-switching-site.mp4
Transition between thinking and AI response
As mentioned by Matt here, it would be great to reuse the same container when transitioning between the thinking state and the AI response. Currently, it's removing message while adding the other.
@kozer Let's reduce the delay before showing the thinking bubble to |
@fluiddot , @matt-west , can you please check this PR again? |
Avoids an awkward scroll jump when the assistant responds with a single line message.
Thanks @kozer. This looks much better. I pushed a minor change to fix an issue where the scroll bar jumped if the assistant returned a single line message. It was because the height of the loading bubble is less than the height of a single message. The fix sets a min-height on the loading bubble to prevent this. I'm not sure if it's related to this PR, but I noticed that markdown isn't always rendered correctly when a message first appears. Sometimes switching tabs or sending another message fixes it. Screen.Recording.2024-07-02.at.10.59.47.mov |
I'll check this out. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed Markdown syntax in AI responses. The content is only rendered properly after submitting another prompt:
ai-studio-markdown-bug.mp4
@matt-west , it should have been fixed now. |
Yep, looks good now. Thanks @kozer! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊 ! Thanks @kozer for addressing the comments I shared 🙇 !
aria-labelledby={ id } | ||
className={ cx( | ||
'inline-block p-3 rounded border border-gray-300 overflow-x-auto select-text', | ||
'inline-block p-3 rounded border overflow-x-auto select-text', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kozer Is there a reason we are adding this line twice - once with border-gray-300
and the second tine without it but with all other identical classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch Kat! No, just leftover from while no was working on it. Feel free to clean it up! Thanks for looking at this one!
Fixes https://github.com/Automattic/dotcom-forge/issues/7679
Proposed Changes
This PR adds animations when the user receives a new message.
Also, the following changes have implemented:
Testing Instructions
2024-06-26.22-50-26.mp4
Pre-merge Checklist