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

Use react markdown component and sb-prose styles for AI chat modal #380

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

benjreinhart
Copy link
Contributor

@benjreinhart benjreinhart commented Oct 17, 2024

I kept noticing that markdown tags and styles from the AI responses were off. That's because we were using a partially implemented hand crafted markdown parser with the wrong tailwind classes (e.g., hardcoded colors to light mode).

Given we are not stream parsing markdown (at least not now), then we should use the marked-react library that we're already using in the notebook as well as the sb-prose styles we created for this purpose. That library, coupled with our styles, handles the vast majority of markdown formatting we expect from the AI or humans.

NOTE

These are follow ups.

  • The existing sb-prose styles are too big for the small chat panel. We will need a variant of sb-prose that is smaller than sb-prose but larger than sb-prose-mini.
  • The user's message should also use the react markdown component because users should be able to write markdown like they can inside claude, chat gpt, v0, etc.
  • The styling is sometimes really messed up because either AI responds with funky spacing as a result of inserting its responses into xml tags and/or the 'plan parser' parsing logic. As one example, there are sometimes excess spaces in the beginning of lines or excess newlines which can cause the resulting markdown parser to assume it was intentional and add more paragraphs or think that the indentation means it should be treated as a code block. This will likely need to be a combined effort by getting the prompt to be formatted AND the prompt parser to properly trim whitespace.
Screenshot 2024-10-17 at 7 45 43 AM

@benjreinhart benjreinhart merged commit f3a2d3a into main Oct 17, 2024
3 checks passed
@benjreinhart benjreinhart deleted the ai-markdown branch October 17, 2024 14:59
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.

1 participant