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

Generate embeddings and summaries of a group in context menu #11832

Merged
merged 10 commits into from
Oct 6, 2024

Conversation

InAnYan
Copy link
Collaborator

@InAnYan InAnYan commented Sep 25, 2024

Partially solves https://github.com/JabRef/jabref-issue-melting-pot/issues/546

image

Mandatory checks

- [ ] Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
- [ ] Tests created for changes (if applicable)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Your code currently does not meet JabRef's code guidelines.
We use OpenRewrite to ensure "modern" Java coding practices.
The issues found can be automatically fixed.
Please execute the gradle task rewriteRun, check the results, commit, and push.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".

src/main/java/org/jabref/gui/actions/StandardActions.java Outdated Show resolved Hide resolved
@@ -386,7 +396,6 @@ public void editGroup(GroupNodeViewModel oldGroup) {
}

public void chatWithGroup(GroupNodeViewModel group) {
// This should probably be done some other way. Please don't blame, it's just a thing to make it quick and fast.
if (currentDatabase.isEmpty()) {
dialogService.showErrorDialogAndWait(Localization.lang("Unable to chat with group"), Localization.lang("No library is selected."));
Copy link
Member

Choose a reason for hiding this comment

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

Is this branch ever it in th execution? Maybe, it can be replaced by a LOGGER.warn statement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, the code really can't proceed without a database.

I don't like that if there is no database, there is no reasonably visible response from the JabRef. Just a LOGGER.warn. Not sure what should I do

Copy link
Member

@koppor koppor Oct 4, 2024

Choose a reason for hiding this comment

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

What I mean, we could do assert !currentDatabase.isEmpty(). -- Thus: My bet is: This branch is never hit during real use in JabRef.

This creates an additional translation string - therefore I was thinking and worrying.

Comment on lines 443 to 446
if (currentDatabase.isEmpty()) {
dialogService.notify(Localization.lang("Unable to generate embeddings. No library is selected."));
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this branch ever it in th execution? Maybe, it can be replaced by a LOGGER.warn statement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

porposal for now. Re-use "Unable to chat" and add a LOGGER.warn with the full message. If user enounters this situation, we will see in the log.

Comment on lines 469 to 473
if (currentDatabase.isEmpty()) {
dialogService.notify(Localization.lang("Unable to generate summaries. No library is selected."));
return;
}

Copy link
Member

Choose a reason for hiding this comment

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

Is this branch ever it in th execution? Maybe, it can be replaced by a LOGGER.warn statement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

porposal for now. Re-use "Unable to chat" and add a LOGGER.warn with the full message. If user enounters this situation, we will see in the log.

Comment on lines 2641 to 2642
Unable\ to\ generate\ embeddings.\ No\ library\ is\ selected.=Unable to generate embeddings. No library is selected.
Unable\ to\ generate\ summaries.\ No\ library\ is\ selected.=Unable to generate summaries. No library is selected.
Copy link
Member

Choose a reason for hiding this comment

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

I think, these can be removed (see above) --> logger.warn outputs are not localized.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

These strings should then vanish.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Your code currently does not meet JabRef's code guidelines.
We use OpenRewrite to ensure "modern" Java coding practices.
The issues found can be automatically fixed.
Please execute the gradle task rewriteRun, check the results, commit, and push.

You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".

@InAnYan InAnYan requested a review from koppor October 3, 2024 07:41
@InAnYan
Copy link
Collaborator Author

InAnYan commented Oct 3, 2024

Updated, but can you tell me what should I do with that branch without database?

Leave as is or use LOGGER instead of a dialogService?

@InAnYan
Copy link
Collaborator Author

InAnYan commented Oct 6, 2024

I put an assert there)

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

micro comment.

@@ -59,6 +59,12 @@ public SummariesService(AiPreferences aiPreferences,
this.taskExecutor = taskExecutor;
}

/**
* Start generating summary of a {@link BibEntry}, if it was already generated.
Copy link
Member

Choose a reason for hiding this comment

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

I think, there is something missing before "if it was"

Suggested change
* Start generating summary of a {@link BibEntry}, if it was already generated.
* Start generating summary of a {@link BibEntry}, independent of whether if it was already generated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, it should mean: if it wasn't

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If it wasn't, it will start summarization task and put a ProcessingInfo in the map.

If it is generating, it will return current ProcessingInfo

Copy link
Member

Choose a reason for hiding this comment

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

Oops, it should mean: if it wasn't

Just reword and commit 😅

@koppor koppor enabled auto-merge October 6, 2024 11:37
# Conflicts:
#	src/main/java/org/jabref/gui/groups/GroupTreeView.java
#	src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
#	src/main/java/org/jabref/gui/sidepane/SidePaneContentFactory.java
#	src/main/java/org/jabref/logic/ai/summarization/SummariesService.java
#	src/main/resources/l10n/JabRef_en.properties
#	src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java
@koppor koppor added this pull request to the merge queue Oct 6, 2024
Merged via the queue into JabRef:main with commit b6efdee Oct 6, 2024
23 checks passed
@koppor koppor deleted the generate-ai-actions branch October 6, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants