Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
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
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Added

- We added a "Regenerate" button to the AI chat allowing the user to make the LLM reformulate its answer to the previous prompt [#12191](https://github.com/JabRef/jabref/issues/12191)

### Changed

### Fixed
Expand Down Expand Up @@ -51,6 +53,24 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added an option to choose the group during import of the entry(s). [#9191](https://github.com/JabRef/jabref/issues/9191)
- We added an option to search and filter the fields and formatters in the clean up entries dialog. [#13890](https://github.com/JabRef/jabref/issues/13890)
- We added support for managing multiple linked files via the entry context menu. [#12567](https://github.com/JabRef/jabref/issues/12567)

### Changed

- We moved all sorting options into a dedicated “Sort” sub-menu in the Groups menu. ([#14017](https://github.com/JabRef/jabref/issues/14017))
- We merged `Citation information` and `Citation relations` into a singular tab. [#13618](https://github.com/JabRef/jabref/issues/13618)
- We changed `ISSNCleanup` into `NormalizeIssn` a `ISSN` formatter. [#13748](https://github.com/JabRef/jabref/issues/13748)
- We changed Citation Relations tab and gave tab panes more descriptive titles and tooltips. [#13619](https://github.com/JabRef/jabref/issues/13619)
- We changed the name from Open AI Provider to Open AI (or API compatible). [#13585](https://github.com/JabRef/jabref/issues/13585)
- We improved the citations relations caching by implementing an offline storage. [#11189](https://github.com/JabRef/jabref/issues/11189)
- We added a tooltip to keywords that resemble Math Subject Classification (MSC) codes. [#12944](https://github.com/JabRef/jabref/issues/12944)
- We added a formatter to convert keywords that resemble MSC codes to their descriptions. [#12944](https://github.com/JabRef/jabref/issues/12944)
- We introduced a new command line application called `jabkit`. [#13012](https://github.com/JabRef/jabref/pull/13012) [#110](https://github.com/JabRef/jabref/issues/110)
- We added a new "Add JabRef suggested groups" option in the context menu of "All entries". [#12659](https://github.com/JabRef/jabref/issues/12659)
- We added an option to create entries directly from Bib(La)TeX sources to the 'Create New Entry' tool. [#8808](https://github.com/JabRef/jabref/issues/8808)
- We added the provision to choose different CSL bibliography body formats (e.g. First Line Indent, Hanging Indent, Bibliography 1, etc.) in the LibreOffice integration. [#13049](https://github.com/JabRef/jabref/issues/13049)
- We use `https` to connect to [shortDOI](https://shortdoi.org/) service. [#13637](https://github.com/JabRef/jabref/pull/13637)
- We added "Bibliography Heading" to the available CSL bibliography header formats in the LibreOffice integration. [#13049](https://github.com/JabRef/jabref/issues/13049)
- We added [LOBID](https://lobid.org/) as an alternative ISBN-Fetcher. [#13076](https://github.com/JabRef/jabref/issues/13076)
Copy link
Member

Choose a reason for hiding this comment

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

Those are duplicates right? When searching (ctrl+f) for some of those, they can be found in the changelog multiple times. I haven't checked all of them. Commit 7fcba9a seems to have introduced it.

- We made the "Configure API key" option in the Web Search preferences tab searchable via preferences search. [#13929](https://github.com/JabRef/jabref/issues/13929)
- We added support for Cygwin-file paths on a Windows Operating System. [#13274](https://github.com/JabRef/jabref/issues/13274)
- We added a success dialog when using the "Copy to" option, indicating whether the entry was successfully copied and specifying if a cross-reference entry was included. [#12486](https://github.com/JabRef/jabref/issues/12486)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.google.common.annotations.VisibleForTesting;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.data.message.ChatMessageType;
import dev.langchain4j.data.message.UserMessage;
import org.controlsfx.control.PopOver;
import org.slf4j.Logger;
Expand Down Expand Up @@ -191,6 +192,20 @@ private void initializeChatPrompt() {
onSendMessage(userMessage);
});

chatPrompt.setRegenerateCallback(() -> {
String lastUserPrompt = "";
if (!aiChatLogic.getChatHistory().isEmpty()) {
lastUserPrompt = getLastUserMessage().singleText();
deleteLastMessage();
deleteLastMessage();
}

chatPrompt.switchToNormalState();
if (!lastUserPrompt.isEmpty()) {
onSendMessage(lastUserPrompt);
}
});

chatPrompt.requestPromptFocus();

updatePromptHistory();
Expand Down Expand Up @@ -334,4 +349,19 @@ private void deleteLastMessage() {
aiChatLogic.getChatHistory().remove(index);
}
}

private UserMessage getLastUserMessage() {
if (!aiChatLogic.getChatHistory().isEmpty() && aiChatLogic.getChatHistory().size() >= 2) {
int userMessageIndex = aiChatLogic.getChatHistory().size() - 2;
ChatMessage chat = aiChatLogic.getChatHistory().get(userMessageIndex);

if (chat.type() == ChatMessageType.USER) {
return (UserMessage) chat;
} else {
return new UserMessage("");
}
} else {
return new UserMessage("");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class ChatPromptComponent extends HBox {
private final ObjectProperty<Consumer<String>> sendCallback = new SimpleObjectProperty<>();
private final ObjectProperty<Consumer<String>> retryCallback = new SimpleObjectProperty<>();
private final ObjectProperty<Runnable> cancelCallback = new SimpleObjectProperty<>();
private final ObjectProperty<Runnable> regenerateCallback = new SimpleObjectProperty<>();

private final ListProperty<String> history = new SimpleListProperty<>(FXCollections.observableArrayList());

Expand All @@ -44,6 +45,7 @@ public class ChatPromptComponent extends HBox {

@FXML private ExpandingTextArea userPromptTextArea;
@FXML private Button submitButton;
@FXML private Button regenerateButton;

public ChatPromptComponent() {
ViewLoader.view(this)
Expand All @@ -68,6 +70,10 @@ public void setCancelCallback(Runnable cancelCallback) {
this.cancelCallback.set(cancelCallback);
}

public void setRegenerateCallback(Runnable regenerateCallback) {
this.regenerateCallback.set(regenerateCallback);
}

public ListProperty<String> getHistory() {
return history;
}
Expand Down Expand Up @@ -174,6 +180,7 @@ public void switchToNormalState() {
this.getChildren().clear();
this.getChildren().add(userPromptTextArea);
this.getChildren().add(submitButton);
this.getChildren().add(regenerateButton);
requestPromptFocus();
}

Expand All @@ -191,4 +198,11 @@ private void onSendMessage() {
sendCallback.get().accept(userPrompt);
}
}

@FXML
private void onRegenerateMessage() {
if (regenerateCallback.get() != null) {
regenerateCallback.get().run();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
mnemonicParsing="false"
onAction="#onSendMessage"
text="%Submit"/>
<Button fx:id="regenerateButton"
mnemonicParsing="false"
onAction="#onRegenerateMessage"
text="%Regenerate"/>
</fx:root>
Loading