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

Export chats to markdown or HTML #230

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

Export chats to markdown or HTML #230

wants to merge 7 commits into from

Conversation

Jurredr
Copy link
Contributor

@Jurredr Jurredr commented Feb 5, 2025

Problem

Users would like to export their chats so that they can revisit them later.

Solution

  • Added a serialization function to serialize a tab to an HTML or markdown string
  • For markdown, it will list all card body strings, separated by an empty line and ---
  • For HTML, it will include the MynahUI stylesheets to replicate the chat window, with all buttons / interactions removed from the cards:
    Screenshot 2025-02-05 at 14 10 50

The example app includes an example of calling this serialization and using it to download a file.

Tests (NA)

- [ ] I have tested this change on VSCode
- [ ] I have tested this change on JetBrains

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Jurredr Jurredr added the new feature New feature or request label Feb 5, 2025
@Jurredr Jurredr self-assigned this Feb 5, 2025
@Jurredr Jurredr requested a review from a team as a code owner February 5, 2025 13:23
@Jurredr Jurredr closed this Feb 5, 2025
@Jurredr Jurredr reopened this Feb 5, 2025
@Jurredr
Copy link
Contributor Author

Jurredr commented Feb 5, 2025

Don't merge yet!

* @param tabId Corresponding tab ID.
* @param fileType Whether to serialize to markdown or HTML format
*/
public serializeChat = (tabId: string, fileType: 'markdown' | 'html'): string => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: just type or contentType would be better, since we're sending content instead of an actual file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally right, thanks, will fix

Copy link
Collaborator

@dogusata dogusata left a comment

Choose a reason for hiding this comment

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

Brilliant!

@dogusata
Copy link
Collaborator

dogusata commented Feb 7, 2025

Maybe also removing the code block actions and then releasing it would be a better idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants