mail_body_or_selected_text and mail_body_or_selected_html placeholders added. see #641

This commit is contained in:
Mic 2026-02-06 00:08:00 +01:00
parent 5a39f1e298
commit db8cada6e6
2 changed files with 33 additions and 1 deletions

View file

@ -659,6 +659,14 @@
"message": "Account email address",
"description": ""
},
"placeholder_mail_text_body_or_selected": {
"message": "Mail body or selected text",
"description": ""
},
"placeholder_mail_html_body_or_selected": {
"message": "Mail body or selected HTML",
"description": ""
},
"prefs_OptionText_placeholders_use_default_value": {
"message": "Placeholders: use default value",
"description": ""
@ -1000,7 +1008,7 @@
"description": ""
},
"prompt_get_calendar_event_full_text": {
"message": "Extract all relevant details required to generate a calendar event from the following text. The extracted information should include:\n- Event Title\n- Start Date and Time (including timezone, if specified)\n- End Date and Time (including timezone, if specified)\n- Full day (if mentioned)\n- Attendees\nEnsure the data is formatted clearly and consistently so that it can be directly used for creating a calendar event.\nIf there are relative time references, consider that the date and time of the email are \"{%mail_datetime%}\". Calculate the start date and time based on this reference. If the calculated start date and time are earlier than \"{%current_datetime%}\", recalculate the start date and time using \"{%current_datetime%}\" as the base.\nIf the duration is not specified, set it to one hour.\nThese are the attendees: {%author%}, {%recipients%}, {%cc_list%}. If present, exclude my address: {%account_email_address%}.\nIf you're not able to get one or more of the required information, please respond with an empty string.\nGenerate a response in JSON format only. Do not include any additional text or explanations; provide only the JSON. Here is the format to be used:\n{\n\"startDate\": \"YYYYMMDDTHHMMSS\",\n\"endDate\": \"YYYYMMDDTHHMMSS\",\n\"summary\": \"Calendar event summary here\",\n\"forceAllDay\": false,\n\"attendees\": [attendee1@example.com,attendee2@example.com,attendee3@example.com]\n}\nHere's the text:\"{%selected_text%}\"",
"message": "Extract all relevant details required to generate a calendar event from the following text. The extracted information should include:\n- Event Title\n- Start Date and Time (including timezone, if specified)\n- End Date and Time (including timezone, if specified)\n- Full day (if mentioned)\n- Attendees\nEnsure the data is formatted clearly and consistently so that it can be directly used for creating a calendar event.\nIf there are relative time references, consider that the date and time of the email are \"{%mail_datetime%}\". Calculate the start date and time based on this reference. If the calculated start date and time are earlier than \"{%current_datetime%}\", recalculate the start date and time using \"{%current_datetime%}\" as the base.\nIf the duration is not specified, set it to one hour.\nThese are the attendees: {%author%}, {%recipients%}, {%cc_list%}. If present, exclude my address: {%account_email_address%}.\nIf you're not able to get one or more of the required information, please respond with an empty string.\nGenerate a response in JSON format only. Do not include any additional text or explanations; provide only the JSON. Here is the format to be used:\n{\n\"startDate\": \"YYYYMMDDTHHMMSS\",\n\"endDate\": \"YYYYMMDDTHHMMSS\",\n\"summary\": \"Calendar event summary here\",\n\"forceAllDay\": false,\n\"attendees\": [attendee1@example.com,attendee2@example.com,attendee3@example.com]\n}\nHere's the text:\"{%mail_text_body_or_selected%}\"",
"description": ""
},
"Summarize_prompt_prefs_title": {

View file

@ -267,6 +267,24 @@ const defaultPlaceholders = [
is_default: "1",
is_dynamic: "0",
enabled: 1,
},
{
id: 'mail_text_body_or_selected',
name: "__MSG_placeholder_mail_text_body_or_selected__",
default_value: "",
type: 0,
is_default: "1",
is_dynamic: "0",
enabled: 1,
},
{
id: 'mail_html_body_or_selected',
name: "__MSG_placeholder_mail_html_body_or_selected__",
default_value: "",
type: 0,
is_default: "1",
is_dynamic: "0",
enabled: 1,
}
];
@ -517,6 +535,12 @@ export const placeholdersUtils = {
case 'selected_html':
finalSubs['selected_html'] = placeholdersUtils.failSafePlaceholders(selection_html);
break;
case 'mail_text_body_or_selected':
finalSubs['mail_text_body_or_selected'] = placeholdersUtils.failSafePlaceholders(selection_text || body_text);
break;
case 'mail_html_body_or_selected':
finalSubs['mail_html_body_or_selected'] = placeholdersUtils.failSafePlaceholders(selection_html || msg_text?.html);
break;
case 'author':
finalSubs['author'] = placeholdersUtils.failSafePlaceholders(curr_message.author);
break;