Skip to content

Commit fcd51ac

Browse files
Merge pull request #1 from JabRef/main
Synch with new main changes
2 parents 4ab11ca + f6ea6a9 commit fcd51ac

File tree

15 files changed

+1312
-322
lines changed

15 files changed

+1312
-322
lines changed

src/main/java/org/jabref/gui/preferences/ai/AiTab.fxml

Lines changed: 206 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -9,151 +9,249 @@
99

1010
<?import org.jabref.gui.icon.JabRefIconView?>
1111
<?import org.controlsfx.control.SearchableComboBox?>
12-
<fx:root spacing="10.0" type="VBox" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.ai.AiTab">
12+
13+
<?import com.dlsc.gemsfx.ResizableTextArea?>
14+
<fx:root
15+
spacing="10.0"
16+
type="VBox"
17+
xmlns="http://javafx.com/javafx/17.0.2-ea"
18+
xmlns:fx="http://javafx.com/fxml/1"
19+
fx:controller="org.jabref.gui.preferences.ai.AiTab">
1320
<children>
14-
<Label styleClass="titleHeader" text="%AI" />
21+
<Label styleClass="titleHeader"
22+
text="%AI"/>
1523

16-
<Label styleClass="sectionHeader" text="%General" />
24+
<Label styleClass="sectionHeader"
25+
text="%General"/>
1726

18-
<HBox alignment="CENTER_LEFT" spacing="10.0">
27+
<HBox alignment="CENTER_LEFT"
28+
spacing="10.0">
1929
<children>
20-
<CheckBox fx:id="enableAi" mnemonicParsing="false" text="%Enable AI functionality (summary generation and chatting) in JabRef" VBox.vgrow="ALWAYS" />
21-
<Button fx:id="enableAiHelp" prefWidth="20.0" />
30+
<CheckBox
31+
fx:id="enableAi"
32+
mnemonicParsing="false"
33+
text="%Enable AI functionality (summary generation and chatting) in JabRef"
34+
HBox.hgrow="ALWAYS"
35+
maxWidth="Infinity"/>
36+
<Button fx:id="enableAiHelp"
37+
prefWidth="20.0"/>
2238
</children>
2339
</HBox>
2440

25-
<HBox alignment="CENTER_LEFT" layoutX="10.0" layoutY="306.0" spacing="10.0">
41+
<HBox alignment="CENTER_LEFT"
42+
layoutX="10.0"
43+
layoutY="306.0"
44+
spacing="10.0">
2645
<children>
27-
<Label alignment="BASELINE_CENTER" text="%AI provider" />
28-
<ComboBox fx:id="aiProviderComboBox" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS" />
29-
<Button fx:id="aiProviderHelp" prefWidth="20.0" />
46+
<Label alignment="BASELINE_CENTER"
47+
text="%AI provider"/>
48+
<ComboBox
49+
fx:id="aiProviderComboBox"
50+
maxWidth="1.7976931348623157E308"
51+
HBox.hgrow="ALWAYS"/>
52+
<Button fx:id="aiProviderHelp"
53+
prefWidth="20.0"/>
3054
</children>
3155
</HBox>
3256

33-
<HBox alignment="CENTER_LEFT" spacing="10.0">
57+
<HBox alignment="CENTER_LEFT"
58+
spacing="10.0">
3459
<children>
35-
<Label alignment="BASELINE_CENTER" text="%Chat model" />
36-
<ComboBox fx:id="chatModelComboBox" editable="true" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS" />
37-
<Button fx:id="chatModelHelp" prefWidth="20.0" />
60+
<Label alignment="BASELINE_CENTER"
61+
text="%Chat model"/>
62+
<ComboBox
63+
fx:id="chatModelComboBox"
64+
editable="true"
65+
maxWidth="1.7976931348623157E308"
66+
HBox.hgrow="ALWAYS"/>
67+
<Button fx:id="chatModelHelp"
68+
prefWidth="20.0"/>
3869
</children>
3970
<padding>
40-
<Insets left="20.0" />
71+
<Insets left="20.0"/>
4172
</padding>
4273
</HBox>
4374

44-
<HBox alignment="CENTER_LEFT" spacing="10.0">
75+
<HBox alignment="CENTER_LEFT"
76+
spacing="10.0">
4577
<children>
46-
<Label alignment="BASELINE_CENTER" text="%API key" />
47-
<CustomPasswordField fx:id="apiKeyTextField" HBox.hgrow="ALWAYS" />
48-
<Button fx:id="apiKeyHelp" prefWidth="20.0" />
78+
<Label alignment="BASELINE_CENTER"
79+
text="%API key"/>
80+
<CustomPasswordField
81+
fx:id="apiKeyTextField"
82+
HBox.hgrow="ALWAYS"/>
83+
<Button fx:id="apiKeyHelp"
84+
prefWidth="20.0"/>
4985
</children>
5086
<padding>
51-
<Insets left="20.0" />
87+
<Insets left="20.0"/>
5288
</padding>
5389
</HBox>
5490

55-
<Label styleClass="sectionHeader" text="%Expert settings" />
91+
<Label styleClass="sectionHeader"
92+
text="%Expert settings"/>
5693
<VBox>
5794
<children>
58-
<Label text="%These parameters affect how the AI will answer your questions." />
59-
<Label text="%Leave these fields as is, if you are not sure of their purpose." />
95+
<Label text="%These parameters affect how the AI will answer your questions."/>
96+
<Label text="%Leave these fields as is, if you are not sure of their purpose."/>
6097
</children>
6198
</VBox>
6299

63-
<CheckBox fx:id="customizeExpertSettingsCheckbox" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="%Customize expert settings" />
100+
<CheckBox
101+
fx:id="customizeExpertSettingsCheckbox"
102+
maxWidth="1.7976931348623157E308"
103+
mnemonicParsing="false"
104+
text="%Customize expert settings"/>
64105

65-
<HBox alignment="CENTER_LEFT" spacing="10.0">
106+
<HBox alignment="CENTER_LEFT"
107+
spacing="10.0">
66108
<children>
67-
<Label alignment="BASELINE_CENTER" text="%API base URL (used only for LLM)" />
68-
<TextField fx:id="apiBaseUrlTextField" disable="true" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS" />
69-
<Button fx:id="apiBaseUrlHelp" prefWidth="20.0" />
109+
<Label alignment="BASELINE_CENTER"
110+
text="%API base URL (used only for LLM)"/>
111+
<TextField
112+
fx:id="apiBaseUrlTextField"
113+
disable="true"
114+
maxWidth="1.7976931348623157E308"
115+
HBox.hgrow="ALWAYS"/>
116+
<Button fx:id="apiBaseUrlHelp"
117+
prefWidth="20.0"/>
70118
</children>
71119
</HBox>
72120

73-
74-
<HBox alignment="CENTER_LEFT" spacing="10.0">
121+
<HBox alignment="CENTER_LEFT"
122+
spacing="10.0">
75123
<children>
76-
<Label alignment="BASELINE_CENTER" text="%Embedding model" />
77-
<SearchableComboBox fx:id="embeddingModelComboBox" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS" />
78-
<Button fx:id="embeddingModelHelp" prefWidth="20.0" />
124+
<Label alignment="BASELINE_CENTER"
125+
text="%Embedding model"/>
126+
<SearchableComboBox
127+
fx:id="embeddingModelComboBox"
128+
maxWidth="1.7976931348623157E308"
129+
HBox.hgrow="ALWAYS"/>
130+
<Button fx:id="embeddingModelHelp"
131+
prefWidth="20.0"/>
79132
</children>
80133
</HBox>
81134

82135
<Label text="%The size of the embedding model could be smaller than written in the list.">
83-
<font>
84-
<Font name="System Italic" size="13.0" />
85-
</font></Label>
86-
87-
<HBox alignment="CENTER_LEFT" spacing="10.0">
88-
<children>
89-
<Label maxWidth="1.7976931348623157E308" text="%Instruction for AI (also known as prompt or system message)" HBox.hgrow="ALWAYS" />
90-
<Button fx:id="instructionHelp" prefWidth="20.0" />
91-
</children>
92-
</HBox>
93-
94-
<TextArea fx:id="instructionTextArea" wrapText="true" />
95-
96-
<HBox alignment="CENTER_LEFT" spacing="10.0">
97-
<children>
98-
<Label alignment="BASELINE_CENTER" text="%Context window size" />
99-
<IntegerInputField fx:id="contextWindowSizeTextField" HBox.hgrow="ALWAYS" />
100-
<Button fx:id="contextWindowSizeHelp" prefWidth="20.0" />
101-
</children>
102-
</HBox>
103-
<HBox alignment="CENTER_LEFT" layoutX="10.0" layoutY="448.0" spacing="10.0">
104-
<children>
105-
<Label alignment="BASELINE_CENTER" text="%Temperature" />
106-
<DoubleInputField fx:id="temperatureTextField" HBox.hgrow="ALWAYS" />
107-
</children>
108-
</HBox>
109-
<VBox>
110-
<children>
111-
<HBox alignment="CENTER_LEFT" spacing="10.0">
112-
<children>
113-
<Label maxWidth="1.7976931348623157E308" text="%RAG - maximum results count" HBox.hgrow="ALWAYS" />
114-
<Button fx:id="ragMaxResultsCountHelp" prefWidth="20.0" />
115-
</children>
116-
</HBox>
117-
<IntegerInputField fx:id="ragMaxResultsCountTextField" />
118-
</children>
119-
</VBox>
120-
<VBox>
121-
<children>
122-
<HBox alignment="CENTER_LEFT" spacing="10.0">
123-
<children>
124-
<Label maxWidth="1.7976931348623157E308" text="%RAG - minimum score" HBox.hgrow="ALWAYS" />
125-
<Button fx:id="ragMinScoreHelp" prefWidth="20.0" />
126-
</children>
127-
</HBox>
128-
<DoubleInputField fx:id="ragMinScoreTextField" />
129-
</children>
130-
</VBox>
131-
<VBox>
132-
<children>
133-
<HBox alignment="CENTER_LEFT" spacing="10.0">
134-
<children>
135-
<Label maxWidth="1.7976931348623157E308" text="%Document splitter - chunk size" HBox.hgrow="ALWAYS" />
136-
<Button fx:id="documentSplitterChunkSizeHelp" prefWidth="20.0" />
137-
</children>
138-
</HBox>
139-
<IntegerInputField fx:id="documentSplitterChunkSizeTextField" />
140-
</children>
141-
</VBox>
142-
<VBox>
143-
<children>
144-
<HBox alignment="CENTER_LEFT" spacing="10.0">
145-
<children>
146-
<Label maxWidth="1.7976931348623157E308" text="%Document splitter - overlap size" HBox.hgrow="ALWAYS" />
147-
<Button fx:id="documentSplitterOverlapSizeHelp" prefWidth="20.0" />
148-
</children>
149-
</HBox>
150-
<IntegerInputField fx:id="documentSplitterOverlapSizeTextField" />
151-
</children>
152-
</VBox>
153-
<Button onAction="#onResetExpertSettingsButtonClick" text="%Reset expert settings to default">
154-
<graphic>
155-
<JabRefIconView glyph="REFRESH"/>
156-
</graphic>
157-
</Button>
136+
<font>
137+
<Font name="System Italic"
138+
size="13.0"/>
139+
</font>
140+
</Label>
141+
142+
<HBox alignment="CENTER_LEFT"
143+
spacing="10.0">
144+
<children>
145+
<Label maxWidth="1.7976931348623157E308"
146+
text="%Instruction for AI (also known as prompt or system message)"
147+
HBox.hgrow="ALWAYS"/>
148+
<Button fx:id="instructionHelp"
149+
prefWidth="20.0"/>
150+
</children>
151+
</HBox>
152+
153+
<ResizableTextArea
154+
fx:id="instructionTextArea"
155+
wrapText="true"/>
156+
157+
<GridPane hgap="10" vgap="10">
158+
<columnConstraints>
159+
<ColumnConstraints hgrow="ALWAYS" percentWidth="50" />
160+
<ColumnConstraints hgrow="ALWAYS" percentWidth="50" />
161+
</columnConstraints>
162+
163+
<!-- Context Window Size -->
164+
<VBox spacing="10" GridPane.columnIndex="0" GridPane.rowIndex="0">
165+
<HBox spacing="10" alignment="CENTER_LEFT">
166+
<Label HBox.hgrow="ALWAYS"
167+
maxWidth="Infinity"
168+
text="%Context window size"/>
169+
<Button fx:id="contextWindowSizeHelp"
170+
prefWidth="20.0"/>
171+
</HBox>
172+
<IntegerInputField
173+
fx:id="contextWindowSizeTextField"
174+
HBox.hgrow="ALWAYS"/>
175+
</VBox>
176+
177+
<!-- Temperature -->
178+
<VBox spacing="10" GridPane.columnIndex="1" GridPane.rowIndex="0">
179+
<HBox spacing="10">
180+
<Label HBox.hgrow="ALWAYS"
181+
maxWidth="Infinity"
182+
text="%Temperature"/>
183+
<Button fx:id="temperatureHelp"
184+
prefWidth="20.0"/>
185+
</HBox>
186+
<DoubleInputField
187+
fx:id="temperatureTextField"
188+
HBox.hgrow="ALWAYS"/>
189+
</VBox>
190+
191+
<!-- RAG - Maximum Results Count -->
192+
<VBox spacing="10" GridPane.columnIndex="0" GridPane.rowIndex="1">
193+
<HBox spacing="10" alignment="CENTER_LEFT">
194+
<Label HBox.hgrow="ALWAYS"
195+
maxWidth="Infinity"
196+
text="%RAG - maximum results count"/>
197+
<Button fx:id="ragMaxResultsCountHelp"
198+
prefWidth="20.0"/>
199+
</HBox>
200+
<IntegerInputField
201+
fx:id="ragMaxResultsCountTextField"
202+
HBox.hgrow="ALWAYS"/>
203+
</VBox>
204+
205+
<!-- RAG - Minimum Score -->
206+
<VBox spacing="10" GridPane.columnIndex="1" GridPane.rowIndex="1">
207+
<HBox spacing="10" alignment="CENTER_LEFT">
208+
<Label HBox.hgrow="ALWAYS"
209+
maxWidth="Infinity"
210+
text="%RAG - minimum score"/>
211+
<Button fx:id="ragMinScoreHelp"
212+
prefWidth="20.0"/>
213+
</HBox>
214+
<DoubleInputField
215+
fx:id="ragMinScoreTextField"
216+
HBox.hgrow="ALWAYS"/>
217+
</VBox>
218+
219+
<!-- Document Splitter - Chunk Size -->
220+
<VBox spacing="10" GridPane.columnIndex="0" GridPane.rowIndex="2">
221+
<HBox spacing="10" alignment="CENTER_LEFT">
222+
<Label HBox.hgrow="ALWAYS"
223+
maxWidth="Infinity"
224+
text="%Document splitter - chunk size"/>
225+
<Button fx:id="documentSplitterChunkSizeHelp"
226+
prefWidth="20.0"/>
227+
</HBox>
228+
<IntegerInputField
229+
fx:id="documentSplitterChunkSizeTextField"
230+
HBox.hgrow="ALWAYS"/>
231+
</VBox>
232+
233+
<!-- Document Splitter - Overlap Size -->
234+
<VBox spacing="10" GridPane.columnIndex="1" GridPane.rowIndex="2">
235+
<HBox spacing="10" alignment="CENTER_LEFT">
236+
<Label HBox.hgrow="ALWAYS"
237+
maxWidth="Infinity"
238+
text="%Document splitter - overlap size"/>
239+
<Button fx:id="documentSplitterOverlapSizeHelp"
240+
prefWidth="20.0"/>
241+
</HBox>
242+
<IntegerInputField
243+
fx:id="documentSplitterOverlapSizeTextField"
244+
HBox.hgrow="ALWAYS"/>
245+
</VBox>
246+
247+
</GridPane>
248+
249+
<Button onAction="#onResetExpertSettingsButtonClick"
250+
text="%Reset expert settings to default">
251+
<graphic>
252+
<JabRefIconView
253+
glyph="REFRESH"/>
254+
</graphic>
255+
</Button>
158256
</children>
159257
</fx:root>

src/main/java/org/jabref/gui/preferences/ai/AiTab.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import javafx.scene.control.Button;
66
import javafx.scene.control.CheckBox;
77
import javafx.scene.control.ComboBox;
8-
import javafx.scene.control.TextArea;
98
import javafx.scene.control.TextField;
109

1110
import org.jabref.gui.actions.ActionFactory;
@@ -21,6 +20,7 @@
2120
import org.jabref.preferences.ai.EmbeddingModel;
2221

2322
import com.airhacks.afterburner.views.ViewLoader;
23+
import com.dlsc.gemsfx.ResizableTextArea;
2424
import com.dlsc.unitfx.DoubleInputField;
2525
import com.dlsc.unitfx.IntegerInputField;
2626
import de.saxsys.mvvmfx.utils.validation.visualization.ControlsFxVisualizer;
@@ -43,7 +43,7 @@ public class AiTab extends AbstractPreferenceTabView<AiTabViewModel> implements
4343

4444
@FXML private TextField apiBaseUrlTextField;
4545
@FXML private SearchableComboBox<EmbeddingModel> embeddingModelComboBox;
46-
@FXML private TextArea instructionTextArea;
46+
@FXML private ResizableTextArea instructionTextArea;
4747
@FXML private DoubleInputField temperatureTextField;
4848
@FXML private IntegerInputField contextWindowSizeTextField;
4949
@FXML private IntegerInputField documentSplitterChunkSizeTextField;
@@ -59,6 +59,7 @@ public class AiTab extends AbstractPreferenceTabView<AiTabViewModel> implements
5959
@FXML private Button embeddingModelHelp;
6060
@FXML private Button instructionHelp;
6161
@FXML private Button contextWindowSizeHelp;
62+
@FXML private Button temperatureHelp;
6263
@FXML private Button documentSplitterChunkSizeHelp;
6364
@FXML private Button documentSplitterOverlapSizeHelp;
6465
@FXML private Button ragMaxResultsCountHelp;
@@ -212,6 +213,7 @@ public void initialize() {
212213
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AI_API_BASE_URL, dialogService, preferencesService.getFilePreferences()), apiBaseUrlHelp);
213214
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AI_INSTRUCTION, dialogService, preferencesService.getFilePreferences()), instructionHelp);
214215
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AI_CONTEXT_WINDOW_SIZE, dialogService, preferencesService.getFilePreferences()), contextWindowSizeHelp);
216+
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AI_TEMPERATURE, dialogService, preferencesService.getFilePreferences()), temperatureHelp);
215217
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AI_DOCUMENT_SPLITTER_CHUNK_SIZE, dialogService, preferencesService.getFilePreferences()), documentSplitterChunkSizeHelp);
216218
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AI_DOCUMENT_SPLITTER_OVERLAP_SIZE, dialogService, preferencesService.getFilePreferences()), documentSplitterOverlapSizeHelp);
217219
actionFactory.configureIconButton(StandardActions.HELP, new HelpAction(HelpFile.AI_RAG_MAX_RESULTS_COUNT, dialogService, preferencesService.getFilePreferences()), ragMaxResultsCountHelp);

0 commit comments

Comments
 (0)