Skip to content

Commit

Permalink
Showing default prompt source.
Browse files Browse the repository at this point in the history
  • Loading branch information
frianasoa committed Dec 19, 2023
1 parent 7dd3ba1 commit 63296a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 4 additions & 6 deletions content/notes/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,7 @@ Menus = {

else if(key.includes("custom-prompt-"))
{
if(!annotationkey)
{
alert("Annotation not found!");
return;
}
var annotation = Zotero.Items.get(annotationid);

var target = "cell";
data = {
"Direct quote": annotation["annotationText"],
Expand All @@ -425,6 +419,10 @@ Menus = {
}

var customprompt = Zotero.ZeNotes.Prefs.get(target+"-custom-prompt");
if(!customprompt)
{
customprompt = Zotero.ZeNotes.Ai.prompts[target];
}

var currentcomment = annotation.annotationComment;

Expand Down
12 changes: 9 additions & 3 deletions content/ui/ai-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ AiUi = {
c.style.backgroundColor = "";
},

acceptcandidate(id, currentcomment, annotation, mode="bard")
acceptcandidate(id, currentcomment, annotation=false, mode="bard")
{
if(!annotation)
{
alert("No destination annotation!\nThis button adds the current element to annotation.\nIf you want to add the results to an annotation, right click on the annotation.");
return;
}

var c = document.getElementById(id);
var comment = c.innerText;
annotation.annotationComment = currentcomment+"\n\n<b>[Paraphrase]</b>\n"+comment+"\n";
Expand All @@ -30,10 +36,10 @@ AiUi = {

createdialog(annotation, currentcomment, candidates, mode="bard")
{
var confirm_message = "Do you want to use this paraprase?";
var confirm_message = "Do you want to add this content to the annotation?";
if(mode=="g-translate")
{
confirm_message = "Do you want to use this translation?"
confirm_message = "Do you want to add this translation to the annotation?";
}
var table = document.createElement("table");
table.id = "zn-ai-table";
Expand Down
2 changes: 2 additions & 0 deletions core/ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ Ai.Bard = {
{
var model = Zotero.ZeNotes.Prefs.get("bard-model");
var prompts = Zotero.ZeNotes.Prefs.get("cell-custom-prompt");

if(prompts=="")
{
prompts = Ai.prompts[target];
}

if(model=="")
{
model = "gemini-pro";
Expand Down

0 comments on commit 63296a9

Please sign in to comment.