Skip to content

Commit

Permalink
prompt engineering
Browse files Browse the repository at this point in the history
  • Loading branch information
haesleinhuepf authored and ctrueden committed Nov 7, 2023
1 parent dd3ed86 commit 0047719
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/org/scijava/ui/swing/script/TextEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3246,7 +3246,10 @@ public void askChatGPTtoGenerateCode() {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

// setup default prompt
String prompt = "Write concise and high quality code in " + getCurrentLanguage().getLanguageName() + " for ImageJ/Fiji.\n" +
String prompt =
"Write code in " + getCurrentLanguage().getLanguageName() + ".\n" +
"Write concise and high quality code for ImageJ/Fiji.\n" +
"Put minimal comments explaining what the code does.\n" +
"The code should do the following:\n" +
getTextArea().getSelectedText();

Expand All @@ -3266,7 +3269,7 @@ public void askChatGPTtoGenerateCode() {
}

//getTextArea().insert(answer, getTextArea().getCaretPosition());
getTextArea().replaceSelection(answer);
getTextArea().replaceSelection(answer + "\n");
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
});
}
Expand Down

0 comments on commit 0047719

Please sign in to comment.