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

Add "regenerate" button to AI chat tab #12191

Open
ThiloteE opened this issue Nov 15, 2024 · 12 comments
Open

Add "regenerate" button to AI chat tab #12191

ThiloteE opened this issue Nov 15, 2024 · 12 comments
Assignees
Labels
AI Related to AI Chat/Summarization 📍 Assigned Assigned by assign-issue-action (or manually assigned) ui

Comments

@ThiloteE
Copy link
Member

ThiloteE commented Nov 15, 2024

JabRef 6.0--2024-11-13--5f1dd59
Windows 10 10.0 amd64
Java 23.0.1
JavaFX 23.0.1+4

Problem:

If the response of the AI in the AI Chat tab of the entry editor is inadequate, the whole conversation first has to be deleted and then started anew.
A workflow that involves multiple generations of a chat model to find a better response is hardly possible, if the conversation is long.

Solution that I would like:

Add regenerate button for AI chat.
Expected behaviour: Clicking the button will trigger a new response by the large language model.

Additional context

Current UI of the AI Chat tab in JabRef:
Image

Maybe GPT4All can be an inspiration for the location:
Image

@ThiloteE ThiloteE added the AI Related to AI Chat/Summarization label Nov 15, 2024
@github-project-automation github-project-automation bot moved this to Free to take in Good First Issues Nov 15, 2024
@github-project-automation github-project-automation bot moved this to Normal priority in Prioritization Nov 15, 2024
@ThiloteE ThiloteE added the ui label Nov 15, 2024
@arshchawla21
Copy link
Contributor

Hello maintainers, I am interested in taking on this issue if possible!

@koppor
Copy link
Member

koppor commented Nov 16, 2024

/assign @arshchawla21

Copy link
Contributor

👋 Hey @arshchawla21, thank you for your interest in this issue! 🎉

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.

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 30 days (by 16 December 2024). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

@github-actions github-actions bot added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Nov 16, 2024
@Princccee
Copy link

Hey maintainers!
I'm interested in solving this issue.

@koppor
Copy link
Member

koppor commented Nov 29, 2024

/unassign @arshchawla21

Copy link
Contributor

👋 Hey @arshchawla21, you've been automatically unassigned from this issue due to inactivity.

Note

If you'd like to be re-assigned, just leave another comment or ask a maintainer to assign you again.
If you're still actively working on the issue, let us know by commenting, and we can pin it to prevent automatic unassignment.

@github-actions github-actions bot removed the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Nov 29, 2024
@koppor
Copy link
Member

koppor commented Nov 29, 2024

/assign @Princccee

Copy link
Contributor

👋 Hey @Princccee, thank you for your interest in this issue! 🎉

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.

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 90 days (by 27 February 2025). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

@github-actions github-actions bot added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Nov 29, 2024
@ThiloteE ThiloteE moved this from Free to take to Assigned in Good First Issues Nov 29, 2024
@ThiloteE
Copy link
Member Author

We are currently using Langchain4j to manage LLMs in the JabRef 6.0 development version. I opened an issue over there, because I haven't found anything related in their documentation. See langchain4j/langchain4j#2215.

I found a Q&A related to how the memory is structured: langchain4j/langchain4j#2035. Maybe it helps.

Maybe also @InAnYan can give a pointer to where one could start in the code.

@InAnYan
Copy link
Collaborator

InAnYan commented Nov 30, 2024

Fixing this issue should be simple.

You need to add a button for regeneration on the side of chat message, near the "delete" button.

Because chat history and chat message componenta are decoupled, you need to add a callback for regenerate button in chat message component constructor.

Then you need to implement "regenerate" method in chat history component, which you will pass to chat message constructor. This method will delete last AI message and call AI again

@ThiloteE
Copy link
Member Author

ThiloteE commented Dec 4, 2024

langchain4j responded in the issue I raised:

[...] there is no explicit "remove last interaction" functionality in LC4j.

If you operate on the low-level ChatLanguageModel + ChatMemory API, you can do this like so:

  1. List<ChatMessage> messages = ChatMemory.messages()

  2. Modify messages as you wish (e.g. remove latest AiMessage and UserMessage from the end of the list)

  3. Call ChatMemory.clear()

  4. Call ChatMemory.add() for every remaining message in messages

@InAnYan
Copy link
Collaborator

InAnYan commented Dec 4, 2024

Yes! This should be done manually.

And in my code there should be a method for deleting both message from LLM chat memory and chat history (yeah, there are 2 histories 😄 )

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) ui
Projects
Status: Assigned
Status: Normal priority
Status: No status
Development

No branches or pull requests

5 participants