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

[AI Tutor] CT-503: Format OpenAI responses using markdown #58270

Merged
merged 4 commits into from
May 1, 2024

Conversation

ebeastlake
Copy link
Contributor

@ebeastlake ebeastlake commented Apr 26, 2024

The following PR formats the AI response in markdown, so code blocks are properly rendered.

Links

Jira ticket: https://codedotorg.atlassian.net/browse/CT-503

Testing story

Screenshot 2024-04-26 at 3 32 44 PM

Screenshot 2024-04-26 at 3 33 36 PM

Screenshot 2024-04-26 at 3 34 10 PM

Follow-up work

We want to add the ability to copy a code block -- this is in a separate PR because it's riskier and requires refactoring the SafeMarkdown component.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@ebeastlake
Copy link
Contributor Author

The code block and horizontal rule don't seem exactly right in the list, but code blocks are rendering appropriately in normal responses and the horizontal rule is unlikely to get used, I think. Is it worth spending time to investigate?

Copy link
Contributor

@molly-moen molly-moen left a comment

Choose a reason for hiding this comment

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

Looks good to me! For the incorrect markdown in the list, is the text being sent correct markdown or is the ai messing up? My guess is it's the AI's fault...

@ebeastlake
Copy link
Contributor Author

I confirmed it's the AI's fault! It was escaping the backticks on the code blocks (i.e., ```) and adding triple backticks around the horizontal rule. Without those, they each render correctly.

Screenshot 2024-04-29 at 10 28 34 PM Screenshot 2024-04-29 at 10 30 44 PM

@ebeastlake ebeastlake merged commit b6fa27c into staging May 1, 2024
2 checks passed
@ebeastlake ebeastlake deleted the emily/ct-503/properly-formatted-responses branch May 1, 2024 15:04
ebeastlake added a commit that referenced this pull request May 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.

None yet

2 participants