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

feat(chat): Improve markdown handling #1777

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gadenbuie
Copy link
Collaborator

@gadenbuie gadenbuie commented Nov 20, 2024

Initially, this PR started by allowing content_type on <shiny-user-chat> to customize the content type of the user message (previously hard-coded to `"semi-markdown").

I still think that's a reasonable thing to do, but I think we could simplify and have a single "markdown" mode. That said, I've kept markdown and semi-markdown for now, but I've refactored them a bit. semi-markdown now lets more HTML through while escaping any unknown tags to retain them in the markup.

We can consolidate into markdown, html and text message modes by reverting b90c211.

Example prompts

<img src="https://placehold.co/200x200"> ![](https://placehold.co/200x200) <example>thing</example>
Before After
image image

Note that if we made markdown and semi-markdown the same thing, the echoed output from this assistant would match the user message presentation.

You’re a financial analyst at **AcmeCorp**. Generate a Q2 financial report for our investors.

This is an 'unusual' character: "&amp;".

Use this data for your report:<data>{{SPREADSHEET_DATA}}</data>

<instructions>
1. Include sections: Revenue Growth, Profit Margins, Cash Flow.
2. Highlight strengths and areas for improvement.
</instructions>

Make your tone concise and professional. Follow this structure:
<formatting_example>{{Q1_REPORT}}</formatting_example>
Before After
image image

@gadenbuie gadenbuie marked this pull request as ready for review November 20, 2024 16:21
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