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

Fix group chat history and group embeddings generation #11795

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public void initialize() {
JabRefGUI.aiService = new AiService(
preferences.getAiPreferences(),
preferences.getFilePreferences(),
preferences.getCitationKeyPatternPreferences(),
dialogService,
taskExecutor);
Injector.setModelOrService(AiService.class, aiService);
Expand Down Expand Up @@ -376,6 +375,8 @@ public void stop() {
} catch (Exception e) {
LOGGER.error("Unable to close AI service", e);
}
LOGGER.trace("Closing chat history service");
chatHistoryService.close();
LOGGER.trace("Closing OpenOffice connection");
OOBibBaseConnect.closeOfficeConnection();
LOGGER.trace("Stopping background tasks");
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/logic/ai/AiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public class AiService implements AutoCloseable {

public AiService(AiPreferences aiPreferences,
FilePreferences filePreferences,
CitationKeyPatternPreferences citationKeyPatternPreferences,
NotificationService notificationService,
TaskExecutor taskExecutor
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javafx.beans.property.StringProperty;
import javafx.util.Pair;

import org.jabref.gui.util.UiTaskExecutor;
import org.jabref.logic.FilePreferences;
import org.jabref.logic.ai.processingstatus.ProcessingInfo;
import org.jabref.logic.ai.processingstatus.ProcessingState;
Expand Down Expand Up @@ -79,7 +80,8 @@ public Void call() throws Exception {
linkedFiles
.stream()
.map(processingInfo -> {
processingInfo.setState(ProcessingState.PROCESSING);
UiTaskExecutor.runInJavaFXThread(() -> processingInfo.setState(ProcessingState.PROCESSING));
Copy link
Member

Choose a reason for hiding this comment

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

This is the wrong place, see my other PR

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm, I see.

But I had an exception on this line. Maybe I'll investigate the bug further later. I'll just focus on group chat history in this PR

Copy link
Member

Choose a reason for hiding this comment

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

The exception comes because we access the UI, but at this point we are in "logic" and we cannot use UI In logic, thus we need to go the point in the UI where the notification is triggered.


return new Pair<>(
new GenerateEmbeddingsTask(
processingInfo.getObject(),
Expand Down
Loading