Verified Owner
Top Fields Constructors Methods
org.jabref.gui.preferences.ai

public Class AiTab

extends AbstractPreferenceTabView<AiTabViewModel>
Class Inheritance
Imports
javafx.beans.binding.Bindings, .BooleanBinding, javafx.beans.property.IntegerProperty, .ReadOnlyObjectProperty, .StringProperty, javafx.geometry.Pos, javafx.scene.Node, javafx.scene.control.Button, .ComboBox, .Spinner, .Tab, .TabPane, .TextArea, .TextField, javafx.scene.layout.HBox, .Priority, .Region, .StackPane, .VBox, org.jabref.gui.icon.IconTheme, org.jabref.gui.preferences.AbstractPreferenceTabView, org.jabref.gui.preferences.ai.AiTabViewModel.ConnectionTestState, org.jabref.gui.preferences.forms.PasswordFieldEditor, org.jabref.gui.util.BindingsHelper, org.jabref.logic.ai.AiNamingUtils, .AiService, org.jabref.logic.ai.embedding.EmbeddingModelMetadataService, org.jabref.logic.ai.preferences.AiPreferences, org.jabref.logic.help.HelpFile, org.jabref.logic.l10n.Localization, org.jabref.model.ai.llm.AiProvider, com.airhacks.afterburner.injection.Injector, com.dlsc.unitfx.IntegerInputField

Field Summary

Modifier and TypeField and Description
private final BooleanBinding
private ComboBox<String>
private static final String
private TabPane
Inherited from org.jabref.gui.preferences.AbstractPreferenceTabView:
dialogServicepreferencestaskExecutorviewModel

Constructor Summary

AccessConstructor and Description
public
AiTab(AiPreferences workingAiPreferences)

Method Summary

Modifier and TypeMethod and Description
private void
private ComboBox<String>
buildChatModelCombo()

Editable combo whose prompt switches to a model-name hint once Hugging Face is selected.

private Spinner<Integer>
private Node
buildTemplatesRegion()

One tab per prompt template, plus the two reset buttons underneath.

private TextArea
buildTestConnectionDetailsArea()

Read-only text area rather than a label, so that the error message (e.g., the ollama pull command) can be copied.

private void
public String
getTabName()

Implements org.jabref.gui.preferences.PreferencesTab.getTabName.

Should return the localized identifier to use for the tab.

private IntegerInputField
integerField(IntegerProperty value)

IntegerInputField holds a nullable Integer; mirror it onto the view model's primitive property in both directions, mapping null to zero.

private Button
resetButton(String text, Runnable action)

private void
private Tab
templateTab(String title, StringProperty template, Runnable reset)

A template tab; its reset action is carried on the tab itself so that "reset current template" needs no chain of identity comparisons.

private void
private TextField
Inherited from org.jabref.gui.preferences.AbstractPreferenceTabView:
formgetContentgetRestartWarningsgetSearchableElementssetContentsetValuesstoreSettingsvalidateSettings

Field Detail

aiDisabledback to summary
private final BooleanBinding aiDisabled
chatModelComboback to summary
private ComboBox<String> chatModelCombo
HUGGING_FACE_CHAT_MODEL_PROMPTback to summary
private static final String HUGGING_FACE_CHAT_MODEL_PROMPT
templatesTabPaneback to summary
private TabPane templatesTabPane

Constructor Detail

AiTabback to summary
public AiTab(AiPreferences workingAiPreferences)

Method Detail

bindTestConnectionButtonback to summary
private void bindTestConnectionButton(Button button)
buildChatModelComboback to summary
private ComboBox<String> buildChatModelCombo()

Editable combo whose prompt switches to a model-name hint once Hugging Face is selected.

buildFollowUpQuestionsCountSpinnerback to summary
private Spinner<Integer> buildFollowUpQuestionsCountSpinner()
buildTemplatesRegionback to summary
private Node buildTemplatesRegion()

One tab per prompt template, plus the two reset buttons underneath.

buildTestConnectionDetailsAreaback to summary
private TextArea buildTestConnectionDetailsArea()

Read-only text area rather than a label, so that the error message (e.g., the ollama pull command) can be copied.

buildViewback to summary
private void buildView()
getTabNameback to summary
public String getTabName()

Implements org.jabref.gui.preferences.PreferencesTab.getTabName.

Doc from org.jabref.gui.preferences.PreferencesTab.getTabName.

Should return the localized identifier to use for the tab.

Annotations
@Override
integerFieldback to summary
private IntegerInputField integerField(IntegerProperty value)

IntegerInputField holds a nullable Integer; mirror it onto the view model's primitive property in both directions, mapping null to zero.

resetButtonback to summary
private Button resetButton(String text, Runnable action)
resetCurrentTemplateback to summary
private void resetCurrentTemplate()
templateTabback to summary
private Tab templateTab(String title, StringProperty template, Runnable reset)

A template tab; its reset action is carried on the tab itself so that "reset current template" needs no chain of identity comparisons.

The text area sits in a wrapper rather than being the content directly: Tab writes through to its content's disable property (on Tab#setContent, on being added to a TabPane, and whenever the tab itself is disabled), which throws against a bound value. The wrapper absorbs those writes; the text area keeps its own binding and the effective state is the union of both.

testConnectionback to summary
private void testConnection()
textFieldback to summary
private TextField textField(StringProperty value)