Skip to content

Commit

Permalink
Revert "Fix for InAnYan#148 and partially InAnYan#146"
Browse files Browse the repository at this point in the history
This reverts commit 5fa3bb5.
  • Loading branch information
InAnYan committed Aug 14, 2024
1 parent 5fa3bb5 commit 58bdb8c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.jabref.gui.ai.components.aichat;

import javafx.application.Platform;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ProgressIndicator;
Expand Down Expand Up @@ -30,7 +28,6 @@
import dev.langchain4j.data.message.UserMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.impl.FutureConvertersImpl;

public class AiChatComponent extends VBox {
private static final Logger LOGGER = LoggerFactory.getLogger(AiChatComponent.class);
Expand Down Expand Up @@ -73,6 +70,12 @@ public void initialize() {
}
});

scrollPane.needsLayoutProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) {
scrollPane.setVvalue(1.0);
}
});

chatVBox
.getChildren()
.addAll(aiChatLogic.getChatHistory()
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/jabref/logic/ai/FileEmbeddingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ public FileEmbeddingsManager(AiPreferences aiPreferences, ReadOnlyBooleanPropert
}

private void setupListeningToPreferencesChanges() {
aiPreferences.addListenerToEmbeddingsParametersChange(() -> {
embeddingStore.removeAll();
fullyIngestedDocumentsTracker.unmarkAll();
});
aiPreferences.addListenerToEmbeddingsParametersChange(embeddingStore::removeAll);
}

public void addDocument(String link, Document document, long modificationTimeInSeconds, IntegerProperty workDone, IntegerProperty workMax) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,4 @@ public void unmarkDocumentAsFullyIngested(String link) {
public Set<String> getFullyIngestedDocuments() {
return new HashSet<>(ingestedMap.keySet());
}

public void unmarkAll() {
ingestedMap.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ private void setupListeningToPreferencesChanges() {
}
});

aiPreferences.addListenerToEmbeddingsParametersChange(this::startRebuildingTask);
aiPreferences.customizeExpertSettingsProperty().addListener((obs, oldValue, newValue) -> {
if (newValue && predictorProperty.get().isEmpty()) {
startRebuildingTask();
}
});

aiPreferences.embeddingModelProperty().addListener(obs -> startRebuildingTask());
}

@Override
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/jabref/preferences/ai/AiPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,6 @@ public void setRagMinScore(double ragMinScore) {
* @param runnable The runnable that should be executed when the preferences change.
*/
public void addListenerToEmbeddingsParametersChange(Runnable runnable) {
customizeExpertSettings.addListener((observableValue, oldValue, newValue) -> {
if (newValue != oldValue) {
runnable.run();
}
});

embeddingModel.addListener((observableValue, oldValue, newValue) -> {
if (newValue != oldValue) {
runnable.run();
Expand Down

0 comments on commit 58bdb8c

Please sign in to comment.