mail_attachments_info placeholder added. see #446
This commit is contained in:
parent
9292b0d02e
commit
f82aa23560
2 changed files with 22 additions and 0 deletions
|
|
@ -1143,6 +1143,10 @@
|
||||||
"message": "Default language as defined in ThunderAI options.",
|
"message": "Default language as defined in ThunderAI options.",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
|
"placeholder_mail_attachments_info": {
|
||||||
|
"message": "Information about the attachments in the email",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
"empty": {
|
"empty": {
|
||||||
"message": "This placeholder doesn't add any text, but it prevents the email body from being automatically appended at the end of the prompt.",
|
"message": "This placeholder doesn't add any text, but it prevents the email body from being automatically appended at the end of the prompt.",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,14 @@ const defaultPlaceholders = [
|
||||||
is_default: "1",
|
is_default: "1",
|
||||||
enabled: 1,
|
enabled: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'mail_attachments_info',
|
||||||
|
name: "__MSG_placeholder_mail_attachments_info__",
|
||||||
|
default_value: "",
|
||||||
|
type: 1,
|
||||||
|
is_default: "1",
|
||||||
|
enabled: 1,
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -460,6 +468,16 @@ export const placeholdersUtils = {
|
||||||
let prefs_def_lang = await browser.storage.sync.get({default_chatgpt_lang: ''});
|
let prefs_def_lang = await browser.storage.sync.get({default_chatgpt_lang: ''});
|
||||||
finalSubs['thunderai_def_lang'] = placeholdersUtils.failSafePlaceholders(prefs_def_lang.default_chatgpt_lang);
|
finalSubs['thunderai_def_lang'] = placeholdersUtils.failSafePlaceholders(prefs_def_lang.default_chatgpt_lang);
|
||||||
break;
|
break;
|
||||||
|
case 'mail_attachments_info':
|
||||||
|
let attachments_info_string = "";
|
||||||
|
let attachments_info = await browser.messages.listAttachments(curr_message.id);
|
||||||
|
if(attachments_info && attachments_info.length > 0){
|
||||||
|
attachments_info_string = attachments_info.map(att => "\"" + att.name + "\" [" + att.contentType + "] (" + Math.round(att.size / 1024) + " KB)").join("\n");
|
||||||
|
}
|
||||||
|
attachments_info_string = attachments_info_string.trimEnd();
|
||||||
|
finalSubs['mail_attachments_info'] = placeholdersUtils.failSafePlaceholders(attachments_info_string);
|
||||||
|
// console.log(">>>>>>>>>> mail_attachments_info: " + finalSubs['mail_attachments_info']);
|
||||||
|
break;
|
||||||
case 'empty':
|
case 'empty':
|
||||||
finalSubs['empty'] = '';
|
finalSubs['empty'] = '';
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue