Skip to content

Conversation

@Julien384760
Copy link

@Julien384760 Julien384760 commented Oct 27, 2025

Closes #12191

Changed files

  • AiChatComponent.java
  • ChatPromptComponent.java
  • ChatPromptComponent.fxml

The goal of the changes in the AiChatComponent.java is to have access to the chat history and to trigger another response from the LLM. It describes the logic behind the button.
The changes in ChatPromptComponent.java create the button itself the same way it is done for "retry", "submit" or "cancel".

Steps to test

This button can be accessed by going to the "AI Chat" tab of a document in an opened library, next to the "submit" button. When sending a prompt to the model, you can click on this button to resend the same message and triggering the LLM to generate another answer to the same prompt. However the previous answer is deleted from the history.

Here is an example of the usage of this button :

First answer generated :
regenerate_example_before

Regenerated answer :
regenerate_example_after

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

CHANGELOG.md Outdated
Comment on lines 56 to 73

### 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.

@Julien384760 Julien384760 requested a review from ThiloteE November 5, 2025 12:31
@ThiloteE
Copy link
Member

ThiloteE commented Nov 5, 2025

Tried this PR. At first worked like expected (regenerating a message multiple times), but when I tried sending a different message right after, it got stuck. See
grafik

I also got a huge amount of warnings and a few exceptions in the commandline. The chance is high that not all are related to your PR. Here is the Log I captured.

When I force closed JabRef, the following exception emerged in the commandline:

INFO: index exceeds maxCellCount. Check size calculations for class org.jabref.gui.errorconsole.ErrorConsoleView$1
2025-11-05 15:24:28 [JavaFX Application Thread] sun.util.logging.internal.LoggingProviderImpl$JULWrapper.log()
INFO: index exceeds maxCellCount. Check size calculations for class org.jabref.gui.errorconsole.ErrorConsoleView$1
2025-11-05 15:35:37 [JavaFX Application Thread] org.jabref.gui.JabRefGuiStateManager.setActiveDatabase()
INFO: No open database detected
2025-11-05 15:35:37 [pool-2-thread-1] org.jabref.gui.util.UiThreadList.sourceChanged()
ERROR: Error while running on JavaFX thread: java.lang.InterruptedException
        at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1139)
        at java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:230)
        at org.jabref/org.jabref.gui.util.UiThreadList.sourceChanged(UiThreadList.java:32)
        at [email protected]/javafx.collections.transformation.TransformationList.lambda$getListener$0(TransformationList.java:105)
        at [email protected]/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
        at [email protected]/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
        at [email protected]/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
        at [email protected]/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
        at [email protected]/javafx.collections.FXCollections$UnmodifiableObservableListImpl.lambda$new$0(FXCollections.java:947)
        at [email protected]/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
        at [email protected]/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
        at [email protected]/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
        at [email protected]/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
        at [email protected]/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
        at [email protected]/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
        at [email protected]/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
        at [email protected]/javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:200)
        at java.base/java.util.AbstractList.add(AbstractList.java:113)
        at org.jabref/org.jabref.gui.logging.LogMessages.add(LogMessages.java:30)
        at org.jabref/org.jabref.gui.logging.GuiWriter.write(GuiWriter.java:28)
        at [email protected]/org.tinylog.core.TinylogLoggingProvider.output(TinylogLoggingProvider.java:259)
        at [email protected]/org.tinylog.core.TinylogLoggingProvider.log(TinylogLoggingProvider.java:154)
        at [email protected]/org.tinylog.slf4j.AbstractTinylogLogger.info(AbstractTinylogLogger.java:266)
        at org.jabref.jablib/org.jabref.logic.ai.chatting.AiChatLogic.execute(AiChatLogic.java:144)
        at org.jabref/org.jabref.gui.ai.components.aichat.AiChatComponent.lambda$onSendMessage$0(AiChatComponent.java:284)
        at org.jabref.jablib/org.jabref.logic.util.BackgroundTask$1.call(BackgroundTask.java:68)
        at org.jabref/org.jabref.gui.util.UiTaskExecutor$1.call(UiTaskExecutor.java:188)
        at [email protected]/javafx.concurrent.Task$TaskCallable.call(Task.java:1407)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619)
        at java.base/java.lang.Thread.run(Thread.java:1447)

@Julien384760
Copy link
Author

Thank you for your review, I did not see this issue at first but I will try to reproduce it and eventually fix it. For now I do not really get why these errors appear, there might be some problem with the onSendMessage method or something like this. Just to be sure (although I don't think it is related), which llm did you use when testing ?

@ThiloteE
Copy link
Member

ThiloteE commented Nov 5, 2025

Thanks for looking into it. Maybe you find something in the log. After I sent the review, I restarted JabRef and tried again. Everything went fine. No exceptions. So unfortunately the precise conditions to trigger the exception are still unknown to me.
As shown in the screenshot, I used https://huggingface.co/bartowski/inclusionAI_Ling-mini-2.0-GGUF/blob/main/inclusionAI_Ling-mini-2.0-Q4_K_M.gguf. You will need at least 12GB free VRAM or RAM to run this, which I have. If you have less, you could try https://huggingface.co/mradermacher/granite-4.0-h-tiny-i1-GGUF/blob/main/granite-4.0-h-tiny.i1-Q4_K_M.gguf, but if you just need something for testing and speed, go for https://huggingface.co/DevQuasar/ibm-granite.granite-4.0-350m-GGUF/blob/main/ibm-granite.granite-4.0-350m.Q8_0.gguf. Obviously, the last one is so tiny that its responses will mostly be confabulations.

@ThiloteE
Copy link
Member

ThiloteE commented Nov 5, 2025

What app do you use to run the models?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "regenerate" button to AI chat tab

3 participants