-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(ai): ensure entries are populated when exporting group chat #14651
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
base: main
Are you sure you want to change the base?
Conversation
| this.entries = stateManager.getSelectedEntries(); | ||
| this.entries = (entries != null && !entries.isEmpty()) | ||
| ? entries | ||
| : stateManager.getSelectedEntries(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange code!
When is entries null? Is it a different mode? Is the caller doing something wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that while the previous code fixed the "chat with group" issue, it introduced a regression for standard multi-selection.
Specifically, when right-clicking a multi-selection to start a chat, the UI often passes only the single focused row, causing the multi-selection to be lost.
I have now modified the logic to handle both scenarios:
- It detects if the passed entry is just a subset of the current multi-selection (fixing the right-click issue).
- It correctly prioritizes the passed entries for Group Chat .
I believe that if we don't add the option to directly chat with a group when creating a new library, the entries will be empty when exported. However, I think this might be permissible; otherwise, this option should be disabled.
|
|
||
| ObservableList<BibEntry> currentSelection = stateManager.getSelectedEntries(); | ||
|
|
||
| if (entries != null && !entries.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can entries be null? I would have thought it's an empty list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #14651 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Siedlerchr You are right. I re-verified the behavior. I initially assumed that the conflict resolution between the passed entries and the global selection might lead to a null value in some edge cases. However, when the issue was solved, I see that it consistently results in an empty list[] when no selection is active, not null.
I have removed the unnecessary null check. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont use AI to communicate with us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@calixtus OK,I will not use the translator with the function of AI, last week I did my work so that I did not response immediately. Is there any issue with my PR now?
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
…ix-group-export-entries
Closes #14647
This PR fixes a bug where exporting an AI chat session initiated via "Chat with group" resulted in an empty
entrieslist in the exported file.The Fix:
I updated the
AiChatComponentconstructor logic to prioritize theentrieslist passed as an argument. The component now falls back tostateManager.getSelectedEntries()only if the passed list is null or empty. This ensures that the correct context is used for export in both "Chat with group" and "Chat with selected entry" modes.Steps to test
"entries"array should now contain the bibliographic data of the papers in that group (previously it was empty[]).Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)