Skip to content

Commit

Permalink
Merge branch 'main' into remove-review-dog
Browse files Browse the repository at this point in the history
  • Loading branch information
calixtus authored Oct 27, 2024
2 parents 6ba18f6 + a5b6156 commit fa2be78
Show file tree
Hide file tree
Showing 14 changed files with 267 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- When a search hits a file, the file icon of that entry is changed accordingly. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We added an AI-based chat for entries with linked PDF files. [#11430](https://github.com/JabRef/jabref/pull/11430)
- We added an AI-based summarization possibility for entries with linked PDF files. [#11430](https://github.com/JabRef/jabref/pull/11430)
- We added an AI section in JabRef's [preferences](https://docs.jabref.org/ai/preferences). [#11430](https://github.com/JabRef/jabref/pull/11430)
- We added AI providers: OpenAI, Mistral AI, Hugging Face and Google. [#11430](https://github.com/JabRef/jabref/pull/11430), [#11736](https://github.com/JabRef/jabref/pull/11736)
- We added AI providers: [Ollama](https://docs.jabref.org/ai/local-llm#step-by-step-guide-for-ollama) and GPT4All, which add the possibility to use local LLMs privately on your own device. [#11430](https://github.com/JabRef/jabref/pull/11430), [#11870](https://github.com/JabRef/jabref/issues/11870)
- We added support for selecting and using CSL Styles in JabRef's OpenOffice/LibreOffice integration for inserting bibliographic and in-text citations into a document. [#2146](https://github.com/JabRef/jabref/issues/2146), [#8893](https://github.com/JabRef/jabref/issues/8893)
- We added Tools > New library based on references in PDF file... to create a new library based on the references section in a PDF file. [#11522](https://github.com/JabRef/jabref/pull/11522)
- We added "Tools > New library based on references in PDF file" ... to create a new library based on the references section in a PDF file. [#11522](https://github.com/JabRef/jabref/pull/11522)
- When converting the references section of a paper (PDF file), more than the last page is treated. [#11522](https://github.com/JabRef/jabref/pull/11522)
- Added the functionality to invoke offline reference parsing explicitly. [#11565](https://github.com/JabRef/jabref/pull/11565)
- The dialog for [adding an entry using reference text](https://docs.jabref.org/collect/newentryfromplaintext) is now filled with the clipboard contents as default. [#11565](https://github.com/JabRef/jabref/pull/11565)
Expand Down Expand Up @@ -66,6 +69,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We changed instances of 'Search Selected' to 'Search Pre-configured' in Web Search Preferences UI. [#11871](https://github.com/JabRef/jabref/pull/11871)
- We added a new CSS style class `main-table` for the main table. [#11881](https://github.com/JabRef/jabref/pull/11881)
- When renaming a file, the old extension is now used if there is none provided in the new name. [#11903](https://github.com/JabRef/jabref/issues/11903)
- Added minimum window sizing for windows dedicated to creating new entries [#11944](https://github.com/JabRef/jabref/issues/11944)
- We changed the name of the library-based file directory from 'General File Directory' to 'Library-specific File Directory' per issue [#571](https://github.com/koppor/jabref/issues/571)
- The CitationKey column is now a default shown column for the entry table. [#10510](https://github.com/JabRef/jabref/issues/10510)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@
</Text>
</children>
</TextFlow>
<TextFlow fx:id="gpt4AllTextFlow">
<children>
<Text text="%If you have chosen %0 as an AI provider, the privacy policy of %0 applies. You find it at %1.">
<font>
<Font size="14.0" />
</font>
</Text>
</children>
</TextFlow>
<TextFlow>
<Text fx:id="embeddingModelText" text="%Additionally, we use Deep Java Library (DJL) embedding models for both chatting and summarization. The embedding model will be downloaded in background (size %0) from Deep Java Library servers anonymously.">
<font>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class PrivacyNoticeComponent extends ScrollPane {
@FXML private TextFlow mistralAiPrivacyTextFlow;
@FXML private TextFlow geminiPrivacyTextFlow;
@FXML private TextFlow huggingFacePrivacyTextFlow;
@FXML private TextFlow gpt4AllTextFlow;
@FXML private Text embeddingModelText;

private final AiPreferences aiPreferences;
Expand All @@ -49,6 +50,7 @@ private void initialize() {
initPrivacyHyperlink(mistralAiPrivacyTextFlow, AiProvider.MISTRAL_AI);
initPrivacyHyperlink(geminiPrivacyTextFlow, AiProvider.GEMINI);
initPrivacyHyperlink(huggingFacePrivacyTextFlow, AiProvider.HUGGING_FACE);
initPrivacyHyperlink(gpt4AllTextFlow, AiProvider.GPT4ALL);

String newEmbeddingModelText = embeddingModelText.getText().replaceAll("%0", aiPreferences.getEmbeddingModel().sizeInfo());
embeddingModelText.setText(newEmbeddingModelText);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/entrytype/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javafx.scene.control.Tooltip;
import javafx.scene.layout.FlowPane;
import javafx.stage.Screen;
import javafx.stage.Stage;

import org.jabref.gui.DialogService;
import org.jabref.gui.LibraryTab;
Expand Down Expand Up @@ -87,6 +88,10 @@ public EntryTypeView(LibraryTab libraryTab, DialogService dialogService, GuiPref
.load()
.setAsDialogPane(this);

Stage stage = (Stage) getDialogPane().getScene().getWindow();
stage.setMinHeight(400);
stage.setMinWidth(500);

ControlHelper.setAction(generateButton, this.getDialogPane(), event -> viewModel.runFetcherWorker());
setOnCloseRequest(e -> viewModel.cancelFetcherWorker());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.Tooltip;
import javafx.stage.Stage;

import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.DialogService;
Expand Down Expand Up @@ -53,6 +54,10 @@ public PlainCitationParserDialog() {
.setAsDialogPane(this);

this.setTitle(Localization.lang("Plain Citations Parser"));

Stage stage = (Stage) getDialogPane().getScene().getWindow();
stage.setMinHeight(550);
stage.setMinWidth(500);
}

@FXML
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/org/jabref/gui/preferences/ai/AiTab.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref.gui.preferences.ai;

import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
Expand Down Expand Up @@ -28,6 +29,7 @@

public class AiTab extends AbstractPreferenceTabView<AiTabViewModel> implements PreferencesTab {
private static final String HUGGING_FACE_CHAT_MODEL_PROMPT = "TinyLlama/TinyLlama_v1.1 (or any other model name)";
private static final String GPT_4_ALL_CHAT_MODEL_PROMPT = "Phi-3.1-mini (or any other local model name from GPT4All)";

@FXML private CheckBox enableAi;
@FXML private CheckBox autoGenerateEmbeddings;
Expand Down Expand Up @@ -87,10 +89,19 @@ public void initialize() {
if (newValue == AiProvider.HUGGING_FACE) {
chatModelComboBox.setPromptText(HUGGING_FACE_CHAT_MODEL_PROMPT);
}
if (newValue == AiProvider.GPT4ALL) {
chatModelComboBox.setPromptText(GPT_4_ALL_CHAT_MODEL_PROMPT);
}
});

apiKeyTextField.textProperty().bindBidirectional(viewModel.apiKeyProperty());
apiKeyTextField.disableProperty().bind(viewModel.disableBasicSettingsProperty());
// Disable if GPT4ALL is selected
apiKeyTextField.disableProperty().bind(
Bindings.or(
viewModel.disableBasicSettingsProperty(),
aiProviderComboBox.valueProperty().isEqualTo(AiProvider.GPT4ALL)
)
);

customizeExpertSettingsCheckbox.selectedProperty().bindBidirectional(viewModel.customizeExpertSettingsProperty());
customizeExpertSettingsCheckbox.disableProperty().bind(viewModel.disableBasicSettingsProperty());
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/org/jabref/gui/preferences/ai/AiTabViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ public class AiTabViewModel implements PreferenceTabViewModel {
private final StringProperty mistralAiChatModel = new SimpleStringProperty();
private final StringProperty geminiChatModel = new SimpleStringProperty();
private final StringProperty huggingFaceChatModel = new SimpleStringProperty();
private final StringProperty gpt4AllChatModel = new SimpleStringProperty();

private final StringProperty currentApiKey = new SimpleStringProperty();

private final StringProperty openAiApiKey = new SimpleStringProperty();
private final StringProperty mistralAiApiKey = new SimpleStringProperty();
private final StringProperty geminiAiApiKey = new SimpleStringProperty();
private final StringProperty huggingFaceApiKey = new SimpleStringProperty();
private final StringProperty gpt4AllApiKey = new SimpleStringProperty();

private final BooleanProperty customizeExpertSettings = new SimpleBooleanProperty();

Expand All @@ -75,6 +77,7 @@ public class AiTabViewModel implements PreferenceTabViewModel {
private final StringProperty mistralAiApiBaseUrl = new SimpleStringProperty();
private final StringProperty geminiApiBaseUrl = new SimpleStringProperty();
private final StringProperty huggingFaceApiBaseUrl = new SimpleStringProperty();
private final StringProperty gpt4AllApiBaseUrl = new SimpleStringProperty();

private final StringProperty instruction = new SimpleStringProperty();
private final StringProperty temperature = new SimpleStringProperty();
Expand Down Expand Up @@ -150,6 +153,11 @@ public AiTabViewModel(CliPreferences preferences) {
huggingFaceApiKey.set(currentApiKey.get());
huggingFaceApiBaseUrl.set(currentApiBaseUrl.get());
}
case GPT4ALL-> {
gpt4AllChatModel.set(oldChatModel);
gpt4AllApiKey.set(currentApiKey.get());
gpt4AllApiBaseUrl.set(currentApiBaseUrl.get());
}
}
}

Expand All @@ -174,6 +182,11 @@ public AiTabViewModel(CliPreferences preferences) {
currentApiKey.set(huggingFaceApiKey.get());
currentApiBaseUrl.set(huggingFaceApiBaseUrl.get());
}
case GPT4ALL -> {
currentChatModel.set(gpt4AllChatModel.get());
currentApiKey.set(gpt4AllApiKey.get());
currentApiBaseUrl.set(gpt4AllApiBaseUrl.get());
}
}
});

Expand All @@ -183,6 +196,7 @@ public AiTabViewModel(CliPreferences preferences) {
case MISTRAL_AI -> mistralAiChatModel.set(newValue);
case GEMINI -> geminiChatModel.set(newValue);
case HUGGING_FACE -> huggingFaceChatModel.set(newValue);
case GPT4ALL -> gpt4AllChatModel.set(newValue);
}

contextWindowSize.set(AiDefaultPreferences.getContextWindowSize(selectedAiProvider.get(), newValue));
Expand All @@ -194,6 +208,7 @@ public AiTabViewModel(CliPreferences preferences) {
case MISTRAL_AI -> mistralAiApiKey.set(newValue);
case GEMINI -> geminiAiApiKey.set(newValue);
case HUGGING_FACE -> huggingFaceApiKey.set(newValue);
case GPT4ALL -> gpt4AllApiKey.set(newValue);
}
});

Expand All @@ -203,6 +218,7 @@ public AiTabViewModel(CliPreferences preferences) {
case MISTRAL_AI -> mistralAiApiBaseUrl.set(newValue);
case GEMINI -> geminiApiBaseUrl.set(newValue);
case HUGGING_FACE -> huggingFaceApiBaseUrl.set(newValue);
case GPT4ALL -> gpt4AllApiBaseUrl.set(newValue);
}
});

Expand Down Expand Up @@ -279,16 +295,19 @@ public void setValues() {
mistralAiApiKey.setValue(aiPreferences.getApiKeyForAiProvider(AiProvider.MISTRAL_AI));
geminiAiApiKey.setValue(aiPreferences.getApiKeyForAiProvider(AiProvider.GEMINI));
huggingFaceApiKey.setValue(aiPreferences.getApiKeyForAiProvider(AiProvider.HUGGING_FACE));
gpt4AllApiKey.setValue(aiPreferences.getApiKeyForAiProvider(AiProvider.GPT4ALL));

openAiApiBaseUrl.setValue(aiPreferences.getOpenAiApiBaseUrl());
mistralAiApiBaseUrl.setValue(aiPreferences.getMistralAiApiBaseUrl());
geminiApiBaseUrl.setValue(aiPreferences.getGeminiApiBaseUrl());
huggingFaceApiBaseUrl.setValue(aiPreferences.getHuggingFaceApiBaseUrl());
gpt4AllApiBaseUrl.setValue(aiPreferences.getGpt4AllApiBaseUrl());

openAiChatModel.setValue(aiPreferences.getOpenAiChatModel());
mistralAiChatModel.setValue(aiPreferences.getMistralAiChatModel());
geminiChatModel.setValue(aiPreferences.getGeminiChatModel());
huggingFaceChatModel.setValue(aiPreferences.getHuggingFaceChatModel());
gpt4AllChatModel.setValue(aiPreferences.getGpt4AllChatModel());

enableAi.setValue(aiPreferences.getEnableAi());
autoGenerateSummaries.setValue(aiPreferences.getAutoGenerateSummaries());
Expand Down Expand Up @@ -320,11 +339,13 @@ public void storeSettings() {
aiPreferences.setMistralAiChatModel(mistralAiChatModel.get() == null ? "" : mistralAiChatModel.get());
aiPreferences.setGeminiChatModel(geminiChatModel.get() == null ? "" : geminiChatModel.get());
aiPreferences.setHuggingFaceChatModel(huggingFaceChatModel.get() == null ? "" : huggingFaceChatModel.get());
aiPreferences.setGpt4AllChatModel(gpt4AllChatModel.get() == null ? "" : gpt4AllChatModel.get());

aiPreferences.storeAiApiKeyInKeyring(AiProvider.OPEN_AI, openAiApiKey.get() == null ? "" : openAiApiKey.get());
aiPreferences.storeAiApiKeyInKeyring(AiProvider.MISTRAL_AI, mistralAiApiKey.get() == null ? "" : mistralAiApiKey.get());
aiPreferences.storeAiApiKeyInKeyring(AiProvider.GEMINI, geminiAiApiKey.get() == null ? "" : geminiAiApiKey.get());
aiPreferences.storeAiApiKeyInKeyring(AiProvider.HUGGING_FACE, huggingFaceApiKey.get() == null ? "" : huggingFaceApiKey.get());
aiPreferences.storeAiApiKeyInKeyring(AiProvider.GPT4ALL, gpt4AllApiKey.get() == null ? "" : gpt4AllApiKey.get());
// We notify in all cases without a real check if something was changed
aiPreferences.apiKeyUpdated();

Expand All @@ -336,6 +357,7 @@ public void storeSettings() {
aiPreferences.setMistralAiApiBaseUrl(mistralAiApiBaseUrl.get() == null ? "" : mistralAiApiBaseUrl.get());
aiPreferences.setGeminiApiBaseUrl(geminiApiBaseUrl.get() == null ? "" : geminiApiBaseUrl.get());
aiPreferences.setHuggingFaceApiBaseUrl(huggingFaceApiBaseUrl.get() == null ? "" : huggingFaceApiBaseUrl.get());
aiPreferences.setGpt4AllApiBaseUrl(gpt4AllApiBaseUrl.get() == null ? "" : gpt4AllApiBaseUrl.get());

aiPreferences.setInstruction(instruction.get());
// We already check the correctness of temperature and RAG minimum score in validators, so we don't need to check it here.
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/push/PushToTeXworks.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ protected String[] getCommandLine(String keyString) {

@Override
protected String[] jumpToLineCommandlineArguments(Path fileName, int line, int column) {
// No command known to jump to a specific line
return new String[] {commandPath, fileName.toString()};
return new String[] {commandPath, "--position=\"%s\"".formatted(line), fileName.toString()};
}
}
7 changes: 5 additions & 2 deletions src/main/java/org/jabref/logic/ai/AiDefaultPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public enum PredefinedChatModel {
GEMINI_1_5_PRO(AiProvider.GEMINI, "gemini-1.5-pro", 2097152),
GEMINI_1_0_PRO(AiProvider.GEMINI, "gemini-1.0-pro", 32000),
// Dummy variant for Hugging Face models.
HUGGING_FACE(AiProvider.HUGGING_FACE, "", 0);
// Blank entry used for cases where the model name is not specified.
BLANK_HUGGING_FACE(AiProvider.HUGGING_FACE, "", 0),
BLANK_GPT4ALL(AiProvider.GPT4ALL, "", 0);

private final AiProvider aiProvider;
private final String name;
Expand Down Expand Up @@ -62,7 +64,8 @@ public String toString() {
AiProvider.OPEN_AI, PredefinedChatModel.GPT_4O_MINI,
AiProvider.MISTRAL_AI, PredefinedChatModel.OPEN_MIXTRAL_8X22B,
AiProvider.GEMINI, PredefinedChatModel.GEMINI_1_5_FLASH,
AiProvider.HUGGING_FACE, PredefinedChatModel.HUGGING_FACE
AiProvider.HUGGING_FACE, PredefinedChatModel.BLANK_HUGGING_FACE,
AiProvider.GPT4ALL, PredefinedChatModel.BLANK_GPT4ALL
);

public static final boolean CUSTOMIZE_SETTINGS = false;
Expand Down
Loading

0 comments on commit fa2be78

Please sign in to comment.