Skip to content

Commit 4dbee73

Browse files
committed
chore: implement instruction retrieval during chat operation
BREAKING CHANGE: The predefined function operation needed to be changed.
1 parent 33379e6 commit 4dbee73

File tree

6 files changed

+36
-38
lines changed

6 files changed

+36
-38
lines changed

com.developer.nefarious.zjoule.plugin/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Export-Package:
3131
com.developer.nefarious.zjoule.plugin.core,
3232
com.developer.nefarious.zjoule.plugin.core.events,
3333
com.developer.nefarious.zjoule.plugin.core.functions,
34+
com.developer.nefarious.zjoule.plugin.core.preferences,
3435
com.developer.nefarious.zjoule.plugin.core.ui,
3536
com.developer.nefarious.zjoule.plugin.core.utils,
3637
com.developer.nefarious.zjoule.plugin.login,

com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/chat/ChatOrchestrator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.ArrayList;
55
import java.util.List;
66

7+
import com.developer.nefarious.zjoule.plugin.core.preferences.Instruction;
78
import com.developer.nefarious.zjoule.plugin.models.Role;
89

910
/**

com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/chat/Instruction.java

Lines changed: 0 additions & 36 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.developer.nefarious.zjoule.plugin.core.preferences;
2+
3+
import org.eclipse.jface.preference.IPreferenceStore;
4+
5+
import com.developer.nefarious.zjoule.plugin.core.Activator;
6+
7+
/**
8+
* Provides system-level instructions for AI interactions.
9+
* The {@code Instruction} class contains the operation to retrieve instructions
10+
* used to guide the AI's behavior and ensure responses adhere to best practices.
11+
* This is a utility class and cannot be instantiated.
12+
*/
13+
public abstract class Instruction {
14+
15+
public static String KEY = "instructions";
16+
17+
/**
18+
* Retrieves the preferred system message text.
19+
*
20+
* @return the system message text as a {@link String}.
21+
*/
22+
public static String getMessage() {
23+
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
24+
return store.getString(KEY);
25+
}
26+
27+
/**
28+
* Private constructor to prevent instantiation of this utility class.
29+
*/
30+
private Instruction() { }
31+
32+
}

com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/core/preferences/PluginPreferencesPage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected void createFieldEditors() {
3434
groupContent.setLayout(new GridLayout(1, false));
3535
groupContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
3636

37-
addField(new StringFieldEditor("instructions", "Instructions:", groupContent));
37+
addField(new StringFieldEditor(Instruction.KEY, "Instructions:", groupContent));
3838

3939
}
4040

com.developer.nefarious.zjoule.test/src/com/developer/nefarious/zjoule/test/chat/ChatOrchestratorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import com.developer.nefarious.zjoule.plugin.chat.IAIClient;
2626
import com.developer.nefarious.zjoule.plugin.chat.IChatMessage;
2727
import com.developer.nefarious.zjoule.plugin.chat.IChatOrchestrator;
28-
import com.developer.nefarious.zjoule.plugin.chat.Instruction;
2928
import com.developer.nefarious.zjoule.plugin.chat.utils.EditorContentReader;
29+
import com.developer.nefarious.zjoule.plugin.core.preferences.Instruction;
3030
import com.developer.nefarious.zjoule.plugin.models.Role;
3131

3232
public class ChatOrchestratorTest {

0 commit comments

Comments
 (0)