Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ai-pr-1' into ai-pr-1
Browse files Browse the repository at this point in the history
  • Loading branch information
InAnYan committed Jul 8, 2024
2 parents 7e70584 + 154d621 commit 27cb183
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.jabref.gui.ai.components.chatmessage.ChatMessageComponent;
import org.jabref.logic.ai.chathistory.ChatMessage;
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.WorkspacePreferences;

import com.airhacks.afterburner.views.ViewLoader;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
import javafx.scene.control.Tooltip;

import org.jabref.gui.DialogService;
import org.jabref.gui.ai.components.aichat.AiChatComponent;
import org.jabref.gui.ai.components.errorstate.ErrorStateComponent;
import org.jabref.gui.ai.components.privacynotice.PrivacyNoticeComponent;
import org.jabref.gui.entryeditor.EntryEditorPreferences;
import org.jabref.gui.entryeditor.EntryEditorTab;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.UiTaskExecutor;
import org.jabref.logic.ai.AiService;
import org.jabref.logic.ai.chat.AiChatLogic;
import org.jabref.logic.ai.chathistory.BibDatabaseChatHistory;
import org.jabref.logic.ai.chathistory.BibEntryChatHistory;
import org.jabref.logic.ai.chathistory.ChatMessage;
import org.jabref.logic.ai.embeddings.EmbeddingsGenerationTask;
import org.jabref.logic.ai.embeddings.events.FileIngestedEvent;
import org.jabref.logic.citationkeypattern.CitationKeyGenerator;
Expand All @@ -29,11 +23,8 @@
import org.jabref.model.entry.LinkedFile;
import org.jabref.preferences.FilePreferences;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.WorkspacePreferences;

import com.google.common.eventbus.Subscribe;
import dev.langchain4j.store.embedding.filter.MetadataFilterBuilder;
import org.slf4j.LoggerFactory;

public class AiChatTab extends EntryEditorTab {
private final DialogService dialogService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import java.util.Optional;

import javafx.scene.Node;
import javafx.scene.control.Tab;
import javafx.scene.layout.Pane;

import org.jabref.gui.DialogService;
import org.jabref.gui.ai.components.aichat.AiChatComponent;
Expand All @@ -19,7 +17,6 @@
import org.jabref.logic.ai.embeddings.EmbeddingsGenerationTask;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.preferences.WorkspacePreferences;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/frame/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private void createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.REBUILD_FULLTEXT_SEARCH_INDEX, new RebuildFulltextSearchIndexAction(stateManager, frame::getCurrentLibraryTab, dialogService, preferencesService.getFilePreferences(), preferencesService.getAiPreferences(), taskExecutor)),
factory.createMenuItem(StandardActions.REBUILD_FULLTEXT_SEARCH_INDEX, new RebuildFulltextSearchIndexAction(stateManager, frame::getCurrentLibraryTab, dialogService, preferencesService.getFilePreferences(), taskExecutor)),
factory.createMenuItem(StandardActions.REGENERATE_EMBEDDINGS_CACHE, new RegenerateEmbeddingsAction(stateManager, frame::getCurrentLibraryTab, dialogService, taskExecutor)),

new SeparatorMenuItem(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.gui.preferences.ai;

import java.util.Arrays;
import java.util.List;

import javafx.beans.property.BooleanProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.jabref.logic.pdf.search.PdfIndexer;
import org.jabref.logic.pdf.search.PdfIndexerManager;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.preferences.AiPreferences;
import org.jabref.preferences.FilePreferences;

import org.slf4j.Logger;
Expand All @@ -28,7 +27,6 @@ public class RebuildFulltextSearchIndexAction extends SimpleCommand {
private final GetCurrentLibraryTab currentLibraryTab;
private final DialogService dialogService;
private final FilePreferences filePreferences;
private final AiPreferences aiPreferences;
private final TaskExecutor taskExecutor;

private BibDatabaseContext databaseContext;
Expand All @@ -39,13 +37,11 @@ public RebuildFulltextSearchIndexAction(StateManager stateManager,
GetCurrentLibraryTab currentLibraryTab,
DialogService dialogService,
FilePreferences filePreferences,
AiPreferences aiPreferences,
TaskExecutor taskExecutor) {
this.stateManager = stateManager;
this.currentLibraryTab = currentLibraryTab;
this.dialogService = dialogService;
this.filePreferences = filePreferences;
this.aiPreferences = aiPreferences;
this.taskExecutor = taskExecutor;

this.executable.bind(needsDatabase(stateManager));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
import de.saxsys.mvvmfx.utils.validation.visualization.ControlsFxVisualizer;
import jakarta.inject.Inject;

/**
* This offers the user to connect to a remove SQL database.
* Moreover, it directly opens the shared database after successful connection.
*/
public class SharedDatabaseLoginDialogView extends BaseDialog<Void> {
@FXML private ComboBox<DBMSType> databaseType;
@FXML private TextField host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.jabref.logic.ai.chathistory.BibDatabaseChatHistory;
import org.jabref.preferences.AiPreferences;

import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import org.h2.mvstore.MVStore;

Expand Down Expand Up @@ -48,7 +48,7 @@ public Optional<ChatLanguageModel> getChatLanguageModel() {
}

/**
* Update the underlying {@link ChatLanguageModel] by current {@link AiPreferences} parameters.
* Update the underlying {@link ChatLanguageModel} by current {@link AiPreferences} parameters.
* When the model is updated, the chat messages are not lost.
* See {@link AiChatLogic}, where messages are stored in {@link ChatMemory},
* and {@link BibDatabaseChatHistory}, where messages are stored in {@link MVStore}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
import com.google.common.base.Splitter;
import com.tobiasdiez.easybind.EasyBind;
import jakarta.inject.Singleton;
import org.jspecify.annotations.Nullable;
import org.jvnet.hk2.annotations.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down

0 comments on commit 27cb183

Please sign in to comment.