jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Scope "Chat with groups" to library

Open koppor opened this issue 11 months ago β€’ 44 comments

Currently, the "Chat with groups" uses a "global" name of the group.

If two libraries share the group name, the wrong entries might be used.

Example

Image

Steps to reproduce:

  1. Create two libraries
  2. Create entries in each library
  3. Attach PDF files in each library
  4. Enable AI https://docs.jabref.org/ai/preferences
  5. Chat with a group
  6. Switch to the other library
  7. Start chat with a group with the same name

See that the chat from step 5 is shown.


NOTE: This issue shows that the contributor is willing to get familiar with JabRef from the pont of a user.

koppor avatar Dec 17 '25 19:12 koppor

Hi @koppor, I have successfully reproduced the issue locally. The chat history is indeed shared between libraries if the group name is identical. I am working on a fix now. Please assign this to me.

SonarAkash avatar Dec 18 '25 12:12 SonarAkash

πŸ‘‹ Hey @SonarAkash, looks like you’re eager to work on this issue β€” great! πŸŽ‰ It also looks like you don't know how to assign issues to yourself. Please read our CONTRIBUTING.md to find out how. It will also guide you in other aspects of contributing to JabRef.

jabref-machine avatar Dec 18 '25 12:12 jabref-machine

/assign-me

SonarAkash avatar Dec 18 '25 12:12 SonarAkash

πŸ‘‹ Hey @SonarAkash, thank you for your interest in this issue! πŸŽ‰

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

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

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! πŸš€

jabref-machine avatar Dec 18 '25 12:12 jabref-machine

I am unassigning myself from this issue. Here is my investigation for the next person:

Root Cause: AiChatComponent.java initializes bibDatabaseContext and aiChatLogic as final fields in the constructor. Because the component persists when switching tabs, these fields never update, causing the chat to get stuck on the first library opened.

Attempted Fix: I tried refactoring the component to listen to stateManager.activeDatabaseProperty(). On change, it should update the local bibDatabaseContext, re-instantiate AiChatLogic, and cache the chat history.

Remaining Bug: I ran into collision issues where switching between two libraries with empty selections caused them to share the same chat history ID (e.g., both resolving to "NONE"). The getContextId method needs to include the library path/name to ensure uniqueness.

SonarAkash avatar Dec 18 '25 15:12 SonarAkash

@SonarAkash Thank you for the investigation.

I think, the contextId is the id if a BibDatabaseContext? Then, this should be unique in a JabRef session; no need for a library path. Think of that saving a library to another path should keep the chats.

koppor avatar Dec 19 '25 01:12 koppor

/assign-me

omkarrr2533 avatar Dec 19 '25 16:12 omkarrr2533

πŸŽ‰ Issue Assignment Confirmation

Hey @omkarrr2533, thanks for taking on this issue!

[!IMPORTANT] This issue will be automatically unassigned if idle for 14 days.

ℹ️ Important information
  • To prevent automatic unassignment, a maintainer can add the πŸ“Œ Pinned label
  • You can unassign yourself at any time by commenting with /unassign-me
  • Updates and status reports are encouraged to show progress

jabref-machine avatar Dec 19 '25 16:12 jabref-machine

⏰ Assignment Reminder

Hi @omkarrr2533, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 7 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 7 days
  • Asking for the πŸ“Œ Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar Dec 26 '25 12:12 github-actions[bot]

/assign-me

Priyanshug254 avatar Jan 30 '26 17:01 Priyanshug254

⚠️ Issue Already Assigned

Hi @Priyanshug254, this issue is currently assigned to @omkarrr2533.

[!NOTE] This issue is pinned and will not be automatically unassigned.

Options for contributors
  • Collaborate: You can ask the assignee if they want help
  • Maintainer assistance: A maintainer can add you as co-assignee if appropriate
  • Wait for completion: The issue will remain assigned until the work is complete

jabref-machine avatar Jan 30 '26 17:01 jabref-machine

@Priyanshug254 You have worked on multiple good first issues now. Its time to give others the chance to work on good first issues. Take an issue more challenging (good second issue etc.) Read on at https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md#i-am-a-student-or-a-beginner-to-open-source.

koppor avatar Feb 02 '26 00:02 koppor

/assign-me

LakshanKrithik avatar Feb 02 '26 06:02 LakshanKrithik

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

jabref-machine avatar Feb 02 '26 06:02 jabref-machine

⏰ Assignment Reminder

Hi @LakshanKrithik, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 7 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 7 days
  • Asking for the πŸ“Œ Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar Feb 08 '26 12:02 github-actions[bot]

πŸ“‹ Assignment Update

Hi @LakshanKrithik, due to inactivity, you have been unassigned from this issue.

Next steps


If you still want to work on this:

  • Submit a pull request showing your current state. You will be automatically assigned again.
  • Ask a maintainer to assign you again.

github-actions[bot] avatar Feb 22 '26 12:02 github-actions[bot]

/assign-me

iYashMaurya avatar Feb 23 '26 14:02 iYashMaurya

πŸ‘‹ Hey @iYashMaurya, thank you for your interest in this issue! πŸŽ‰

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

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

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! πŸš€

At this point in time, you raised 0 pull request(s) of which 0% (0/0) have been merged.

jabref-machine avatar Feb 23 '26 14:02 jabref-machine

Hey @koppor, While reproducing this issue, I observed very inconsistent behavior.

Specifically, when I open AI chat with a group in one library and then switch to another library that has a group with the same name, the AI sometimes continues to respond using the entries from the previously opened group instead of the currently selected group. Other times, it correctly uses the entries from the new group.

In some cases, the same chat window appears to be reused, and the responses or chat history seem to be influenced by the previously opened library’s group.

Because of this inconsistency, I wanted to confirm whether this is the exact issue being referred to here that the AI chat context is not properly scoped to the active library and group, and may reuse or leak context from a previously opened group with the same name.

Image

iYashMaurya avatar Feb 24 '26 19:02 iYashMaurya

@iYashMaurya You reformulated the issue in your own words. This shows understanding of the issue. I can confirm that your text matches the issue description.

koppor avatar Feb 24 '26 21:02 koppor