Skip to content
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

Gen AI: format markdown, bot icon to top of message #58449

Merged
merged 2 commits into from
May 8, 2024

Conversation

bencodeorg
Copy link
Contributor

Two unrelated changes to the chat experience in gen AI:

  • support markdown responses
  • move the bot icon to the top of the response (this is what was spec'd in design, and is particularly noticeable with longer messages)
Before After
image image

Links

Testing story

Tested manually in responses containing markdown, responses containing normal text, and errored responses.

@bencodeorg bencodeorg requested a review from a team May 7, 2024 17:55
Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

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

🎉 🎉

Copy link
Contributor

@fisher-alice fisher-alice left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -43,6 +44,7 @@
.assistantMessage {
background-color: $light_gray_50;
border-radius: 0 16px 16px 16px;
margin-top: 14px; // a quarter of height of bot icon
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: icon seems a bit high when bot responses are single line.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still a nit but here are screenshots.

14px:
Screenshot 2024-05-07 at 1 02 29 PM

4px:
Screenshot 2024-05-07 at 1 02 17 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll play with it a bit! FWIW here's what the design mocks look like, need to figure out how to push down the bot message without adding extra space between the user and bot messages

image

Copy link
Contributor Author

@bencodeorg bencodeorg May 7, 2024

Choose a reason for hiding this comment

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

@fisher-alice want to give this another spin and see what you think? i think the main culprit of things being spaced out is a wide margin-bottom we had on bot and user messages, which I tightened up.

I also noticed that long single lines of code in an ordered list were overflowing the container (and were unscrollable), so I allowed scroll in the x direction for assistant messages. I cannot for the life of me get the bot to return it any more, but can simulate by modifying the dom directly:

image

Something like this in a response should repro the issue -- I don't see any other issues with content scrolling rather than just flowing onto the next line as I introduced overflow-x: scroll, but not totally sure):

<ol><li><code class="language-python">def add_numbers(num1, num2):
    sum = num1 + num2
    return sum
</code></li></ol>

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work finding the edge case and fixing! I was able to repro by making window narrower and saw your fix resolved it. 🎉

Screenshot 2024-05-08 at 10 45 48 AM

Copy link
Contributor

Choose a reason for hiding this comment

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

i think the main culprit of things being spaced out is a wide margin-bottom we had on bot and user messages, which I tightened up.

LGTM!

@bencodeorg bencodeorg merged commit 88393e6 into staging May 8, 2024
2 checks passed
@bencodeorg bencodeorg deleted the ben/gen-ai-support-markdown-response branch May 8, 2024 18:02
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.

None yet

3 participants