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 Markdown in AI Summary tab #12233

Open
InAnYan opened this issue Nov 25, 2024 · 17 comments · May be fixed by #12266
Open

Use Markdown in AI Summary tab #12233

InAnYan opened this issue Nov 25, 2024 · 17 comments · May be fixed by #12266
Assignees
Labels
AI Related to AI Chat/Summarization 📍 Assigned Assigned by assign-issue-action (or manually assigned) FirstTimeCodeContribution Triggers GitHub Greeter Workflow good first issue An issue intended for project-newcomers. Varies in difficulty. ui

Comments

@InAnYan
Copy link
Collaborator

InAnYan commented Nov 25, 2024

Is your suggestion for improvement related to a problem? Please describe.

Currently, summary is formatted in a TextArea. This allows text to be selected, but the formatting is ugly. Markdown is a de-facto standard for chat LLMs.

Describe the solution you'd like

Use Markdown in summary window.

Additional context

There is a long-standing problem with JavaFX: you cannot select Text or Label. Only text in TextField or TextArea can be selected. However, text in WebView can be selected, and it is already used in JabRef in entry preview!

Thus, you have 2 options:

  1. Implement Markdown using Text or Labels and add a button Copy somewhere at the end.
  2. Implement Markdown using WebView.

Option 1 is, I think, easier to implement, however option 2 is preferred

@InAnYan InAnYan added the AI Related to AI Chat/Summarization label Nov 25, 2024
@Siedlerchr
Copy link
Member

Implementation hint: Look at the MarkdownEditor

@InAnYan InAnYan added the ui label Nov 25, 2024
@Siedlerchr Siedlerchr added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Nov 29, 2024
@github-project-automation github-project-automation bot moved this to Normal priority in Prioritization Nov 29, 2024
@github-project-automation github-project-automation bot moved this to Free to take in Good First Issues Nov 29, 2024
@mulla028
Copy link
Contributor

@koppor, Hello!
I would like to take a shot here 😄

@Siedlerchr Siedlerchr added the FirstTimeCodeContribution Triggers GitHub Greeter Workflow label Nov 29, 2024
Copy link
Contributor

Welcome to the vibrant world of open-source development with JabRef!

Newcomers, we're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

⚠ Note that this issue will become unassigned if it isn't closed within 30 days.

🔧 A maintainer can also add the Pinned label to prevent it from being unassigned automatically.

Happy coding! 🚀

@koppor koppor moved this from Free to take to Assigned in Good First Issues Nov 29, 2024
@Siedlerchr
Copy link
Member

Siedlerchr commented Nov 29, 2024

/assign @mulla028

@ThiloteE
Copy link
Member

ThiloteE commented Nov 29, 2024

I don't think we should force Markdown. It should be toggleable. Sometimes I want to copy the unformated markdown somewhere else. Sometimes I want to copy the Markdown.

But yes, Markdown should be the default.

@koppor
Copy link
Member

koppor commented Nov 30, 2024

I don't think we should force Markdown. It should be toggleable. Sometimes I want to copy the unformated markdown somewhere else. Sometimes I want to copy the Markdown.

But yes, Markdown should be the default.

I think, you are requesting a context menu with two copy options as available in the context menu of an entry

Image

Note: this is not avaialble in the context menu of the preview (yet)

Image

@koppor koppor added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Nov 30, 2024
@koppor koppor moved this from Assigned to Free to take in Good First Issues Nov 30, 2024
@mulla028
Copy link
Contributor

mulla028 commented Dec 4, 2024

@InAnYan @koppor could you provide more description and what idea is about. Thank you!
Do you need an option copying AI Summary in a markdown format?

@ThiloteE
Copy link
Member

ThiloteE commented Dec 4, 2024

@koppor

No, I am explicitly talking about a toggle. Can be a tab or dropdown too. If push comes to shove also via right-click menu.

Reason: Eventually, html or other formatting could be added as well to the list. Not only do I argue that being able to copy the raw text is important, also in the mid / long term, we want to be be able to edit responses directly in the JabRef UI, which will enable having and fixing longer conversations, even when the model at first responded inadequately (obviously something out of scope for this issue here). Finally, being able to look at the source, just like in biblatex source tab is important, otherwise we will have users that raise issues like these: nomic-ai/gpt4all#864, which are basically formatting issues. Without the raw source, it is hard to debug them.

@ThiloteE
Copy link
Member

ThiloteE commented Dec 4, 2024

@mulla028

When you start JabRef and open the entry editor (by clicking on an entry), you can go to the AI summary / AI chat tab. Copying is already possible and it should still be possible, even with the markdown feature.

IMHO, if my proposal to use a toggle, tab, dropdown, right-click menu to switch between normal and markdown view gets implemented, then copying should work for both views (also via selecting all text via ctrl + a and then copy via ctrl + c).

Related documentation:

@mulla028
Copy link
Contributor

mulla028 commented Dec 4, 2024

@ThiloteE
So the Idea is to add the toggle which will convert the AI Summary into markdown format right, but If toggle is off it should be just normal text, am I getting it right?

@InAnYan
Copy link
Collaborator Author

InAnYan commented Dec 4, 2024

Hi, @mula! Is there anything specific you want to ask about my issue?

I might've formulated it wrong. By "use Markdown" I meant, that LLM models typically generate output not just in plain text, but in markdown (rich text), and we need a way to display a Markdown not in its source, but to apply it and stylize the text.

By "1. Use Text or Labels for Markdown" I meant to render Markdown as several Text elements with different CSS styles. For that you need a Markdown parser.

By "2. Use WebView" I mean using a web view component in summary tab. In this option you need to convert Markdown to HTML (I think JabRef already has something like that).

Thilo has proposed a new feature: toggling. It will allow you to switch between styles: one using TextArea (this is what we already have) and Markdown rendering (two options I told above). This will be a great plus if you implement option 1. If you implement option 2, then there would be no need to show Markdown source in TextArea, as users are able to copy from WebView

@mulla028
Copy link
Contributor

mulla028 commented Dec 5, 2024

@koppor @Siedlerchr
How do you prefer it to be implemented?

@koppor
Copy link
Member

koppor commented Dec 5, 2024

@mulla028 Use WebView. See org.jabref.logic.layout.format.MarkdownFormatter#format of how to transform Markdown to HTML.

WebView component is OK, because it is only one. Similar to the EntryPreview, where we also use one.

Reason: The user experience with WebView is better than having multiple copy buttons. Nearly no other app has that...


@InAnYan

This is ADR-0036?

Can you link "only one package" in the ADR (you will find the text in the ADR itself)

Your option 2 here is option "Use a Markdown parser to convert content into HTML and use a WebView for one message" in that ADR? Wasn't that considered bad? What has changed now?

@InAnYan
Copy link
Collaborator Author

InAnYan commented Dec 5, 2024

  1. This is ADR for chat history (yeah, I haven't written an ADR for summarization).
  2. Because WebView is only one, I think it is okay (rather than having 10 WebViews for 10 chat messages)

@mulla028
Copy link
Contributor

mulla028 commented Dec 5, 2024

@mulla028 Use WebView. See org.jabref.logic.layout.format.MarkdownFormatter#format of how to transform Markdown to HTML.

WebView component is OK, because it is only one. Similar to the EntryPreview, where we also use one.

Reason: The user experience with WebView is better than having multiple copy buttons. Nearly no other app has that...

@InAnYan

This is ADR-0036?

Can you link "only one package" in the ADR (you will find the text in the ADR itself)

Your option 2 here is option "Use a Markdown parser to convert content into HTML and use a WebView for one message" in that ADR? Wasn't that considered bad? What has changed now?

Sounds good 👍

@mulla028 mulla028 linked a pull request Dec 5, 2024 that will close this issue
7 tasks
@koppor
Copy link
Member

koppor commented Dec 6, 2024

  1. This is ADR for chat history (yeah, I haven't written an ADR for summarization).

@InAnYan Can you craft a new (short) ADR for chat summarization and reference that ADR? Moreover, fix that ADR by adding the link to the markdown framework?

@InAnYan
Copy link
Collaborator Author

InAnYan commented Dec 6, 2024

  1. This is ADR for chat history (yeah, I haven't written an ADR for summarization).

@InAnYan Can you craft a new (short) ADR for chat summarization and reference that ADR? Moreover, fix that ADR by adding the link to the markdown framework?

#12277

Made a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Related to AI Chat/Summarization 📍 Assigned Assigned by assign-issue-action (or manually assigned) FirstTimeCodeContribution Triggers GitHub Greeter Workflow good first issue An issue intended for project-newcomers. Varies in difficulty. ui
Projects
Status: Free to take
Status: Normal priority
Status: No status
Development

Successfully merging a pull request may close this issue.

5 participants